Class: Iup::Dialog
- Includes:
- AttributeReference, DragDropAttributes
- Defined in:
- lib/wrapped/dialog.rb
Overview
A top-level window, containing a single widget. Supports standard window decorations and a menu.
Example
The following example displays a label widget within the dialog, setting the dialog’s title and size before showing it.
Iup::Dialog.new(label) do |d|
d.title = " ... from IUP"
d.size = "150x50"
end.show
Also see: Menu.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Widget
Instance Method Summary collapse
-
#background ⇒ Object
:attr: background RGB color for background of dialog and children.
-
#border ⇒ Object
:attr: border If set, displays a resize border around dialog.
-
#clientoffset ⇒ Object
:attr_reader: clientoffset returns current offset of box in its client as “widthxheight”.
-
#clientsize ⇒ Object
:attr_reader: clientsize returns current size of box as “widthxheight”.
-
#close_cb=(callback) ⇒ Object
–.
-
#cursor ⇒ Object
–.
-
#cursor=(image) ⇒ Object
:nodoc:.
-
#defaultenter ⇒ Object
–.
-
#defaultenter=(item) ⇒ Object
:nodoc:.
-
#defaultesc ⇒ Object
–.
-
#defaultesc=(item) ⇒ Object
:nodoc:.
-
#expand ⇒ Object
:attr: expand Allows container to fill available space in indicated direction.
-
#fullscreen ⇒ Object
:attr: fullscreen ‘no’ / ‘yes’.
-
#hide ⇒ Object
Hides the dialog from view.
-
#icon ⇒ Object
–.
-
#icon=(item) ⇒ Object
:nodoc:.
-
#initialize(widget) {|_self| ... } ⇒ Dialog
constructor
Creates a new dialog for given widget.
-
#map ⇒ Object
Lays out the child widget and its contents, without showing the dialog.
-
#maxbox ⇒ Object
:attr: maxbox ‘no’ / ‘yes’, to show maximize box on dialog.
-
#menu ⇒ Object
–.
-
#menu=(item) ⇒ Object
:nodoc:.
-
#menubox ⇒ Object
:attr: menubox ‘no’ / ‘yes’, to show system menu box on dialog.
-
#minbox ⇒ Object
:attr: minbox ‘no’ / ‘yes’, to show minimize box on dialog.
-
#modal ⇒ Object
:attr_reader: modal Returns modal state of dialog.
-
#parentdialog ⇒ Object
–.
-
#parentdialog=(parent) ⇒ Object
:nodoc:.
-
#placement ⇒ Object
:attr: placement ‘normal’ / ‘maximized’ / ‘minimized’ / ‘full’.
-
#popup(x = nil, y = nil) ⇒ Object
Shows the dialog at position (x, y).
-
#rastersize ⇒ Object
:attr: rastersize Size of the dialog, in pixels, value as “widthxheight”.
-
#resize ⇒ Object
:attr: resize ‘no’ / ‘yes’.
-
#resize_cb=(callback) ⇒ Object
–.
-
#screenposition ⇒ Object
:attr_reader: screenposition returns position in pixels on screen as “x,y”.
-
#show(x = nil, y = nil) ⇒ Object
Shows the dialog at the default screen position, or at (x, y) if specified.
-
#show_cb=(callback) ⇒ Object
–.
-
#shrink ⇒ Object
:attr: shrink ‘no’ / ‘yes’, allows dialog’s children to reduce their size if the dialog is made smaller.
-
#startfocus ⇒ Object
–.
-
#startfocus=(item) ⇒ Object
:nodoc:.
-
#tip ⇒ Object
:attr: tip Tooltip string.
-
#title ⇒ Object
:attr: title Displayed as dialog 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(widget) {|_self| ... } ⇒ Dialog
Creates a new dialog for given widget. If a block is given, the new instance is yielded to it.
-
widget- the child widget to display.
Use show to display the dialog after initialisation; some widgets require the dialog to be mapped first, and then shown after the widget is initialised.
29 30 31 32 33 34 |
# File 'lib/wrapped/dialog.rb', line 29 def initialize @handle = IupLib.IupDialog(.handle) # run any provided block on instance, to set up further attributes yield self if block_given? end |
Instance Method Details
#background ⇒ Object
:attr: background RGB color for background of dialog and children.
73 |
# File 'lib/wrapped/dialog.rb', line 73 define_attribute :background |
#border ⇒ Object
:attr: border If set, displays a resize border around dialog.
78 |
# File 'lib/wrapped/dialog.rb', line 78 define_attribute :border |
#clientoffset ⇒ Object
:attr_reader: clientoffset returns current offset of box in its client as “widthxheight”.
83 |
# File 'lib/wrapped/dialog.rb', line 83 define_reader :clientoffset |
#clientsize ⇒ Object
:attr_reader: clientsize returns current size of box as “widthxheight”.
88 |
# File 'lib/wrapped/dialog.rb', line 88 define_reader :clientsize |
#close_cb=(callback) ⇒ Object
–
263 264 265 266 267 268 269 270 271 |
# File 'lib/wrapped/dialog.rb', line 263 def close_cb= callback # :nodoc: unless callback.arity.zero? raise ArgumentError, 'close_cb callback must take 0 arguments' end cb = Proc.new do |ih| callback.call end define_callback cb, 'CLOSE_CB', :plain end |
#cursor ⇒ Object
–
95 96 97 |
# File 'lib/wrapped/dialog.rb', line 95 def cursor attribute_reference('CURSOR', ImageWidget, nil) end |
#cursor=(image) ⇒ Object
:nodoc:
99 100 101 |
# File 'lib/wrapped/dialog.rb', line 99 def cursor= image # :nodoc: attribute_reference('CURSOR', ImageWidget, image) end |
#defaultenter ⇒ Object
–
137 138 139 |
# File 'lib/wrapped/dialog.rb', line 137 def defaultenter attribute_reference('DEFAULTENTER', Button, nil) end |
#defaultenter=(item) ⇒ Object
:nodoc:
141 142 143 |
# File 'lib/wrapped/dialog.rb', line 141 def defaultenter= item # :nodoc: attribute_reference('DEFAULTENTER', Button, item) end |
#defaultesc ⇒ Object
–
150 151 152 |
# File 'lib/wrapped/dialog.rb', line 150 def defaultesc attribute_reference('DEFAULTESC', Button, nil) end |
#defaultesc=(item) ⇒ Object
:nodoc:
154 155 156 |
# File 'lib/wrapped/dialog.rb', line 154 def defaultesc= item # :nodoc: attribute_reference('DEFAULTESC', Button, item) end |
#expand ⇒ Object
:attr: expand Allows container to fill available space in indicated direction. Values ‘no’ / ‘horizontal’ / ‘vertical’ / ‘yes’.
107 |
# File 'lib/wrapped/dialog.rb', line 107 define_attribute :expand |
#fullscreen ⇒ Object
:attr: fullscreen ‘no’ / ‘yes’.
161 |
# File 'lib/wrapped/dialog.rb', line 161 define_attribute :fullscreen |
#hide ⇒ Object
Hides the dialog from view.
37 38 39 |
# File 'lib/wrapped/dialog.rb', line 37 def hide IupLib.IupHide @handle end |
#icon ⇒ Object
–
168 169 170 |
# File 'lib/wrapped/dialog.rb', line 168 def icon attribute_reference('ICON', ImageWidget, nil) end |
#icon=(item) ⇒ Object
:nodoc:
172 173 174 |
# File 'lib/wrapped/dialog.rb', line 172 def icon= item # :nodoc: attribute_reference('ICON', ImageWidget, item) end |
#map ⇒ Object
Lays out the child widget and its contents, without showing the dialog.
42 43 44 45 |
# File 'lib/wrapped/dialog.rb', line 42 def map IupLib.IupMap @handle self end |
#maxbox ⇒ Object
:attr: maxbox ‘no’ / ‘yes’, to show maximize box on dialog.
179 |
# File 'lib/wrapped/dialog.rb', line 179 define_attribute :maxbox |
#menu ⇒ Object
–
187 188 189 |
# File 'lib/wrapped/dialog.rb', line 187 def attribute_reference('MENU', Menu, nil) end |
#menu=(item) ⇒ Object
:nodoc:
191 192 193 |
# File 'lib/wrapped/dialog.rb', line 191 def item # :nodoc: attribute_reference('MENU', Menu, item) end |
#menubox ⇒ Object
:attr: menubox ‘no’ / ‘yes’, to show system menu box on dialog.
198 |
# File 'lib/wrapped/dialog.rb', line 198 define_attribute :menubox |
#minbox ⇒ Object
:attr: minbox ‘no’ / ‘yes’, to show minimize box on dialog.
203 |
# File 'lib/wrapped/dialog.rb', line 203 define_attribute :minbox |
#modal ⇒ Object
:attr_reader: modal Returns modal state of dialog.
208 |
# File 'lib/wrapped/dialog.rb', line 208 define_reader :modal |
#parentdialog ⇒ Object
–
218 219 220 |
# File 'lib/wrapped/dialog.rb', line 218 def parentdialog attribute_reference('PARENTDIALOG', Dialog, nil) end |
#parentdialog=(parent) ⇒ Object
:nodoc:
222 223 224 |
# File 'lib/wrapped/dialog.rb', line 222 def parentdialog= parent # :nodoc: attribute_reference('PARENTDIALOG', Dialog, parent) end |
#placement ⇒ Object
:attr: placement ‘normal’ / ‘maximized’ / ‘minimized’ / ‘full’.
229 |
# File 'lib/wrapped/dialog.rb', line 229 define_attribute :placement |
#popup(x = nil, y = nil) ⇒ Object
Shows the dialog at position (x, y).
-
x- x-coordinate to use, or one of show constants -
y- y-coordinate to use, or one of show constants
50 51 52 |
# File 'lib/wrapped/dialog.rb', line 50 def popup x=nil, y=nil IupLib.IupPopup @handle, x.to_i, y.to_i end |
#rastersize ⇒ Object
:attr: rastersize Size of the dialog, in pixels, value as “widthxheight”.
112 |
# File 'lib/wrapped/dialog.rb', line 112 define_attribute :rastersize |
#resize ⇒ Object
:attr: resize ‘no’ / ‘yes’.
234 |
# File 'lib/wrapped/dialog.rb', line 234 define_attribute :resize |
#resize_cb=(callback) ⇒ Object
–
281 282 283 284 285 286 287 288 289 |
# File 'lib/wrapped/dialog.rb', line 281 def resize_cb= callback # :nodoc: unless callback.arity == 2 raise ArgumentError, 'resize_cb callback must take 2 arguments: (width, height)' end cb = Proc.new do |ih, width, height| callback.call width, height end define_callback cb, 'RESIZE_CB', :ii_i end |
#screenposition ⇒ Object
:attr_reader: screenposition returns position in pixels on screen as “x,y”.
117 |
# File 'lib/wrapped/dialog.rb', line 117 define_reader :screenposition |
#show(x = nil, y = nil) ⇒ Object
Shows the dialog at the default screen position, or at (x, y) if specified.
-
x- x-coordinate to use, or one of show constants -
y- y-coordinate to use, or one of show constants
58 59 60 61 62 63 64 |
# File 'lib/wrapped/dialog.rb', line 58 def show x=nil, y=nil if x.nil? and y.nil? IupLib.IupShow @handle else IupLib.IupShowXY @handle, x.to_i, y.to_i end end |
#show_cb=(callback) ⇒ Object
–
299 300 301 302 303 304 305 306 307 |
# File 'lib/wrapped/dialog.rb', line 299 def show_cb= callback #:nodoc: unless callback.arity == 1 raise ArgumentError, 'show_cb callback must take 1 argument: (state)' end cb = Proc.new do |ih, state| callback.call state end define_callback cb, 'SHOW_CB', :i_i end |
#shrink ⇒ Object
:attr: shrink ‘no’ / ‘yes’, allows dialog’s children to reduce their size if the dialog is made smaller.
240 |
# File 'lib/wrapped/dialog.rb', line 240 define_attribute :shrink |
#startfocus ⇒ Object
–
247 248 249 |
# File 'lib/wrapped/dialog.rb', line 247 def startfocus attribute_reference('STARTFOCUS', Widget, nil) end |
#startfocus=(item) ⇒ Object
:nodoc:
251 252 253 |
# File 'lib/wrapped/dialog.rb', line 251 def startfocus= item # :nodoc: attribute_reference('STARTFOCUS', Widget, item) end |
#tip ⇒ Object
:attr: tip Tooltip string.
122 |
# File 'lib/wrapped/dialog.rb', line 122 define_attribute :tip |
#title ⇒ Object
:attr: title Displayed as dialog title.
127 |
# File 'lib/wrapped/dialog.rb', line 127 define_attribute :title |