Class: Iup::SplitBox
- Includes:
- DynamicFillMethods
- Defined in:
- lib/wrapped/splitbox.rb
Overview
A container for two child widgets, with a moveable divider between them.
Note: named IupSplit in Tecgraf’s documentation.
Example
The following code creates a split box between two text areas, with a blue divider oriented horizontally - so the text areas are placed one above the other:
split = Iup::SplitBox.new(text1, text2) do |b|
b.orientation = 'HORIZONTAL'
b.color = '127 127 255'
end
Also see: StretchBox
Instance Attribute Summary
Attributes inherited from Widget
Instance Method Summary collapse
-
#autohide ⇒ Object
:attr: autohide If set, hides a child if the child client area is smaller than the bar size.
-
#barsize ⇒ Object
:attr: barsize Controls the size of the bar handler, defaults to 5.
-
#color ⇒ Object
:attr: color Color of the bar grip, as “r g b”.
-
#expand ⇒ Object
:attr: expand Allows container to fill available space in indicated direction.
-
#initialize(child1, child2) {|_self| ... } ⇒ SplitBox
constructor
Creates an instance of the split box.
-
#layoutdrag ⇒ Object
:attr: layoutdrag Updates the children’s layout when bar moved automatically.
-
#minmax ⇒ Object
:attr: minmax minimum/maximum values for
valuein form “min:max”, whereminandmaxare integers. -
#orientation ⇒ Object
:attr: orientation Bar handler can be either ‘horizontal’ or ‘vertical’.
-
#position ⇒ Object
:attr_reader: position returns position in pixels within client window as “x,y”.
-
#rastersize ⇒ Object
:attr: rastersize Size of the container, in pixels, value as “widthxheight”.
-
#showgrip ⇒ Object
:attr: showgrip If set, shows the bar grip.
-
#value ⇒ Object
:attr: value Proportion of the left/top area relative to whole, integer in range [0,1000].
-
#valuechanged_cb=(callback) ⇒ Object
–.
Methods included from DynamicFillMethods
Methods inherited from Widget
#active, #assign_handle, #bgcolor, #destroy, #enterwindow_cb=, #fgcolor, #font, #getfocus_cb=, #help_cb=, #k_any=, #killfocus_cb=, #leavewindow_cb=, #map_cb=, #maxsize, #minsize, #open_controls, #size, #unmap_cb=, #visible, #wid, #zorder
Methods included from AttributeBuilders
#define_attribute, #define_id_attribute, #define_id_reader, #define_id_writer, #define_property_attribute, #define_property_reader, #define_property_writer, #define_reader, #define_writer
Methods included from CallbackSetter
Constructor Details
#initialize(child1, child2) {|_self| ... } ⇒ SplitBox
Creates an instance of the split box. If a block is given, the new instance is yielded to it.
-
child1- the left or top child widget -
child2- the right or bottom child widget
30 31 32 33 34 35 |
# File 'lib/wrapped/splitbox.rb', line 30 def initialize child1, child2 @handle = IupLib.IupSplit(child1.handle, child2.handle) # run any provided block on instance, to set up further attributes yield self if block_given? end |
Instance Method Details
#autohide ⇒ Object
:attr: autohide If set, hides a child if the child client area is smaller than the bar size. Values ‘yes’ / ‘no’.
41 |
# File 'lib/wrapped/splitbox.rb', line 41 define_attribute :autohide |
#barsize ⇒ Object
:attr: barsize Controls the size of the bar handler, defaults to 5.
46 |
# File 'lib/wrapped/splitbox.rb', line 46 define_attribute :barsize |
#color ⇒ Object
:attr: color Color of the bar grip, as “r g b”.
51 |
# File 'lib/wrapped/splitbox.rb', line 51 define_attribute :color |
#expand ⇒ Object
:attr: expand Allows container to fill available space in indicated direction. Values ‘no’ / ‘horizontal’ / ‘vertical’ / ‘yes’.
57 |
# File 'lib/wrapped/splitbox.rb', line 57 define_attribute :expand |
#layoutdrag ⇒ Object
:attr: layoutdrag Updates the children’s layout when bar moved automatically. Values ‘yes’ / ‘no’.
63 |
# File 'lib/wrapped/splitbox.rb', line 63 define_attribute :layoutdrag |
#minmax ⇒ Object
:attr: minmax minimum/maximum values for value in form “min:max”, where min and max are integers.
69 |
# File 'lib/wrapped/splitbox.rb', line 69 define_attribute :minmax |
#orientation ⇒ Object
:attr: orientation Bar handler can be either ‘horizontal’ or ‘vertical’.
74 |
# File 'lib/wrapped/splitbox.rb', line 74 define_attribute :orientation |
#position ⇒ Object
:attr_reader: position returns position in pixels within client window as “x,y”.
79 |
# File 'lib/wrapped/splitbox.rb', line 79 define_reader :position |
#rastersize ⇒ Object
:attr: rastersize Size of the container, in pixels, value as “widthxheight”.
84 |
# File 'lib/wrapped/splitbox.rb', line 84 define_attribute :rastersize |
#showgrip ⇒ Object
:attr: showgrip If set, shows the bar grip. Values ‘yes’ / ‘no’.
89 |
# File 'lib/wrapped/splitbox.rb', line 89 define_attribute :showgrip |
#value ⇒ Object
:attr: value Proportion of the left/top area relative to whole, integer in range [0,1000].
94 |
# File 'lib/wrapped/splitbox.rb', line 94 define_attribute :value |
#valuechanged_cb=(callback) ⇒ Object
–
104 105 106 107 108 109 110 111 112 |
# File 'lib/wrapped/splitbox.rb', line 104 def valuechanged_cb= callback unless callback.arity.zero? raise ArgumentError, 'valuechanged_cb callback must take 0 arguments' end cb = Proc.new do |ih| callback.call end define_callback cb, 'VALUECHANGED_CB', :plain end |