/usr/include/Wt/Ext/FormField is in libwtext-dev 3.1.10-1ubuntu2.
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 | // This may look like C code, but it's really -*- C++ -*-
/*
* Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.
*
* See the LICENSE file for terms of use.
*/
#ifndef EXT_FORMFIELD_H_
#define EXT_FORMFIELD_H_
#include <Wt/Ext/Component>
#include <Wt/WValidator>
#include <sstream>
namespace Wt {
class WLabel;
class WFormWidget;
namespace Ext {
/*! \class FormField Wt/Ext/FormField Wt/Ext/FormField
* \brief An abstract base class for form fields.
*
* \ingroup ext
*/
class WT_EXT_API FormField : public Component
{
protected:
/*! \brief Create a form field.
*/
FormField(WContainerWidget *parent = 0);
public:
/*! \brief The location of the validation error message.
*/
enum MessageLocation {
FancyToolTip, //!< Display in a fancy (JavaScript) tool tip
PlainToolTip, //!< Display in a plain HTML tool tip
Below, //!< Display below the field
Besides //!< Display next to the field
};
/*! \brief Set the location of the validation error message.
*/
void setErrorMessageLocation(MessageLocation location);
/*! \brief Set a validator.
*
* The validator will be used for both client side and server side
* validation (if it is, or inherits from, one of the four
* validators provided by %Wt: WDateValidator, WDoubleValidator,
* WIntValidator, WLengthValidator, WRegExpValidator).
*
* If the validator has no parent yet, ownership of the validator is
* transferred to the form field.
*
* \sa validate()
*/
void setValidator(WValidator *validator);
/*! \brief Return the validator.
*/
WValidator *validator() const { return validator_; }
/*! \brief Validate the field.
*/
virtual WValidator::State validate();
/*! \brief Return the label associate with this formfield
*
* Returns the label (if there is one) that acts as a proxy for this widget.
*
* \sa WLabel::setBuddy(Ext::FormField *)
*/
WLabel *label() const;
/*! \brief Give focus to this widget.
*/
void setFocus();
virtual void refresh();
/*! \brief Signal emitted when the value was changed.
*/
EventSignal<>& changed();
/*! \brief Signal emitted when the widget lost focus.
*/
EventSignal<>& blurred();
/*! \brief Signal emitted when the widget recieved focus.
*/
EventSignal<>& focussed();
protected:
void applyToWidget(WWebWidget *widget, std::stringstream& js,
DomElement *inContainer);
void createConfig(std::ostream& config);
virtual WFormWidget *formWidget() const = 0;
virtual void render(WFlags<RenderFlag> flags);
private:
MessageLocation errorMessageLocation_;
WValidator *validator_;
bool focusWhenRendered_;
virtual void useAsTableViewEditor() = 0;
friend class TableView;
friend class Wt::WLabel;
};
}
}
#endif // EXT_FORMFIELD_H_
|