libyui
3.12.1
YMenuButton.h
1
/*
2
Copyright (C) 2000-2012 Novell, Inc
3
This library is free software; you can redistribute it and/or modify
4
it under the terms of the GNU Lesser General Public License as
5
published by the Free Software Foundation; either version 2.1 of the
6
License, or (at your option) version 3.0 of the License. This library
7
is distributed in the hope that it will be useful, but WITHOUT ANY
8
WARRANTY; without even the implied warranty of MERCHANTABILITY or
9
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10
License for more details. You should have received a copy of the GNU
11
Lesser General Public License along with this library; if not, write
12
to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
13
Floor, Boston, MA 02110-1301 USA
14
*/
15
16
17
/*-/
18
19
File: YMenuButton.h
20
21
Author: Stefan Hundhammer <shundhammer@suse.de>
22
23
/-*/
24
25
#ifndef YMenuButton_h
26
#define YMenuButton_h
27
28
#include "YMenuWidget.h"
29
#include "YMenuItem.h"
30
31
class
YMenuButtonPrivate
;
32
33
34
/**
35
* MenuButton: Similar to PushButton, but with several actions: Upon clicking
36
* on a MenuButton (or activating it with the keyboard), a pop-up menu opens
37
* where the user can activate an action. Menu items in that pop-up menu can
38
* have submenus (that will pop up in separate pop-up menus).
39
*
40
* Internally, this widget is more similar to the Tree widget. The difference
41
* is that it does not keep a "selected" status, but triggers an action right
42
* away, just like a PushButton. Like PushButton, MenuButton sends an event
43
* right away when the user selects an item (clicks on a menu item or activates
44
* it with the keyboard). Items that have a submenu never send an event, they
45
* simply open their submenu when activated.
46
**/
47
class
YMenuButton
:
public
YMenuWidget
48
{
49
protected
:
50
/**
51
* Constructor.
52
*
53
* 'label' is the user-visible text on the button (not above it like all
54
* other SelectionWidgets).
55
**/
56
YMenuButton
(
YWidget
*
parent
,
const
std::string &
label
);
57
58
public
:
59
60
/**
61
* Destructor.
62
**/
63
virtual
~YMenuButton
();
64
65
/**
66
* Create a new menu item and add it.
67
**/
68
YMenuItem
*
addItem
(
const
std::string &
label
,
69
const
std::string & iconName =
""
);
70
71
/**
72
* Create a new submenu and add it.
73
**/
74
YMenuItem
*
addMenu
(
const
std::string &
label
,
75
const
std::string & iconName =
""
);
76
77
/**
78
* Create a new menu separator and add it.
79
**/
80
YMenuItem
*
addSeparator
();
81
82
/**
83
* Returns a descriptive name of this widget class for logging,
84
* debugging etc.
85
**/
86
virtual
const
char
*
widgetClass
()
const
{
return
"YMenuButton"
; }
87
88
/**
89
* Set a property.
90
* Reimplemented from YWidget.
91
*
92
* This function may throw YUIPropertyExceptions.
93
*
94
* This function returns 'true' if the value was successfully set and
95
* 'false' if that value requires special handling (not in error cases:
96
* those are covered by exceptions).
97
**/
98
virtual
bool
setProperty
(
const
std::string & propertyName,
99
const
YPropertyValue
& val );
100
101
/**
102
* Get a property.
103
* Reimplemented from YWidget.
104
*
105
* This method may throw YUIPropertyExceptions.
106
**/
107
virtual
YPropertyValue
getProperty
(
const
std::string & propertyName );
108
109
/**
110
* Return this class's property set.
111
* This also initializes the property upon the first call.
112
*
113
* Reimplemented from YWidget.
114
**/
115
virtual
const
YPropertySet
&
propertySet
();
116
117
118
private
:
119
120
ImplPtr<YMenuButtonPrivate>
priv;
121
};
122
123
124
#endif // YMenuButton_h
YWidget::parent
YWidget * parent() const
Return this widget's parent or 0 if it doesn't have a parent.
Definition:
YWidget.cc:271
YWidget
Abstract base class of all UI widgets.
Definition:
YWidget.h:55
YMenuButton::widgetClass
virtual const char * widgetClass() const
Returns a descriptive name of this widget class for logging, debugging etc.
Definition:
YMenuButton.h:86
YMenuButton::propertySet
virtual const YPropertySet & propertySet()
Return this class's property set.
Definition:
YMenuButton.cc:94
YMenuButton::addMenu
YMenuItem * addMenu(const std::string &label, const std::string &iconName="")
Create a new submenu and add it.
Definition:
YMenuButton.cc:73
YMenuButton::~YMenuButton
virtual ~YMenuButton()
Destructor.
Definition:
YMenuButton.cc:55
YPropertySet
A set of properties to check names and types against.
Definition:
YProperty.h:198
YMenuButton::addItem
YMenuItem * addItem(const std::string &label, const std::string &iconName="")
Create a new menu item and add it.
Definition:
YMenuButton.cc:62
YMenuButton
MenuButton: Similar to PushButton, but with several actions: Upon clicking on a MenuButton (or activa...
Definition:
YMenuButton.h:48
YSelectionWidget::label
std::string label() const
Return this widget's label (the caption above the item list).
Definition:
YSelectionWidget.cc:99
YMenuWidget
Abstract base class for widgets that handle menus, e.g.
Definition:
YMenuWidget.h:39
ImplPtr< YMenuButtonPrivate >
YMenuButton::setProperty
virtual bool setProperty(const std::string &propertyName, const YPropertyValue &val)
Set a property.
Definition:
YMenuButton.cc:116
YMenuButton::YMenuButton
YMenuButton(YWidget *parent, const std::string &label)
Constructor.
Definition:
YMenuButton.cc:47
YPropertyValue
Transport class for the value of simple properties.
Definition:
YProperty.h:105
YMenuItem
Item class for menu items.
Definition:
YMenuItem.h:44
YMenuButton::getProperty
virtual YPropertyValue getProperty(const std::string &propertyName)
Get a property.
Definition:
YMenuButton.cc:133
YMenuButton::addSeparator
YMenuItem * addSeparator()
Create a new menu separator and add it.
Definition:
YMenuButton.cc:84
YMenuButtonPrivate
Definition:
YMenuButton.cc:37
src
YMenuButton.h
Generated by
1.8.20