libyui-ncurses  2.44.1
 All Classes Functions Variables
NCSelectionBox.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: NCSelectionBox.h
20 
21  Author: Michael Andres <ma@suse.de>
22 
23 /-*/
24 
25 #ifndef NCSelectionBox_h
26 #define NCSelectionBox_h
27 
28 #include <iosfwd>
29 
30 #include <yui/YSelectionBox.h>
31 #include "NCPadWidget.h"
32 #include "NCTablePad.h"
33 
34 
35 class NCSelectionBox : public YSelectionBox, public NCPadWidget
36 {
37 
38  friend std::ostream & operator<<( std::ostream & STREAM, const NCSelectionBox & OBJ );
39 
40  NCSelectionBox & operator=( const NCSelectionBox & );
41  NCSelectionBox( const NCSelectionBox & );
42 
43 protected:
44 
45  /**
46  * Overload myPad to narrow the type
47  */
48  virtual NCTablePad * myPad() const
49  { return dynamic_cast<NCTablePad*>( NCPadWidget::myPad() ); }
50 
51  bool biglist;
52 
53 protected:
54 
55  virtual const char * location() const { return "NCSelectionBox"; }
56 
57  virtual NCPad * CreatePad();
58  virtual void wRecoded();
59 
60 public:
61 
62  NCSelectionBox( YWidget * parent, const std::string & label );
63  virtual ~NCSelectionBox();
64 
65  bool bigList() const { return biglist; }
66 
67  void setBigList( const bool big ) { biglist = big; }
68 
69  virtual void addItem( YItem *item );
70  virtual void addItem( const std::string & itemLabel, bool selected = false );
71 
72  virtual int preferredWidth();
73  virtual int preferredHeight();
74 
75  virtual void setSize( int newWidth, int newHeight );
76 
77  virtual void setLabel( const std::string & nlabel );
78 
79  virtual int getCurrentItem();
80  virtual void setCurrentItem( int index );
81 
82  virtual void selectItem( YItem *item, bool selected );
83  virtual void selectItem( int index );
84 
85  virtual NCursesEvent wHandleInput( wint_t key );
86 
87  virtual void setEnabled( bool do_bv );
88 
89  virtual bool setKeyboardFocus()
90  {
91  if ( !grabFocus() )
92  return YWidget::setKeyboardFocus();
93 
94  return true;
95  }
96 
97  std::string getLine( const int & index );
98  void clearTable( ) { myPad()->ClearTable(); };
99 
100  void deleteAllItems();
101 };
102 
103 
104 #endif // NCSelectionBox_h
Definition: NCPad.h:93
virtual NCPad * myPad() const
Definition: NCPadWidget.h:62
virtual NCTablePad * myPad() const
virtual void setEnabled(bool do_bv)