libyui
3.0.10
|
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: YDumbTab.h 00020 00021 Author: Stefan Hundhammer <sh@suse.de> 00022 00023 /-*/ 00024 00025 #ifndef YDumbTab_h 00026 #define YDumbTab_h 00027 00028 #include "YSelectionWidget.h" 00029 00030 class YDumbTabPrivate; 00031 00032 /** 00033 * DumbTab: A very simple tab widget that can display and switch between a 00034 * number of tabs, but will only deliver the "user clicked on tab " event very 00035 * much like a PushButton does. Actually exchanging the content of the tab is 00036 * left to the application. 00037 * 00038 * DumbTab accepts a single child widget. 00039 **/ 00040 class YDumbTab : public YSelectionWidget 00041 { 00042 protected: 00043 /** 00044 * Constructor. 00045 **/ 00046 YDumbTab( YWidget * parent ); 00047 00048 public: 00049 /** 00050 * Destructor. 00051 **/ 00052 virtual ~YDumbTab(); 00053 00054 /** 00055 * Returns a descriptive name of this widget class for logging, 00056 * debugging etc. 00057 **/ 00058 virtual const char * widgetClass() const { return "YDumbTab"; } 00059 00060 /** 00061 * Add an item (a tab page). 00062 * 00063 * Reimplemented from YSelectionWidget. 00064 * 00065 * Derived classes can overwrite this function, but they should call this 00066 * base class function in the new implementation. 00067 **/ 00068 virtual void addItem( YItem * item ); 00069 00070 /** 00071 * Notification that any shortcut of any item was changed by the shortcut 00072 * conflict manager. 00073 * 00074 * Derived classes should reimplement this. 00075 **/ 00076 virtual void shortcutChanged() {} 00077 00078 /** 00079 * Set a property. 00080 * Reimplemented from YWidget. 00081 * 00082 * This method may throw exceptions, for example 00083 * - if there is no property with that name 00084 * - if the expected type and the type mismatch 00085 * - if the value is out of range 00086 * 00087 * This function returns 'true' if the value was successfully set and 00088 * 'false' if that value requires special handling (not in error cases: 00089 * those are covered by exceptions). 00090 **/ 00091 virtual bool setProperty( const std::string & propertyName, 00092 const YPropertyValue & val ); 00093 00094 /** 00095 * Get a property. 00096 * Reimplemented from YWidget. 00097 * 00098 * This method may throw exceptions, for example 00099 * - if there is no property with that name 00100 **/ 00101 virtual YPropertyValue getProperty( const std::string & propertyName ); 00102 00103 /** 00104 * Return this class's property set. 00105 * This also initializes the property set upon the first call. 00106 * 00107 * Reimplemented from YWidget. 00108 **/ 00109 virtual const YPropertySet & propertySet(); 00110 00111 /** 00112 * Get the string of this widget that holds the keyboard shortcut. 00113 * Notice that since YDumbTab has one shortcut for each tab page (for each 00114 * item), this is not meaningful for this widget class. 00115 * 00116 * Check YItemShortcut in YShortcut.{cc,h} for more details. 00117 * 00118 * Reimplemented from YSelectionWidget. 00119 **/ 00120 virtual std::string shortcutString() const { return ""; } 00121 00122 /** 00123 * Set the string of this widget that holds the keyboard shortcut. 00124 * Since YDumbTab doesn't have a shortcut for the widget itself (only for 00125 * the tab pages, i.e. the items), this will simply trigger a 00126 * shortcutChanged() notification. 00127 * 00128 * Reimplemented from YSelectionWidget. 00129 **/ 00130 virtual void setShortcutString( const std::string & str ) { shortcutChanged(); } 00131 00132 /** 00133 * Returns 'true' if this widget is stretchable in the specified dimension. 00134 * In this case, the stretchability of the single child is returned. 00135 * 00136 * Reimplemented from YWidget. 00137 **/ 00138 virtual bool stretchable( YUIDimension dim ) const; 00139 00140 /** 00141 * Descriptive label for debugging. Derived from this widget's only child 00142 * (if there is one). 00143 **/ 00144 virtual std::string debugLabel() const; 00145 00146 private: 00147 00148 // Disable unwanted base class methods 00149 std::string label() const; 00150 virtual void setLabel( const std::string & newLabel ) {}; 00151 00152 00153 ImplPtr<YDumbTabPrivate> priv; 00154 }; 00155 00156 00157 #endif // YDumbTab_h