Class: Iup::ColorDialog
- 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
Instance Method Summary collapse
-
#alpha ⇒ Object
:attr: alpha If defined, enables alpha selection in dialog.
-
#colortable ⇒ Object
:attr: colortable “m;n;…” gives a list of values for the palette.
-
#colorupdate_cb=(callback) ⇒ Object
–.
-
#initialize {|_self| ... } ⇒ ColorDialog
constructor
Creates a dialog, using the optional block to set its attributes.
-
#showalpha ⇒ Object
:attr: showalpha If set, shows the color table.
-
#showcolortable ⇒ Object
:attr: showcolortable If set, shows the color table.
-
#showhelp ⇒ Object
:attr: showhelp Shows a help button if
help_cbdefined. -
#showhex ⇒ Object
:attr: showhex If set, shows a hexadecimal representation of color.
-
#status ⇒ Object
:attr_reader: status Returns ‘1’ if ‘OK’ pressed, or null.
-
#value ⇒ Object
:attr: value Initial value for dialog, and return value if ‘OK’ pressed, as ‘r g b’ or ‘r g b a’.
-
#valuehex ⇒ Object
:attr: valuehex Initial value for dialog, and return value if ‘OK’ pressed, as ‘rrggbb’.
-
#valuehsi ⇒ Object
:attr: valuehsi Initial value for dialog, and return value if ‘OK’ pressed, as ‘H S I’.
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
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
Constructor Details
#initialize {|_self| ... } ⇒ ColorDialog
Creates a dialog, using the optional block to set its attributes.
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
#alpha ⇒ Object
: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 |
#colortable ⇒ Object
: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 |
#showalpha ⇒ Object
:attr: showalpha If set, shows the color table. Values ‘yes’ / ‘no’.
83 |
# File 'lib/wrapped/colordialog.rb', line 83 define_attribute :showalpha |
#showcolortable ⇒ Object
:attr: showcolortable If set, shows the color table. Values ‘yes’ / ‘no’.
88 |
# File 'lib/wrapped/colordialog.rb', line 88 define_attribute :showcolortable |
#showhelp ⇒ Object
:attr: showhelp Shows a help button if help_cb defined. Values ‘yes’ / ‘no’.
93 |
# File 'lib/wrapped/colordialog.rb', line 93 define_attribute :showhelp |
#showhex ⇒ Object
:attr: showhex If set, shows a hexadecimal representation of color. Values ‘yes’ / ‘no’.
98 |
# File 'lib/wrapped/colordialog.rb', line 98 define_attribute :showhex |
#status ⇒ Object
:attr_reader: status Returns ‘1’ if ‘OK’ pressed, or null.
103 |
# File 'lib/wrapped/colordialog.rb', line 103 define_reader :status |
#value ⇒ Object
: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 |
#valuehex ⇒ Object
: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 |
#valuehsi ⇒ Object
: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 |