Wt: Wt::WAbstractSpinBox Class Reference

Wt 3.3.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions
Wt::WAbstractSpinBox Class Reference

An abstract spin box. More...

`#include <Wt/WAbstractSpinBox>`

Inheritance diagram for Wt::WAbstractSpinBox:
[legend]

List of all members.

## 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.
virtual WValidator::State | validate ()
| Validates the field.
## Protected Member Functions
| WAbstractSpinBox (WContainerWidget *parent=0)
| Constructor.
virtual void | render (WFlags< RenderFlag > flags)
| Renders the widget.
virtual int | boxPadding (Orientation orientation) const
| Returns the widget's built-in padding.

## Detailed Description

An abstract spin box.

Although the element can be rendered using a native HTML5 control, by default it is rendered using an HTML4 compatibility workaround which is implemented using JavaScript and CSS, as most browsers do not yet implement the HTML5 native element.

## Member Function Documentation

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.

See also:
  boxBorder()

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.

See also:
  setPrefix()

void Wt::WAbstractSpinBox::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::WFormWidget.

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.

Note:
  Not supported by the native controls.

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.

Note:
  Not supported by the native controls.

void Wt::WAbstractSpinBox::setText | ( | const WString & | text | ) | `[virtual]`

Sets the content of the line edit.

The default value is "".

See also:
  text()

Reimplemented from Wt::WLineEdit.

const WString& Wt::WAbstractSpinBox::suffix | ( |  | ) | const

Returns the suffix.

See also:
  setSuffix()

WValidator::State Wt::WAbstractSpinBox::validate | ( |  | ) | `[virtual]`

Validates the field.

See also:
  validated()

Reimplemented from Wt::WFormWidget.

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator