libyui-ncurses
2.44.1
|
00001 /* 00002 Copyright (C) 2000-2012 Novell, Inc 00003 This library is free software; you can redistribute it and/or modify 00004 it under the terms of the GNU Lesser General Public License as 00005 published by the Free Software Foundation; either version 2.1 of the 00006 License, or (at your option) version 3.0 of the License. This library 00007 is distributed in the hope that it will be useful, but WITHOUT ANY 00008 WARRANTY; without even the implied warranty of MERCHANTABILITY or 00009 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 00010 License for more details. You should have received a copy of the GNU 00011 Lesser General Public License along with this library; if not, write 00012 to the Free Software Foundation, Inc., 51 Franklin Street, Fifth 00013 Floor, Boston, MA 02110-1301 USA 00014 */ 00015 00016 00017 /*-/ 00018 00019 File: NCSelectionBox.h 00020 00021 Author: Michael Andres <ma@suse.de> 00022 00023 /-*/ 00024 00025 #ifndef NCSelectionBox_h 00026 #define NCSelectionBox_h 00027 00028 #include <iosfwd> 00029 00030 #include <yui/YSelectionBox.h> 00031 #include "NCPadWidget.h" 00032 #include "NCTablePad.h" 00033 00034 00035 class NCSelectionBox : public YSelectionBox, public NCPadWidget 00036 { 00037 00038 friend std::ostream & operator<<( std::ostream & STREAM, const NCSelectionBox & OBJ ); 00039 00040 NCSelectionBox & operator=( const NCSelectionBox & ); 00041 NCSelectionBox( const NCSelectionBox & ); 00042 00043 protected: 00044 00045 /** 00046 * Overload myPad to narrow the type 00047 */ 00048 virtual NCTablePad * myPad() const 00049 { return dynamic_cast<NCTablePad*>( NCPadWidget::myPad() ); } 00050 00051 bool biglist; 00052 00053 protected: 00054 00055 virtual const char * location() const { return "NCSelectionBox"; } 00056 00057 virtual NCPad * CreatePad(); 00058 virtual void wRecoded(); 00059 00060 public: 00061 00062 NCSelectionBox( YWidget * parent, const std::string & label ); 00063 virtual ~NCSelectionBox(); 00064 00065 bool bigList() const { return biglist; } 00066 00067 void setBigList( const bool big ) { biglist = big; } 00068 00069 virtual void addItem( YItem *item ); 00070 virtual void addItem( const std::string & itemLabel, bool selected = false ); 00071 00072 virtual int preferredWidth(); 00073 virtual int preferredHeight(); 00074 00075 virtual void setSize( int newWidth, int newHeight ); 00076 00077 virtual void setLabel( const std::string & nlabel ); 00078 00079 virtual int getCurrentItem(); 00080 virtual void setCurrentItem( int index ); 00081 00082 virtual void selectItem( YItem *item, bool selected ); 00083 virtual void selectItem( int index ); 00084 00085 virtual NCursesEvent wHandleInput( wint_t key ); 00086 00087 virtual void setEnabled( bool do_bv ); 00088 00089 virtual bool setKeyboardFocus() 00090 { 00091 if ( !grabFocus() ) 00092 return YWidget::setKeyboardFocus(); 00093 00094 return true; 00095 } 00096 00097 std::string getLine( const int & index ); 00098 void clearTable( ) { myPad()->ClearTable(); }; 00099 00100 void deleteAllItems(); 00101 }; 00102 00103 00104 #endif // NCSelectionBox_h