libyui
YDescribedItem.h
1 /*
2  Copyright (c) [2019] 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: YDescribedItem.h
20 
21  Author: Stefan Hundhammer <shundhammer@suse.de>
22 
23 /-*/
24 
25 #ifndef YDescribedItem_h
26 #define YDescribedItem_h
27 
28 #include "YItem.h"
29 
30 
35 class YDescribedItem: public YItem
36 {
37 public:
38 
43  YDescribedItem( const std::string & label,
44  const std::string & description = "",
45  bool selected = false )
46  : YItem( label, selected )
47  , _description( description )
48  , _enabled( true )
49  {}
50 
55  YDescribedItem( const std::string & label,
56  const std::string & description,
57  const std::string & iconName,
58  bool selected = false )
60  , _description( description )
61  , _enabled( true )
62  {}
63 
67  virtual ~YDescribedItem() {}
68 
74  std::string description() const { return _description; }
75 
79  void setDescription( const std::string & desc ) { _description = desc; }
80 
85  bool enabled() const { return _enabled; }
86 
94  void setEnabled( bool value ) { _enabled = value; }
95 
96 private:
97 
98  std::string _description;
99  bool _enabled;
100 
101 }; // class YDescribedItem
102 
103 #endif // YDescribedItem_h
std::string label() const
Definition: YItem.h:97
void setEnabled(bool value)
Definition: YDescribedItem.h:94
bool selected() const
Definition: YItem.h:122
virtual ~YDescribedItem()
Definition: YDescribedItem.h:67
std::string iconName() const
Definition: YItem.h:107
bool enabled() const
Definition: YDescribedItem.h:85
YDescribedItem(const std::string &label, const std::string &description="", bool selected=false)
Definition: YDescribedItem.h:43
std::string description() const
Definition: YDescribedItem.h:74
Definition: YItem.h:55
void setDescription(const std::string &desc)
Definition: YDescribedItem.h:79
Definition: YDescribedItem.h:35
YDescribedItem(const std::string &label, const std::string &description, const std::string &iconName, bool selected=false)
Definition: YDescribedItem.h:55