libyui  3.12.1
YMenuBar.h
1 /*
2  Copyright (c) [2020] SUSE LLC
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: YMenuBar.h
20 
21  Author: Stefan Hundhammer <shundhammer@suse.de>
22 
23 /-*/
24 
25 #ifndef YMenuBar_h
26 #define YMenuBar_h
27 
28 #include "YMenuWidget.h"
29 #include "YMenuItem.h"
30 
31 class YMenuBarPrivate;
32 
33 
34 /**
35  * A classical menu bar for pulldown menus.
36  *
37  * Use this only when appropriate: In most places, YaST follows a wizard-driven
38  * UI strategy, asking the user (ideally) one question at a time, with a [Next]
39  * and a [Back] button to move between wizard steps. One of the last steps is
40  * usually presenting the collected information to the user until everything is
41  * applied.
42  *
43  * A menu bar OTOH is meant for the opposite UI strategy: Presenting some kind
44  * of document (which may also be a number of input fields) to the user as the
45  * central point and providing lots of different operations on that document.
46  * The two concepts don't mix very well, so use this widget with caution.
47  *
48  * A menu bar should only contain menus, no direct actions.
49  **/
50 class YMenuBar: public YMenuWidget
51 {
52 protected:
53  /**
54  * Constructor.
55  **/
56  YMenuBar( YWidget * parent );
57 
58 public:
59 
60  /**
61  * Destructor.
62  **/
63  virtual ~YMenuBar();
64 
65  /**
66  * Create a new menu and add it.
67  **/
68  YMenuItem * addMenu( const std::string & label,
69  const std::string & iconName = "" );
70 
71  /**
72  * Returns a descriptive name of this widget class for logging,
73  * debugging etc.
74  **/
75  virtual const char * widgetClass() const { return "YMenuBar"; }
76 
77  /**
78  * Set a property.
79  * Reimplemented from YWidget.
80  *
81  * This function may throw YUIPropertyExceptions.
82  *
83  * This function returns 'true' if the value was successfully set and
84  * 'false' if that value requires special handling (not in error cases:
85  * those are covered by exceptions).
86  **/
87  virtual bool setProperty( const std::string & propertyName,
88  const YPropertyValue & val );
89 
90  /**
91  * Get a property.
92  * Reimplemented from YWidget.
93  *
94  * This method may throw YUIPropertyExceptions.
95  **/
96  virtual YPropertyValue getProperty( const std::string & propertyName );
97 
98  /**
99  * Return this class's property set.
100  * This also initializes the property upon the first call.
101  *
102  * Reimplemented from YWidget.
103  **/
104  virtual const YPropertySet & propertySet();
105 
106 
107 private:
108 
110 };
111 
112 
113 #endif // YMenuBar_h
YWidget::parent
YWidget * parent() const
Return this widget's parent or 0 if it doesn't have a parent.
Definition: YWidget.cc:271
YMenuBar::setProperty
virtual bool setProperty(const std::string &propertyName, const YPropertyValue &val)
Set a property.
Definition: YMenuBar.cc:100
YWidget
Abstract base class of all UI widgets.
Definition: YWidget.h:55
YMenuBar::propertySet
virtual const YPropertySet & propertySet()
Return this class's property set.
Definition: YMenuBar.cc:78
YMenuBar::YMenuBar
YMenuBar(YWidget *parent)
Constructor.
Definition: YMenuBar.cc:48
YMenuBarPrivate
Definition: YMenuBar.cc:38
YPropertySet
A set of properties to check names and types against.
Definition: YProperty.h:198
YMenuBar::~YMenuBar
virtual ~YMenuBar()
Destructor.
Definition: YMenuBar.cc:60
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< YMenuBarPrivate >
YMenuBar::widgetClass
virtual const char * widgetClass() const
Returns a descriptive name of this widget class for logging, debugging etc.
Definition: YMenuBar.h:75
YMenuBar
A classical menu bar for pulldown menus.
Definition: YMenuBar.h:51
YPropertyValue
Transport class for the value of simple properties.
Definition: YProperty.h:105
YMenuItem
Item class for menu items.
Definition: YMenuItem.h:44
YMenuBar::getProperty
virtual YPropertyValue getProperty(const std::string &propertyName)
Get a property.
Definition: YMenuBar.cc:117
YMenuBar::addMenu
YMenuItem * addMenu(const std::string &label, const std::string &iconName="")
Create a new menu and add it.
Definition: YMenuBar.cc:67