/usr/include/Wt/WAbstractSpinBox is in libwt-dev 3.3.0-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | // This may look like C code, but it's really -*- C++ -*-
/*
* Copyright (C) 2011 Emweb bvba, Kessel-Lo, Belgium.
*
* See the LICENSE file for terms of use.
*/
#ifndef WABSTRACT_SPIN_BOX_H_
#define WABSTRACT_SPIN_BOX_H_
#include <Wt/WLineEdit>
namespace Wt {
/*! \class WAbstractSpinBox Wt/WAbstractSpinBox Wt/WAbstractSpinBox
* \brief 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.
*/
class WT_API WAbstractSpinBox : public WLineEdit
{
public:
/*! \brief Configures whether a native HTML5 control should be used.
*
* When \p 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 \p false (as native support is now well implemented).
*/
void setNativeControl(bool nativeControl);
/*! \brief 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.
*/
bool nativeControl() const;
/*! \brief Sets a prefix.
*
* Option to set a prefix string shown in front of the value, e.g.:
*
* \code
* spinBox->setPrefix("$ ");
* \endcode
*
* The default prefix is empty.
*
* \note Not supported by the native controls.
*/
void setPrefix(const WString& prefix);
/*! \brief Returns the prefix.
*
* \sa setPrefix()
*/
const WString& prefix() const { return prefix_; }
/*! \brief Sets a suffix.
*
* Option to set a suffix string shown to the right of the value, e.g.:
*
* \code
* spinBox->setSuffix(" crates");
* \endcode
*
* The default suffix is empty.
*
* \note Not supported by the native controls.
*/
void setSuffix(const WString& suffix);
/*! \brief Returns the suffix.
*
* \sa setSuffix()
*/
const WString& suffix() const { return suffix_; }
virtual void setText(const WT_USTRING& text);
virtual WValidator::State validate();
protected:
/*! \brief Constructor.
*/
WAbstractSpinBox(WContainerWidget *parent = 0);
virtual void updateDom(DomElement& element, bool all);
virtual void render(WFlags<RenderFlag> flags);
virtual void setFormData(const FormData& formData);
virtual void propagateRenderOk(bool deep);
virtual std::string jsMinMaxStep() const = 0;
virtual int decimals() const = 0;
virtual bool parseNumberValue(const std::string& text) = 0;
virtual WString textFromValue() const = 0;
virtual WValidator *createValidator() = 0; // for nativeControl
virtual WValidator::Result validateRange() const = 0;
virtual int boxPadding(Orientation orientation) const;
bool changed_;
bool valueChangedConnection_;
private:
bool preferNative_, setup_;
WString prefix_, suffix_;
void defineJavaScript();
void connectJavaScript(Wt::EventSignalBase& s,
const std::string& methodName);
void setup();
bool parseValue(const WT_USTRING& text);
friend class SpinBoxValidator;
};
}
#endif // WABSTRACT_SPIN_BOX_H_
|