libyui  3.4.2
YMultiSelectionBox.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: YSelectionBox.h
20 
21  Author: Stefan Hundhammer <sh@suse.de>
22 
23 /-*/
24 
25 #ifndef YMultiSelectionBox_h
26 #define YMultiSelectionBox_h
27 
28 #include "YSelectionWidget.h"
29 
31 
32 
33 /**
34  * A variant of YSelectionBox where more than one item can be selected.
35  **/
37 {
38 protected:
39  /**
40  * Constructor.
41  **/
42  YMultiSelectionBox( YWidget * parent, const std::string & label );
43 
44 public:
45  /**
46  * Destructor.
47  **/
48  virtual ~YMultiSelectionBox();
49 
50  /**
51  * Returns a descriptive name of this widget class for logging,
52  * debugging etc.
53  **/
54  virtual const char * widgetClass() const { return "YMultiSelectionBox"; }
55 
56  /**
57  * Return 'true' if this MultiSelectionBox should be very small.
58  **/
59  bool shrinkable() const;
60 
61  /**
62  * Make this MultiSelectionBox very small. This will take effect only upon
63  * the next geometry management run.
64  *
65  * Derived classes can overwrite this, but should call this base class
66  * function in the new function.
67  **/
68  virtual void setShrinkable( bool shrinkable = true );
69 
70  /**
71  * Set a property.
72  * Reimplemented from YWidget.
73  *
74  * This function may throw YUIPropertyExceptions.
75  *
76  * This function returns 'true' if the value was successfully set and
77  * 'false' if that value requires special handling (not in error cases:
78  * those are covered by exceptions).
79  **/
80  virtual bool setProperty( const std::string & propertyName,
81  const YPropertyValue & val );
82 
83  /**
84  * Get a property.
85  * Reimplemented from YWidget.
86  *
87  * This method may throw YUIPropertyExceptions.
88  **/
89  virtual YPropertyValue getProperty( const std::string & propertyName );
90 
91  /**
92  * Return this class's property set.
93  * This also initializes the property upon the first call.
94  *
95  * Reimplemented from YWidget.
96  **/
97  virtual const YPropertySet & propertySet();
98 
99  /**
100  * The name of the widget property that will return user input.
101  * Inherited from YWidget.
102  **/
103  const char * userInputProperty() { return YUIProperty_SelectedItems; }
104 
105  /**
106  * Return the the item that currently has the keyboard focus
107  * or 0 if no item currently has the keyboard focus.
108  *
109  * Notice that for a MultiSelectionBox the current item is not necessarily
110  * selected, i.e., its check box may or may not be checked.
111  *
112  * Derived classes are required to implement this function.
113  **/
114  virtual YItem * currentItem() = 0;
115 
116  /**
117  * Set the keyboard focus to the specified item.
118  * 0 means clear the keyboard focus.
119  *
120  * Notice that for a MultiSelectionBox the current item is not necessarily
121  * selected, i.e., its check box may or may not be checked.
122  * Use selectItem() for that.
123  *
124  * Also notice that selectItem() does not make that newly selected item the
125  * current item.
126  *
127  * Derived classes are required to implement this function.
128  **/
129  virtual void setCurrentItem( YItem * item ) = 0;
130 
131  /**
132  * Save the widget's user input to a macro recorder.
133  *
134  * Reimplemented from YWidget because two properties need to be recorded.
135  **/
136  virtual void saveUserInput( YMacroRecorder *macroRecorder );
137 
138 private:
139 
141 };
142 
143 
144 #endif // YMultiSelectionBox_h
std::string label() const
Return this widget&#39;s label (the caption above the item list).
virtual const char * widgetClass() const
Returns a descriptive name of this widget class for logging, debugging etc.
Abstract base class for macro recorders.
Transport class for the value of simple properties.
Definition: YProperty.h:104
Base class for various kinds of multi-value widgets.
virtual YPropertyValue getProperty(const std::string &propertyName)
Get a property.
const char * userInputProperty()
The name of the widget property that will return user input.
A set of properties to check names and types against.
Definition: YProperty.h:197
YWidget * parent() const
Return this widget&#39;s parent or 0 if it doesn&#39;t have a parent.
Definition: YWidget.cc:269
A variant of YSelectionBox where more than one item can be selected.
virtual ~YMultiSelectionBox()
Destructor.
YMultiSelectionBox(YWidget *parent, const std::string &label)
Constructor.
Simple item class for SelectionBox, ComboBox, MultiSelectionBox etc.
Definition: YItem.h:49
virtual void saveUserInput(YMacroRecorder *macroRecorder)
Save the widget&#39;s user input to a macro recorder.
virtual const YPropertySet & propertySet()
Return this class&#39;s property set.
virtual bool setProperty(const std::string &propertyName, const YPropertyValue &val)
Set a property.
virtual void setCurrentItem(YItem *item)=0
Set the keyboard focus to the specified item.
virtual void setShrinkable(bool shrinkable=true)
Make this MultiSelectionBox very small.
bool shrinkable() const
Return &#39;true&#39; if this MultiSelectionBox should be very small.
virtual YItem * currentItem()=0
Return the the item that currently has the keyboard focus or 0 if no item currently has the keyboard ...
Abstract base class of all UI widgets.
Definition: YWidget.h:54