libyui-ncurses
 
Loading...
Searching...
No Matches
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
33class NCPadWidget;
34class NCScrollbar;
35
39class NCPadWidget : public NCWidget, protected NCSchrollCB
40{
41private:
42
43 friend std::ostream & operator<<( std::ostream & str, const NCPadWidget & obj );
44
45 NCPadWidget & operator=( const NCPadWidget & );
46 NCPadWidget( const NCPadWidget & );
47
48
49 NClabel label;
50 NCursesWindow * padwin;
51 NCScrollbar * hsb;
52 NCScrollbar * vsb;
53
54 wsze minPadSze;
55 bool multidraw;
56 NCPad * pad;
57
58protected:
59
64 virtual NCPad * myPad() const { return pad; }
65
66 bool hasHeadline;
67 bool activeLabelOnly;
68
69 void startMultidraw() { multidraw = true; }
70
71 void stopMultidraw() { multidraw = false; DrawPad(); }
72
73 bool inMultidraw() const { return multidraw; }
74
75protected:
76
77 virtual const char * location() const { return "NCPadWidget"; }
78
79 // widget stuff
80 unsigned labelWidth() const { return label.width(); }
81
82 virtual void wCreate( const wrect & newrect );
83 virtual void wDelete();
84 virtual void wRedraw();
85 virtual void wRecoded();
86
87 // pad stuff
88 wsze defPadSze() const
89 {
90 if ( !padwin )
91 return 0;
92
93 return wsze( padwin->height(), padwin->width() );
94 }
95
96 virtual NCPad * CreatePad();
97 virtual void DrawPad();
98
99 void InitPad();
100 void AdjustPad( wsze nsze );
101 void DelPad();
102
103 // scroll hints
104 virtual void HScroll( unsigned total, unsigned visible, unsigned start );
105 virtual void VScroll( unsigned total, unsigned visible, unsigned start );
106 virtual void ScrollHead( NCursesWindow & w, unsigned ccol );
107
108 // resize hints
109 virtual void AdjustPadSize( wsze & minsze );
110
111 // input
112 virtual bool handleInput( wint_t key );
113
114public:
115
116 NCPadWidget( NCWidget * myparent = 0 );
117 NCPadWidget( YWidget * parent );
118
119 virtual ~NCPadWidget();
120
121 size_t Columns() { return minPadSze.W; }
122
123 void setLabel( const NClabel & nlabel );
124
125 virtual void setEnabled( bool do_bv ) { NCWidget::setEnabled( do_bv ); }
126};
127
128
129#endif // NCPadWidget_h
Definition NCPadWidget.h:40
virtual void HScroll(unsigned total, unsigned visible, unsigned start)
Definition NCPadWidget.cc:505
virtual void VScroll(unsigned total, unsigned visible, unsigned start)
Definition NCPadWidget.cc:516
virtual void setEnabled(bool do_bv)
Definition NCPadWidget.h:125
virtual NCPad * myPad() const
Definition NCPadWidget.h:64
Definition NCPad.h:113
Interface for scroll callbacks.
Definition NCPad.h:36
Definition NCPadWidget.cc:49
virtual void setEnabled(bool do_bv)=0
Definition NCWidget.cc:392
Multi-line string, with optional hotkey, drawable.
Definition NCtext.h:82
C++ class for windows.
Definition ncursesw.h:907
Screen dimension (screen size) in the order height, width: (H, W)
Definition position.h:154