libyui
2.42.5
|
Public Member Functions | |
virtual const char * | widgetClass () const |
void | open () |
bool | isOpen () const |
YEvent * | waitForEvent (int timeout_millisec=0) |
YEvent * | pollEvent () |
bool | isTopmostDialog () const |
bool | destroy (bool doThrow=true) |
void | setInitialSize () |
void | recalcLayout () |
YDialogType | dialogType () const |
bool | isMainDialog () |
YDialogColorMode | colorMode () const |
void | checkShortcuts (bool force=false) |
void | postponeShortcutCheck () |
bool | shortcutCheckPostponed () const |
YPushButton * | defaultButton () const |
void | deleteEvent (YEvent *event) |
void | addEventFilter (YEventFilter *eventFilter) |
void | removeEventFilter (YEventFilter *eventFilter) |
virtual void | highlight (YWidget *child) |
virtual void | setDefaultButton (YPushButton *defaultButton) |
virtual void | activate ()=0 |
![]() | |
virtual | ~YSingleChildContainerWidget () |
virtual int | preferredWidth () |
virtual int | preferredHeight () |
virtual void | setSize (int newWidth, int newHeight) |
virtual bool | stretchable (YUIDimension dim) const |
![]() | |
virtual | ~YWidget () |
virtual std::string | debugLabel () const |
std::string | helpText () const |
void | setHelpText (const std::string &helpText) |
virtual const YPropertySet & | propertySet () |
virtual bool | setProperty (const std::string &propertyName, const YPropertyValue &val) |
virtual YPropertyValue | getProperty (const std::string &propertyName) |
bool | hasChildren () const |
YWidget * | firstChild () const |
YWidget * | lastChild () const |
YWidgetListConstIterator | childrenBegin () const |
YWidgetListConstIterator | childrenEnd () const |
int | childrenCount () const |
bool | contains (YWidget *child) const |
virtual void | addChild (YWidget *child) |
virtual void | removeChild (YWidget *child) |
void | deleteChildren () |
YWidget * | parent () const |
bool | hasParent () const |
void | setParent (YWidget *newParent) |
YDialog * | findDialog () |
YWidget * | findWidget (YWidgetID *id, bool doThrow=true) const |
virtual int | preferredSize (YUIDimension dim) |
bool | isValid () const |
bool | beingDestroyed () const |
void * | widgetRep () const |
void | setWidgetRep (void *toolkitWidgetRep) |
bool | hasId () const |
YWidgetID * | id () const |
void | setId (YWidgetID *newId_disown) |
virtual void | setEnabled (bool enabled=true) |
void | setDisabled () |
virtual bool | isEnabled () const |
void | setStretchable (YUIDimension dim, bool newStretch) |
void | setDefaultStretchable (YUIDimension dim, bool newStretch) |
virtual int | weight (YUIDimension dim) |
bool | hasWeight (YUIDimension dim) |
void | setWeight (YUIDimension dim, int weight) |
void | setNotify (bool notify=true) |
bool | notify () const |
void | setNotifyContextMenu (bool notifyContextMenu=true) |
bool | notifyContextMenu () const |
bool | sendKeyEvents () const |
void | setSendKeyEvents (bool doSend) |
bool | autoShortcut () const |
void | setAutoShortcut (bool _newAutoShortcut) |
int | functionKey () const |
bool | hasFunctionKey () const |
virtual void | setFunctionKey (int fkey_no) |
virtual bool | setKeyboardFocus () |
virtual std::string | shortcutString () const |
virtual void | setShortcutString (const std::string &str) |
virtual const char * | userInputProperty () |
void | dumpWidgetTree (int indentationLevel=0) |
void | dumpDialogWidgetTree () |
void | setChildrenEnabled (bool enabled) |
virtual void | saveUserInput (YMacroRecorder *macroRecorder) |
void * | operator new (size_t size) |
virtual void | startMultipleChanges () |
virtual void | doneMultipleChanges () |
Static Public Member Functions | |
static bool | deleteTopmostDialog (bool doThrow=true) |
static void | deleteAllDialogs () |
static void | deleteTo (YDialog *dialog) |
static int | openDialogsCount () |
static YDialog * | currentDialog (bool doThrow=true) |
static YDialog * | topmostDialog (bool doThrow=true) |
static void | showText (const std::string &text, bool richText=false) |
static bool | showHelpText (YWidget *widget) |
Protected Member Functions | |
YDialog (YDialogType dialogType, YDialogColorMode colorMode=YDialogNormalColor) | |
virtual | ~YDialog () |
virtual void | openInternal ()=0 |
virtual YEvent * | waitForEventInternal (int timeout_millisec)=0 |
virtual YEvent * | pollEventInternal ()=0 |
YEvent * | filterInvalidEvents (YEvent *event) |
YEvent * | callEventFilters (YEvent *event) |
void | deleteEventFilters () |
![]() | |
YSingleChildContainerWidget (YWidget *parent) | |
![]() | |
YWidget (YWidget *parent) | |
YWidgetChildrenManager * | childrenManager () const |
void | setChildrenManager (YWidgetChildrenManager *manager) |
void | setBeingDestroyed () |
void | dumpWidget (YWidget *w, int indentationLevel) |
Static Protected Attributes | |
static std::stack< YDialog * > | _dialogStack |
|
protected |
Constructor.
'dialogType' is one of YMainDialog or YPopupDialog.
'colorMode' can be set to YDialogWarnColor to use very bright "warning" colors or YDialogInfoColor to use more prominent, yet not quite as bright as "warning" colors. Use both only very rarely.
Definition at line 111 of file YDialog.cc.
|
protectedvirtual |
Destructor. Don't delete a dialog directly, use YDialog::deleteTopmostDialog() or YDialog::destroy().
Definition at line 127 of file YDialog.cc.
|
pure virtual |
Activate this dialog: Make sure that it is shown as the topmost dialog of this application and that it can receive input.
Derived classes are required to implement this.
void YDialog::addEventFilter | ( | YEventFilter * | eventFilter | ) |
Add an event filter. This can be useful to catch certain types of events before they are delivered to the application. All event filters are called (in unspecified order) in waitForEvent(). Each one may consume an event, pass it through unchanged, or replace it with a newly created event.
Normally, an YEventFilter should be created on the heap with 'new'. In that case, the dialog's destructor will take care of deleting it.
In rare cases it might make sense to create an YEventFilter on the stack (as a local variable) and rely on that variable to go out of scope and be destroyed before the dialog gets destroyed. But that may be risky.
Notice that applications never need to call this function: YEventFilter does it automatically in its constructor.
Definition at line 560 of file YDialog.cc.
Call the installed event filters.
Definition at line 594 of file YDialog.cc.
void YDialog::checkShortcuts | ( | bool | force = false | ) |
Checks the keyboard shortcuts of widgets in this dialog unless shortcut checks are postponed or 'force' is 'true'.
A forced shortcut check resets postponed checking.
Definition at line 279 of file YDialog.cc.
YDialogColorMode YDialog::colorMode | ( | ) | const |
Return this dialog's color mode.
Definition at line 258 of file YDialog.cc.
|
static |
Return the current (topmost) dialog.
If there is none, throw a YUINoDialogException if 'doThrow' is 'true' and return 0 if 'doThrow' is false.
Definition at line 491 of file YDialog.cc.
YPushButton * YDialog::defaultButton | ( | ) | const |
Return this dialog's default button: The button that is activated when the user hits [Return] anywhere in this dialog. Note that this is not the same as the button that currently has the keyboard focus.
This might return 0 if there is no default button.
Definition at line 297 of file YDialog.cc.
|
static |
Delete all open dialogs.
Definition at line 522 of file YDialog.cc.
void YDialog::deleteEvent | ( | YEvent * | event | ) |
Delete an event.
Definition at line 468 of file YDialog.cc.
|
protected |
Delete all (remaining) event filters.
Definition at line 197 of file YDialog.cc.
|
static |
Delete all dialogs from the topmost to the one specified.
Definition at line 532 of file YDialog.cc.
|
static |
Delete the topmost dialog.
Will throw a YUINoDialogException if there is no dialog and 'doThrow' is 'true'.
This is equivalent to YDialog::currentDialog()->destroy().
Returns 'true' if there is another open dialog after deleting, 'false' if there is none.
Definition at line 505 of file YDialog.cc.
bool YDialog::destroy | ( | bool | doThrow = true | ) |
Close and delete this dialog (and all its children) if it is the topmost dialog. If this is not the topmost dialog, this will throw an exception if 'doThrow' is true (default).
Remember that all pointers to the dialog and its children will be invalid after this operation.
This is intentionally not named close() since close() would not imply that the dialog and its children are deleted.
Returns 'true' upon success, 'false' upon failure.
Definition at line 212 of file YDialog.cc.
YDialogType YDialog::dialogType | ( | ) | const |
Return this dialog's type (YMainDialog / YPopupDialog /YWizardDialog).
Definition at line 233 of file YDialog.cc.
Filter out invalid events: Return 0 if the event does not belong to this dialog or the unchanged event if it does.
Silently discard events from widgets that have become invalid.
This may legitimately happen if some widget triggered an event yet nobody cared for that event (i.e. called UserInput() or PollInput() ) and the widget has been destroyed meanwhile.
Silently discard events from all but the current (topmost) dialog.
This may happen even here even though the specific UI should have taken care about that: Events may still be in the queue. They might have been valid (i.e. belonged to the topmost dialog) when they arrived, but maybe simply nobody has evaluated them.
Definition at line 404 of file YDialog.cc.
|
inlinevirtual |
Highlight a child widget of this dialog. This is meant for debugging: YDialogSpy and similar uses.
No more than one widget can be highlighted at any one time in the same dialog. Highlighting another widget un-highlights a previously highlighted widget. 0 means 'unhighlight the last highlighted widget, but don't highlight any other'.
This default implementation does nothing.
bool YDialog::isMainDialog | ( | ) |
Return 'true' if this dialog is a dialog of main dialog size: YMainDialog or YWizardDialog.
Definition at line 240 of file YDialog.cc.
bool YDialog::isOpen | ( | ) | const |
Return 'true' if open() has already been called for this dialog.
Definition at line 177 of file YDialog.cc.
bool YDialog::isTopmostDialog | ( | ) | const |
Return 'true' if this dialog is the topmost dialog.
Definition at line 184 of file YDialog.cc.
void YDialog::open | ( | ) |
Open a newly created dialog: Finalize it and make it visible on the screen.
Applications should call this once after all children are created. If the application doesn't do this, it will be done automatically upon the next call of YDialog::waitForEvent() (or related). This is OK if YDialog::waitForEvent() is called immediately after creating the dialog anyway. If it is not, the application might appear sluggish to the user.
Derived classes are free to reimplement this, but they should call this base class method in the new implementation.
Definition at line 163 of file YDialog.cc.
|
static |
Returns the number of currently open dialogs (from 1 on), i.e., the depth of the dialog stack.
Definition at line 553 of file YDialog.cc.
|
protectedpure virtual |
YEvent * YDialog::pollEvent | ( | ) |
Check if a user event is pending. If there is one, return it. If there is none, do not wait for one - return 0.
If open() has not been called for this dialog until now, it is called now.
The dialog retains ownership of the event and will delete it upon the next call to waitForEvent() or pollEvent() or when the dialog is deleted. This also means that the return value of this function can safely be ignored without fear of memory leaks.
If this dialog is not the topmost dialog, an exception is thrown.
Definition at line 379 of file YDialog.cc.
|
protectedpure virtual |
Check if a user event is pending. If there is one, return it. If there is none, do not wait for one - return 0.
Derived classes are required to implement this.
void YDialog::postponeShortcutCheck | ( | ) |
From now on, postpone keyboard shortcut checks - i.e. normal (not forced) checkKeyboardShortcuts() will do nothing. Reset this mode by forcing a shortcut check with checkKeyboardShortcuts( true ).
Definition at line 265 of file YDialog.cc.
void YDialog::recalcLayout | ( | ) |
Recalculate the layout of the dialog and of all its children after children have been added or removed or if any of them changed its preferred width of height.
This is a very expensive operation. Call it only when really necessary. YDialog::open() includes a call to YDialog::setInitialSize() which does the same.
The basic idea behind this function is to call it when the dialog changed after it (and its children hierarchy) was initially created.
Definition at line 330 of file YDialog.cc.
void YDialog::removeEventFilter | ( | YEventFilter * | eventFilter | ) |
Remove an event filter.
Notice that applications never need to call this function: YEventFilter does it automatically in its destructor.
Definition at line 582 of file YDialog.cc.
|
virtual |
Set this dialog's default button (the button that is activated when the user hits [Return] anywhere in this dialog). 0 means no default button.
There should be no more than one default button in a dialog.
Derived classes are free to overwrite this method, but they should call this base class method in the new implementation.
Definition at line 304 of file YDialog.cc.
void YDialog::setInitialSize | ( | ) |
Set the initial dialog size, depending on dialogType: YMainDialog dialogs get the UI's "default main window" size, YPopupDialog dialogs use their content's preferred size.
Definition at line 318 of file YDialog.cc.
bool YDialog::shortcutCheckPostponed | ( | ) | const |
Return whether or not shortcut checking is currently postponed.
Definition at line 272 of file YDialog.cc.
|
static |
Show the help text for the specified widget. If it doesn't have one, traverse up the widget hierarchy until there is one.
If there is a help text, it is displayed in a pop-up dialog with a local event loop.
This returns 'true' on success (there was a help text) and 'false' on failure (no help text).
Definition at line 660 of file YDialog.cc.
|
static |
Show the specified text in a pop-up dialog with a local event loop. This is useful for help texts. 'richText' indicates if YRichText formatting should be applied.
Definition at line 614 of file YDialog.cc.
|
inlinestatic |
Alias for currentDialog().
YEvent * YDialog::waitForEvent | ( | int | timeout_millisec = 0 | ) |
Wait for a user event. In most cases, this means waiting until the user has clicked on a button in this dialog. If any widget has its 'notify' flag set (opt(
notify) in YCP, setNotify( true ) in C++), an action on such a widget will also make waitForEvent() return.
If the specified timeout elapses without any user event, a YTimeoutEvent will be returned. 0 means no timeout (wait forever).
If open() has not been called for this dialog until now, it is called now.
The dialog retains ownership of the event and will delete it upon the next call to waitForEvent() or pollEvent() or when the dialog is deleted. This also means that the return value of this function can safely be ignored without fear of memory leaks.
Applications can create YEventFilters to act upon some events before they are delivered to the application. Each event filter of this dialog is called (in undefined order) in waitForEvent(). An event filter can consume an event (in which case waitForEvent() will return to its internal event loop), pass it through unchanged, or even replace it with a new event. Refer to the YEventFilter documentation for more details.
If this dialog is not the topmost dialog, an exception is thrown.
Definition at line 339 of file YDialog.cc.
|
protectedpure virtual |
Wait for a user event.
Derived classes are required to implement this.
|
inlinevirtual |
|
staticprotected |