Class: Iup::ZBox

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

Overview

A container of a list of widgets, but only displays one of them.

Example

The following example stores four widgets and displays the label:

zbox = Iup::ZBox.new(frame, text, label, button) do |b|
  b.alignment = 'acenter'
  b.expand = 'yes'
  b.valuepos = 2
end

Also see: HBox, Tabs, VBox

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, #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(*widgets) {|_self| ... } ⇒ ZBox

Creates a new instance. If a block is given, the new instance is yielded to it.

  • widgets - one or more child widgets

Yields:

  • (_self)

Yield Parameters:

  • _self (Iup::ZBox)

    the object that the method was called on



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

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

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

Instance Method Details

#alignmentObject

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



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

define_attribute :alignment

#clientoffsetObject

:attr_reader: clientoffset returns current offset of box in its client as “widthxheight”.



56
# File 'lib/wrapped/zbox.rb', line 56

define_reader :clientoffset

#clientsizeObject

:attr_reader: clientsize returns current size of box as “widthxheight”.



61
# File 'lib/wrapped/zbox.rb', line 61

define_reader :clientsize

#expandObject

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



67
# File 'lib/wrapped/zbox.rb', line 67

define_attribute :expand

#rastersizeObject

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



72
# File 'lib/wrapped/zbox.rb', line 72

define_attribute :rastersize

#sizeObject

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



77
# File 'lib/wrapped/zbox.rb', line 77

define_attribute :size

#valueposObject



39
40
41
# File 'lib/wrapped/zbox.rb', line 39

def valuepos
  IupLib.IupGetAttribute(@handle, 'VALUEPOS').first.to_i
end

#valuepos=(val) ⇒ Object

:nodoc:



43
44
45
# File 'lib/wrapped/zbox.rb', line 43

def valuepos= val # :nodoc:
  IupLib.IupSetAttribute(@handle, 'VALUEPOS', val.to_s)
end