libyui-ncurses  2.44.1
 All Classes Functions Variables
NCPadWidget.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: NCPadWidget.h
20 
21  Author: Michael Andres <ma@suse.de>
22 
23 /-*/
24 
25 #ifndef NCPadWidget_h
26 #define NCPadWidget_h
27 
28 #include <iosfwd>
29 
30 #include "NCWidget.h"
31 #include "NCPad.h"
32 
33 class NCPadWidget;
34 class NCScrollbar;
35 
36 
37 class NCPadWidget : public NCWidget, protected NCSchrollCB
38 {
39 private:
40 
41  friend std::ostream & operator<<( std::ostream & STREAM, const NCPadWidget & OBJ );
42 
43  NCPadWidget & operator=( const NCPadWidget & );
44  NCPadWidget( const NCPadWidget & );
45 
46 
47  NClabel label;
48  NCursesWindow * padwin;
49  NCScrollbar * hsb;
50  NCScrollbar * vsb;
51 
52  wsze minPadSze;
53  bool multidraw;
54  NCPad * pad;
55 
56 protected:
57 
58  /**
59  * Return the current pad. Make it virtual so descendant classes
60  * can narrow the return type.
61  */
62  virtual NCPad * myPad() const { return pad; }
63 
64  bool hasHeadline;
65  bool activeLabelOnly;
66 
67  void startMultidraw() { multidraw = true; }
68 
69  void stopMultidraw() { multidraw = false; DrawPad(); }
70 
71  bool inMultidraw() const { return multidraw; }
72 
73 protected:
74 
75  virtual const char * location() const { return "NCPadWidget"; }
76 
77  // widget stuff
78  unsigned labelWidth() const { return label.width(); }
79 
80  virtual void wCreate( const wrect & newrect );
81  virtual void wDelete();
82  virtual void wRedraw();
83  virtual void wRecoded();
84 
85  // pad stuff
86  wsze defPadSze() const
87  {
88  if ( !padwin )
89  return 0;
90 
91  return wsze( padwin->height(), padwin->width() );
92  }
93 
94  virtual NCPad * CreatePad();
95  virtual void DrawPad();
96 
97  void InitPad();
98  void AdjustPad( wsze nsze );
99  void DelPad();
100 
101  // scroll hints
102  virtual void HScroll( unsigned total, unsigned visible, unsigned start );
103  virtual void VScroll( unsigned total, unsigned visible, unsigned start );
104  virtual void ScrollHead( NCursesWindow & w, unsigned ccol );
105 
106  // resize hints
107  virtual void AdjustPadSize( wsze & minsze );
108 
109  // input
110  virtual bool handleInput( wint_t key );
111 
112 public:
113 
114  NCPadWidget( NCWidget * myparent = 0 );
115  NCPadWidget( YWidget * parent );
116 
117  virtual ~NCPadWidget();
118 
119  size_t Columns( ) { return minPadSze.W; }
120 
121  void setLabel( const NClabel & nlabel );
122 
123  virtual void setEnabled( bool do_bv ) { NCWidget::setEnabled( do_bv ); }
124 };
125 
126 
127 #endif // NCPadWidget_h
C++ class for windows.
Definition: ncursesw.h:904
Definition: NCPad.h:93
int height() const
Definition: ncursesw.h:1070
virtual NCPad * myPad() const
Definition: NCPadWidget.h:62
virtual void setEnabled(bool do_bv)=0
Definition: NCWidget.cc:391
Definition: NCtext.h:81
virtual void setEnabled(bool do_bv)
Definition: NCPadWidget.h:123
Definition: position.h:154
int width() const
Definition: ncursesw.h:1075