Wt 3.1.10
|
An abstract spin box. More...
#include <Wt/WAbstractSpinBox>
Public Member Functions | |
void | setNativeControl (bool nativeControl) |
Configures whether a native HTML5 control should be used. | |
bool | nativeControl () const |
Returns whether a native HTML5 control is used. | |
void | setPrefix (const WString &prefix) |
Sets a prefix. | |
const WString & | prefix () const |
Returns the prefix. | |
void | setSuffix (const WString &suffix) |
Sets a suffix. | |
const WString & | suffix () const |
Returns the suffix. | |
virtual void | setText (const WString &text) |
Sets the content of the line edit. | |
Protected Member Functions | |
WAbstractSpinBox (WContainerWidget *parent=0) | |
Constructor. | |
virtual int | boxPadding (Orientation orientation) const |
Returns the widget's built-in padding. |
An abstract spin box.
Using HTML4, the widget is implemented using a <input type="text"> The element can be styled using the Wt-spinbox
style. It may be styled through the current theme, or you can override the style using internal or external CSS as appropriate.
int Wt::WAbstractSpinBox::boxPadding | ( | Orientation | orientation | ) | const [protected, virtual] |
Returns the widget's built-in padding.
This is used by the layout managers to correct for a built-in padding which interferes with setting a widget's width (or height) to 100%.
A layout manager needs to set the width to 100% only for form widgets (WTextArea, WLineEdit, WComboBox, etc...). Therefore, only for those widgets this needs to return the padding (the default implementation returns 0).
For form widgets, the padding depends on the specific browser/platform combination, unless an explicit padding is set for the widget.
When setting an explicit padding for the widget using a style class, you will want to reimplement this method to return this padding in case you want to set the widget inside a layout manager.
Reimplemented from Wt::WLineEdit.
bool Wt::WAbstractSpinBox::nativeControl | ( | ) | const |
Returns whether a native HTML5 control is used.
Taking into account the preference for a native control, configured using setNativeControl(), this method returns whether a native control is actually being used.
const WString& Wt::WAbstractSpinBox::prefix | ( | ) | const |
Returns the prefix.
void Wt::WAbstractSpinBox::setNativeControl | ( | bool | nativeControl | ) |
Configures whether a native HTML5 control should be used.
When native
, the new "number" input element, specified by HTML5 and when implemented by the browser, is used rather than the built-in element. The native control is styled by the browser (usually in sync with the OS) rather than through the theme chosen.
The default is false
(as native support is now well implemented).
void Wt::WAbstractSpinBox::setPrefix | ( | const WString & | prefix | ) |
Sets a prefix.
Option to set a prefix string shown in front of the value, e.g.:
spinBox->setPrefix("$ ");
The default prefix is empty.
void Wt::WAbstractSpinBox::setSuffix | ( | const WString & | suffix | ) |
Sets a suffix.
Option to set a suffix string shown to the right of the value, e.g.:
spinBox->setSuffix(" crates");
The default suffix is empty.
void Wt::WAbstractSpinBox::setText | ( | const WString & | text | ) | [virtual] |
Sets the content of the line edit.
The default value is "".
Reimplemented from Wt::WLineEdit.
const WString& Wt::WAbstractSpinBox::suffix | ( | ) | const |
Returns the suffix.