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: YSelectionBox.h 00020 00021 Author: Stefan Hundhammer <sh@suse.de> 00022 00023 /-*/ 00024 00025 #ifndef YMultiSelectionBox_h 00026 #define YMultiSelectionBox_h 00027 00028 #include "YSelectionWidget.h" 00029 00030 class YMultiSelectionBoxPrivate; 00031 00032 00033 class YMultiSelectionBox : public YSelectionWidget 00034 { 00035 protected: 00036 /** 00037 * Constructor. 00038 **/ 00039 YMultiSelectionBox( YWidget * parent, const std::string & label ); 00040 00041 public: 00042 /** 00043 * Destructor. 00044 **/ 00045 virtual ~YMultiSelectionBox(); 00046 00047 /** 00048 * Returns a descriptive name of this widget class for logging, 00049 * debugging etc. 00050 **/ 00051 virtual const char * widgetClass() const { return "YMultiSelectionBox"; } 00052 00053 /** 00054 * Return 'true' if this MultiSelectionBox should be very small. 00055 **/ 00056 bool shrinkable() const; 00057 00058 /** 00059 * Make this MultiSelectionBox very small. This will take effect only upon 00060 * the next geometry management run. 00061 * 00062 * Derived classes can overwrite this, but should call this base class 00063 * function in the new function. 00064 **/ 00065 virtual void setShrinkable( bool shrinkable = true ); 00066 00067 /** 00068 * Set a property. 00069 * Reimplemented from YWidget. 00070 * 00071 * This function may throw YUIPropertyExceptions. 00072 * 00073 * This function returns 'true' if the value was successfully set and 00074 * 'false' if that value requires special handling (not in error cases: 00075 * those are covered by exceptions). 00076 **/ 00077 virtual bool setProperty( const std::string & propertyName, 00078 const YPropertyValue & val ); 00079 00080 /** 00081 * Get a property. 00082 * Reimplemented from YWidget. 00083 * 00084 * This method may throw YUIPropertyExceptions. 00085 **/ 00086 virtual YPropertyValue getProperty( const std::string & propertyName ); 00087 00088 /** 00089 * Return this class's property set. 00090 * This also initializes the property upon the first call. 00091 * 00092 * Reimplemented from YWidget. 00093 **/ 00094 virtual const YPropertySet & propertySet(); 00095 00096 /** 00097 * The name of the widget property that will return user input. 00098 * Inherited from YWidget. 00099 **/ 00100 const char * userInputProperty() { return YUIProperty_SelectedItems; } 00101 00102 /** 00103 * Return the the item that currently has the keyboard focus 00104 * or 0 if no item currently has the keyboard focus. 00105 * 00106 * Notice that for a MultiSelectionBox the current item is not necessarily 00107 * selected, i.e., its check box may or may not be checked. 00108 * 00109 * Derived classes are required to implement this function. 00110 **/ 00111 virtual YItem * currentItem() = 0; 00112 00113 /** 00114 * Set the keyboard focus to the specified item. 00115 * 0 means clear the keyboard focus. 00116 * 00117 * Notice that for a MultiSelectionBox the current item is not necessarily 00118 * selected, i.e., its check box may or may not be checked. 00119 * Use selectItem() for that. 00120 * 00121 * Also notice that selectItem() does not make that newly selected item the 00122 * current item. 00123 * 00124 * Derived classes are required to implement this function. 00125 **/ 00126 virtual void setCurrentItem( YItem * item ) = 0; 00127 00128 /** 00129 * Save the widget's user input to a macro recorder. 00130 * 00131 * Reimplemented from YWidget because two properties need to be recorded. 00132 **/ 00133 virtual void saveUserInput( YMacroRecorder *macroRecorder ); 00134 00135 private: 00136 00137 ImplPtr<YMultiSelectionBoxPrivate> priv; 00138 }; 00139 00140 00141 #endif // YMultiSelectionBox_h