Wt
3.3.0
|
Base class for popup widgets. More...
#include <Wt/WPopupWidget>
Public Member Functions | |
WPopupWidget (WWidget *impl, WObject *parent=0) | |
Constructor. | |
virtual | ~WPopupWidget () |
Destructor. | |
void | setAnchorWidget (WWidget *widget, Orientation orientation=Vertical) |
Sets an anchor widget. | |
Orientation | orientation () const |
Returns the orientation. | |
void | setTransient (bool transient, int autoHideDelay=0) |
Sets transient property. | |
bool | isTransient () const |
Returns whether the popup is transient. | |
int | autoHideDelay () const |
Returns the auto-hide delay. | |
virtual void | setHidden (bool hidden, const WAnimation &animation=WAnimation()) |
Hides or shows the widget. | |
Signal & | hidden () |
Signal emitted when the popup is hidden. | |
Signal & | shown () |
Signal emitted when the popup is shown. | |
Protected Member Functions | |
virtual void | render (WFlags< RenderFlag > flags) |
Renders the widget. |
Base class for popup widgets.
A popup widget anchors to another widget, for which it usually provides additional information or assists in editing, etc...
The popup widget will position itself relative to the anchor widget by taking into account available space, and switching sides if necessary to fit the widget into the current window. For example, a vertically anchored widget will by default be a "drop-down", positioning itself under the anchor widget, but it may also choose to position itself above the anchor widget if space is lacking below.
Constructor.
You need to pass in a widget that provides the main contents of the widget (e.g. a WTemplate or WContainerWidget).
Unlike other widgets, a popup widget does not need a parent widget (it acts like a pseudo top-level widget), but it can be given a parent object which is used to scope its lifetime.
int Wt::WPopupWidget::autoHideDelay | ( | ) | const |
Returns the auto-hide delay.
Signal& Wt::WPopupWidget::hidden | ( | ) |
Signal emitted when the popup is hidden.
This signal is emitted when the popup is being hidden because of a client-side event (not when setHidden() or hide() is called).
bool Wt::WPopupWidget::isTransient | ( | ) | const |
Returns whether the popup is transient.
Orientation Wt::WPopupWidget::orientation | ( | ) | const |
Returns the orientation.
void Wt::WPopupWidget::render | ( | WFlags< RenderFlag > | flags | ) | [protected, virtual] |
Renders the widget.
This function renders the widget (or an update for the widget), after this has been scheduled using scheduleRender().
The default implementation will render the widget by serializing changes to JavaScript and HTML. You may want to reimplement this widget if you have been postponing some of the layout / rendering implementation until the latest moment possible. In that case you should make sure you call the base implementation however.
Reimplemented from Wt::WCompositeWidget.
Reimplemented in Wt::WSuggestionPopup, and Wt::WDialog.
void Wt::WPopupWidget::setAnchorWidget | ( | WWidget * | widget, |
Orientation | orientation = Vertical |
||
) |
Sets an anchor widget.
A vertical popup will show below (or above) the widget, while a horizontal popup will show right (or left) of the widget.
void Wt::WPopupWidget::setHidden | ( | bool | hidden, |
const WAnimation & | animation = WAnimation() |
||
) | [virtual] |
Hides or shows the widget.
Hides or show the widget (including all its descendant widgets). When setting hidden
= false
, this widget and all descendant widgets that are not hidden will be shown. A widget is only visible if it and all its ancestors in the widget tree are visible, which may be checked using isVisible().
Reimplemented from Wt::WCompositeWidget.
Reimplemented in Wt::WDialog.
void Wt::WPopupWidget::setTransient | ( | bool | transient, |
int | autoHideDelay = 0 |
||
) |
Sets transient property.
A transient popup will automatically hide when the user clicks outside of the popup. When autoHideDelay
is not 0, then it will also automatically hide when the user moves the mouse outside the widget for longer than this delay.
Signal& Wt::WPopupWidget::shown | ( | ) |
Signal emitted when the popup is shown.
This signal is emitted when the popup is being hidden because of a client-side event (not when setHidden() or show() is called).