Class: Iup::SplitBox

Inherits:
Widget show all
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

#handle

Instance Method Summary collapse

Methods included from DynamicFillMethods

#append, #insert

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

#define_callback

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

Yields:

  • (_self)

Yield Parameters:

  • _self (Iup::SplitBox)

    the object that the method was called on



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

#autohideObject

: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

#barsizeObject

:attr: barsize Controls the size of the bar handler, defaults to 5.



46
# File 'lib/wrapped/splitbox.rb', line 46

define_attribute :barsize

#colorObject

:attr: color Color of the bar grip, as “r g b”.



51
# File 'lib/wrapped/splitbox.rb', line 51

define_attribute :color

#expandObject

: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

#layoutdragObject

: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

#minmaxObject

: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

#orientationObject

:attr: orientation Bar handler can be either ‘horizontal’ or ‘vertical’.



74
# File 'lib/wrapped/splitbox.rb', line 74

define_attribute :orientation

#positionObject

:attr_reader: position returns position in pixels within client window as “x,y”.



79
# File 'lib/wrapped/splitbox.rb', line 79

define_reader :position

#rastersizeObject

:attr: rastersize Size of the container, in pixels, value as “widthxheight”.



84
# File 'lib/wrapped/splitbox.rb', line 84

define_attribute :rastersize

#showgripObject

:attr: showgrip If set, shows the bar grip. Values ‘yes’ / ‘no’.



89
# File 'lib/wrapped/splitbox.rb', line 89

define_attribute :showgrip

#valueObject

: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