Class: Iup::ColourDialog

Inherits:
Widget
  • Object
show all
Defined in:
lib/wrapped/colourdialog.rb

Overview

A ColourDialog allows the user to select a colour.

Also see: Iup#get_colour

Attributes

alpha

If defined, enables alpha selection in dialog. Returns value if user pressed ‘OK’.

colortable

“m;n;…” gives a list of values for the palette.

parentdialog

This dialog will be always in front of the parent dialog. If the parent is minimized, this dialog is automatically minimized. Important Closing the parent will also close the child, but the child dialog’s CLOSE_CB method will not be called.

showalpha

If set, shows the colour table. Values ‘yes’ / ‘no’.

showcolortable

If set, shows the colour table. Values ‘yes’ / ‘no’.

showhelp

Shows a help button if help_cb defined. Values ‘yes’ / ‘no’.

showhex

If set, shows a hexadecimal representation of colour. Values ‘yes’ / ‘no’.

status

read-only Returns ‘1’ if ‘OK’ pressed, or null.

title

Title text for the dialog.

value

Initial value for dialog, and return value if ‘OK’ pressed, as ‘r g b’ or ‘r g b a’.

valuehex

Initial value for dialog, and return value if ‘OK’ pressed, as ‘rrggbb’.

valuehsi

Initial value for dialog, and return value if ‘OK’ pressed, as ‘H S I’.

Instance Attribute Summary

Attributes inherited from Widget

#handle

Instance Method Summary collapse

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(&block) ⇒ ColourDialog

Creates a dialog, using the optional block to set its attributes.



32
33
34
35
36
# File 'lib/wrapped/colourdialog.rb', line 32

def initialize &block
  @handle = IupLib.IupColorDlg

  self.instance_eval &block if block_given?
end

Instance Method Details

#parentdialog(parent = nil) ⇒ Object

:nodoc:



48
49
50
# File 'lib/wrapped/colourdialog.rb', line 48

def parentdialog parent=nil # :nodoc:
  attribute_reference 'PARENTDIALOG', Dialog, parent
end

Shows the dialog at position x, y.



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

def popup x=0, y=0
  IupLib.IupPopup @handle, x, y
end