Class: MittensUi::HBox
- Inherits:
-
Object
- Object
- MittensUi::HBox
- Includes:
- Helpers
- Defined in:
- lib/mittens_ui/hbox.rb
Instance Method Summary collapse
-
#initialize(widgets, options = {}) ⇒ HBox
constructor
A new instance of HBox.
- #remove ⇒ Object
- #render ⇒ Object
Methods included from Helpers
#icon_map, #list_system_icons, #set_margin_from_opts_for
Constructor Details
#initialize(widgets, options = {}) ⇒ HBox
Returns a new instance of HBox.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/mittens_ui/hbox.rb', line 7 def initialize(, ={}) box_spacing = [:spacing].nil? ? 6 : [:spacing] @box = Gtk::Box.new(:horizontal, box_spacing) set_margin_from_opts_for(@box, ) .each do |w| # We need to remove the widget from the global $vertical_box before hand # otherwise it won't render the widgets properly since they are already in another container. w.remove self.attach(w., { position: :start }) end end |
Instance Method Details
#remove ⇒ Object
22 23 24 25 |
# File 'lib/mittens_ui/hbox.rb', line 22 def remove return if @box.nil? @box.destroy end |
#render ⇒ Object
27 28 29 30 |
# File 'lib/mittens_ui/hbox.rb', line 27 def render $vertical_box.pack_start(@box) return self end |