![]() |
Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
![]() |
#include <FXApp.h>
It manages the event queue, timers, signals, chores, and input sources. Each FOX application should have exactly one Application object, which is the ultimate owner of the entire widget tree; when the application object is deleted, all the widgets and other reachable resources of the widget tree are also deleted. When the Application is initialized using init(), it parses the command line arguments meant for it, and opens the display. The run() function is used to run the application; this function does not return until the user is ready to quit the application. During run(), the application processes events from the various windows and dispatches them to the appropriate handlers. Finally, a call to exit() terminates the application. The Application object also manages a registry of configuration data, which is read during init() and written back at the exit(); thus, all configurations changed by the user normally persist to the next invocation of the application. Since different organizations and different applications each need to keep their own set of configuration data, an application name and vendor name can be passed in the Application object's constructor to identify a particular application's configuration data.
See also:
anonymous enum |
Copyright notice of library.
Construct application object; the name and vendor strings are used as keys into the registry database for this application's settings. Only one single application object can be constructed.
virtual FX::FXApp::~FXApp | ( | ) | [virtual] |
Destroy the application and all reachable resources.
const FXString& FX::FXApp::getAppName | ( | ) | const [inline] |
Get application name.
const FXString& FX::FXApp::getVendorName | ( | ) | const [inline] |
Get vendor name.
Connection to display; this is called by init().
FXbool FX::FXApp::closeDisplay | ( | ) |
Close connection to the display.
void* FX::FXApp::getDisplay | ( | ) | const [inline] |
Return pointer.
FXbool FX::FXApp::isInitialized | ( | ) | const [inline] |
Is application initialized.
FXint FX::FXApp::getArgc | ( | ) | const [inline] |
Get argument count.
const FXchar* const* FX::FXApp::getArgv | ( | ) | const [inline] |
Get argument vector.
FXbool FX::FXApp::hasInputMethod | ( | ) | const |
Return true if input method support.
FXVisual* FX::FXApp::getDefaultVisual | ( | ) | const [inline] |
Get default visual.
void FX::FXApp::setDefaultVisual | ( | FXVisual * | vis | ) |
Change default visual.
FXVisual* FX::FXApp::getMonoVisual | ( | ) | const [inline] |
Get monochrome visual.
FXRootWindow* FX::FXApp::getRootWindow | ( | ) | const [inline] |
Get root Window.
void FX::FXApp::setRootWindow | ( | FXRootWindow * | rt | ) |
Set root Window.
FXWindow* FX::FXApp::getFocusWindow | ( | ) | const |
Return window at the end of the focus chain.
FXWindow* FX::FXApp::getCursorWindow | ( | ) | const [inline] |
Get the window under the cursor, if any.
FXWindow* FX::FXApp::getActiveWindow | ( | ) | const [inline] |
Get the active toplevel window, if any.
FXPopup* FX::FXApp::getPopupWindow | ( | ) | const [inline] |
Get current popup window, if any.
FXWindow* FX::FXApp::getSelectionWindow | ( | ) | const [inline] |
Return window currently owning primary selection.
FXWindow* FX::FXApp::getClipboardWindow | ( | ) | const [inline] |
Return window currently owning the clipboard.
FXWindow* FX::FXApp::getDragWindow | ( | ) | const [inline] |
Return drag window if a drag operation is in progress.
Find window from root x,y, starting from given window.
virtual void FX::FXApp::create | ( | ) | [virtual] |
Create application's windows.
virtual void FX::FXApp::destroy | ( | ) | [virtual] |
Destroy application's windows.
virtual void FX::FXApp::detach | ( | ) | [virtual] |
Detach application's windows.
void FX::FXApp::addTimeout | ( | FXObject * | tgt, | |
FXSelector | sel, | |||
FXTime | ns = 1000000000 , |
|||
void * | ptr = NULL | |||
) |
Add timeout message sel to be sent to target object tgt after an interval of ns nanoseconds; 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. Note: the smallest interval that one can wait is actually much larger than a nanosecond; on Unix systems, the smallest interval is about 1000 ns, whereas on Windows, it is about 1000000 ns.
void FX::FXApp::addDeadline | ( | FXObject * | tgt, | |
FXSelector | sel, | |||
FXTime | due = forever , |
|||
void * | ptr = NULL | |||
) |
Add deadline timeout message sel to be sent to target object tgt when the due time, expressed in nanoseconds since Epoch (Jan 1, 1970), is reached.
This is the preferred way to schedule regularly occuring events, as the exact time of issue will not suffer accumulating errors as with the addTimeout() method. However, it is important to ensure that the due time is sufficiently far into the future, as otherwise the system may be swamped executing nothing but timeout messages.
void FX::FXApp::removeTimeout | ( | FXObject * | tgt, | |
FXSelector | sel = 0 | |||
) |
Remove timeout identified by target object tgt and message sel; if sel=0, remove all timeouts which reference object tgt.
FXbool FX::FXApp::hasTimeout | ( | FXObject * | tgt, | |
FXSelector | sel = 0 | |||
) | const |
Return true if a timeout with target object tgt and message sel has been set; if sel=0, return true if any timeout has been set with target object tgt.
FXTime FX::FXApp::remainingTimeout | ( | FXObject * | tgt, | |
FXSelector | sel = 0 | |||
) |
Return the time (in nanoseconds) remaining until the timer identified by target object tgt and message sel will fire.
If the timer is past due, 0 is returned. If there is no such timer, the constant forever (LLONG_MAX) is returned. If sel=0, return the earliest timeout that will be received by target object tgt.
void FX::FXApp::addChore | ( | FXObject * | tgt, | |
FXSelector | sel, | |||
void * | ptr = NULL | |||
) |
Add a chore message sel to be sent to target object tgt 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::FXApp::removeChore | ( | FXObject * | tgt, | |
FXSelector | sel = 0 | |||
) |
Remove chore identified by target object tgt and message sel; if sel=0, remove all idle processing messages which refernce object tgt.
FXbool FX::FXApp::hasChore | ( | FXObject * | tgt, | |
FXSelector | sel = 0 | |||
) | const |
Return true if a chore with target object tgt and message sel has been set; if sel=0, return true if any chore has been set with target object tgt.
void FX::FXApp::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::FXApp::removeSignal | ( | FXint | sig | ) |
Remove signal message for signal sig.
FXbool FX::FXApp::addInput | ( | FXObject * | tgt, | |
FXSelector | sel, | |||
FXInputHandle | fd, | |||
FXuint | mode = INPUT_READ , |
|||
void * | ptr = NULL | |||
) |
Add a file descriptor fd to be watched for activity as determined by mode, where mode is a bitwise OR of (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; the void* ptr is user data which will be passed into the void* ptr of the mesage handler; often you will want to pass the file descriptor fd itself as the value for ptr so that the message handler knows which file descriptor is involved.
FXbool FX::FXApp::removeInput | ( | FXInputHandle | fd, | |
FXuint | mode = INPUT_READ | |||
) |
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).
Omitting the last parameter will delete all the handlers associated with the file descriptor.
FXbool FX::FXApp::peekEvent | ( | ) |
Peek to determine if there's an event.
Perform one event dispatch; return true if event was dispatched.
FXint FX::FXApp::run | ( | ) |
Run an event loop till some flag becomes non-zero, and then return.
Run non-modal event loop while events arrive within blocking nanoseconds.
Returns when no new events arrive in this time, and no timers, or chores are outstanding.
Run modal event loop while events arrive within blocking nanoseconds.
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::FXApp::runModal | ( | ) |
Run modal event loop, blocking keyboard and mouse events to all windows until stopModal is called.
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.
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.
Run popup menu while shown, until stop() or stopModal() is called.
Also returns when entering previous cascading popup menu.
FXWindow* FX::FXApp::getModalWindow | ( | ) | const |
Return window of current modal loop.
FXModality FX::FXApp::getModality | ( | ) | const |
Return mode of current modal loop.
void FX::FXApp::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.
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::FXApp::stopModal | ( | FXint | value = 0 |
) |
Break out of the innermost modal loop, returning code equal to value.
void FX::FXApp::forceRefresh | ( | ) |
Force GUI refresh.
void FX::FXApp::refresh | ( | ) |
Schedule a refresh.
void FX::FXApp::flush | ( | FXbool | sync = false |
) |
Flush pending repaints.
void FX::FXApp::repaint | ( | ) |
Paint all windows marked for repainting.
On return all the applications windows have been painted.
virtual void FX::FXApp::init | ( | int & | argc, | |
char ** | argv, | |||
FXbool | connect = true | |||
) | [virtual] |
Initialize application.
Parses and removes common command line arguments, reads the registry. Finally, if connect is true, it opens the display.
virtual void FX::FXApp::exit | ( | FXint | code = 0 |
) | [virtual] |
Exit application.
Closes the display and writes the registry.
FXRegistry& FX::FXApp::reg | ( | ) | [inline] |
Return a reference to the registry.
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.
FXDragType FX::FXApp::registerDragType | ( | const FXString & | name | ) | const |
Register new DND type.
FXString FX::FXApp::getDragTypeName | ( | FXDragType | type | ) | const |
Get drag type name.
void FX::FXApp::beep | ( | ) |
Beep.
static FXApp* FX::FXApp::instance | ( | ) | [inline, static] |
Return application instance.
void FX::FXApp::setNormalFont | ( | FXFont * | font | ) |
Change default font.
FXFont* FX::FXApp::getNormalFont | ( | ) | const [inline] |
Return default font.
void FX::FXApp::beginWaitCursor | ( | ) |
Begin of wait-cursor block; wait-cursor blocks may be nested.
void FX::FXApp::endWaitCursor | ( | ) |
End of wait-cursor block.
void FX::FXApp::setWaitCursor | ( | FXCursor * | cur | ) |
Change to a new wait cursor.
FXCursor* FX::FXApp::getWaitCursor | ( | ) | const [inline] |
Return current wait cursor.
FXCursor* FX::FXApp::getDefaultCursor | ( | FXDefaultCursor | which | ) | const [inline] |
Obtain a default cursor.
void FX::FXApp::setDefaultCursor | ( | FXDefaultCursor | which, | |
FXCursor * | cur | |||
) |
Change default cursor.
FXMutex& FX::FXApp::mutex | ( | ) | [inline] |
Return a reference to the application-wide mutex.
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.
void FX::FXApp::setTranslator | ( | FXTranslator * | trans | ) |
Change message translator.
The new translator will be owned by FXApp.
FXTranslator* FX::FXApp::getTranslator | ( | ) | const [inline] |
Return message translator.
FXTime FX::FXApp::getTypingSpeed | ( | ) | const [inline] |
Obtain application-wide timing constants, in nanoseconds.
FXTime FX::FXApp::getClickSpeed | ( | ) | const [inline] |
FXTime FX::FXApp::getScrollSpeed | ( | ) | const [inline] |
FXTime FX::FXApp::getScrollDelay | ( | ) | const [inline] |
FXTime FX::FXApp::getBlinkSpeed | ( | ) | const [inline] |
FXTime FX::FXApp::getAnimSpeed | ( | ) | const [inline] |
FXTime FX::FXApp::getMenuPause | ( | ) | const [inline] |
FXTime FX::FXApp::getToolTipPause | ( | ) | const [inline] |
FXTime FX::FXApp::getToolTipTime | ( | ) | const [inline] |
FXTime FX::FXApp::getAutoHideDelay | ( | ) | const [inline] |
void FX::FXApp::setTypingSpeed | ( | FXTime | speed | ) |
Change application-wide timing constants, in nanoseconds.
void FX::FXApp::setClickSpeed | ( | FXTime | speed | ) |
void FX::FXApp::setScrollSpeed | ( | FXTime | speed | ) |
void FX::FXApp::setScrollDelay | ( | FXTime | delay | ) |
void FX::FXApp::setBlinkSpeed | ( | FXTime | speed | ) |
void FX::FXApp::setAnimSpeed | ( | FXTime | speed | ) |
void FX::FXApp::setMenuPause | ( | FXTime | pause | ) |
void FX::FXApp::setToolTipPause | ( | FXTime | pause | ) |
void FX::FXApp::setToolTipTime | ( | FXTime | time | ) |
void FX::FXApp::setAutoHideDelay | ( | FXTime | time | ) |
void FX::FXApp::setDragDelta | ( | FXint | delta | ) |
Access drag hysteresis.
FXint FX::FXApp::getDragDelta | ( | ) | const [inline] |
void FX::FXApp::setWheelLines | ( | FXint | lines | ) |
Access mouse wheel scroll lines.
FXint FX::FXApp::getWheelLines | ( | ) | const [inline] |
void FX::FXApp::setScrollBarSize | ( | FXint | size | ) |
Access scroll bar slot size.
FXint FX::FXApp::getScrollBarSize | ( | ) | const [inline] |
FXColor FX::FXApp::getBorderColor | ( | ) | const [inline] |
Obtain default colors.
FXColor FX::FXApp::getBaseColor | ( | ) | const [inline] |
FXColor FX::FXApp::getHiliteColor | ( | ) | const [inline] |
FXColor FX::FXApp::getShadowColor | ( | ) | const [inline] |
FXColor FX::FXApp::getBackColor | ( | ) | const [inline] |
FXColor FX::FXApp::getForeColor | ( | ) | const [inline] |
FXColor FX::FXApp::getSelforeColor | ( | ) | const [inline] |
FXColor FX::FXApp::getSelbackColor | ( | ) | const [inline] |
FXColor FX::FXApp::getTipforeColor | ( | ) | const [inline] |
FXColor FX::FXApp::getTipbackColor | ( | ) | const [inline] |
FXColor FX::FXApp::getSelMenuTextColor | ( | ) | const [inline] |
FXColor FX::FXApp::getSelMenuBackColor | ( | ) | const [inline] |
void FX::FXApp::setBorderColor | ( | FXColor | color | ) |
Change default colors.
void FX::FXApp::setBaseColor | ( | FXColor | color | ) |
void FX::FXApp::setHiliteColor | ( | FXColor | color | ) |
void FX::FXApp::setShadowColor | ( | FXColor | color | ) |
void FX::FXApp::setBackColor | ( | FXColor | color | ) |
void FX::FXApp::setForeColor | ( | FXColor | color | ) |
void FX::FXApp::setSelforeColor | ( | FXColor | color | ) |
void FX::FXApp::setSelbackColor | ( | FXColor | color | ) |
void FX::FXApp::setTipforeColor | ( | FXColor | color | ) |
void FX::FXApp::setTipbackColor | ( | FXColor | color | ) |
void FX::FXApp::setSelMenuTextColor | ( | FXColor | color | ) |
void FX::FXApp::setSelMenuBackColor | ( | FXColor | color | ) |
FXuint FX::FXApp::getWindowCount | ( | ) | const [inline] |
Get number of existing windows.
virtual void FX::FXApp::save | ( | FXStream & | store | ) | const [virtual] |
virtual void FX::FXApp::load | ( | FXStream & | store | ) | [virtual] |
void FX::FXApp::dumpWidgets | ( | ) | const |
Dump widget information.
friend class FXId [friend] |
friend class FXBitmap [friend] |
friend class FXImage [friend] |
friend class FXIcon [friend] |
friend class FXCursor [friend] |
friend class FXDrawable [friend] |
friend class FXWindow [friend] |
friend class FXShell [friend] |
friend class FXRootWindow [friend] |
friend class FXTopWindow [friend] |
friend class FXMainWindow [friend] |
friend class FXPopup [friend] |
friend class FXFont [friend] |
friend class FXVisual [friend] |
friend class FXGLVisual [friend] |
friend class FXGLContext [friend] |
friend class FXDC [friend] |
friend class FXDCWindow [friend] |
friend class FXDragCorner [friend] |
friend class FXDockHandler [friend] |
friend class FXComposeContext [friend] |
const FXuchar FX::FXApp::copyright[] [static] |
Information.
![]() |