/usr/include/Wt/WSubMenuItem 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 | // 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 WSUB_MENU_ITEM_H_
#define WSUB_MENU_ITEM_H_
#include <Wt/WMenuItem>
namespace Wt {
class WMenu;
/*! \brief A menu item that contains a nested sub menu.
*
* This class specializes menu item to have an optional sub menu.
*
* When the item is shown and hidden when the item is selected
* respectively deselected.
*
* \if cpp
* Usage example:
* \code
* // create the stack where the contents will be located
* Wt::WStackedWidget *contents = new Wt::WStackedWidget();
*
* // create a top-level menu
* Wt::WMenu *menu = new Wt::WMenu(contents, Wt::Vertical);
*
* // add two plain items
* menu->addItem("Introduction", new Wt::WText(tr("intro"));
* menu->addItem("Download", new Wt::WText("Not yet available"));
* // add an item with a sub menu
* Wt::WSubMenuItem *examples = new Wt::WSubMenuItem("Examples", new Wt::WText(tr("examples")));
* Wt::WMenu *examplesMenu = new Wt::WMenu(contents, Wt::Vertical);
* examplesMenu->addItem("Hello world", new Wt::WText(tr("example.hello-world")));
* examplesMenu->addItem("Shopping cart", new Wt::WText(tr("example.shopping")));
* examples->setSubMenu(examplesMenu);
* menu->addItem(examples);
*
* addWidget(menu);
* addWidget(contents);
* \endcode
* \endif
*
* \sa WMenuItem, WMenu
*/
class WT_API WSubMenuItem : public WMenuItem
{
public:
/*! \brief Creates a new item.
*
* \sa WMenuItem::WMenuItem(const WString&, WWidget *, LoadPolicy)
*/
WSubMenuItem(const WString& text, WWidget *contents,
LoadPolicy policy = LazyLoading);
/*! \brief Sets a sub menu.
*
* Ownership of the \p subMenu is transferred to the item. In
* most cases, the sub menu would use the same contents stack as the
* parent menu.
*
* The default submenu is \c 0, in which case the item behaves as a
* plain WMenuItem.
*
* \note A sub menu can only be set before the item is added to a menu.
*/
void setSubMenu(WMenu *subMenu);
/*! \brief Returns the sub menu.
*
* \sa setSubMenu()
*/
WMenu *subMenu() { return subMenu_; }
virtual std::string pathComponent() const;
protected:
virtual WWidget *createItemWidget();
virtual void updateItemWidget(WWidget *itemWidget);
virtual void renderSelected(bool selected);
virtual SignalBase& activateSignal();
virtual void setFromInternalPath(const std::string& path);
private:
WMenu *subMenu_;
void subItemSelected();
};
}
#endif // SUB_MENU_ITEM_H_
|