Class: Iup::ZBox

Inherits:
Widget show all
Includes:
DynamicFillMethods
Defined in:
lib/wrapped/zbox.rb

Overview

A ZBox is a container class, which stores a list of widgets but only displays one of them.

Attributes

alignment

alignment of visible child. Values: ‘north’ / ‘south’ / ‘east’ / ‘west’/ ‘ne’ / ‘nw’ / ‘se’ / ‘sw’ / ‘acenter’

clientoffset

read-only, returns current offset of box in its client as “widthxheight”.

clientsize

read-only, returns current size of box as “widthxheight”.

expand

Allows container to fill available space in indicated direction. Values ‘no’ / ‘horizontal’ / ‘vertical’ / ‘yes’.

gap

Number of pixels between children, default value of 0.

rastersize

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

size

Size of the container, in character units, value as “widthxheight”.

Instance Attribute Summary

Attributes inherited from Widget

#handle

Instance Method Summary collapse

Methods included from DynamicFillMethods

#append, #insert

Methods inherited from Widget

#assign_handle, #enterwindow_cb, #getfocus_cb, #help_cb, #k_any, #killfocus_cb, #leavewindow_cb, #map_cb, #open_controls, #unmap_cb

Methods included from AttributeBuilders

#define_attribute, #define_id_attribute, #define_id_readonly, #define_id_writeonly, #define_property_attribute, #define_property_writeonly, #define_readonly, #define_writeonly

Methods included from CallbackSetter

#define_callback

Constructor Details

#initialize(*widgets, &block) ⇒ ZBox

Creates an instance of the ZBox.

*widgets

one or more child widgets

block

optional block to set up the box’s attributes.



26
27
28
29
30
31
# File 'lib/wrapped/zbox.rb', line 26

def initialize *widgets, &block
  @handle = IupLib.IupZbox *widget_list(widgets)

  # run any provided block on instance, to set up further attributes
  self.instance_eval &block if block_given?
end

Instance Method Details

#valuepos(val = nil? ) ⇒ Object

Returns the visible child, accessed by its index position.



36
37
38
39
40
41
42
43
# File 'lib/wrapped/zbox.rb', line 36

def valuepos val=nil? 
  if val.nil?
    result = IupLib.IupGetAttribute(@handle, 'VALUEPOS').first
    result.to_i
  else
    IupLib.IupSetAttribute @handle, 'VALUEPOS', (val.to_i - 1).to_s
  end
end