libyui-ncurses
Loading...
Searching...
No Matches
NCMultiSelectionBox.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: NCMultiSelectionBox.h
20
21 Author: Michael Andres <ma@suse.de>
22
23/-*/
24
25#ifndef NCMultiSelectionBox_h
26#define NCMultiSelectionBox_h
27
28#include <iosfwd>
29
30#include <yui/YMultiSelectionBox.h>
31#include "NCPadWidget.h"
32#include "NCTablePad.h"
33
34
35class NCMultiSelectionBox : public YMultiSelectionBox, public NCPadWidget
36{
37
38 friend std::ostream & operator<<( std::ostream & str, const NCMultiSelectionBox & obj );
39
40 NCMultiSelectionBox & operator=( const NCMultiSelectionBox & );
42
43protected:
44
48 virtual NCTablePad * myPad() const
49 { return dynamic_cast<NCTablePad*>( NCPadWidget::myPad() ); }
50
51 NCTableTag * tagCell( int index );
52 const NCTableTag * tagCell( int index ) const;
53
54 bool isItemSelected( YItem *item );
55
56 void toggleCurrentItem();
57
58public:
59
60 virtual void startMultipleChanges() { startMultidraw(); }
61
62 virtual void doneMultipleChanges() { stopMultidraw(); }
63
64 virtual const char * location() const { return "NCMultiSelectionBox"; }
65
66 virtual void addItem( YItem * item );
67
68 virtual void deleteAllItems();
69
70 virtual void selectItem( YItem * item, bool selected );
71
72 virtual void deselectAllItems();
73
74protected:
75
76 virtual NCPad * CreatePad();
77 virtual void wRecoded();
78
79
80public:
81
82 NCMultiSelectionBox( YWidget * parent, const std::string & label );
83 virtual ~NCMultiSelectionBox();
84
85 virtual int preferredWidth();
86 virtual int preferredHeight();
87
88 virtual void setSize( int newWidth, int newHeight );
89
90 virtual void setLabel( const std::string & nlabel );
91
92 virtual YItem * currentItem();
93 virtual void setCurrentItem( YItem * item );
94
95 virtual NCursesEvent wHandleInput( wint_t key );
96
97 virtual void setEnabled( bool do_bv );
98
99 virtual bool setKeyboardFocus()
100 {
101 if ( !grabFocus() )
102 return YWidget::setKeyboardFocus();
103
104 return true;
105 }
106
107 unsigned getNumLines() { return myPad()->Lines(); }
108
109 const NCTableLine * getLine( int index ) { return myPad()->GetLine( index ); }
110
111 void clearItems() { return myPad()->ClearTable(); }
112};
113
114
115#endif // NCMultiSelectionBox_h
Definition NCMultiSelectionBox.h:36
virtual NCPad * CreatePad()
Definition NCMultiSelectionBox.cc:209
NCTableTag * tagCell(int index)
Definition NCMultiSelectionBox.cc:115
virtual NCTablePad * myPad() const
Definition NCMultiSelectionBox.h:48
void toggleCurrentItem()
Definition NCMultiSelectionBox.cc:191
virtual void setEnabled(bool do_bv)
Definition NCMultiSelectionBox.cc:60
Definition NCPadWidget.h:40
virtual NCPad * myPad() const
Definition NCPadWidget.h:64
Definition NCPad.h:113
Definition NCTableItem.h:68
Definition NCTablePad.h:62
Definition NCTableItem.h:647
Definition NCurses.h:73