Wt
3.3.8
|
A base class for widgets with an HTML counterpart. More...
#include <Wt/WWebWidget>
Public Member Functions | |
WWebWidget (WContainerWidget *parent=0) | |
Construct a WebWidget with a given parent. More... | |
virtual void | setPositionScheme (PositionScheme scheme) |
Sets the CSS position scheme. More... | |
virtual PositionScheme | positionScheme () const |
Returns the CSS position scheme. More... | |
virtual void | setOffsets (const WLength &offset, WFlags< Side > sides=All) |
Sets CSS offsets for a non-statically positioned widget. More... | |
virtual WLength | offset (Side s) const |
Returns a CSS offset. More... | |
virtual void | resize (const WLength &width, const WLength &height) |
Resizes the widget. More... | |
virtual WLength | width () const |
Returns the width. More... | |
virtual WLength | height () const |
Returns the height. More... | |
virtual void | setMinimumSize (const WLength &width, const WLength &height) |
Sets a minimum size. More... | |
virtual WLength | minimumWidth () const |
Returns the minimum width. More... | |
virtual WLength | minimumHeight () const |
Returns the minimum height. More... | |
virtual void | setMaximumSize (const WLength &width, const WLength &height) |
Sets a maximum size. More... | |
virtual WLength | maximumWidth () const |
Returns the maximum width. More... | |
virtual WLength | maximumHeight () const |
Returns the maximum height. More... | |
virtual void | setLineHeight (const WLength &height) |
Sets the CSS line height for contained text. | |
virtual WLength | lineHeight () const |
Returns the CSS line height for contained text. More... | |
virtual void | setFloatSide (Side s) |
Specifies a CSS float side. More... | |
virtual Side | floatSide () const |
Returns the CSS float side. More... | |
virtual void | setClearSides (WFlags< Side > sides) |
Sets the sides that should be cleared of floats. More... | |
virtual WFlags< Side > | clearSides () const |
Returns the sides that should remain empty. More... | |
virtual void | setMargin (const WLength &margin, WFlags< Side > sides=All) |
Sets CSS margins around the widget. More... | |
virtual WLength | margin (Side side) const |
Returns a CSS margin set. More... | |
virtual void | setHiddenKeepsGeometry (bool enabled) |
Sets whether the widget keeps its geometry when hidden. More... | |
virtual bool | hiddenKeepsGeometry () const |
Returns whether the widget keeps its geometry when hidden. More... | |
virtual void | setHidden (bool hidden, const WAnimation &animation=WAnimation()) |
Hides or shows the widget. More... | |
virtual bool | isHidden () const |
Returns whether the widget is set hidden. More... | |
virtual bool | isVisible () const |
Returns whether the widget is visible. More... | |
virtual void | setDisabled (bool disabled) |
Sets whether the widget is disabled. More... | |
virtual bool | isDisabled () const |
Returns whether the widget is set disabled. More... | |
virtual bool | isEnabled () const |
Returns whether the widget is enabled. More... | |
virtual void | setPopup (bool popup) |
Lets the widget overlay over other sibling widgets. More... | |
virtual bool | isPopup () const |
Returns whether the widget is overlayed. More... | |
virtual void | setInline (bool isInline) |
Sets whether the widget is displayed inline or as a block. More... | |
virtual bool | isInline () const |
Returns whether the widget is displayed inline or as block. More... | |
virtual void | setDecorationStyle (const WCssDecorationStyle &style) |
Sets a CSS decoration style. More... | |
virtual WCssDecorationStyle & | decorationStyle () |
Returns the decoration style of this widget. More... | |
virtual void | setStyleClass (const WString &styleClass) |
Sets (one or more) CSS style classes. More... | |
virtual WString | styleClass () const |
Returns the CSS style class. More... | |
virtual void | addStyleClass (const WString &styleClass, bool force=false) |
Adds a CSS style class. More... | |
virtual void | removeStyleClass (const WString &styleClass, bool force=false) |
Removes a CSS style class. More... | |
virtual bool | hasStyleClass (const WString &styleClass) const |
Returns whether the widget has a style class. | |
virtual void | setVerticalAlignment (AlignmentFlag alignment, const WLength &length=WLength()) |
Sets the vertical alignment. More... | |
virtual AlignmentFlag | verticalAlignment () const |
Returns the vertical alignment. More... | |
virtual WLength | verticalAlignmentLength () const |
Returns the fixed vertical alignment that was set. More... | |
virtual void | setToolTip (const WString &text, TextFormat textFormat=PlainText) |
Sets a tooltip. More... | |
virtual void | setDeferredToolTip (bool enable, TextFormat textFormat=PlainText) |
Enable deferred tooltip. More... | |
virtual WString | toolTip () const |
Returns the tooltip. | |
virtual void | refresh () |
Refresh the widget. More... | |
virtual void | setAttributeValue (const std::string &name, const WString &value) |
Sets an attribute value. More... | |
virtual WString | attributeValue (const std::string &name) const |
Returns an attribute value. More... | |
virtual void | setJavaScriptMember (const std::string &name, const std::string &value) |
Sets a JavaScript member. More... | |
virtual std::string | javaScriptMember (const std::string &name) const |
Returns the value of a JavaScript member. More... | |
virtual void | callJavaScriptMember (const std::string &name, const std::string &args) |
Calls a JavaScript member. More... | |
virtual void | load () |
Loads content just before the widget is used. More... | |
virtual bool | loaded () const |
Returns whether this widget has been loaded. More... | |
virtual void | setId (const std::string &id) |
Sets the CSS Id. More... | |
virtual WWidget * | find (const std::string &name) |
Finds a descendent widget by name. More... | |
virtual WWidget * | findById (const std::string &id) |
Finds a descendent widget by id. | |
virtual void | setSelectable (bool selectable) |
Sets as selectable. More... | |
virtual void | doJavaScript (const std::string &javascript) |
Executes the given JavaScript statements when the widget is rendered or updated. More... | |
virtual const std::string | id () const |
Returns the (unique) identifier for this object. More... | |
void | setLoadLaterWhenInvisible (bool) |
Change the way the widget is loaded when invisible. More... | |
std::string | htmlTagName () const |
returns the current html tag name More... | |
void | setHtmlTagName (const std::string &tag) |
set the custom HTML tag name More... | |
const std::vector< WWidget * > & | children () const |
Returns contained widgets. More... | |
Signal & | childrenChanged () |
Signal emitted when children have been added or removed. More... | |
virtual void | setCanReceiveFocus (bool enabled) |
Sets whether the widget can receive focus. More... | |
virtual bool | canReceiveFocus () const |
Returns whether the widget can receive focus. More... | |
virtual bool | setFirstFocus () |
Set focus on the widget's first descendant. More... | |
virtual void | setFocus (bool focus) |
Sets focus. More... | |
virtual bool | hasFocus () const |
Returns whether the widget currently has the focus. | |
virtual void | setTabIndex (int index) |
Sets the tab index. More... | |
virtual int | tabIndex () const |
Returns the tab index. More... | |
EventSignal & | blurred () |
Signal emitted when the widget lost focus. More... | |
EventSignal & | focussed () |
Signal emitted when the widget recieved focus. More... | |
virtual bool | scrollVisibilityEnabled () const WT_CXX11ONLY(finaloverride) |
Returns whether scroll visibility detection is enabled for this widget. More... | |
virtual void | setScrollVisibilityEnabled (bool enabled) WT_CXX11ONLY(finaloverride) |
Sets whether scroll visibility detection is enabled for this widget. More... | |
virtual int | scrollVisibilityMargin () const WT_CXX11ONLY(finaloverride) |
Returns the margin around the viewport within which the widget is considered visible. More... | |
virtual void | setScrollVisibilityMargin (int margin) WT_CXX11ONLY(finaloverride) |
Sets the margin around the viewport within which the widget is considered visible. More... | |
virtual Signal< bool > & | scrollVisibilityChanged () WT_CXX11ONLY(finaloverride) |
Signal triggered when the scroll visibility of this widget changes. More... | |
virtual bool | isScrollVisible () const WT_CXX11ONLY(finaloverride) |
Returns whether this widget is currently considered scroll visible. More... | |
virtual void | setThemeStyleEnabled (bool enabled) |
Sets whether theme styling for a widget is enabled or disabled. More... | |
virtual bool | isThemeStyleEnabled () const |
Returns whether this widget is currently styled by the chosen theme. More... | |
Public Member Functions inherited from Wt::WWidget | |
virtual | ~WWidget () |
Destructor. More... | |
WWidget * | parent () const |
Returns the parent widget. More... | |
virtual void | removeChild (WObject *child) |
Removes a child object. More... | |
void | setWidth (const WLength &width) |
Sets the width. More... | |
void | setHeight (const WLength &height) |
Sets the height. More... | |
virtual void | positionAt (const WWidget *widget, Orientation orientation=Vertical) |
Positions a widget next to another widget. More... | |
virtual void | toggleStyleClass (const WString &styleClass, bool add, bool force=false) |
Toggles a CSS style class. | |
std::string | jsRef () const |
Returns a JavaScript expression to the corresponding DOM node. More... | |
void | setFocus () |
Sets focus. More... | |
virtual void | acceptDrops (const std::string &mimeType, const WString &hoverStyleClass=WString()) |
Sets a mime type to be accepted for dropping. More... | |
virtual void | stopAcceptDrops (const std::string &mimeType) |
Indicates that a mime type is no longer accepted for dropping. More... | |
virtual void | setObjectName (const std::string &name) |
Sets an object name. More... | |
virtual void | htmlText (std::ostream &out) |
Streams the (X)HTML representation. More... | |
bool | isRendered () const |
Returns whether the widget is rendered. More... | |
void | hide () |
Hides the widget. More... | |
void | animateHide (const WAnimation &animation) |
Hides the widget using an animation. More... | |
void | show () |
Shows the widget. More... | |
void | animateShow (const WAnimation &animation) |
Shows the widget using an animation. More... | |
void | enable () |
Enables the widget. More... | |
void | disable () |
Disable thes widget. More... | |
bool | layoutSizeAware () const |
Returns whether the widget is layout size aware. More... | |
Public Member Functions inherited from Wt::WObject | |
WObject (WObject *parent=0) | |
Create a WObject with a given parent object. More... | |
virtual | ~WObject () |
Destructor. More... | |
virtual std::string | objectName () const |
Returns the object name. More... | |
void | resetLearnedSlots () |
Resets learned stateless slot implementations. More... | |
template<class T > | |
void | resetLearnedSlot (void(T::*method)()) |
Resets a learned stateless slot implementation. More... | |
template<class T > | |
WStatelessSlot * | implementStateless (void(T::*method)()) |
Declares a slot to be stateless and learn client-side behaviour on first invocation. More... | |
template<class T > | |
WStatelessSlot * | implementStateless (void(T::*method)(), void(T::*undoMethod)()) |
Declares a slot to be stateless and learn client-side behaviour in advance. More... | |
void | isNotStateless () |
Marks the current function as not stateless. More... | |
template<class T > | |
WStatelessSlot * | implementJavaScript (void(T::*method)(), const std::string &jsCode) |
Provides a JavaScript implementation for a method. More... | |
void | addChild (WObject *child) |
Adds a child object. More... | |
const std::vector< WObject * > & | children () const |
Returns the children. | |
WObject * | parent () const |
Returns the parent object. | |
Static Public Member Functions | |
static WString | escapeText (const WString &text, bool newlinesToo=false) |
Escape HTML control characters in the text, to display literally (deprecated). More... | |
static std::string & | escapeText (std::string &text, bool newlinestoo=false) |
Escape HTML control characters in the text, to display literally (deprecated). More... | |
static bool | removeScript (WString &text) |
Remove tags/attributes from text that are not passive (deprecated). More... | |
static std::string | jsStringLiteral (const std::string &v, char delimiter= '\'') |
Turn a UTF8 encoded string into a JavaScript string literal. More... | |
Static Public Member Functions inherited from Wt::WWidget | |
static WString | tr (const char *key) |
Short hand for WString::tr() More... | |
Protected Member Functions | |
virtual void | propagateSetEnabled (bool enabled) |
Propagates that a widget was enabled or disabled through children. More... | |
virtual void | enableAjax () |
Progresses to an Ajax-enabled widget. More... | |
virtual WStatelessSlot * | getStateless (Method method) |
On-demand stateless slot implementation. More... | |
virtual void | render (WFlags< RenderFlag > flags) |
Renders the widget. More... | |
Protected Member Functions inherited from Wt::WWidget | |
void | setLayoutSizeAware (bool sizeAware) |
Sets the widget to be aware of its size set by a layout manager. More... | |
virtual void | layoutSizeChanged (int width, int height) |
Virtual method that indicates a size change. More... | |
WWidget (WContainerWidget *parent=0) | |
Creates a widget. More... | |
virtual void | dropEvent (WDropEvent dropEvent) |
Handles a drop event. More... | |
virtual int | boxPadding (Orientation orientation) const |
Returns the widget's built-in padding. More... | |
virtual int | boxBorder (Orientation orientation) const |
Returns the widget's built-in border width. More... | |
void | scheduleRender (WFlags< RepaintFlag > flags=0) |
Schedules rerendering of the widget. More... | |
Additional Inherited Members | |
Public Types inherited from Wt::WObject | |
typedef void(WObject::* | Method) () |
Typedef for a WObject method without arguments. | |
Static Protected Member Functions inherited from Wt::WObject | |
static WObject * | sender () |
Returns the sender of the current slot call. More... | |
A base class for widgets with an HTML counterpart.
All descendants of WWebWidget implement a widget which corresponds almost one-on-one with an HTML element. These widgets provide most capabilities of these HTML elements, but rarely make no attempt to do anything more.
Wt::WWebWidget::WWebWidget | ( | WContainerWidget * | parent = 0 | ) |
Construct a WebWidget with a given parent.
|
virtual |
Adds a CSS style class.
When force
= true
, a JavaScript call will be used to add the style class to the DOM element (if JavaScript is available). This may be necessary when client-side JavaScript manipulates the same style class.
The styleClass
should be a single class (although multiple classes will work for the common case that the additional style classes are all not yet present on the element.
Implements Wt::WWidget.
|
virtual |
EventSignal & Wt::WWebWidget::blurred | ( | ) |
Signal emitted when the widget lost focus.
This signals is only emitted for a widget that canReceiveFocus()
|
virtual |
Calls a JavaScript member.
This calls a JavaScript member.
Implements Wt::WWidget.
|
virtual |
Returns whether the widget can receive focus.
Implements Wt::WWidget.
Reimplemented in Wt::WAnchor, and Wt::WFormWidget.
const std::vector< WWidget * > & Wt::WWebWidget::children | ( | ) | const |
Returns contained widgets.
Signal & Wt::WWebWidget::childrenChanged | ( | ) |
Signal emitted when children have been added or removed.
Returns the sides that should remain empty.
Implements Wt::WWidget.
|
virtual |
Returns the decoration style of this widget.
This groups all decorative aspects of the widget, which do not affect the widget layout (except for the border properties which may behave like extra margin around the widget).
When a decoration style has not been previously set, it returns a default decoration style object.
Implements Wt::WWidget.
|
virtual |
Executes the given JavaScript statements when the widget is rendered or updated.
Calling WApplication::doJavaScript() with JavaScript code that refers to a widget using jsRef(), that is still to be rendered may cause JavaScript errors because the corresponding DOM node does not exist. This happens for example when a widget is created, but not yet inserted in the widget tree.
This method guarantees that the JavaScript code is only run when the corresponding DOM node (using jsRef()) resolves to a valid DOM object.
Implements Wt::WWidget.
|
protectedvirtual |
Progresses to an Ajax-enabled widget.
This method is called when the progressive bootstrap method is used, and support for AJAX has been detected. The default behavior will upgrade the widget's event handling to use AJAX instead of full page reloads, and propagate the call to its children.
You may want to reimplement this method if you want to make changes to widget when AJAX is enabled. You should always call the base implementation.
Implements Wt::WWidget.
Reimplemented in Wt::WTemplate, Wt::WMenuItem, Wt::WAnchor, Wt::WPushButton, Wt::WPaintedWidget, Wt::WFileUpload, Wt::WSlider, Wt::WAbstractMedia, Wt::WFormWidget, and Wt::WFileDropWidget.
Escape HTML control characters in the text, to display literally (deprecated).
|
static |
Escape HTML control characters in the text, to display literally (deprecated).
|
virtual |
|
virtual |
EventSignal & Wt::WWebWidget::focussed | ( | ) |
Signal emitted when the widget recieved focus.
This signals is only emitted for a widget that canReceiveFocus()
|
protectedvirtual |
On-demand stateless slot implementation.
This method returns a stateless slot implementation for the given method
. To avoid the cost of declaring methods to be stateless when they are not used, you may reimplement this method to provide a stateless implementation for a method only when the method is involved in a slot connection.
Use implementStateless() to provide a stateless implementation of the given method
, or return the base class implementation otherwise.
Reimplemented from Wt::WWidget.
Reimplemented in Wt::WAbstractToggleButton.
|
virtual |
Returns the height.
Returns the height set for this widget. This is not a calculated height, based on layout, but the height as specified previously with resize(const WLength& width, const WLength& height).
This applies to CSS-based layout.
Implements Wt::WWidget.
|
virtual |
Returns whether the widget keeps its geometry when hidden.
Implements Wt::WWidget.
std::string Wt::WWebWidget::htmlTagName | ( | ) | const |
returns the current html tag name
|
virtual |
Returns the (unique) identifier for this object.
For a WWidget, this corresponds to the id of the DOM element that represents the widget. This is not entirely unique, since a composite widget shares the same id as its implementation.
By default, the id is auto-generated, unless a custom id is set for a widget using WWidget::setId(). The auto-generated id is created by concatenating objectName() with a unique number.
Reimplemented from Wt::WObject.
|
virtual |
Returns whether the widget is set disabled.
A widget that is not set disabled may still be disabled when one of its ancestor widgets is set disabled. Use isEnabled() to find out whether a widget is enabled.
Implements Wt::WWidget.
|
virtual |
Returns whether the widget is enabled.
A widget is enabled if it is not disabled, and none of its ancestors are disabled. This method returns whether the widget is rendered as enabled, while isDisabled() returns whether a widget has been explicitly disabled.
Note that a widget may be at the same time not enabled, and not disabled, in case one of its ancestors was disabled.
Implements Wt::WWidget.
Reimplemented in Wt::WInteractWidget.
|
virtual |
Returns whether the widget is set hidden.
A widget that is not hidden may still be not visible when one of its ancestor widgets is hidden. Use isVisible() to check the visibility of a widget.
Implements Wt::WWidget.
|
virtual |
Returns whether the widget is displayed inline or as block.
Implements Wt::WWidget.
|
virtual |
Returns whether the widget is overlayed.
This applies to CSS-based layout.
Implements Wt::WWidget.
|
finaloverridevirtual |
Returns whether this widget is currently considered scroll visible.
isScrollVisible() is initially false.
Implements Wt::WWidget.
|
virtual |
Returns whether this widget is currently styled by the chosen theme.
isThemeEnabled() is initially true.
Implements Wt::WWidget.
|
virtual |
Returns whether the widget is visible.
A widget is visible if it is not hidden, and none of its ancestors are hidden. This method returns the true visibility, while isHidden() returns whether a widget has been explicitly hidden.
Note that a widget may be at the same time not hidden, and not visible, in case one of its ancestors was hidden.
Implements Wt::WWidget.
Reimplemented in Wt::WTableCell.
|
virtual |
|
static |
Turn a UTF8 encoded string into a JavaScript string literal.
The delimiter
may be a single or double quote.
|
virtual |
|
virtual |
Loads content just before the widget is used.
This method is called after a widget is inserted in the widget hierarchy and fully constructed, but before the widget is rendered. Widgets that get inserted in the widget hierarchy will be rendered. Visible widgets are rendered immediately, and invisible widgets in the back-ground (or not for a plain HTML session). This method is called when the widget is directly or indirectly inserted into the widget tree.
The default implementation simply propagates the load signal to its children. You may want to override this method to delay loading of resource-intensive contents.
During the life-time of a widget, this method may be called multiple times, so you should make sure that you do a deferred initializiation only once.
Implements Wt::WWidget.
Reimplemented in Wt::WInteractWidget, Wt::WDateEdit, Wt::WTimeEdit, and Wt::WViewWidget.
|
virtual |
Returns a CSS margin set.
This applies to CSS-based layout.
Implements Wt::WWidget.
|
virtual |
Returns the maximum height.
Returns the minmum height set for this widget with setMaximumSize().
Implements Wt::WWidget.
|
virtual |
Returns the maximum width.
Returns the maximum width set for this widget with setMaximumSize().
Implements Wt::WWidget.
|
virtual |
Returns the minimum height.
Returns the minmum height set for this widget with setMinimumSize().
Implements Wt::WWidget.
|
virtual |
Returns the minimum width.
Returns the minimum width set for this widget with setMinimumSize().
Implements Wt::WWidget.
|
virtual |
|
protectedvirtual |
Propagates that a widget was enabled or disabled through children.
When enabling or disabling a widget, you usually also want to disable contained children. This method is called by setDisabled() to propagate its state to all children.
You may want to reimplement this method if they wish to render differently when a widget is disabled. The default implementation will propagate the signal to all children.
Implements Wt::WWidget.
Reimplemented in Wt::WAnchor, Wt::WFileUpload, Wt::WInteractWidget, Wt::WPushButton, Wt::WTextEdit, Wt::WFormWidget, Wt::WLabel, Wt::WDateEdit, Wt::WTimeEdit, and Wt::Ext::Component.
|
virtual |
Refresh the widget.
The refresh method is invoked when the locale is changed using WApplication::setLocale() or when the user hit the refresh button.
The widget must actualize its contents in response.
Reimplemented from Wt::WWidget.
Reimplemented in Wt::WTemplate, Wt::Ext::TableView, Wt::WPushButton, Wt::Ext::Panel, Wt::WText, Wt::Ext::ComboBox, Wt::WComboBox, Wt::Ext::MessageBox, Wt::WFormWidget, Wt::Ext::TabWidget, Wt::WAbstractToggleButton, Wt::WDateEdit, Wt::WViewWidget, Wt::WDoubleSpinBox, Wt::Ext::AbstractButton, Wt::WGroupBox, Wt::WAbstractSpinBox, and Wt::Ext::FormField.
|
static |
Remove tags/attributes from text that are not passive (deprecated).
This removes tags and attributes from XHTML-formatted text that do not simply display something but may trigger scripting, and could have been injected by a malicious user for Cross-Site Scripting (XSS).
This method is used by the library to sanitize XHTML-formatted text set in WText, but it may also be useful outside the library to sanitize user content when direcly using JavaScript.
Modifies the text
if needed. When the text is not proper XML, returns false
.
|
virtual |
Removes a CSS style class.
When force
= true
, a JavaScript call will be used to remove the style class from the DOM element (if JavaScript is available). This may be necessary when client-side JavaScript manipulates the same style class.
The styleClass
should be a single class
Implements Wt::WWidget.
|
protectedvirtual |
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::WWidget.
Reimplemented in Wt::WGLWidget, Wt::Chart::WCartesianChart, Wt::WMenuItem, Wt::WLineEdit, Wt::Auth::AuthWidget, Wt::WPaintedWidget, Wt::WText, Wt::WSlider, Wt::WImage, Wt::WFormWidget, Wt::Chart::WAxisSliderWidget, Wt::WDateEdit, Wt::WTimeEdit, Wt::WDoubleSpinBox, Wt::WStackedWidget, Wt::WViewWidget, Wt::Ext::FormField, Wt::WAbstractSpinBox, and Wt::Auth::RegistrationWidget.
Resizes the widget.
Specifies a fixed size for this widget, setting CSS width
and height
properties. By default a widget has automatic width and height, which sets a size for the widget following CSS rules.
When the widget is not managed by a layout manager, the automatic (natural) size of a widget depends on whether they widget is a block or inline widget:
When inserted in a layout manager, the size set will be used as a widget's preferred size, but the widget may be given a different size by the layout manager based on available space and stretch factors. The actual size given by a layout manager may be retrieved by making the widget "layout size aware", using setLayoutSizeAware(). If you have defined a "wtResize()"
JavaScript method for the widget, then this method will also be called.
The default width and height of a widget is WLength::Auto.
Reimplemented from Wt::WWidget.
Reimplemented in Wt::WGLWidget, Wt::Chart::WCartesian3DChart, Wt::WSlider, Wt::WTextEdit, Wt::WPaintedWidget, Wt::WProgressBar, Wt::WVideo, Wt::Ext::TextEdit, and Wt::WFlashObject.
|
finaloverridevirtual |
Signal triggered when the scroll visibility of this widget changes.
The boolean parameter indicates whether the widget is currently scroll visible.
Implements Wt::WWidget.
|
finaloverridevirtual |
Returns whether scroll visibility detection is enabled for this widget.
Implements Wt::WWidget.
|
finaloverridevirtual |
Returns the margin around the viewport within which the widget is considered visible.
Implements Wt::WWidget.
|
virtual |
Sets an attribute value.
Sets the value for an HTML attribute.
This is only useful for HTML features that are not supported directly in Wt (and beware that browsers have non-consistent support for many more exotic HTML features).
Implements Wt::WWidget.
|
virtual |
Sets whether the widget can receive focus.
By default, only form widgets (descendants of WFormWidget), anchors (WAnchor) and buttons (WPushButton) can receive focus.
Any other widget can be configured to receive focus however.
Implements Wt::WWidget.
Sets the sides that should be cleared of floats.
This pushes the widget down until it is not surrounded by floats at the sides
(which may be a combination of Wt::Left and Wt::Right).
This applies to CSS-based layout.
Implements Wt::WWidget.
|
virtual |
Sets a CSS decoration style.
This copies the style over its current decorationStyle()
Implements Wt::WWidget.
|
virtual |
Enable deferred tooltip.
You may override toolTip() to read data only when the user hovers over the widget.
When textFormat
is XHTMLText, the tooltip may contain any valid XHTML snippet. The tooltip will then be rendered using JavaScript.
Note: To change existing toolTip call setDeferredToolTip() again.
Implements Wt::WWidget.
|
virtual |
Sets whether the widget is disabled.
Enables or disables the widget (including all its descendant widgets). setDisabled(false) will enable this widget and all descendant widgets that are not disabled. A widget is only enabled if it and all its ancestors in the widget tree are disabled.
Typically, a disabled form widget will not allow changing the value, and disabled widgets will not react to mouse click events.
Implements Wt::WWidget.
Reimplemented in Wt::WMenuItem, and Wt::WSlider.
|
virtual |
Set focus on the widget's first descendant.
Set focus on the widget itself, or on a first descendant which can receive focus.
Returns whether focus could be set.
Implements Wt::WWidget.
Reimplemented in Wt::WAnchor, and Wt::WPushButton.
|
virtual |
Specifies a CSS float side.
This only applies to widgets with a Wt::Static positionScheme().
This lets the widget float to one of the sides of the parent widget, at the current line. A typical use is to position images within text. Valid values for Side or Wt::Nonejava {javadoclink Side::None None} , Wt::Left or Wt::Right.
This applies to CSS-based layout.
Implements Wt::WWidget.
|
virtual |
Sets focus.
When using focus
= false
, you can undo a previous setFocus() call.
Implements Wt::WWidget.
|
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().
Implements Wt::WWidget.
Reimplemented in Wt::WMenuItem, Wt::Ext::MessageBox, Wt::Ext::Dialog, Wt::WDateEdit, Wt::WTimeEdit, Wt::WFormWidget, and Wt::Ext::Widget.
|
virtual |
Sets whether the widget keeps its geometry when hidden.
Normally, a widget that is hidden will no longer occupy space, causing a reflow of sibling widgets. Using this method you may change this behavior to keep an (open) space when hidden.
Implements Wt::WWidget.
void Wt::WWebWidget::setHtmlTagName | ( | const std::string & | tag | ) |
set the custom HTML tag name
The custom tag will replace the actual tag. The tag is not tested to see if it is a valid one and a closing tag will always be added.
|
virtual |
Sets the CSS Id.
Sets a custom Id. Note that the Id must be unique across the whole widget tree, can only be set right after construction and cannot be changed. This is mostly useful for in tests using a test plan that manipulates DOM elements by Id.
By default, auto-generated id's are used.
Implements Wt::WWidget.
|
virtual |
Sets whether the widget is displayed inline or as a block.
This option changes whether this widget must be rendered in line with sibling widgets wrapping at the right edge of the parent container (like text), or whether this widget must be rendered as a rectangular block that stacks vertically with sibling widgets (unless a CSS float property is applied). Depending on the widget type, the default value is inline (such as for example for WText, or WPushButton), or block (such as for example for a WContainerWidget).
This applies to CSS-based layout.
Implements Wt::WWidget.
|
virtual |
Sets a JavaScript member.
This binds a JavaScript member, which is set as a JavaScript property to the DOM object that implements this widget. The value may be any JavaScript expression, including a function.
Members that start with "wt"
are reserved for internal use. You may define a member "wtResize(self, width,
height)"
method if your widget needs active layout management. If defined, this method will be used by layout managers and when doing resize() to set the size of the widget, instead of setting the CSS width and height properties.
Implements Wt::WWidget.
void Wt::WWebWidget::setLoadLaterWhenInvisible | ( | bool | how | ) |
Change the way the widget is loaded when invisible.
By default, invisible widgets are loaded only after visible content. For tiny widgets this may lead to a performance loss, instead of the expected increase, because they require many more DOM manipulations to render, reducing the overall responsiveness of the application.
Therefore, this is disabled for some widgets like WImage, or empty WContainerWidgets.
You may also want to disable deferred loading when JavaScript event handling expects the widget to be loaded.
Usually the default settings are fine, but you may want to change the behaviour.
Sets CSS margins around the widget.
Setting margin has the effect of adding a distance between the widget and surrounding widgets. The default margin (with an automatic length) is zero.
Use any combination of Wt::Left, Wt::Right, Wt::Bottom, or Wt::Top.
This applies to CSS-based layout.
Implements Wt::WWidget.
Sets a maximum size.
Specifies a maximum size for this widget, setting CSS max-width
and max-height
properties.
The default the maximum width and height are WLength::Auto, indicating no maximum size. A WLength::Percentage size should not be used, as this is (in virtually all cases) undefined behaviour.
When the widget is a container widget that contains a layout manager, then setting a maximum size will have the effect of letting the size of the container to reflect the preferred size of the contents (rather than constraining the size of the children based on the size of the container), up to the specified maximum size.
Implements Wt::WWidget.
Sets a minimum size.
Specifies a minimum size for this widget, setting CSS min-width
and min-height
properties.
The default minimum width and height is 0. The special value WLength::Auto indicates that the initial width is used as minimum size. A WLength::Percentage size should not be used, as this is (in virtually all cases) undefined behaviour.
When the widget is inserted in a layout manager, then the minimum size will be taken into account.
Implements Wt::WWidget.
Sets CSS offsets for a non-statically positioned widget.
The argument sides
may be a combination of Wt::Left, Wt::Right, Wt::Top, and Wt::Bottom.
This applies only to widgets that have a position scheme that is Wt::Relative, Wt::Absolute, or Wt::Fixed, and has a slightly different meaning for these three cases.
For a relatively positioned widget, an offset applies relative to the position the widget would have when layed-out using a static position scheme. The widget may be shifted to the left or right by specifying an offset for the left or right) side. The widget may be shifted vertically, by specifying an offset for the top or bottom side.
For an absolutely positioned widget, an offset specifies a distance of the corresponding side of the widget with respect to the corresponding side of the reference parent widget. Thus, setting all offsets to 0 result in a widget that spans the entire reference widget. The reference parent widget is the first ancestor widget that is a table cell, or a widget with a relative, absolute or fixed position scheme.
For an fixed positioned widget, an offset specifies a distance of the corresponding side of the widget with respect to the browser window, regardless of scrolling. Thus, setting all offsets to 0 result in a widget that spans the entire browser window.
This applies to CSS-based layout.
Implements Wt::WWidget.
|
virtual |
Lets the widget overlay over other sibling widgets.
A widget that isPopup() will be rendered on top of any other sibling widget contained within the same parent (including other popup widgets previously added to the container).
This will only have an effect when the widgetis either Wt::Absolute or Wt::Fixed positionScheme().
This applies to CSS-based layout, and configures the z-index property.
Implements Wt::WWidget.
Reimplemented in Wt::WInteractWidget.
|
virtual |
Sets the CSS position scheme.
Establishes how the widget must be layed-out relative to its siblings. The default position scheme is Static.
This applies to CSS-based layout.
Implements Wt::WWidget.
|
finaloverridevirtual |
Sets whether scroll visibility detection is enabled for this widget.
Disabled by default. When enabled, the client keeps track of whether this widget is currently visible inside of the browser window. A widget is "scroll visible" if it is currently visible according to isVisible(), and its position is inside of the browser window, with an extra margin determined by scrollVisibilityMargin().
If scroll visibility changes, the scrollVisibilityChanged() signal is fired, and isScrollVisible() is updated.
This feature can be useful to implement infinite scroll, where a sentinel widget placed at the bottom of the page causes more content to be loaded when it becomes visible, see the infinite-scroll
example.
This feature can also be used to lazy load widgets when they become visible.
Implements Wt::WWidget.
|
finaloverridevirtual |
Sets the margin around the viewport within which the widget is considered visible.
This causes the widget to be considered "scroll visible" before it is within the viewport. Setting this margin could be useful to trigger the loading of content before it is in view.
Implements Wt::WWidget.
|
virtual |
Sets as selectable.
When a widget is made unselectable, a selection of text (or images) will not be visible (but may still be possible).
By default, the widget inherits this property from its parent, and this property propagates to all children. The top level container (WApplication::root()) selectable by default.
Implements Wt::WWidget.
Reimplemented in Wt::WMenuItem.
|
virtual |
Sets (one or more) CSS style classes.
You may set one or more space separated style classes. CSS style class works in conjunction with style sheet, and provides a flexible way to provide many widgets the same markup.
Setting an empty string removes the style class(es).
Implements Wt::WWidget.
|
virtual |
Sets the tab index.
For widgets that receive focus (canReceiveFocus()), focus is passed on to the next widget in the tabbing chain based on their tab index. When the user navigates through form widgets using the keyboard, widgets receive focus starting from the element with the lowest tab index to elements with the highest tab index.
Widgets with a same tab index will receive focus in the same order as they are inserted in the widget tree.
The default tab index is 0 (for a widget that can receive focus).
Implements Wt::WWidget.
|
virtual |
Sets whether theme styling for a widget is enabled or disabled.
By default all widgets are styled according to the chosen theme. Disabling the theme style could be useful to completely customize the style of the widget outside of the theme.
Implements Wt::WWidget.
|
virtual |
Sets a tooltip.
The tooltip is displayed when the cursor hovers over the widget.
When textFormat
is XHTMLText, the tooltip may contain any valid XHTML snippet. The tooltip will then be rendered using JavaScript.
Note: This will set deferred tooltip to false.
Implements Wt::WWidget.
Reimplemented in Wt::WFormWidget.
|
virtual |
Sets the vertical alignment.
This only applies to inline widgets, and determines how to position itself on the current line, with respect to sibling inline widgets.
This applies to CSS-based layout.
Implements Wt::WWidget.
|
virtual |
|
virtual |
Returns the tab index.
Implements Wt::WWidget.
Reimplemented in Wt::WAnchor, and Wt::WFormWidget.
|
virtual |
Returns the vertical alignment.
This applies to CSS-based layout.
Implements Wt::WWidget.
|
virtual |
Returns the fixed vertical alignment that was set.
This applies to CSS-based layout.
Implements Wt::WWidget.
|
virtual |
Returns the width.
Returns the width set for this widget. This is not a calculated width, based on layout, but the width as specified with resize(const WLength&, const WLength&).
This applies to CSS-based layout.
Implements Wt::WWidget.