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: NCMenuButton.h 00020 00021 Author: Michael Andres <ma@suse.de> 00022 00023 /-*/ 00024 00025 #ifndef NCMenuButton_h 00026 #define NCMenuButton_h 00027 00028 #include <iosfwd> 00029 00030 #include <yui/YMenuButton.h> 00031 #include "NCApplication.h" 00032 #include "NCWidget.h" 00033 00034 00035 class NCMenuButton : public YMenuButton, public NCWidget 00036 { 00037 private: 00038 00039 friend std::ostream & operator<<( std::ostream & STREAM, const NCMenuButton & OBJ ); 00040 00041 NCMenuButton & operator=( const NCMenuButton & ); 00042 NCMenuButton( const NCMenuButton & ); 00043 00044 NClabel label; 00045 bool haveUtf8() { return YUI::app()->hasFullUtf8Support(); } 00046 00047 protected: 00048 00049 virtual const char * location() const { return "NCMenuButton"; } 00050 00051 virtual void wRedraw(); 00052 00053 NCursesEvent postMenu(); 00054 00055 public: 00056 00057 NCMenuButton( YWidget * parent, 00058 std::string label ); 00059 virtual ~NCMenuButton(); 00060 00061 virtual int preferredWidth(); 00062 virtual int preferredHeight(); 00063 00064 virtual void setSize( int newWidth, int newHeight ); 00065 00066 virtual void rebuildMenuTree(); 00067 00068 virtual NCursesEvent wHandleInput( wint_t key ); 00069 00070 virtual void setLabel( const std::string & nlabel ); 00071 00072 virtual void setEnabled( bool do_bv ); 00073 00074 YMenuItem * findItem( int selection ) { return findMenuItem( selection ); } 00075 00076 virtual bool setKeyboardFocus() 00077 { 00078 if ( !grabFocus() ) 00079 return YWidget::setKeyboardFocus(); 00080 00081 return true; 00082 } 00083 }; 00084 00085 00086 #endif // NCMenuButton_h