Class: Iup::ColorDialog

Inherits:
Dialog show all
Defined in:
lib/wrapped/colordialog.rb

Overview

A predefined modal dialog used for selecting a color.

Example

dlg = Iup::ColorDialog.new do |d|
  d.title = "select a new color"
end
dlg.popup
p dlg.value # retrieve the selected color

Also see: Iup.get_color

Instance Attribute Summary

Attributes inherited from Widget

#handle

Instance Method Summary collapse

Methods inherited from Dialog

#background, #border, #clientoffset, #clientsize, #close_cb=, #cursor, #cursor=, #defaultenter, #defaultenter=, #defaultesc, #defaultesc=, #expand, #fullscreen, #hide, #icon, #icon=, #map, #maxbox, #menu, #menu=, #menubox, #minbox, #modal, #parentdialog, #parentdialog=, #placement, #popup, #rastersize, #resize, #resize_cb=, #screenposition, #show, #show_cb=, #shrink, #startfocus, #startfocus=, #tip, #title

Methods included from AttributeReference

#attribute_reference

Methods included from DragDropAttributes

#dragbegin_cb=, #dragdata_cb=, #dragdatasize_cb=, #dragend_cb=, #dragsource, #dragsourcemove, #dragtypes, #dropdata_cb=, #dropmotion_cb=, #droptarget, #droptypes

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 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 CallbackSetter

#define_callback

Constructor Details

#initialize {|_self| ... } ⇒ ColorDialog

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

Yields:

  • (_self)

Yield Parameters:



40
41
42
43
44
# File 'lib/wrapped/colordialog.rb', line 40

def initialize &block
  @handle = IupLib.IupColorDlg

  yield self if block_given?
end

Instance Method Details

#alphaObject

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



73
# File 'lib/wrapped/colordialog.rb', line 73

define_attribute :alpha

#colortableObject

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



78
# File 'lib/wrapped/colordialog.rb', line 78

define_attribute :colortable

#colorupdate_cb=(callback) ⇒ Object



55
56
57
58
59
60
61
62
63
# File 'lib/wrapped/colordialog.rb', line 55

def colorupdate_cb= callback
  unless callback.arity.zero?
    raise ArgumentError, 'colorupdate_cb callback must take 0 arguments'
  end
  cb = Proc.new do |ih|
    callback.call
  end
  define_callback cb, 'COLORUPDATE_CB', :plain_v
end

#showalphaObject

:attr: showalpha If set, shows the color table. Values ‘yes’ / ‘no’.



83
# File 'lib/wrapped/colordialog.rb', line 83

define_attribute :showalpha

#showcolortableObject

:attr: showcolortable If set, shows the color table. Values ‘yes’ / ‘no’.



88
# File 'lib/wrapped/colordialog.rb', line 88

define_attribute :showcolortable

#showhelpObject

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



93
# File 'lib/wrapped/colordialog.rb', line 93

define_attribute :showhelp

#showhexObject

:attr: showhex If set, shows a hexadecimal representation of color. Values ‘yes’ / ‘no’.



98
# File 'lib/wrapped/colordialog.rb', line 98

define_attribute :showhex

#statusObject

:attr_reader: status Returns ‘1’ if ‘OK’ pressed, or null.



103
# File 'lib/wrapped/colordialog.rb', line 103

define_reader :status

#valueObject

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



108
# File 'lib/wrapped/colordialog.rb', line 108

define_attribute :value

#valuehexObject

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



113
# File 'lib/wrapped/colordialog.rb', line 113

define_attribute :valuehex

#valuehsiObject

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



118
# File 'lib/wrapped/colordialog.rb', line 118

define_attribute :valuehsi