libyui-ncurses
NCCustomStatusItemSelector.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: NCCustomStatusItemSelector.h
20 
21  Author: Stefan Hundhammer <shundhammer@suse.de>
22 
23 /-*/
24 
25 #ifndef NCCustomStatusItemSelector_h
26 #define NCCustomStatusItemSelector_h
27 
28 #include <iosfwd>
29 #include <string>
30 
31 #include "NCItemSelector.h"
32 
33 
39 class NCCustomStatusTableTag: public NCTableTag // base class defined in NCTablePadBase.h
40 {
41 public:
42 
43  NCCustomStatusTableTag( YItemSelector * parentSelector, YItem * item );
44  virtual ~NCCustomStatusTableTag() {}
45 
46  virtual void DrawAt( NCursesWindow & w, const wrect at,
47  NCTableStyle & tableStyle,
48  NCTableLine::STATE linestate,
49  unsigned colidx ) const;
50 
51  virtual void SetSelected( bool sel );
52 
53  virtual bool Selected() const;
54 
55  virtual bool SingleSelection() const { return false; }
56 
60  int status() const;
61 
66  void setStatus( int newStatus );
67 
72  void updateStatusIndicator();
73 
74 protected:
75 
76  YItemSelector * _parentSelector;
77 };
78 
79 
80 
82 {
83  friend std::ostream & operator<<( std::ostream & str, const NCCustomStatusItemSelector & obj );
84 
85 public:
86 
90  NCCustomStatusItemSelector( YWidget * parent,
91  const YItemCustomStatusVector & customStates );
92 
97 
98  virtual const char * location() const { return "NCCustomStatusItemSelector"; }
99 
100 
101 protected:
102 
108  virtual NCTableTag * createTagCell( YItem * item );
109 
114  virtual void cycleCurrentItemStatus();
115 
120  virtual bool statusChangeAllowed( int fromStatus, int toStatus );
121 
126  virtual NCursesEvent valueChangedNotify( YItem * item );
127 
132  virtual NCCustomStatusTableTag * tagCell( int index ) const;
133 
140  virtual void updateCustomStatusIndicator( YItem * item );
141 
142 
143 private:
144 
145  // Disable assignment operator and copy constructor
146 
149 };
150 
151 
152 #endif // NCCustomStatusItemSelector_h
virtual bool statusChangeAllowed(int fromStatus, int toStatus)
Definition: NCCustomStatusItemSelector.cc:103
C++ class for windows.
Definition: ncursesw.h:906
Definition: NCurses.h:72
void setStatus(int newStatus)
Definition: NCCustomStatusItemSelector.cc:174
NCCustomStatusItemSelector(YWidget *parent, const YItemCustomStatusVector &customStates)
Definition: NCCustomStatusItemSelector.cc:34
virtual NCTableTag * createTagCell(YItem *item)
Definition: NCCustomStatusItemSelector.cc:48
virtual ~NCCustomStatusItemSelector()
Definition: NCCustomStatusItemSelector.cc:42
Definition: NCCustomStatusItemSelector.h:81
virtual NCursesEvent valueChangedNotify(YItem *item)
Definition: NCCustomStatusItemSelector.cc:116
virtual void cycleCurrentItemStatus()
Definition: NCCustomStatusItemSelector.cc:80
Styling for a NCTable: column widths, alignment and colors.
Definition: NCTableItem.h:522
Definition: NCCustomStatusItemSelector.h:39
A rectangle is defined by its position and size: wpos Pos, wsze Sze.
Definition: position.h:193
void updateStatusIndicator()
Definition: NCCustomStatusItemSelector.cc:139
virtual void updateCustomStatusIndicator(YItem *item)
Definition: NCCustomStatusItemSelector.cc:66
int status() const
Definition: NCCustomStatusItemSelector.cc:166
Definition: NCTableItem.h:646
Definition: NCItemSelector.h:37
virtual NCCustomStatusTableTag * tagCell(int index) const
Definition: NCCustomStatusItemSelector.cc:58