Class: Uh::Layout::Column
- Inherits:
-
Object
- Object
- Uh::Layout::Column
- Extended by:
- Forwardable
- Includes:
- GeoAccessors
- Defined in:
- lib/uh/layout/column.rb
Constant Summary collapse
Instance Attribute Summary collapse
-
#clients ⇒ Object
readonly
Returns the value of attribute clients.
-
#geo ⇒ Object
readonly
Returns the value of attribute geo.
-
#mode ⇒ Object
readonly
Returns the value of attribute mode.
Instance Method Summary collapse
- #<<(client) ⇒ Object
- #arrange_clients ⇒ Object
- #arranger ⇒ Object
- #client_swap(direction) ⇒ Object
-
#initialize(geo, mode: :stack) ⇒ Column
constructor
A new instance of Column.
- #mode_toggle ⇒ Object
- #show_hide_clients(arranger: self.arranger) ⇒ Object
- #to_s ⇒ Object
Constructor Details
Instance Attribute Details
#clients ⇒ Object (readonly)
Returns the value of attribute clients.
17 18 19 |
# File 'lib/uh/layout/column.rb', line 17 def clients @clients end |
#geo ⇒ Object (readonly)
Returns the value of attribute geo.
17 18 19 |
# File 'lib/uh/layout/column.rb', line 17 def geo @geo end |
#mode ⇒ Object (readonly)
Returns the value of attribute mode.
17 18 19 |
# File 'lib/uh/layout/column.rb', line 17 def mode @mode end |
Instance Method Details
#<<(client) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/uh/layout/column.rb', line 29 def << client client.geo = @geo.dup if @clients.current @clients.insert_after_current client else @clients << client end self end |
#arrange_clients ⇒ Object
55 56 57 58 |
# File 'lib/uh/layout/column.rb', line 55 def arrange_clients arranger.arrange clients.each &:moveresize end |
#arranger ⇒ Object
43 44 45 |
# File 'lib/uh/layout/column.rb', line 43 def arranger MODES[@mode].new @clients, @geo end |
#client_swap(direction) ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/uh/layout/column.rb', line 47 def client_swap direction @clients.set direction if @mode == :tile arrange_clients show_hide_clients end end |
#mode_toggle ⇒ Object
39 40 41 |
# File 'lib/uh/layout/column.rb', line 39 def mode_toggle @mode = MODES.keys[(MODES.keys.index(@mode) + 1) % MODES.keys.size] end |
#show_hide_clients(arranger: self.arranger) ⇒ Object
60 61 62 63 |
# File 'lib/uh/layout/column.rb', line 60 def show_hide_clients arranger: self.arranger arranger.each_visible { |client| client.show if client.hidden? } arranger.each_hidden { |client| client.hide unless client.hidden? } end |
#to_s ⇒ Object
25 26 27 |
# File 'lib/uh/layout/column.rb', line 25 def to_s "COL geo: #{@geo}" end |