Class: Interphase::Box
- Defined in:
- lib/interphase/widgets/box.rb
Overview
A simple item container. You should use VBox
or HBox
rather than this.
Constant Summary collapse
- PACK_START =
0
- PACK_END =
1
Instance Attribute Summary
Attributes inherited from Container
Attributes inherited from Widget
Instance Method Summary collapse
-
#add(child, expand = true, fill = true, padding = 0, ref = PACK_START, &block) ⇒ Object
Add a widget to the box, after all others added at the same reference.
Methods inherited from Container
#method_missing, #respond_to_missing?, #show_all
Methods inherited from Widget
#destroy, #initialize, #method_missing, #on, #respond_to_missing?, #show, #size
Constructor Details
This class inherits a constructor from Interphase::Widget
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Interphase::Container
Instance Method Details
#add(child, expand = true, fill = true, padding = 0, ref = PACK_START, &block) ⇒ Object
Add a widget to the box, after all others added at the same reference. Accepts a block which is executed on the child.
child
-
The new child widget.
expand
-
(Optional) Allocate extra space to this widget, default
true
. fill
-
(Optional) Allocate to the full width/height of the box, default
true
. padding
-
(Optional) Any padding to allocate to this widget, default 0.
ref
-
(Optional) The reference at which to add the widget. Either
PACK_START
(default) orPACK_END
.
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/interphase/widgets/box.rb', line 20 def add(child, = true, fill = true, padding = 0, ref = PACK_START, &block) super(child, false, &block) if ref == PACK_START gtk_instance.pack_start(child.gtk_instance, , fill, padding) elsif ref == PACK_END gtk_instance.pack_end(child.gtk_instance, , fill, padding) else raise 'ref should be either PACK_START or PACK_END' end end |