class Iup::ProgressDialog
A dialog to show the progress of an operation.
Attributes¶ ↑
- count
-
n, number of iterations completed so far.
- description
-
The text to show within the dialog, describing operation.
- inc
-
n, write-only increases progress by
n
. - 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.
- percent
-
n, current percent of iterations.
- state
-
current state of the iteration, values 'idle' / 'processing' / 'undefined' / 'aborted'.
- title
-
Title text for the progress dialog.
- totalcount
-
n, total number of iterations to complete.
Public Class Methods
Creates an instance of the dialog.
- block
-
optional block to set up the dialog's attributes.
# File lib/wrapped/progressdialog.rb, line 25 def initialize &block @handle = IupLib.IupProgressDlg # run any provided block on instance, to set up further attributes self.instance_eval &block if block_given? end
Public Instance Methods
Action generated when the user clicked on the Cancel button.
# File lib/wrapped/progressdialog.rb, line 64 def cancel_cb callback unless callback.arity.zero? raise ArgumentError, 'cancel_cb callback must take 0 arguments' end cb = Proc.new do |ih| callback.call end define_callback cb, 'CANCEL_CB', :plain end
Called right before the dialog is closed.
# File lib/wrapped/progressdialog.rb, line 75 def close_cb callback 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
Hides the dialog.
# File lib/wrapped/progressdialog.rb, line 33 def hide IupLib.IupHide @handle end
Action generated when the dialog size is changed. resize_cb
a 2-argument callback: (width, height).
- width
-
internal width of canvas (client width)
- height
-
internal height of canvas (client height)
# File lib/wrapped/progressdialog.rb, line 89 def resize_cb callback 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
Shows the dialog, at an optional (x, y) position.
# File lib/wrapped/progressdialog.rb, line 38 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
Called right after the dialog is shown, hidden, maximized, minimized or restored from minimized/maximized. Callback takes one argument, the state of the change.
# File lib/wrapped/progressdialog.rb, line 101 def show_cb callback 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