/usr/include/Wt/Ext/ToolBar 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 136 137 | // 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_TOOLBAR_H_
#define EXT_TOOLBAR_H_
#include <Wt/Ext/Widget>
#include <Wt/Ext/Button>
#include <sstream>
namespace Wt {
namespace Ext {
class Menu;
class Panel;
/*! \class ToolBar Wt/Ext/ToolBar Wt/Ext/ToolBar
* \brief A class that represents a tool bar (or a menu bar).
*
* A tool bar shows buttons (and other widgets). When using text-only
* buttons, the tool bar behaves like a top-level menu.
*
* \image html ExtToolBar-1.png "Example of a ToolBar"
*
* \ingroup ext
*/
class WT_EXT_API ToolBar : public Widget
{
public:
/*! \brief Create a new tool bar.
*/
ToolBar(WContainerWidget *parent = 0);
/*! \brief Add a button with given text.
*/
Button *addButton(const WString& text);
/*! \brief Add a button with given icon and text.
*/
Button *addButton(const std::string& iconPath, const WString& text);
/*! \brief Add a button with given text, and specify a slot method to be
* called when activated.
*
* The <i>target</i> and <i>method</i> are connected to the
* Button::activated() signal.
*/
template<class T, class V>
Button *addButton(const WString& text,
T *target, void (V::*method)());
/*! \brief Add a button with given text and icon, and specify a slot
* method to be called when activated.
*
* The <i>target</i> and <i>method</i> are connected to the
* Button::activated() signal.
*/
template<class T, class V>
Button *addButton(const std::string& iconPath, const WString& text,
T *target, void (V::*method)());
/*! \brief Add a menu button, with given text.
*/
Button *addButton(const WString& text, Menu *menu);
/*! \brief Add a menu button, with given icon and text.
*/
Button *addButton(const std::string& iconPath, const WString& text,
Menu *menu);
/*! \brief Add a button to the tool bar.
*/
void add(Button *item);
/*! \brief Add a widget to the tool bar.
*/
void add(WWidget *item);
/*! \brief Insert a button in the tool bar.
*/
void insert(int index, Button *item);
/*! \brief Insert a widget in the tool bar.
*
* \note A widget can ony be inserted before initial rendering.
*/
void insert(int index, WWidget *item);
/*! \brief Add a separator to the tool bar.
*/
void addSeparator();
/*! \brief Adds stretch to the tool bar.
*
* This is an empty space that will stretch and push contents to the
* right of it away to the very right end.
*/
void addStretch();
protected:
void removeChild(WWidget *child);
std::vector<WWidget *> items_;
virtual void jsAfterPanelRendered(std::stringstream& js);
private:
virtual std::string createJS(DomElement *inContainer);
friend class Panel;
};
#ifndef JAVA
template<class T, class V>
Button *ToolBar::addButton(const WString& text,
T *target, void (V::*method)())
{
return addButton(std::string(), text, target, method);
}
template<class T, class V>
Button *ToolBar::addButton(const std::string& iconPath, const WString& text,
T *target, void (V::*method)())
{
Button *button = addButton(iconPath, text);
button->activated().connect(target, method);
return button;
}
#endif // JAVA
}
}
#endif // EXT_TOOLBAR_H_
|