FX::FXEventLoop Class Reference

#include <FXApp.h>

Inheritance diagram for FX::FXEventLoop:

Inheritance graph
[legend]

List of all members.


Detailed Description

FOX event dispatch loop.

Public Types

enum  { ID_ASYNCRECALC, ID_LAST }

Public Member Functions

FXAppgetApp () const
FXRootWindowgetRootWindow () const
void setRootWindow (FXRootWindow *rt)
FXWindowgetFocusWindow () const
FXWindowgetCursorWindow () const
FXWindowgetActiveWindow () const
FXPopupgetPopupWindow () const
FXWindowfindWindowWithId (FXID xid) const
FXWindowfindWindowAt (FXint rx, FXint ry, FXID window=0) const
void addTimeout (FXObject *tgt, FXSelector sel, FXuint ms=1000, void *ptr=NULL)
void removeTimeout (FXObject *tgt, FXSelector sel)
bool hasTimeout (FXObject *tgt, FXSelector sel) const
FXuint remainingTimeout (FXObject *tgt, FXSelector sel)
void handleTimeouts ()
void addChore (FXObject *tgt, FXSelector sel, void *ptr=NULL)
void removeChore (FXObject *tgt, FXSelector sel)
bool hasChore (FXObject *tgt, FXSelector sel) const
void addSignal (FXint sig, FXObject *tgt, FXSelector sel, FXbool immediate=FALSE, FXuint flags=0)
void removeSignal (FXint sig)
bool addInput (FXInputHandle fd, FXuint mode, FXObject *tgt, FXSelector sel)
bool removeInput (FXInputHandle fd, FXuint mode)
bool getKeyState (FXuint keysym) const
bool peekEvent ()
bool runOneEvent (bool blocking=true)
FXint run ()
FXint runUntil (FXuint &condition)
FXint runWhileEvents ()
FXint runModalWhileEvents (FXWindow *window=NULL)
FXint runModal ()
FXint runModalFor (FXWindow *window)
FXint runModalWhileShown (FXWindow *window)
FXint runPopup (FXWindow *window)
bool isModal (FXWindow *window) const
FXWindowgetModalWindow () const
FXModality getModality () const
void stop (FXint value=0)
void stopModal (FXWindow *window, FXint value=0)
void stopModal (FXint value=0)
void forceRefresh ()
void refresh ()
void flush (bool sync=false)
void repaint ()
FXWindowgetDragWindow () const
long onCmdAsyncRecalc (FXObject *, FXSelector, void *)
void postAsyncMessage (FXObject *tgt, FXuint message, void *ptr=NULL, FXObject *src=NULL)
virtual FXulong getThreadId () const
virtual void lock ()
virtual void unlock ()
virtual long onDefault (FXObject *, FXSelector, void *)
const FXchar * getClassName () const
bool isMemberOf (const FXMetaClass *metaclass) const
virtual long tryHandle (FXObject *sender, FXSelector sel, void *ptr)
virtual void save (FXStream &store) const
virtual void load (FXStream &store)
QTransString tr (const char *text, const char *hint=0)
virtual void * getPythonObject () const
virtual void decouplePythonObject () const

Static Public Member Functions

static void postAsyncMessage (FXId *tgt, FXuint message, void *ptr=NULL, FXObject *src=NULL)
static void requestAsyncRecalc (FXWindow *what)

Protected Member Functions

 FXEventLoop (const FXEventLoop &)
FXEventLoopoperator= (const FXEventLoop &)
void setup ()
void leaveWindow (FXWindow *window, FXWindow *ancestor)
void enterWindow (FXWindow *window, FXWindow *ancestor)
void selectionSetData (const FXWindow *window, FXDragType type, FXuchar *data, FXuint size)
void selectionGetData (const FXWindow *window, FXDragType type, FXuchar *&data, FXuint &size)
void selectionGetTypes (const FXWindow *window, FXDragType *&types, FXuint &numtypes)
void clipboardSetData (const FXWindow *window, FXDragType type, FXuchar *data, FXuint size)
void clipboardGetData (const FXWindow *window, FXDragType type, FXuchar *&data, FXuint &size)
void clipboardGetTypes (const FXWindow *window, FXDragType *&types, FXuint &numtypes)
void dragdropSetData (const FXWindow *window, FXDragType type, FXuchar *data, FXuint size)
void dragdropGetData (const FXWindow *window, FXDragType type, FXuchar *&data, FXuint &size)
void dragdropGetTypes (const FXWindow *window, FXDragType *&types, FXuint &numtypes)
void addRepaint (FXID win, FXint x, FXint y, FXint w, FXint h, FXbool synth=0)
void removeRepaints (FXID win, FXint x, FXint y, FXint w, FXint h)
void scrollRepaints (FXID win, FXint dx, FXint dy)
 FXEventLoop (FXApp *app=NULL)
virtual bool getNextEvent (FXRawEvent &ev, bool blocking=true)
virtual bool dispatchEvent (FXRawEvent &ev)
virtual void latchLoop ()
virtual void resetLoopLatch ()
virtual bool getNextEventI (FXRawEvent &ev, bool blocking)
virtual bool peekEventI ()
virtual void * makeStaticPtr (void *val)
virtual void deleteStaticPtr (void *ref)
virtual void * getStaticPtr (const void *ref) const
virtual void setStaticPtr (void *ref, void *val)

Static Protected Member Functions

static void signalhandler (int sig)
static void immediatesignalhandler (int sig)

Protected Attributes

FXAppapp
FXHash hash
FXWindowactiveWindow
FXWindowcursorWindow
FXWindowmouseGrabWindow
FXWindowkeyboardGrabWindow
FXWindowkeyWindow
FXWindowselectionWindow
FXWindowclipboardWindow
FXWindowdropWindow
FXWindowdragWindow
FXWindowrefresher
FXWindowrefresherstop
FXPopuppopupWindow
FXRootWindowroot
FXTimer * timers
FXChore * chores
FXRepaint * repaints
FXTimer * timerrecs
FXChore * chorerecs
FXRepaint * repaintrecs
FXInvocation * invocation
FXSignal * signals
FXint nsignals
FXEvent event
FXInput * inputs
FXint ninputs
FXint maxinput
FXAsyncMsg * asyncmsgs
FXAsyncMsg * asyncmsgsrecs
bool & initialized
void *& display
void *& xim
void * r_fds
void * w_fds
void * e_fds
int latch [2]

Friends

class FXApp
class FXPopup
class FXWindow
class FXDockHandler
class FXEventLoop_Static

Constructor & Destructor Documentation

FX::FXEventLoop::FXEventLoop ( FXApp app = NULL  )  [protected]

Constructs an event loop.


Member Function Documentation

virtual bool FX::FXEventLoop::getNextEvent ( FXRawEvent &  ev,
bool  blocking = true 
) [protected, virtual]

Return TRUE when new raw event is available.

virtual bool FX::FXEventLoop::dispatchEvent ( FXRawEvent &  ev  )  [protected, virtual]

Dispatch raw event.

virtual void FX::FXEventLoop::latchLoop (  )  [protected, virtual]

Latches the loop (stops any wait and restarts it).

virtual void FX::FXEventLoop::resetLoopLatch (  )  [protected, virtual]

Resets the loop latch.

virtual bool FX::FXEventLoop::getNextEventI ( FXRawEvent &  ev,
bool  blocking 
) [protected, virtual]

Implementation of fetching an event.

virtual bool FX::FXEventLoop::peekEventI (  )  [protected, virtual]

Implementation of peeking for an event.

virtual void* FX::FXEventLoop::makeStaticPtr ( void *  val  )  [protected, virtual]

Allocates a per-thread static instance.

virtual void FX::FXEventLoop::deleteStaticPtr ( void *  ref  )  [protected, virtual]

Deallocates a per-thread static instance.

virtual void* FX::FXEventLoop::getStaticPtr ( const void *  ref  )  const [protected, virtual]

Retrieves the value stored in the per-thread static instance.

virtual void FX::FXEventLoop::setStaticPtr ( void *  ref,
void *  val 
) [protected, virtual]

Sets the value stored in the per-thread static instance.

FXApp* FX::FXEventLoop::getApp (  )  const [inline]

Get application.

FXRootWindow* FX::FXEventLoop::getRootWindow (  )  const [inline]

Get root Window.

void FX::FXEventLoop::setRootWindow ( FXRootWindow rt  ) 

Set root Window.

FXWindow* FX::FXEventLoop::getFocusWindow (  )  const

Return window at the end of the focus chain.

FXWindow* FX::FXEventLoop::getCursorWindow (  )  const [inline]

Get the window under the cursor, if any.

FXWindow* FX::FXEventLoop::getActiveWindow (  )  const [inline]

Get the active toplevel window, if any.

FXPopup* FX::FXEventLoop::getPopupWindow (  )  const [inline]

Get current popup window, if any.

FXWindow* FX::FXEventLoop::findWindowWithId ( FXID  xid  )  const

Find window from id.

FXWindow* FX::FXEventLoop::findWindowAt ( FXint  rx,
FXint  ry,
FXID  window = 0 
) const

Find window from root x,y, starting from given window.

void FX::FXEventLoop::addTimeout ( FXObject tgt,
FXSelector  sel,
FXuint  ms = 1000,
void *  ptr = NULL 
)

Add timeout message to be sent to target object in ms milliseconds; the timer fires only once after the interval expires. The void* ptr is user data which will be passed into the void* ptr of the message handler. If a timer with the same target and message already exists, it will be rescheduled.

void FX::FXEventLoop::removeTimeout ( FXObject tgt,
FXSelector  sel 
)

Remove timeout identified by tgt and sel.

bool FX::FXEventLoop::hasTimeout ( FXObject tgt,
FXSelector  sel 
) const

Return TRUE if given timeout has been set

FXuint FX::FXEventLoop::remainingTimeout ( FXObject tgt,
FXSelector  sel 
)

Return, in ms, the time remaining until the given timer fires. If the timer is past due, 0 is returned. If there is no such timer, infinity (UINT_MAX) is returned.

void FX::FXEventLoop::handleTimeouts (  ) 

Process any timouts due at this time.

void FX::FXEventLoop::addChore ( FXObject tgt,
FXSelector  sel,
void *  ptr = NULL 
)

Add a idle processing message to be sent to target object when the system becomes idle, i.e. there are no events to be processed. The void* ptr is user data which will be passed into the void* ptr of the message handler. If a chore with the same target and message already exists, it will be rescheduled.

void FX::FXEventLoop::removeChore ( FXObject tgt,
FXSelector  sel 
)

Remove idle processing message identified by tgt and sel.

bool FX::FXEventLoop::hasChore ( FXObject tgt,
FXSelector  sel 
) const

Return TRUE if given chore has been set

void FX::FXEventLoop::addSignal ( FXint  sig,
FXObject tgt,
FXSelector  sel,
FXbool  immediate = FALSE,
FXuint  flags = 0 
)

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.

void FX::FXEventLoop::removeSignal ( FXint  sig  ) 

Remove signal message for signal sig.

bool FX::FXEventLoop::addInput ( FXInputHandle  fd,
FXuint  mode,
FXObject tgt,
FXSelector  sel 
)

Add a file descriptor fd 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.

bool FX::FXEventLoop::removeInput ( FXInputHandle  fd,
FXuint  mode 
)

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).

bool FX::FXEventLoop::getKeyState ( FXuint  keysym  )  const

Return key state of given key.

bool FX::FXEventLoop::peekEvent (  ) 

Peek to determine if there's an event.

bool FX::FXEventLoop::runOneEvent ( bool  blocking = true  ) 

Perform one event dispatch; return true if event was dispatched.

FXint FX::FXEventLoop::run (  ) 

Run the main application event loop until stop() is called, and return the exit code passed as argument to stop().

FXint FX::FXEventLoop::runUntil ( FXuint &  condition  ) 

Run an event loop till some flag becomes non-zero, and then return.

FXint FX::FXEventLoop::runWhileEvents (  ) 

Run event loop while events are available, non-modally. Return when no more events, timers, or chores are outstanding.

FXint FX::FXEventLoop::runModalWhileEvents ( FXWindow window = NULL  ) 

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 NULL, all user input is blocked.

FXint FX::FXEventLoop::runModal (  ) 

Run modal event loop, blocking keyboard and mouse events to all windows until stopModal is called.

FXint FX::FXEventLoop::runModalFor ( FXWindow window  ) 

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 NULL all user input is blocked.

FXint FX::FXEventLoop::runModalWhileShown ( FXWindow window  ) 

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 NULL all user input is blocked.

FXint FX::FXEventLoop::runPopup ( FXWindow window  ) 

Run popup menu while shown, until stop() or stopModal() is called. Also returns when entering previous cascading popup menu.

bool FX::FXEventLoop::isModal ( FXWindow window  )  const

True if the window is modal.

FXWindow* FX::FXEventLoop::getModalWindow (  )  const

Return window of current modal loop.

FXModality FX::FXEventLoop::getModality (  )  const

Return mode of current modal loop.

void FX::FXEventLoop::stop ( FXint  value = 0  ) 

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.

void FX::FXEventLoop::stopModal ( FXWindow window,
FXint  value = 0 
)

Break out of the matching modal loop, returning code equal to value. All deeper nested event loops are terminated with code equal to 0.

void FX::FXEventLoop::stopModal ( FXint  value = 0  ) 

Break out of the innermost modal loop, returning code equal to value.

void FX::FXEventLoop::forceRefresh (  ) 

Force GUI refresh.

void FX::FXEventLoop::refresh (  ) 

Schedule a refresh.

void FX::FXEventLoop::flush ( bool  sync = false  ) 

Flush pending repaints.

void FX::FXEventLoop::repaint (  ) 

Paint all windows marked for repainting. On return all the applications windows have been painted.

FXWindow* FX::FXEventLoop::getDragWindow (  )  const [inline]

Return drag window if a drag operation is in progress.

void FX::FXEventLoop::postAsyncMessage ( FXObject tgt,
FXuint  message,
void *  ptr = NULL,
FXObject src = NULL 
)

Posts a message asynchronously.

static void FX::FXEventLoop::postAsyncMessage ( FXId tgt,
FXuint  message,
void *  ptr = NULL,
FXObject src = NULL 
) [static]

Posts a message asynchronously.

virtual FXulong FX::FXEventLoop::getThreadId (  )  const [inline, virtual]

Returns the id of the thread this event loop runs in (only valid in subclasses).

static void FX::FXEventLoop::requestAsyncRecalc ( FXWindow what  )  [static]

Requests that a recalc() be issued for the sender before the next event fetch

Warning:
You should avoid this call except where absolutely necessary

virtual void FX::FXLockable::unlock (  )  [inline, virtual, inherited]

Locks the object for exclusive access.

Reimplemented in FX::TnFXApp.

virtual long FX::FXObject::onDefault ( FXObject ,
FXSelector  ,
void *   
) [virtual, inherited]

Called for unhandled messages.

Reimplemented in FX::FXDelegator, FX::FXGLViewer, FX::FXMDIChild, and FX::FXMDIClient.

const FXchar* FX::FXObject::getClassName (  )  const [inherited]

Get class name of some object.

bool FX::FXObject::isMemberOf ( const FXMetaClass metaclass  )  const [inherited]

Check if object is member of metaclass.

virtual long FX::FXObject::tryHandle ( FXObject sender,
FXSelector  sel,
void *  ptr 
) [virtual, inherited]

Try handle message safely.

virtual void FX::FXObject::save ( FXStream store  )  const [virtual, inherited]

Save object to stream.

Reimplemented in FX::FX4Splitter, FX::FX7Segment, FX::FXAccelTable, FX::FXApp, FX::FXArrowButton, FX::FXBitmap, FX::FXBitmapFrame, FX::FXBitmapView, FX::FXCheckButton, FX::FXChoiceBox, FX::FXColorBar, FX::FXColorDialog, FX::FXColorRing, FX::FXColorSelector, FX::FXColorWell, FX::FXColorWheel, FX::FXComboBox, FX::FXCursor, FX::FXDial, FX::FXDirBox, FX::FXDirDialog, FX::FXDirList, FX::FXDirSelector, FX::FXDockBar, FX::FXDockHandler, FX::FXDockTitle, FX::FXDocument, FX::FXDragCorner, FX::FXDrawable, FX::FXDriveBox, FX::FXFileDialog, FX::FXFileDict, FX::FXFileList, FX::FXFileSelector, FX::FXFoldingItem, FX::FXFoldingList, FX::FXFont, FX::FXFontDialog, FX::FXFontSelector, FX::FXFrame, FX::FXGLCanvas, FX::FXGLCone, FX::FXGLContext, FX::FXGLCube, FX::FXGLCylinder, FX::FXGLGroup, FX::FXGLShape, FX::FXGLSphere, FX::FXGLTriangleMesh, FX::FXGLVertices, FX::FXGLViewer, FX::FXGLVisual, FX::FXGradientBar, FX::FXGroupBox, FX::FXHeaderItem, FX::FXHeader, FX::FXIconDict, FX::FXIconItem, FX::FXIconList, FX::FXIconSource, FX::FXId, FX::FXImage, FX::FXImageFrame, FX::FXImageView, FX::FXKnob, FX::FXLabel, FX::FXListItem, FX::FXList, FX::FXListBox, FX::FXMDIChild, FX::FXMDIClient, FX::FXMenuButton, FX::FXMenuCaption, FX::FXMenuCascade, FX::FXMenuCheck, FX::FXMenuCommand, FX::FXMenuRadio, FX::FXMenuSeparator, FX::FXMenuTitle, FX::FXOptionMenu, FX::FXPacker, FX::FXPrimaryButton, FX::FXPrintDialog, FX::FXProgressBar, FX::FXRadioButton, FX::FXRealSlider, FX::FXRealSpinner, FX::FXRecentFiles, FX::FXReplaceDialog, FX::FXRuler, FX::FXRulerView, FX::FXScrollBar, FX::FXSlider, FX::FXSpinner, FX::FXSplashWindow, FX::FXSplitter, FX::FXSpring, FX::FXStatusBar, FX::FXStatusLine, FX::FXSwitcher, FX::FXTabBar, FX::FXTableItem, FX::FXTable, FX::FXText, FX::FXTextField, FX::FXToggleButton, FX::FXToolBarGrip, FX::FXToolBarShell, FX::FXToolBarTab, FX::FXToolTip, FX::FXTopWindow, FX::FXTreeItem, FX::FXTreeList, FX::FXTreeListBox, FX::FXTriStateButton, FX::FXVisual, FX::FXWindow, and FX::FXWizard.

virtual void FX::FXObject::load ( FXStream store  )  [virtual, inherited]

Load object from stream.

Reimplemented in FX::FX4Splitter, FX::FX7Segment, FX::FXAccelTable, FX::FXApp, FX::FXArrowButton, FX::FXBitmap, FX::FXBitmapFrame, FX::FXBitmapView, FX::FXCheckButton, FX::FXChoiceBox, FX::FXColorBar, FX::FXColorDialog, FX::FXColorRing, FX::FXColorSelector, FX::FXColorWell, FX::FXColorWheel, FX::FXComboBox, FX::FXCursor, FX::FXDial, FX::FXDirBox, FX::FXDirDialog, FX::FXDirList, FX::FXDirSelector, FX::FXDockBar, FX::FXDockHandler, FX::FXDockTitle, FX::FXDocument, FX::FXDragCorner, FX::FXDrawable, FX::FXDriveBox, FX::FXFileDialog, FX::FXFileDict, FX::FXFileList, FX::FXFileSelector, FX::FXFoldingItem, FX::FXFoldingList, FX::FXFont, FX::FXFontDialog, FX::FXFontSelector, FX::FXFrame, FX::FXGLCanvas, FX::FXGLCone, FX::FXGLContext, FX::FXGLCube, FX::FXGLCylinder, FX::FXGLGroup, FX::FXGLShape, FX::FXGLSphere, FX::FXGLTriangleMesh, FX::FXGLVertices, FX::FXGLViewer, FX::FXGLVisual, FX::FXGradientBar, FX::FXGroupBox, FX::FXHeaderItem, FX::FXHeader, FX::FXIconDict, FX::FXIconItem, FX::FXIconList, FX::FXIconSource, FX::FXId, FX::FXImage, FX::FXImageFrame, FX::FXImageView, FX::FXKnob, FX::FXLabel, FX::FXListItem, FX::FXList, FX::FXListBox, FX::FXMDIChild, FX::FXMDIClient, FX::FXMenuButton, FX::FXMenuCaption, FX::FXMenuCascade, FX::FXMenuCheck, FX::FXMenuCommand, FX::FXMenuRadio, FX::FXMenuSeparator, FX::FXMenuTitle, FX::FXOptionMenu, FX::FXPacker, FX::FXPrimaryButton, FX::FXPrintDialog, FX::FXProgressBar, FX::FXRadioButton, FX::FXRealSlider, FX::FXRealSpinner, FX::FXRecentFiles, FX::FXReplaceDialog, FX::FXRuler, FX::FXRulerView, FX::FXScrollBar, FX::FXSlider, FX::FXSpinner, FX::FXSplashWindow, FX::FXSplitter, FX::FXSpring, FX::FXStatusBar, FX::FXStatusLine, FX::FXSwitcher, FX::FXTabBar, FX::FXTableItem, FX::FXTable, FX::FXText, FX::FXTextField, FX::FXToggleButton, FX::FXToolBarGrip, FX::FXToolBarShell, FX::FXToolBarTab, FX::FXToolTip, FX::FXTopWindow, FX::FXTreeItem, FX::FXTreeList, FX::FXTreeListBox, FX::FXTriStateButton, FX::FXVisual, FX::FXWindow, and FX::FXWizard.

QTransString FX::FXObject::tr ( const char *  text,
const char *  hint = 0 
) [inherited]

Returns a human translated version of the text to the locale language (warning: uses a virtual method call, so can't use before construction)

virtual void* FX::FXObject::getPythonObject (  )  const [inline, virtual, inherited]

Returns the python object representing this instance (if created in python).

virtual void FX::FXObject::decouplePythonObject (  )  const [inline, virtual, inherited]

Causes decoupling of python object from this object (deletes self).


The documentation for this class was generated from the following file:

(C) 2002-2008 Niall Douglas. Some parts (C) to assorted authors.
Generated on Fri Jun 13 21:56:49 2008 for TnFOX by doxygen v1.5.6