Class: Iup::Expander
Overview
An expandable container for a single widget. The user can show or hide the child widget, as required.
Example
The following places a button in an expandable area, with a blue title:
bt = Iup::Button.new('Button ONE')
exp = Iup::Expander.new(bt) do |e|
e.title = 'Expander title'
e.forecolor = '0 0 255'
end
Instance Attribute Summary
Attributes inherited from Widget
Instance Method Summary collapse
-
#action=(callback) ⇒ Object
–.
-
#autoshow ⇒ Object
:attr: autoshow If set, child will be shown when mouse hovers over container.
-
#backcolor ⇒ Object
:attr: backcolor Color of background in title area, as “r g b”.
-
#barposition ⇒ Object
:attr: barposition Position of expander bar, as ‘top’ / ‘bottom’ / ‘left’ / ‘right’.
-
#barsize ⇒ Object
:attr: barsize Size of bar - defaults to text line height + 5.
-
#clientoffset ⇒ Object
:attr_reader: clientoffset Returns current offset of box in its client as “widthxheight”.
-
#clientsize ⇒ Object
:attr_reader: clientsize Returns current size of box as “widthxheight”.
-
#expand ⇒ Object
:attr: expand Allows container to fill available space in indicated direction.
-
#forecolor ⇒ Object
:attr: forecolor Color of text in title area, as “r g b”.
-
#initialize(child) {|_self| ... } ⇒ Expander
constructor
Creates an instance of the Expander.
-
#openclose_cb=(callback) ⇒ Object
–.
-
#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”.
-
#state ⇒ Object
:attr: state Show or hide child, as ‘open’ / ‘close’.
-
#title ⇒ Object
:attr: title Displayed on box in title area.
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(child) {|_self| ... } ⇒ Expander
Creates an instance of the Expander. If a block is given, the new instance is yielded to it.
-
child- the child widget to display.
23 24 25 26 27 |
# File 'lib/wrapped/expander.rb', line 23 def initialize child @handle = IupLib.IupExpander(child.handle) yield self if block_given? end |
Instance Method Details
#action=(callback) ⇒ Object
–
101 102 103 104 105 106 107 108 109 |
# File 'lib/wrapped/expander.rb', line 101 def action= callback unless callback.arity.zero? raise ArgumentError, 'action callback must take 0 arguments' end cb = Proc.new do |ih| callback.call end define_callback cb, 'ACTION', :plain end |
#autoshow ⇒ Object
:attr: autoshow If set, child will be shown when mouse hovers over container. Values ‘yes’ / ‘no’.
35 |
# File 'lib/wrapped/expander.rb', line 35 define_attribute :autoshow |
#backcolor ⇒ Object
:attr: backcolor Color of background in title area, as “r g b”.
40 |
# File 'lib/wrapped/expander.rb', line 40 define_attribute :backcolor |
#barposition ⇒ Object
:attr: barposition Position of expander bar, as ‘top’ / ‘bottom’ / ‘left’ / ‘right’.
45 |
# File 'lib/wrapped/expander.rb', line 45 define_attribute :barposition |
#barsize ⇒ Object
:attr: barsize Size of bar - defaults to text line height + 5.
50 |
# File 'lib/wrapped/expander.rb', line 50 define_attribute :barsize |
#clientoffset ⇒ Object
:attr_reader: clientoffset Returns current offset of box in its client as “widthxheight”.
55 |
# File 'lib/wrapped/expander.rb', line 55 define_reader :clientoffset |
#clientsize ⇒ Object
:attr_reader: clientsize Returns current size of box as “widthxheight”.
60 |
# File 'lib/wrapped/expander.rb', line 60 define_reader :clientsize |
#expand ⇒ Object
:attr: expand Allows container to fill available space in indicated direction. Values ‘no’ / ‘horizontal’ / ‘vertical’ / ‘yes’.
66 |
# File 'lib/wrapped/expander.rb', line 66 define_attribute :expand |
#forecolor ⇒ Object
:attr: forecolor Color of text in title area, as “r g b”.
71 |
# File 'lib/wrapped/expander.rb', line 71 define_attribute :forecolor |
#openclose_cb=(callback) ⇒ Object
–
118 119 120 121 122 123 124 125 126 |
# File 'lib/wrapped/expander.rb', line 118 def openclose_cb= callback unless callback.arity.zero? raise ArgumentError, 'openclose_cb callback must take 0 arguments' end cb = Proc.new do |ih| callback.call end define_callback cb, 'OPENCLOSE_CB', :plain end |
#position ⇒ Object
:attr_reader: position Returns position in pixels within client window as “x,y”.
76 |
# File 'lib/wrapped/expander.rb', line 76 define_attribute :position |
#rastersize ⇒ Object
:attr: rastersize Size of the container, in pixels, value as “widthxheight”.
81 |
# File 'lib/wrapped/expander.rb', line 81 define_attribute :rastersize |
#state ⇒ Object
:attr: state Show or hide child, as ‘open’ / ‘close’.
86 |
# File 'lib/wrapped/expander.rb', line 86 define_attribute :state |
#title ⇒ Object
:attr: title Displayed on box in title area.
91 |
# File 'lib/wrapped/expander.rb', line 91 define_attribute :title |