libyui
YItemSelector.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: YItemSelector.h
20 
21  Author: Stefan Hundhammer <shundhammer@suse.de>
22 
23 /-*/
24 
25 #ifndef YItemSelector_h
26 #define YItemSelector_h
27 
28 #include "YSelectionWidget.h"
29 #include "YDescribedItem.h"
30 #include "YItemCustomStatus.h"
31 
32 
34 
44 {
45 public:
46 
51  bool enforceSingleSelection = true );
52 
81  const YItemCustomStatusVector & customStates );
82 
86  virtual ~YItemSelector();
87 
92  virtual const char * widgetClass() const;
93 
101  int visibleItems() const;
102 
110  virtual void setVisibleItems( int newVal );
111 
118  virtual void setItemStatus( YItem * item, int status );
119 
124  bool usingCustomStatus() const;
125 
130  int customStatusCount() const;
131 
138  const YItemCustomStatus & customStatus( int index );
139 
144  bool validCustomStatusIndex( int index ) const;
145 
152  int cycleCustomStatus( int oldStatus );
153 
164  virtual bool setProperty( const std::string & propertyName,
165  const YPropertyValue & val );
166 
173  virtual YPropertyValue getProperty( const std::string & propertyName );
174 
181  virtual const YPropertySet & propertySet();
182 
187  const char * userInputProperty() { return YUIProperty_Value; }
188 
194  virtual void activateItem( YItem * item ) = 0;
195 
196 protected:
197 
204  virtual void updateCustomStatusIndicator( YItem * item ) {}
205 
206 
207 private:
208 
212  void init();
213 
217  void checkCustomStates();
218 
219 
220  // Data members
221 
223 
224 }; // class YItemSelector
225 
226 #endif // YItemSelector_h
bool validCustomStatusIndex(int index) const
Definition: YItemSelector.cc:161
int cycleCustomStatus(int oldStatus)
Definition: YItemSelector.cc:196
virtual const YPropertySet & propertySet()
Definition: YItemSelector.cc:209
int visibleItems() const
Definition: YItemSelector.cc:100
Definition: YProperty.h:104
Definition: YSelectionWidget.h:45
Definition: YProperty.h:197
YWidget * parent() const
Definition: YWidget.cc:271
virtual const char * widgetClass() const
Definition: YItemSelector.cc:90
virtual void setItemStatus(YItem *item, int status)
Definition: YItemSelector.cc:115
virtual YPropertyValue getProperty(const std::string &propertyName)
Definition: YItemSelector.cc:260
Definition: YItemCustomStatus.h:44
Definition: YItemSelector.h:43
virtual ~YItemSelector()
Definition: YItemSelector.cc:74
virtual void activateItem(YItem *item)=0
Definition: YItem.h:55
YItemSelector(YWidget *parent, bool enforceSingleSelection=true)
Definition: YItemSelector.cc:46
virtual void setVisibleItems(int newVal)
Definition: YItemSelector.cc:106
virtual void updateCustomStatusIndicator(YItem *item)
Definition: YItemSelector.h:204
Definition: YItemSelector.cc:35
virtual bool setProperty(const std::string &propertyName, const YPropertyValue &val)
Definition: YItemSelector.cc:239
int customStatusCount() const
Definition: YItemSelector.cc:142
Definition: YWidget.h:54
const char * userInputProperty()
Definition: YItemSelector.h:187
bool enforceSingleSelection() const
Definition: YSelectionWidget.cc:111
const YItemCustomStatus & customStatus(int index)
Definition: YItemSelector.cc:149
bool usingCustomStatus() const
Definition: YItemSelector.cc:136