/usr/include/Wt/WAbstractToggleButton is in libwt-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 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | // 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 WABSTRACTTOGGLEBUTTON_H_
#define WABSTRACTTOGGLEBUTTON_H_
#include <Wt/WFormWidget>
namespace Wt {
class WLabel;
/*! \brief An abstract base class for radio buttons and check boxes.
*
* A toggle button provides a button with a boolean state (checked or
* unchecked), and a text label.
*
* To act on a change of the state, either connect a slot to the changed()
* signal, or connect a slot to the checked() or unChecked() signals.
*
* The current state (checked or unchecked) may be inspected using the
* isChecked() method.
*/
class WT_API WAbstractToggleButton : public WFormWidget
{
protected:
/*! \brief Creates an unchecked toggle button without label.
*/
WAbstractToggleButton(WContainerWidget *parent = 0);
/*! \brief Creates an unchecked toggle button with given text label.
*
* The text label is rendered to the right side of the button.
*/
WAbstractToggleButton(const WString& text, WContainerWidget *parent = 0);
public:
/*! \brief Destructor.
*/
virtual ~WAbstractToggleButton();
/*! \brief Sets the label text.
*
* The label is rendered to the right fo the button.
*/
void setText(const WString& text);
/*! \brief Returns the label text.
*
* \sa setText()
*/
const WString text() const;
/*! \brief Returns the button state.
*
* \sa setChecked()
*/
bool isChecked() const { return state_ == Checked; }
/*! \brief Sets the button state.
*
* This method does not emit one of the checked() or unChecked()
* signals.
*
* \sa setChecked(), setUnChecked()
*/
void setChecked(bool checked);
/*! \brief Checks the button.
*
* Does not emit the checked() signal.
*
* \sa setChecked(bool)
*/
virtual void setChecked();
/*! \brief Unchecks the button.
*
* Does not emit the unChecked() signal.
*
* \sa setChecked(bool)
*/
virtual void setUnChecked();
/*! \brief %Signal emitted when the button gets checked.
*
* This signal is emitted when the user checks the button.
*
* You can use the changed() signal to react to any change of the
* button state.
*/
EventSignal<>& checked();
/*! \brief %Signal emitted when the button gets unChecked.
*
* This signal is emitted when the user unchecks the button.
*
* You can use the changed() signal to react to any change of the
* button state.
*/
EventSignal<>& unChecked();
protected:
CheckState state_;
virtual void updateInput(DomElement& input, bool all) = 0;
virtual void updateDom(DomElement& element, bool all);
virtual void getFormObjects(FormObjectsMap& formObjects);
virtual void setFormData(const FormData& formData);
virtual void propagateRenderOk(bool deep);
virtual DomElementType domElementType() const;
virtual bool supportsIndeterminate(const WEnvironment& env) const;
virtual std::string formName() const;
virtual WStatelessSlot *getStateless(Method method);
private:
static const char *CHECKED_SIGNAL;
static const char *UNCHECKED_SIGNAL;
static const char *UNDETERMINATE_CLICK_SIGNAL;
bool stateChanged_;
CheckState prevState_;
void undoSetChecked();
void undoSetUnChecked();
void setCheckState(CheckState state);
friend class WCheckBox;
friend class WRadioButton;
friend class WButtonGroup;
};
}
#endif // WABSTRACTTOGGLEBUTTON_H_
|