/usr/include/Wt/Ext/AbstractButton is in libwtext-dev 3.3.6+dfsg-1.1.
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 | // 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_ABSTRACT_BUTTON_H_
#define EXT_ABSTRACT_BUTTON_H_
#include <Wt/Ext/Component>
#include <Wt/WJavaScript>
namespace Wt {
namespace Ext {
class Menu;
class ToolTipConfig;
/*! \class AbstractButton Wt/Ext/AbstractButton Wt/Ext/AbstractButton
* \brief Abstract base class for a (toolbar) button or menu item.
*
* You may set the button text using setText() and icon use setIcon(),
* and configure whether the button/menu item can be checked or
* toggled using setCheckable().
*
* To respond to a click, you can connect to the activated() signal,
* and for a checkable button/item you may listen to the toggled()
* signal.
*
* \sa Button, MenuItem, AbstractToggleButton
*
* \ingroup ext
*/
class WT_EXT_API AbstractButton : public Component
{
protected:
AbstractButton(WContainerWidget *parent = 0);
public:
/*! \brief Set the item text.
*/
void setText(const WString& text);
/*! \brief Get the item text.
*/
const WString& text() const { return text_; }
/*! \brief Set the item icon path.
*/
void setIcon(const std::string& path);
/*! \brief Get the item icon path.
*/
const std::string& icon() const { return icon_; }
/*! \brief Set if the item is checkable.
*/
void setCheckable(bool how);
/*! \brief Return if the item is checkable.
*/
bool isCheckable() const { return checkable_; }
/*! \brief Set a menu that popups up when the item is activated.
*/
void setMenu(Menu *menu);
/*! \brief Change the checked state.
*
* This is only used when the isCheckable() == true.
*
* \sa setCheckable(bool), isCheckable()
*/
void setChecked(bool how);
/*! \brief Get the checked state.
*/
bool isChecked() const { return checked_; }
/*! \brief Configure the tool tip associated with this item.
*
* If the config has no parent, then ownership is transferred to this
* widget.
*/
void configureToolTip(ToolTipConfig *config);
/*! \brief %Signal emitted when a item gets activated.
*
* This signal is emitted for non-checkable items (for who
* isCheckable() == false), when the user activates the item
* (by clicking it).
*
* \sa setCheckable(bool), isCheckable()
*/
JSignal<>& activated() { return activated_; }
/*! \brief %Signal emitted when a item gets toggled.
*
* This signal is emitted for checkable items (for who
* isCheckable() == false), when the user changed toggles the item
* state. The new state is passed as a parameter value.
*
* \sa setCheckable(bool), isCheckable()
*/
JSignal<bool>& toggled() { return toggled_; }
virtual void refresh();
protected:
std::string createJSHelper(const std::string& extClassName,
bool intoElement = false);
virtual void updateExt();
virtual void createConfig(std::ostream& js);
private:
JSignal<> activated_;
JSignal<bool> toggled_;
WString text_;
std::string icon_;
bool checkable_;
bool checked_;
Menu *menu_;
ToolTipConfig *toolTipConfig_;
virtual std::string checkMethodJS() const = 0;
virtual std::string checkEventJS() const = 0;
virtual std::string checkInitialState() const = 0;
void wasToggled(bool how);
};
}
}
#endif // EXT_ABSTRACT_BUTTON_H_
|