libyui-ncurses
NCTablePad.h
1 /*
2  Copyright (C) 2000-2012 Novell, Inc
3  Copyright (C) 2020 SUSE LLC
4  This library is free software; you can redistribute it and/or modify
5  it under the terms of the GNU Lesser General Public License as
6  published by the Free Software Foundation; either version 2.1 of the
7  License, or (at your option) version 3.0 of the License. This library
8  is distributed in the hope that it will be useful, but WITHOUT ANY
9  WARRANTY; without even the implied warranty of MERCHANTABILITY or
10  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
11  License for more details. You should have received a copy of the GNU
12  Lesser General Public License along with this library; if not, write
13  to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
14  Floor, Boston, MA 02110-1301 USA
15 */
16 
17 
18 /*-/
19 
20  File: NCTablePad.h
21 
22  Authors: Michael Andres <ma@suse.de>
23  Stefan Hundhammer <shundhammer@suse.de>
24 
25 /-*/
26 
27 #ifndef NCTablePad_h
28 #define NCTablePad_h
29 
30 #include <iosfwd>
31 #include <vector>
32 
33 #include "NCTablePadBase.h"
34 #include "NCTableItem.h"
35 #include "NCstring.h"
36 
37 
61 class NCTablePad : public NCTablePadBase
62 {
63 public:
64 
65  NCTablePad( int lines, int cols, const NCWidget & p );
66  virtual ~NCTablePad();
67 
68 public:
69 
80  virtual bool handleInput( wint_t key );
81 
82  bool setItemByKey( int key );
83 
84  void AssertMinCols( unsigned num )
85  {
86  _itemStyle.AssertMinCols( num );
87  }
88 
89  void SetSepChar( const chtype colSepchar )
90  {
91  _itemStyle.SetSepChar( colSepchar );
92  }
93 
94  void SetSepWidth( const unsigned sepwidth )
95  {
96  _itemStyle.SetSepWidth( sepwidth );
97  }
98 
99  unsigned HotCol() const
100  {
101  return _itemStyle.HotCol();
102  }
103 
104  void SetHotCol( int hcol )
105  {
106  _itemStyle.SetHotCol( hcol );
107  }
108 
116  int findIndexById( int id ) const;
117 
118  void stripHotkeys();
119 
120 
121 protected:
122 
128  virtual int DoRedraw();
129 
130  virtual void directDraw( NCursesWindow & w, const wrect at, unsigned lineno );
131 
132 
133 private:
134 
135  // Disable unwanted assignment operator and copy constructor
136 
137  NCTablePad & operator=( const NCTablePad & );
138  NCTablePad( const NCTablePad & );
139 };
140 
141 
142 #endif // NCTablePad_h
C++ class for windows.
Definition: ncursesw.h:906
static int lines()
Definition: ncursesw.h:1044
Definition: NCTablePad.h:61
static int cols()
Definition: ncursesw.h:1049
int findIndexById(int id) const
Definition: NCTablePad.cc:153
virtual void directDraw(NCursesWindow &w, const wrect at, unsigned lineno)
Definition: NCTablePad.cc:67
Definition: NCTablePadBase.h:58
void AssertMinCols(unsigned num)
Ensure we know width and alignment for at least num columns.
Definition: NCTableItem.h:560
A rectangle is defined by its position and size: wpos Pos, wsze Sze.
Definition: position.h:193
void SetSepWidth(const unsigned sepWidth)
total width of space between adjacent columns, including the separator character
Definition: NCTableItem.h:544
virtual int DoRedraw()
Definition: NCTablePad.cc:44
Definition: NCWidget.h:45
WINDOW * w
Definition: ncursesw.h:949
virtual bool handleInput(wint_t key)
Definition: NCTablePad.cc:81