Class: Iup::GridBox

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

Overview

A container which arranges its widgets in a left-to-right, top-to-bottom order.

Attributes

alignmentcol

gets/sets horizontal alignment of columns.

  • alignmentcol() -> reads value of ‘ALIGNMENTCOL’

  • alignmentcol(val) -> sets ‘ALIGNMENTCOL’ to val, which is ‘ALEFT’ / ‘ACENTER’ / ‘ARIGHT’

  • alignmentcol(n, val) -> sets alignment of column n to val.

alignmentlin

vertical alignment within line, as ‘atop’ / ‘abottom’ / ‘acenter’

cgapcol

n, horizontal space in characters between columns.

cgaplin

n, vertical space in characters between lines.

clientoffset

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

clientsize

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

cmargin

Margin in x and y directions in characters, value as “mxn”.

expand

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

expandchildren

Set to allow children to expand fully, values as ‘yes’ / ‘no’ / ‘horizontal’ / ‘vertical’.

fittochildren

‘column’ / ‘line’, n -> force column/line n to fit largest element in that column/line.

gapcol

n, horizontal space in pixels between columns.

gaplin

n, vertical space in pixels between lines.

homogeneouscol

Forces all columns to have same horizontal space, values as ‘yes’ / ‘no’.

homogeneouslin

Forces all lines to have same vertical space. values as ‘yes’ / ‘no’.

margin

Margin in x and y directions in pixels, value as “mxn”.

normalsize

Set to make natural size of children same, values as ‘yes’ / ‘no’ / ‘horizontal’ / ‘vertical’.

numcol

read-only returns number of columns.

numdiv

‘auto’ / n, controls number of divisions in direction as determined by orientation.

numlin

read-only returns number of lines.

orientation

Controls distribution of children, in lines or columns. Value as ‘horizontal’ / ‘vertical’.

position

read-only returns position in pixels within client window as “x,y”.

rastersize

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

sizecol

Index of column to use for calculating height of lines.

sizelin

Index of line to use for calculating width of columns.

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) ⇒ GridBox

Creates an instance of the hbox.

*widgets

one or more child widgets

block

optional block to set up the box’s attributes.



51
52
53
54
55
56
# File 'lib/wrapped/gridbox.rb', line 51

def initialize *widgets, &block
  @handle = IupLib.IupGridBox *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

#alignmentcol(val = nil, val2 = nil) ⇒ Object

– attributes



60
61
62
63
64
65
66
67
68
# File 'lib/wrapped/gridbox.rb', line 60

def alignmentcol val=nil, val2=nil # :nodoc:
  if val.nil?
    IupLib.IupGetAttribute(@handle, 'ALIGNMENTCOL').first
  elsif val2.nil?
    IupLib.IupSetAttribute @handle, 'ALIGNMENTCOL', val.to_s
  else
    IupLib.IupSetAttribute @handle, "ALIGNMENTCOL#{val}", val2.to_s
  end
end