Class: Fox::FXApp
- Defined in:
- rdoc-sources/FXApp.rb,
lib/fox16/chore.rb,
lib/fox16/input.rb,
lib/fox16/signal.rb,
lib/fox16/thread.rb,
lib/fox16/timeout.rb,
lib/fox16/iterators.rb
Overview
Application Object
Events
The FXApp object itself doesn’t have a designated message target like other FOX objects, but it can send messages to objects for a few special events.
- Timers
-
When a timeout event is registered with the application using the addTimeout method, a
SEL_TIMEOUT
message is sent to the message target. - Chores
-
When a chore event is registered with the application using the addChore method, a
SEL_CHORE
message is sent to the message target. - Inputs
-
When an input event is registered with the application using the addInput method, a
SEL_IO_READ
,SEL_IO_WRITE
orSEL_IO_EXCEPT
message may be sent to the message target. - Signals
-
When a signal handler object is registered with the application using the addSignal method, a
SEL_SIGNAL
message may be sent to the message target.
File input modes for #addInput
INPUT_NONE
-
inactive
INPUT_READ
-
read input fd
INPUT_WRITE
-
write input fd
INPUT_EXCEPT
-
except input fd
All ways of being modal
MODAL_FOR_NONE
-
Non modal event loop (dispatch normally)
MODAL_FOR_WINDOW
-
Modal dialog (beep if outside of modal dialog)
MODAL_FOR_POPUP
-
Modal for popup (always dispatch to popup)
Default cursors provided by the application
These constants symbolically represent the different cursor shapes used in FOX applications, and can be used as the which arguments for #getDefaultCursor and #setDefaultCursor.
DEF_ARROW_CURSOR
-
Arrow cursor
DEF_RARROW_CURSOR
-
Reverse arrow cursor
DEF_TEXT_CURSOR
-
Text cursor
DEF_HSPLIT_CURSOR
-
Horizontal split cursor
DEF_VSPLIT_CURSOR
-
Vertical split cursor
DEF_XSPLIT_CURSOR
-
Cross split cursor
DEF_SWATCH_CURSOR
-
Color swatch drag cursor
DEF_MOVE_CURSOR
-
Move cursor
DEF_DRAGH_CURSOR
-
Resize horizontal edge
DEF_DRAGV_CURSOR
-
Resize vertical edge
DEF_DRAGTL_CURSOR
-
Resize upper-leftcorner
DEF_DRAGBR_CURSOR
-
Resize bottom-right corner
DEF_DRAGTR_CURSOR
-
Resize upper-right corner
DEF_DRAGBL_CURSOR
-
Resize bottom-left corner
DEF_DNDSTOP_CURSOR
-
Drag and drop stop
DEF_DNDCOPY_CURSOR
-
Drag and drop copy
DEF_DNDMOVE_CURSOR
-
Drag and drop move
DEF_DNDLINK_CURSOR
-
Drag and drop link
DEF_CROSSHAIR_CURSOR
-
Cross hair cursor
DEF_CORNERNE_CURSOR
-
North-east cursor
DEF_CORNERNW_CURSOR
-
North-west cursor
DEF_CORNERSE_CURSOR
-
South-east cursor
DEF_CORNERSW_CURSOR
-
South-west cursor
DEF_HELP_CURSOR
-
Help arrow cursor
DEF_HAND_CURSOR
-
Hand cursor
DEF_ROTATE_CURSOR
-
Rotate cursor
DEF_WAIT_CURSOR
-
Wait cursor
Messages identifiers
ID_QUIT
-
Terminate the application normally
ID_DUMP
-
Dump the current widget tree
Instance Attribute Summary collapse
-
#activeWindow ⇒ Object
readonly
The active top-level window, if any FXWindow.
-
#animSpeed ⇒ Object
Animation speed, in milliseconds [Integer].
-
#appName ⇒ Object
readonly
Application name [String].
-
#argc ⇒ Object
readonly
Argument count [Integer].
-
#argv ⇒ Object
readonly
Argument vector [Array].
-
#backColor ⇒ Object
Default background color FXColor.
-
#baseColor ⇒ Object
Background color of GUI controls FXColor.
-
#blinkSpeed ⇒ Object
Blink speed, in milliseconds [Integer].
-
#borderColor ⇒ Object
Border color FXColor.
-
#clickSpeed ⇒ Object
Click speed, in milliseconds [Integer].
-
#cursorWindow ⇒ Object
readonly
The window under the cursor, if any FXWindow.
-
#defaultVisual ⇒ Object
Default visual FXVisual.
-
#display ⇒ Object
readonly
Display [Integer].
-
#dragDelta ⇒ Object
Drag delta, in pixels [Integer].
-
#focusWindow ⇒ Object
readonly
The window at the end of the focus chain, if any FXWindow.
-
#foreColor ⇒ Object
Default foreground color FXColor.
-
#hiliteColor ⇒ Object
Hilite color of GUI controls FXColor.
-
#menuPause ⇒ Object
Menu pause, in milliseconds [Integer].
-
#modalModality ⇒ Object
readonly
Mode of current modal loop [Integer].
-
#modalWindow ⇒ Object
readonly
The window of the current modal loop FXWindow.
-
#monoVisual ⇒ Object
readonly
Monochrome visual FXVisual.
-
#normalFont ⇒ Object
Default font FXFont.
-
#rootWindow ⇒ Object
readonly
Root window FXRootWindow.
-
#scrollBarSize ⇒ Object
Scroll bar size [Integer].
-
#scrollDelay ⇒ Object
Scroll delay time, in milliseconds [Integer].
-
#scrollSpeed ⇒ Object
Scroll speed, in milliseconds [Integer].
-
#selbackColor ⇒ Object
Default background color for selected objects FXColor.
-
#selforeColor ⇒ Object
Default foreground color for selected objects FXColor.
-
#selMenuBackColor ⇒ Object
Default background color for selected menu items FXColor.
-
#selMenuTextColor ⇒ Object
Default text color for selected menu items FXColor.
-
#shadowColor ⇒ Object
Shadow color of GUI controls FXColor.
-
#sleepTime ⇒ Object
Amount of time (in milliseconds) to yield to Ruby’s thread scheduler [Integer].
-
#tipbackColor ⇒ Object
Default background color for tooltips FXColor.
-
#tipforeColor ⇒ Object
Default foreground color for tooltips FXColor.
-
#tooltipPause ⇒ Object
Tooltip pause, in milliseconds [Integer].
-
#tooltipTime ⇒ Object
Tooltip time, in milliseconds [Integer].
-
#translator ⇒ Object
Message translator FXTranslator.
-
#typingSpeed ⇒ Object
Typing speed used for the FXIconList, FXList and FXTreeList widgets’ lookup features, in milliseconds.
-
#vendorName ⇒ Object
readonly
Vendor name [String].
-
#waitCursor ⇒ Object
Wait cursor FXCursor.
-
#wheelLines ⇒ Object
Number of wheel lines [Integer].
Class Method Summary collapse
-
.copyright ⇒ Object
Copyright notice for library.
-
.instance ⇒ Object
Return application instance.
Instance Method Summary collapse
-
#addChore(*args, &block) ⇒ Object
Add a idle processing message to be sent to a target object when the system becomes idle, i.e.
-
#addChoreOrig ⇒ Object
:nodoc:.
-
#addInput(io, mode, *args, &block) ⇒ Object
Add an IO object as io to be watched for activity as determined by mode, where mode is a bitwise OR (
INPUT_READ
,INPUT_WRITE
,INPUT_EXCEPT
). -
#addInputOrig ⇒ Object
:nodoc:.
-
#addSignal(sig, *args, &block) ⇒ Object
Register a signal processing message to be sent to target object when the specified signal is raised.
-
#addSignalOrig ⇒ Object
Add signal processing message to be sent to target object when the signal sig is raised; flags are to be set as per POSIX definitions.
-
#addTimeout(ms, *args, &block) ⇒ Object
Add a timeout message to be sent to target object in ms milliseconds.
-
#addTimeoutOrig ⇒ Object
:nodoc:.
-
#beep ⇒ Object
Beep.
-
#beginWaitCursor ⇒ Object
Changes the default application cursor to an hourglass shape, to provide a visual cue to the user that it’s time to wait.
-
#beginWaitCursor0 ⇒ Object
:nodoc:.
-
#closeDisplay ⇒ Object
Close connection to the display.
-
#create ⇒ Object
Create application’s windows.
-
#destroy ⇒ Object
Destroy application’s windows.
-
#detach ⇒ Object
Detach application’s windows.
-
#disableThreads ⇒ Object
Disable support for multithreaded applications.
-
#dumpWidgets ⇒ Object
Dump widget information.
-
#enableThreads ⇒ Object
Enable support for multithreaded applications.
-
#endWaitCursor ⇒ Object
End the most deeply nested wait-cursor block.
-
#exit(code = 0) ⇒ Object
Exit application.
-
#flush(sync = false) ⇒ Object
Flush pending repaints.
-
#forceRefresh ⇒ Object
Force GUI refresh.
-
#getDefaultCursor(which) ⇒ Object
Return a reference to one of the default application cursors (an FXCursor instance), where which is one of the default cursor identifiers listed above, e.g.
-
#getDragTypeName(dragType) ⇒ Object
Return the name of a previously registered drag type, e.g.
-
#getKeyState(keysym) ⇒ Object
Return key state (either
true
orfalse
) for keysym. -
#handleTimeouts ⇒ Object
Process any timeouts due at this time.
-
#hasChore?(*args) ⇒ Boolean
Return
true
if given chore has been set, otherwise returnfalse
. -
#hasChoreOrig? ⇒ Object
:nodoc:.
-
#hasInputMethod? ⇒ Boolean
Return
true
if input methods are supported. -
#hasTimeout?(*args) ⇒ Boolean
Return
true
if given timeout has been set, otherwise returnfalse
. -
#hasTimeoutOrig? ⇒ Object
:nodoc:.
-
#init(argv, connect = true) ⇒ Object
Initialize application.
-
#initialize(*args, &block) ⇒ FXApp
constructor
Construct application object; the appName and vendorName strings are used as keys into the registry database for this application’s settings.
-
#initialize_before_thread ⇒ FXApp
Construct application object; the appName and vendorName strings are used as keys into the registry database for this application’s settings.
-
#initialized? ⇒ Boolean
Return true if the application has been initialized.
-
#modal?(window) ⇒ Boolean
Returns
true
if the window is modal. -
#mutex ⇒ Object
Return a reference to the application-wide mutex (an FXMutex instance).
-
#openDisplay(dpyname = nil) ⇒ Object
Open connection to display; this is called by #init.
-
#peekEvent ⇒ Object
Peek to determine if there’s an event.
-
#readWindow(store, father, owner) ⇒ Object
Read a window and its children from the stream store, and append it under father; note it is initially not created yet.
-
#refresh ⇒ Object
Schedule a refresh.
-
#reg ⇒ Object
Return a reference to the registry (an FXRegistry instance).
-
#registerDragType(name) ⇒ Object
Register a drag type with the given name and return the drag drag type.
-
#remainingTimeout(*args) ⇒ Object
Return the time remaining (in milliseconds) until the given timer fires.
-
#remainingTimeoutOrig ⇒ Object
:nodoc:.
-
#removeChore(*args) ⇒ Object
Remove idle processing message identified by tgt and sel.
-
#removeChoreOrig ⇒ Object
:nodoc:.
-
#removeInput(fd, mode) ⇒ Object
Remove input message and target object for the specified file descriptor and mode, which is a bitwise OR of (
INPUT_READ
,INPUT_WRITE
,INPUT_EXCEPT
). -
#removeSignal(sig) ⇒ Object
Remove signal message for signal sig.
-
#removeTimeout(*args) ⇒ Object
Remove timeout previously registered using #addTimeout; returns
nil
. -
#removeTimeoutOrig ⇒ Object
:nodoc:.
-
#repaint ⇒ Object
Paint all windows marked for repainting.
- #run ⇒ Object
-
#runModal ⇒ Object
Run modal event loop, blocking keyboard and mouse events to all windows until #stopModal is called.
-
#runModalFor(window) ⇒ Object
Run a modal event loop for the given window, until #stop or #stopModal is called.
-
#runModalWhileEvents(window = nil) ⇒ Object
Run event loop while there are events are available in the queue.
-
#runModalWhileShown(window) ⇒ Object
Run modal while window is shown, or until #stop or #stopModal is called.
-
#runOneEvent(blocking = true) ⇒ Object
Perform one event dispatch; return
true
if event was dispatched. -
#runOnUiThread(&block) ⇒ Object
Runs the specified block on the UI thread.
-
#runPopup(window) ⇒ Object
Run popup menu while shown, until #stop or #stopModal is called.
-
#runUntil(condition) ⇒ Object
Run an event loop till some flag becomes non-zero, and then return.
-
#runWhileEvents ⇒ Object
Run event loop while events are available, non-modally.
-
#setDefaultCursor(which, cursor) ⇒ Object
Replace one of the default application cursors with cursor; e.g.
-
#stop(value = 0) ⇒ Object
Terminate the outermost event loop, and all inner modal loops; All more deeper nested event loops will be terminated with code equal to 0, while the outermost event loop will return code equal to value.
-
#stopModal(value = 0) ⇒ Object
Break out of the innermost modal loop, returning code equal to value.
-
#threadsEnabled? ⇒ Boolean
Check to see if multithreaded applications are supported.
-
#windowCount ⇒ Object
Return the number of existing windows.
-
#writeWindow(store, window) ⇒ Object
Write a window and its children, and all resources reachable from this window, into the stream store (an FXStream instance).
Methods inherited from FXObject
#bind, #handle, #load, #save, subclasses
Constructor Details
#initialize(*args, &block) ⇒ FXApp
Construct application object; the appName and vendorName strings are used as keys into the registry database for this application’s settings. Only one single application object can be constructed.
283 284 |
# File 'rdoc-sources/FXApp.rb', line 283 def initialize(appName="Application", vendorName="FoxDefault") # :yields: theApp end |
Instance Attribute Details
#activeWindow ⇒ Object (readonly)
The active top-level window, if any Fox::FXWindow
224 225 226 |
# File 'rdoc-sources/FXApp.rb', line 224 def activeWindow @activeWindow end |
#animSpeed ⇒ Object
Animation speed, in milliseconds [Integer]
249 250 251 |
# File 'rdoc-sources/FXApp.rb', line 249 def animSpeed @animSpeed end |
#appName ⇒ Object (readonly)
Application name [String]
152 153 154 |
# File 'rdoc-sources/FXApp.rb', line 152 def appName @appName end |
#argc ⇒ Object (readonly)
Argument count [Integer]
158 159 160 |
# File 'rdoc-sources/FXApp.rb', line 158 def argc @argc end |
#argv ⇒ Object (readonly)
Argument vector [Array]
161 162 163 |
# File 'rdoc-sources/FXApp.rb', line 161 def argv @argv end |
#backColor ⇒ Object
Default background color Fox::FXColor
179 180 181 |
# File 'rdoc-sources/FXApp.rb', line 179 def backColor @backColor end |
#baseColor ⇒ Object
Background color of GUI controls Fox::FXColor
170 171 172 |
# File 'rdoc-sources/FXApp.rb', line 170 def baseColor @baseColor end |
#blinkSpeed ⇒ Object
Blink speed, in milliseconds [Integer]
246 247 248 |
# File 'rdoc-sources/FXApp.rb', line 246 def blinkSpeed @blinkSpeed end |
#borderColor ⇒ Object
Border color Fox::FXColor
167 168 169 |
# File 'rdoc-sources/FXApp.rb', line 167 def borderColor @borderColor end |
#clickSpeed ⇒ Object
Click speed, in milliseconds [Integer]
237 238 239 |
# File 'rdoc-sources/FXApp.rb', line 237 def clickSpeed @clickSpeed end |
#cursorWindow ⇒ Object (readonly)
The window under the cursor, if any Fox::FXWindow
218 219 220 |
# File 'rdoc-sources/FXApp.rb', line 218 def cursorWindow @cursorWindow end |
#defaultVisual ⇒ Object
Default visual Fox::FXVisual
203 204 205 |
# File 'rdoc-sources/FXApp.rb', line 203 def defaultVisual @defaultVisual end |
#display ⇒ Object (readonly)
Display [Integer]
164 165 166 |
# File 'rdoc-sources/FXApp.rb', line 164 def display @display end |
#dragDelta ⇒ Object
Drag delta, in pixels [Integer]
261 262 263 |
# File 'rdoc-sources/FXApp.rb', line 261 def dragDelta @dragDelta end |
#focusWindow ⇒ Object (readonly)
The window at the end of the focus chain, if any Fox::FXWindow
221 222 223 |
# File 'rdoc-sources/FXApp.rb', line 221 def focusWindow @focusWindow end |
#foreColor ⇒ Object
Default foreground color Fox::FXColor
182 183 184 |
# File 'rdoc-sources/FXApp.rb', line 182 def foreColor @foreColor end |
#hiliteColor ⇒ Object
Hilite color of GUI controls Fox::FXColor
173 174 175 |
# File 'rdoc-sources/FXApp.rb', line 173 def hiliteColor @hiliteColor end |
#menuPause ⇒ Object
Menu pause, in milliseconds [Integer]
252 253 254 |
# File 'rdoc-sources/FXApp.rb', line 252 def @menuPause end |
#modalModality ⇒ Object (readonly)
Mode of current modal loop [Integer]
230 231 232 |
# File 'rdoc-sources/FXApp.rb', line 230 def modalModality @modalModality end |
#modalWindow ⇒ Object (readonly)
The window of the current modal loop Fox::FXWindow
227 228 229 |
# File 'rdoc-sources/FXApp.rb', line 227 def modalWindow @modalWindow end |
#monoVisual ⇒ Object (readonly)
Monochrome visual Fox::FXVisual
212 213 214 |
# File 'rdoc-sources/FXApp.rb', line 212 def monoVisual @monoVisual end |
#normalFont ⇒ Object
Default font Fox::FXFont
206 207 208 |
# File 'rdoc-sources/FXApp.rb', line 206 def normalFont @normalFont end |
#rootWindow ⇒ Object (readonly)
Root window Fox::FXRootWindow
215 216 217 |
# File 'rdoc-sources/FXApp.rb', line 215 def rootWindow @rootWindow end |
#scrollBarSize ⇒ Object
Scroll bar size [Integer]
267 268 269 |
# File 'rdoc-sources/FXApp.rb', line 267 def scrollBarSize @scrollBarSize end |
#scrollDelay ⇒ Object
Scroll delay time, in milliseconds [Integer]
243 244 245 |
# File 'rdoc-sources/FXApp.rb', line 243 def scrollDelay @scrollDelay end |
#scrollSpeed ⇒ Object
Scroll speed, in milliseconds [Integer]
240 241 242 |
# File 'rdoc-sources/FXApp.rb', line 240 def scrollSpeed @scrollSpeed end |
#selbackColor ⇒ Object
Default background color for selected objects Fox::FXColor
188 189 190 |
# File 'rdoc-sources/FXApp.rb', line 188 def selbackColor @selbackColor end |
#selforeColor ⇒ Object
Default foreground color for selected objects Fox::FXColor
185 186 187 |
# File 'rdoc-sources/FXApp.rb', line 185 def selforeColor @selforeColor end |
#selMenuBackColor ⇒ Object
Default background color for selected menu items Fox::FXColor
200 201 202 |
# File 'rdoc-sources/FXApp.rb', line 200 def selMenuBackColor @selMenuBackColor end |
#selMenuTextColor ⇒ Object
Default text color for selected menu items Fox::FXColor
197 198 199 |
# File 'rdoc-sources/FXApp.rb', line 197 def selMenuTextColor @selMenuTextColor end |
#shadowColor ⇒ Object
Shadow color of GUI controls Fox::FXColor
176 177 178 |
# File 'rdoc-sources/FXApp.rb', line 176 def shadowColor @shadowColor end |
#sleepTime ⇒ Object
Amount of time (in milliseconds) to yield to Ruby’s thread scheduler [Integer]
270 271 272 |
# File 'rdoc-sources/FXApp.rb', line 270 def sleepTime @sleepTime end |
#tipbackColor ⇒ Object
Default background color for tooltips Fox::FXColor
194 195 196 |
# File 'rdoc-sources/FXApp.rb', line 194 def tipbackColor @tipbackColor end |
#tipforeColor ⇒ Object
Default foreground color for tooltips Fox::FXColor
191 192 193 |
# File 'rdoc-sources/FXApp.rb', line 191 def tipforeColor @tipforeColor end |
#tooltipPause ⇒ Object
Tooltip pause, in milliseconds [Integer]
255 256 257 |
# File 'rdoc-sources/FXApp.rb', line 255 def tooltipPause @tooltipPause end |
#tooltipTime ⇒ Object
Tooltip time, in milliseconds [Integer]
258 259 260 |
# File 'rdoc-sources/FXApp.rb', line 258 def tooltipTime @tooltipTime end |
#translator ⇒ Object
Message translator Fox::FXTranslator
273 274 275 |
# File 'rdoc-sources/FXApp.rb', line 273 def translator @translator end |
#typingSpeed ⇒ Object
Typing speed used for the FXIconList, FXList and FXTreeList widgets’ lookup features, in milliseconds. Default value is 1000 milliseconds.
234 235 236 |
# File 'rdoc-sources/FXApp.rb', line 234 def typingSpeed @typingSpeed end |
#vendorName ⇒ Object (readonly)
Vendor name [String]
155 156 157 |
# File 'rdoc-sources/FXApp.rb', line 155 def vendorName @vendorName end |
#waitCursor ⇒ Object
Wait cursor Fox::FXCursor
209 210 211 |
# File 'rdoc-sources/FXApp.rb', line 209 def waitCursor @waitCursor end |
#wheelLines ⇒ Object
Number of wheel lines [Integer]
264 265 266 |
# File 'rdoc-sources/FXApp.rb', line 264 def wheelLines @wheelLines end |
Class Method Details
.copyright ⇒ Object
Copyright notice for library
276 |
# File 'rdoc-sources/FXApp.rb', line 276 def FXApp.copyright() ; end |
.instance ⇒ Object
Return application instance
463 |
# File 'rdoc-sources/FXApp.rb', line 463 def FXApp.instance(); end |
Instance Method Details
#addChore(*args, &block) ⇒ Object
Add a idle processing message to be sent to a target object when the system becomes idle, i.e. when there are no more events to be processed. There are several forms for #addChore; the original form (from FOX) takes two arguments, a target object and a message identifier:
app.addChore(tgt, sel)
If a chore with the same target and message already exists, it will be rescheduled.
A second form takes a Method instance as its single argument:
app.addChore(mthd)
For this form, the method should have the standard argument list for a FOX message handler. That is, the method should take three arguments, for the message sender (an FXObject), the message selector, and the message data (if any).
The last form takes a block:
app.addChore() do |sender, sel, data|
... handle the chore ...
end
All of these return a reference to an opaque FXChore instance that can be passed to #removeChore if it is necessary to remove the chore before it fires.
For the last two forms, you can pass in the optional :repeat
parameter to cause the chore to be re-registered after it fires, e.g.
chore = app.addChore(:repeat => true) do |sender, sel, data|
... handle the chore ...
... re-add the chore ...
end
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/fox16/chore.rb', line 46 def addChore(*args, &block) params = {} params = args.pop if args.last.is_a? Hash tgt, sel = nil, 0 if args.length > 0 if args[0].respond_to? :call tgt = params[:target] || FXPseudoTarget.new tgt.pconnect(SEL_CHORE, args[0], params) else tgt, sel = args[0], args[1] end else tgt = params[:target] || FXPseudoTarget.new tgt.pconnect(SEL_CHORE, block, params) end addChoreOrig(tgt, sel) params[:target] = tgt params[:selector] = sel params end |
#addChoreOrig ⇒ Object
:nodoc:
5 |
# File 'lib/fox16/chore.rb', line 5 alias addChoreOrig addChore |
#addInput(io, mode, *args, &block) ⇒ Object
Add an IO object as io to be watched for activity as determined by mode, where mode is a bitwise OR (INPUT_READ
, INPUT_WRITE
, INPUT_EXCEPT
). A message of type SEL_IO_READ
, SEL_IO_WRITE
, or SEL_IO_EXCEPT
will be sent to the target when the specified activity is detected on the file descriptor.
On POSIX operating systems all kinds of file descriptors can be watched. It works for Socket.new
, IO.popen
, IO.pipe
, IO.for_fd
, File.open
, etc. Windows provides level triggered events only for network sockets. So on Windows only socket IO objects like TCPSocket.new
and TCPServer.new
are currently supported to be watched.
There are several forms for #addInput; the original form (from FOX) takes four arguments:
anApp.addInput(fileDesc, mode, anObject, aMessageId)
A second form takes three arguments:
anApp.addInput(fileDesc, mode, aMethod)
For this form, aMethod should have the standard argument list for a FOX message handler. That is, the method should take three arguments, for the message sender (an FXObject), the message selector, and the message data (if any).
The last form of #addInput takes a block:
anApp.addInput(fileDesc, mode) { |sender, sel, data|
... handle the I/O event ...
}
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/fox16/input.rb', line 36 def addInput(io, mode, *args, &block) params = {} params = args.pop if args.last.is_a? Hash tgt, sel = nil, 0 if args.length > 0 if args[0].respond_to? :call tgt = FXPseudoTarget.new tgt.pconnect(SEL_IO_READ, args[0], params) tgt.pconnect(SEL_IO_WRITE, args[0], params) tgt.pconnect(SEL_IO_EXCEPT, args[0], params) else # it's some other kind of object tgt = args[0] sel = args[1] end else tgt = FXPseudoTarget.new tgt.pconnect(SEL_IO_READ, block, params) tgt.pconnect(SEL_IO_WRITE, block, params) tgt.pconnect(SEL_IO_EXCEPT, block, params) end addInputOrig(io, mode, tgt, sel) end |
#addInputOrig ⇒ Object
:nodoc:
5 |
# File 'lib/fox16/input.rb', line 5 alias addInputOrig addInput |
#addSignal(sig, *args, &block) ⇒ Object
Register a signal processing message to be sent to target object when the specified signal is raised.
There are several forms for #addSignal; the original form (from FOX) takes (up to) five arguments:
anApp.addSignal(aSignal, anObject, aMessageId, sendImmediately=false, flags=0)
Here, aSignal is a string indicating the operating system signal of interest (such as “SIGINT”). The second and third arguments are the target object and message identifier for the message to be sent when this signal is raised. If sendImmediately is true
, the message will be sent to the target right away; this should be used with extreme care as the application is interrupted at an unknown point in its execution. The flags are to be set as per POSIX definitions.
A second form of #addSignal takes a Method instance as its second argument:
anApp.addSignal(aSignal, aMethod, sendImmediately=false, flags=0)
For this form, the method should have the standard argument list for a FOX message handler. That is, the method should take three arguments, for the message sender (an FXObject), the message selector, and the message data (if any).
The last form of #addSignal takes a block:
anApp.addSignal(aSignal, sendImmediately=false, flags=0) { |sender, sel, data|
... handle the signal ...
}
312 |
# File 'rdoc-sources/FXApp.rb', line 312 def addSignal(sig, tgt, sel, immediate=false, flags=0) ; end |
#addSignalOrig ⇒ Object
Add signal processing message to be sent to target object when the signal sig is raised; flags are to be set as per POSIX definitions. When immediate is true
, the message will be sent to the target right away; this should be used with extreme care as the application is interrupted at an unknown point in its execution. :nodoc:
5 |
# File 'lib/fox16/signal.rb', line 5 def addSignal(sig, tgt, sel, immediate=false, flags=0) ; end |
#addTimeout(ms, *args, &block) ⇒ Object
Add a timeout message to be sent to target object in ms milliseconds. By default, the timer fires only once after the interval expires. The last argument is optional user data which will be passed along as the ptr argument of the message handler. If a timer with the same target and message already exists, it will be rescheduled.
There are several forms for #addTimeout; the original form (from FOX) takes three arguments:
timeout = app.addTimeout(delay, tgt, sel)
Here, delay is the time interval (in milliseconds) to wait before firing this timeout. The second and third arguments are the target object and message identifier for the message to be sent when this timeout fires.
A second form of #addTimeout takes a Method instance as its single argument:
timeout = app.addTimeout(delay, mthd)
For this form, the method should have the standard argument list for a FOX message handler. That is, the method should take three arguments, for the message sender (an FXObject), the message selector, and the message data (if any).
The last form of #addTimeout takes a block:
timeout = app.addTimeout(delay) do |sender, sel, data|
... handle the timeout ...
end
All of these return a reference to an opaque object (actually, a hash) that can be passed to #removeTimeout if it is necessary to remove the timeout before it fires.
For the last two forms, you can pass in the optional :repeat
parameter to cause the timeout to be re-registered after it fires, e.g.
timeout = app.addTimeout(delay, :repeat => true) do |sender, sel, data|
... handle the timeout ...
... re-add the timeout with the same delay ...
end
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/fox16/timeout.rb', line 54 def addTimeout(ms, *args, &block) params = {} params = args.pop if args.last.is_a? Hash params[:delay] = ms tgt, sel = nil, 0 if args.length > 0 if args[0].respond_to? :call tgt = params[:target] || FXPseudoTarget.new tgt.pconnect(SEL_TIMEOUT, args[0], params) else # it's some other kind of object tgt = args[0] sel = args[1] end else tgt = params[:target] || FXPseudoTarget.new tgt.pconnect(SEL_TIMEOUT, block, params) end addTimeoutOrig(tgt, sel, ms) params[:target] = tgt params[:selector] = sel params end |
#addTimeoutOrig ⇒ Object
:nodoc:
5 |
# File 'lib/fox16/timeout.rb', line 5 alias addTimeoutOrig addTimeout |
#beep ⇒ Object
Beep
460 |
# File 'rdoc-sources/FXApp.rb', line 460 def beep(); end |
#beginWaitCursor ⇒ Object
Changes the default application cursor to an hourglass shape, to provide a visual cue to the user that it’s time to wait. To revert the default application cursor to its normal shape, call the #endWaitCursor method. For example,
getApp().beginWaitCursor()
... time-consuming operation ...
getApp().endWaitCursor()
Invocations of #beginWaitCursor may be nested, and if so, the call to #endWaitCursor is matched with the most recent call to #beginWaitCursor.
If an optional code block is provided, #endWaitCursor is automatically called after the block terminates, e.g.
getApp().beginWaitCursor() {
... time-consuming operation ...
... endWaitCursor() is called automatically ...
}
366 367 368 369 370 371 372 373 374 375 |
# File 'lib/fox16/iterators.rb', line 366 def beginWaitCursor beginWaitCursor0 if block_given? begin yield ensure endWaitCursor end end end |
#beginWaitCursor0 ⇒ Object
:nodoc:
342 |
# File 'lib/fox16/iterators.rb', line 342 alias beginWaitCursor0 beginWaitCursor |
#closeDisplay ⇒ Object
Close connection to the display
292 |
# File 'rdoc-sources/FXApp.rb', line 292 def closeDisplay() ; end |
#create ⇒ Object
Create application’s windows
326 |
# File 'rdoc-sources/FXApp.rb', line 326 def create() ; end |
#destroy ⇒ Object
Destroy application’s windows
329 |
# File 'rdoc-sources/FXApp.rb', line 329 def destroy() ; end |
#detach ⇒ Object
Detach application’s windows
332 |
# File 'rdoc-sources/FXApp.rb', line 332 def detach() ; end |
#disableThreads ⇒ Object
Disable support for multithreaded applications
537 |
# File 'rdoc-sources/FXApp.rb', line 537 def disableThreads(); end |
#dumpWidgets ⇒ Object
Dump widget information
528 |
# File 'rdoc-sources/FXApp.rb', line 528 def dumpWidgets() ; end |
#enableThreads ⇒ Object
Enable support for multithreaded applications
534 |
# File 'rdoc-sources/FXApp.rb', line 534 def enableThreads(); end |
#endWaitCursor ⇒ Object
End the most deeply nested wait-cursor block. See also #beginWaitCursor.
467 |
# File 'rdoc-sources/FXApp.rb', line 467 def endWaitCursor(); end |
#exit(code = 0) ⇒ Object
Exit application. Closes the display and writes the registry.
437 |
# File 'rdoc-sources/FXApp.rb', line 437 def exit(code=0); end |
#flush(sync = false) ⇒ Object
Flush pending repaints
416 |
# File 'rdoc-sources/FXApp.rb', line 416 def flush(sync=false); end |
#forceRefresh ⇒ Object
Force GUI refresh
410 |
# File 'rdoc-sources/FXApp.rb', line 410 def forceRefresh(); end |
#getDefaultCursor(which) ⇒ Object
Return a reference to one of the default application cursors (an FXCursor instance), where which is one of the default cursor identifiers listed above, e.g.
rotateCursor = app.getDefaultCursor(DEF_ROTATE_CURSOR)
See also #setDefaultCursor.
478 |
# File 'rdoc-sources/FXApp.rb', line 478 def getDefaultCursor(which) ; end |
#getDragTypeName(dragType) ⇒ Object
Return the name of a previously registered drag type, e.g.
dragTypeName = app.getDragTypeName(yamlDragType)
See also #registerDragType.
457 |
# File 'rdoc-sources/FXApp.rb', line 457 def getDragTypeName(dragType) ; end |
#getKeyState(keysym) ⇒ Object
Return key state (either true
or false
) for keysym.
337 |
# File 'rdoc-sources/FXApp.rb', line 337 def getKeyState(keysym); end |
#handleTimeouts ⇒ Object
Process any timeouts due at this time.
303 |
# File 'rdoc-sources/FXApp.rb', line 303 def handleTimeouts(); end |
#hasChore?(*args) ⇒ Boolean
Return true
if given chore has been set, otherwise return false
.
For example, you might set up a chore at some point in the execution:
chore = app.addChore { ... }
but decide that you want to “cancel” that chore later (before it’s had a chance to run):
if app.hasChore?(chore)
app.removeChore(chore)
end
94 95 96 97 98 99 100 101 |
# File 'lib/fox16/chore.rb', line 94 def hasChore?(*args) if args.length == 2 hasChoreOrig?(args[0], args[1]) else hsh = args[0] hasChoreOrig?(hsh[:target], hsh[:selector]) end end |
#hasChoreOrig? ⇒ Object
:nodoc:
7 |
# File 'lib/fox16/chore.rb', line 7 alias hasChoreOrig? hasChore? |
#hasInputMethod? ⇒ Boolean
Return true
if input methods are supported.
298 |
# File 'rdoc-sources/FXApp.rb', line 298 def hasInputMethod?; end |
#hasTimeout?(*args) ⇒ Boolean
Return true
if given timeout has been set, otherwise return false
.
For example, suppose you set up a timeout event to run ten seconds from now:
timeout = app.addTimeout(10*1000, ...)
but in the meantime, you decide that you want to cancel it if it hasn’t run yet:
if app.hasTimeout?(timeout)
app.removeTimeout(timeout)
end
106 107 108 109 110 111 112 113 |
# File 'lib/fox16/timeout.rb', line 106 def hasTimeout?(*args) if args.length == 2 hasTimeoutOrig?(args[0], args[1]) else hsh = args[0] hasTimeoutOrig?(hsh[:target], hsh[:selector]) end end |
#hasTimeoutOrig? ⇒ Object
:nodoc:
7 |
# File 'lib/fox16/timeout.rb', line 7 alias hasTimeoutOrig? hasTimeout? |
#init(argv, connect = true) ⇒ Object
Initialize application. Parses and removes common command line arguments, reads the registry. Finally, if connect is true
, it opens the display.
433 |
# File 'rdoc-sources/FXApp.rb', line 433 def init(argv, connect=true) ; end |
#initialize_before_thread ⇒ FXApp
Construct application object; the appName and vendorName strings are used as keys into the registry database for this application’s settings. Only one single application object can be constructed. :nodoc:
7 8 |
# File 'lib/fox16/thread.rb', line 7 def initialize(appName="Application", vendorName="FoxDefault") # :yields: theApp end |
#initialized? ⇒ Boolean
Return true if the application has been initialized.
295 |
# File 'rdoc-sources/FXApp.rb', line 295 def initialized?; end |
#modal?(window) ⇒ Boolean
Returns true
if the window is modal
391 |
# File 'rdoc-sources/FXApp.rb', line 391 def modal?(window) ; end |
#mutex ⇒ Object
Return a reference to the application-wide mutex (an FXMutex instance). Normally, the main user interface thread holds this mutex, insuring that no other threads are modifying data during the processing of user interface messages. However, whenever the main user interface thread blocks for messages, it releases this mutex, to allow other threads to modify the same data. When a new message becomes available, the main user interface thread regains the mutex prior to dispatching the message. Other threads should hold this mutex only for short durations, so as to not starve the main user interface thread.
525 |
# File 'rdoc-sources/FXApp.rb', line 525 def mutex(); end |
#openDisplay(dpyname = nil) ⇒ Object
Open connection to display; this is called by #init.
289 |
# File 'rdoc-sources/FXApp.rb', line 289 def openDisplay(dpyname=nil) ; end |
#peekEvent ⇒ Object
Peek to determine if there’s an event.
342 |
# File 'rdoc-sources/FXApp.rb', line 342 def peekEvent(); end |
#readWindow(store, father, owner) ⇒ Object
Read a window and its children from the stream store, and append it under father; note it is initially not created yet. Return a reference to the new window.
Parameters:
store
father
owner
511 |
# File 'rdoc-sources/FXApp.rb', line 511 def readWindow(store, father, owner); end |
#refresh ⇒ Object
Schedule a refresh
413 |
# File 'rdoc-sources/FXApp.rb', line 413 def refresh(); end |
#reg ⇒ Object
Return a reference to the registry (an FXRegistry instance). The registry keeps settings and configuration information for an application, which are automatically loaded when the application starts up, and saved when the application terminates.
428 |
# File 'rdoc-sources/FXApp.rb', line 428 def reg; end |
#registerDragType(name) ⇒ Object
Register a drag type with the given name and return the drag drag type. If this drag type has already been registered, this method will return the previously returned drag type. For example,
yamlDragType = app.registerDragType("application/x-yaml")
See also #getDragTypeName.
448 |
# File 'rdoc-sources/FXApp.rb', line 448 def registerDragType(name) ; end |
#remainingTimeout(*args) ⇒ Object
Return the time remaining (in milliseconds) until the given timer fires. If the timer is past due, zero is returned. If there is no such timer, infinity (UINT_MAX) is returned.
For example:
timeout = app.addTimeout(ms, ...)
time_left = app.remainingTimeout(timeout)
125 126 127 128 129 130 131 132 |
# File 'lib/fox16/timeout.rb', line 125 def remainingTimeout(*args) if args.length == 2 remainingTimeoutOrig(args[0], args[1]) else hsh = args[0] remainingTimeoutOrig(hsh[:target], hsh[:selector]) end end |
#remainingTimeoutOrig ⇒ Object
:nodoc:
8 |
# File 'lib/fox16/timeout.rb', line 8 alias remainingTimeoutOrig remainingTimeout |
#removeChore(*args) ⇒ Object
Remove idle processing message identified by tgt and sel. See the documentation for #hasChore? for an example of how to use the #removeChore method.
72 73 74 75 76 77 78 79 |
# File 'lib/fox16/chore.rb', line 72 def removeChore(*args) if args.length == 2 removeChoreOrig(args[0], args[1]) else params = args[0] removeChoreOrig(params[:target], params[:selector]) end end |
#removeChoreOrig ⇒ Object
:nodoc:
6 |
# File 'lib/fox16/chore.rb', line 6 alias removeChoreOrig removeChore |
#removeInput(fd, mode) ⇒ Object
Remove input message and target object for the specified file descriptor and mode, which is a bitwise OR of (INPUT_READ
, INPUT_WRITE
, INPUT_EXCEPT
).
323 |
# File 'rdoc-sources/FXApp.rb', line 323 def removeInput(fd, mode) ; end |
#removeSignal(sig) ⇒ Object
Remove signal message for signal sig.
317 |
# File 'rdoc-sources/FXApp.rb', line 317 def removeSignal(sig) ; end |
#removeTimeout(*args) ⇒ Object
Remove timeout previously registered using #addTimeout; returns nil
. For an example of how to use #removeTimeout, see the documentation for the #hasTimeout? method.
82 83 84 85 86 87 88 89 |
# File 'lib/fox16/timeout.rb', line 82 def removeTimeout(*args) if args.length == 2 removeTimeoutOrig(args[0], args[1]) else params = args[0] removeTimeoutOrig(params[:target], params[:selector]) end end |
#removeTimeoutOrig ⇒ Object
:nodoc:
6 |
# File 'lib/fox16/timeout.rb', line 6 alias removeTimeoutOrig removeTimeout |
#repaint ⇒ Object
Paint all windows marked for repainting. On return all the applications windows have been painted.
420 |
# File 'rdoc-sources/FXApp.rb', line 420 def repaint(); end |
#run ⇒ Object
349 |
# File 'rdoc-sources/FXApp.rb', line 349 def run(); end |
#runModal ⇒ Object
Run modal event loop, blocking keyboard and mouse events to all windows until #stopModal is called.
374 |
# File 'rdoc-sources/FXApp.rb', line 374 def runModal(); end |
#runModalFor(window) ⇒ Object
Run a modal event loop for the given window, until #stop or #stopModal is called. Except for the modal window and its children, user input to all windows is blocked; if the modal window is nil
all user input is blocked.
379 |
# File 'rdoc-sources/FXApp.rb', line 379 def runModalFor(window); end |
#runModalWhileEvents(window = nil) ⇒ Object
Run event loop while there are events are available in the queue. Returns 1 when all events in the queue have been handled, and 0 when the event loop was terminated due to #stop or #stopModal. Except for the modal window and its children, user input to all windows is blocked; if the modal window is nil
, all user input is blocked.
370 |
# File 'rdoc-sources/FXApp.rb', line 370 def runModalWhileEvents(window=nil); end |
#runModalWhileShown(window) ⇒ Object
Run modal while window is shown, or until #stop or #stopModal is called. Except for the modal window and its children, user input to all windows is blocked; if the modal window is nil
all user input is blocked.
384 |
# File 'rdoc-sources/FXApp.rb', line 384 def runModalWhileShown(window); end |
#runOneEvent(blocking = true) ⇒ Object
Perform one event dispatch; return true
if event was dispatched.
345 |
# File 'rdoc-sources/FXApp.rb', line 345 def runOneEvent(blocking=true); end |
#runOnUiThread(&block) ⇒ Object
Runs the specified block on the UI thread.
The block is posted to the event queue of the UI thread.
545 |
# File 'rdoc-sources/FXApp.rb', line 545 def runOnUiThread(&block); end |
#runPopup(window) ⇒ Object
Run popup menu while shown, until #stop or #stopModal is called. Also returns when entering previous cascading popup menu.
388 |
# File 'rdoc-sources/FXApp.rb', line 388 def runPopup(window); end |
#runUntil(condition) ⇒ Object
Run an event loop till some flag becomes non-zero, and then return.
355 |
# File 'rdoc-sources/FXApp.rb', line 355 def runUntil(condition); end |
#runWhileEvents ⇒ Object
Run event loop while events are available, non-modally. Return when no more events, timers, or chores are outstanding.
361 |
# File 'rdoc-sources/FXApp.rb', line 361 def runWhileEvents(); end |
#setDefaultCursor(which, cursor) ⇒ Object
Replace one of the default application cursors with cursor; e.g
app.setDefaultCursor(DEF_ROTATE_CURSOR, myRotateCursor)
See also #getDefaultCursor.
487 |
# File 'rdoc-sources/FXApp.rb', line 487 def setDefaultCursor(which, cursor); end |
#stop(value = 0) ⇒ Object
Terminate the outermost event loop, and all inner modal loops; All more deeper nested event loops will be terminated with code equal to 0, while the outermost event loop will return code equal to value.
396 |
# File 'rdoc-sources/FXApp.rb', line 396 def stop(value=0); end |
#stopModal(value = 0) ⇒ Object
Break out of the innermost modal loop, returning code equal to value.
402 |
# File 'rdoc-sources/FXApp.rb', line 402 def stopModal(window, value=0); end |
#threadsEnabled? ⇒ Boolean
Check to see if multithreaded applications are supported
540 |
# File 'rdoc-sources/FXApp.rb', line 540 def threadsEnabled?(); end |
#windowCount ⇒ Object
Return the number of existing windows.
531 |
# File 'rdoc-sources/FXApp.rb', line 531 def windowCount; end |
#writeWindow(store, window) ⇒ Object
Write a window and its children, and all resources reachable from this window, into the stream store (an FXStream instance).
Parameters:
store
window
498 |
# File 'rdoc-sources/FXApp.rb', line 498 def writeWindow(store, window); end |