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