00001 /*************************************************************************** 00002 * Copyright (C) 2005-2007 Stefan Schwarzer, Jens Schneider, * 00003 * Matthias Hardt, Guido Madaus * 00004 * * 00005 * Copyright (C) 2007-2008 BerLinux Solutions GbR * 00006 * Stefan Schwarzer & Guido Madaus * 00007 * * 00008 * Copyright (C) 2009-2013 BerLinux Solutions GmbH * 00009 * * 00010 * Authors: * 00011 * Stefan Schwarzer <stefan.schwarzer@diskohq.org>, * 00012 * Matthias Hardt <matthias.hardt@diskohq.org>, * 00013 * Jens Schneider <jens.schneider@diskohq.org>, * 00014 * Guido Madaus <guido.madaus@diskohq.org>, * 00015 * Patrick Helterhoff <patrick.helterhoff@diskohq.org>, * 00016 * René Bählkow <rene.baehlkow@diskohq.org> * 00017 * * 00018 * This library is free software; you can redistribute it and/or * 00019 * modify it under the terms of the GNU Lesser General Public * 00020 * License version 2.1 as published by the Free Software Foundation. * 00021 * * 00022 * This library is distributed in the hope that it will be useful, * 00023 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00024 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00025 * Lesser General Public License for more details. * 00026 * * 00027 * You should have received a copy of the GNU Lesser General Public * 00028 * License along with this library; if not, write to the * 00029 * Free Software Foundation, Inc., * 00030 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * 00031 **************************************************************************/ 00032 00033 #ifndef MMSARROWWIDGETCLASS_H_ 00034 #define MMSARROWWIDGETCLASS_H_ 00035 00036 #include "mmsgui/theme/mmswidgetclass.h" 00037 00038 //! describe attributes for MMSArrowWidget which are additional to the MMSWidgetClass 00039 namespace MMSGUI_ARROWWIDGET_ATTR { 00040 00041 #define MMSGUI_ARROWWIDGET_ATTR_ATTRDESC \ 00042 { "color", TAFF_ATTRTYPE_COLOR }, \ 00043 { "color.a", TAFF_ATTRTYPE_UCHAR }, \ 00044 { "color.r", TAFF_ATTRTYPE_UCHAR }, \ 00045 { "color.g", TAFF_ATTRTYPE_UCHAR }, \ 00046 { "color.b", TAFF_ATTRTYPE_UCHAR }, \ 00047 { "selcolor", TAFF_ATTRTYPE_COLOR }, \ 00048 { "selcolor.a", TAFF_ATTRTYPE_UCHAR }, \ 00049 { "selcolor.r", TAFF_ATTRTYPE_UCHAR }, \ 00050 { "selcolor.g", TAFF_ATTRTYPE_UCHAR }, \ 00051 { "selcolor.b", TAFF_ATTRTYPE_UCHAR }, \ 00052 { "direction", TAFF_ATTRTYPE_STRING }, \ 00053 { "check_selected", TAFF_ATTRTYPE_BOOL } 00054 00055 #define MMSGUI_ARROWWIDGET_ATTR_IDS \ 00056 MMSGUI_ARROWWIDGET_ATTR_IDS_color, \ 00057 MMSGUI_ARROWWIDGET_ATTR_IDS_color_a, \ 00058 MMSGUI_ARROWWIDGET_ATTR_IDS_color_r, \ 00059 MMSGUI_ARROWWIDGET_ATTR_IDS_color_g, \ 00060 MMSGUI_ARROWWIDGET_ATTR_IDS_color_b, \ 00061 MMSGUI_ARROWWIDGET_ATTR_IDS_selcolor, \ 00062 MMSGUI_ARROWWIDGET_ATTR_IDS_selcolor_a, \ 00063 MMSGUI_ARROWWIDGET_ATTR_IDS_selcolor_r, \ 00064 MMSGUI_ARROWWIDGET_ATTR_IDS_selcolor_g, \ 00065 MMSGUI_ARROWWIDGET_ATTR_IDS_selcolor_b, \ 00066 MMSGUI_ARROWWIDGET_ATTR_IDS_direction, \ 00067 MMSGUI_ARROWWIDGET_ATTR_IDS_check_selected 00068 00069 #define MMSGUI_ARROWWIDGET_ATTR_INIT { \ 00070 MMSGUI_BASE_ATTR_ATTRDESC, \ 00071 MMSGUI_BORDER_ATTR_ATTRDESC, \ 00072 MMSGUI_WIDGET_ATTR_ATTRDESC, \ 00073 MMSGUI_ARROWWIDGET_ATTR_ATTRDESC, \ 00074 { NULL, TAFF_ATTRTYPE_NONE } \ 00075 } 00076 00077 typedef enum { 00078 MMSGUI_BASE_ATTR_IDS, 00079 MMSGUI_BORDER_ATTR_IDS, 00080 MMSGUI_WIDGET_ATTR_IDS, 00081 MMSGUI_ARROWWIDGET_ATTR_IDS 00082 } ids; 00083 } 00084 00085 extern TAFF_ATTRDESC MMSGUI_ARROWWIDGET_ATTR_I[]; 00086 00087 00088 //! A data access class for the arrow widget. 00089 /*! 00090 This class is the base for the MMSArrowWidget class. 00091 With this data store you have access to all changeable widget attributes. 00092 It is also one of the base classes for MMSThemeManager and MMSDialogManager 00093 which are main features of the MMSGUI. 00094 \note This class will be internally used by class MMSArrowWidget. 00095 \author Jens Schneider 00096 */ 00097 class MMSArrowWidgetClass { 00098 private: 00099 //! name of the theme class 00100 string className; 00101 00102 //! is color set? 00103 bool iscolor; 00104 00105 //! color if the arrow is not selected 00106 MMSFBColor color; 00107 00108 //! is selcolor set? 00109 bool isselcolor; 00110 00111 //! color if the arrow is selected 00112 MMSFBColor selcolor; 00113 00114 //! is direction set? 00115 bool isdirection; 00116 00117 //! direction of the arrow 00118 MMSDIRECTION direction; 00119 00120 //! is checkselected set? 00121 bool ischeckselected; 00122 00123 //! if true the input event will only be submitted if widget is in selected state 00124 bool checkselected; 00125 00126 //! Read and set all attributes from the given TAFF buffer. 00127 /*! 00128 \param tafff pointer to the TAFF buffer 00129 \param prefix optional, prefix to all attribute names (<prefix><attrname>=<attrvalue>) 00130 \param path optional, path needed for empty path values from the TAFF buffer 00131 \param reset_paths optional, should reset all path attributes? 00132 */ 00133 void setAttributesFromTAFF(MMSTaffFile *tafff, string *prefix = NULL, string *path = NULL, 00134 bool reset_paths = false); 00135 00136 public: 00137 //! stores base widget attributes 00138 MMSWidgetClass widgetClass; 00139 00140 //! Constructor of class MMSArrowWidgetClass. 00141 MMSArrowWidgetClass(); 00142 00143 //! Mark all attributes as not set. 00144 void unsetAll(); 00145 00146 //! Set the name of the theme class. 00147 /*! 00148 \param className name of the class 00149 */ 00150 void setClassName(string className); 00151 00152 //! Get the name of the theme class. 00153 /*! 00154 \return name of the class 00155 */ 00156 string getClassName(); 00157 00158 //! Check if the color is set. This color will be used for the unselected arrow. 00159 /*! 00160 \return true if the color is set 00161 */ 00162 bool isColor(); 00163 00164 //! Set the color which is used to draw the unselected arrow. 00165 /*! 00166 \param color color for unselected arrow 00167 */ 00168 void setColor(MMSFBColor color); 00169 00170 //! Mark the color as not set. 00171 void unsetColor(); 00172 00173 //! Get the color which is used to draw the unselected arrow. 00174 /*! 00175 \return color which is used for the unselected arrow 00176 */ 00177 MMSFBColor getColor(); 00178 00179 //! Check if the color is set. This color will be used for the selected arrow. 00180 /*! 00181 \return true if the color is set 00182 */ 00183 bool isSelColor(); 00184 00185 //! Set the color which is used to draw the selected arrow. 00186 /*! 00187 \param selcolor color for selected arrow 00188 */ 00189 void setSelColor(MMSFBColor selcolor); 00190 00191 //! Mark the color as not set. 00192 void unsetSelColor(); 00193 00194 //! Get the color which is used to draw the selected arrow. 00195 /*! 00196 \return color which is used for the selected arrow 00197 */ 00198 MMSFBColor getSelColor(); 00199 00200 //! Check if the direction is set. 00201 /*! 00202 \return true if the direction is set 00203 */ 00204 bool isDirection(); 00205 00206 //! Set the direction of the arrow. 00207 /*! 00208 \param direction direction, see definition of MMSDIRECTION 00209 */ 00210 void setDirection(MMSDIRECTION direction); 00211 00212 //! Mark the direction as not set. 00213 void unsetDirection(); 00214 00215 //! Get the current direction of the arrow. 00216 /*! 00217 \return direction 00218 */ 00219 MMSDIRECTION getDirection(); 00220 00221 //! Check if the checkselected is set. 00222 /*! 00223 \return true if the checkselected is set 00224 */ 00225 bool isCheckSelected(); 00226 00227 //! Set the checkselected flag. 00228 /*! 00229 \param checkselected if true the input event will only be submitted if widget is in selected state 00230 */ 00231 void setCheckSelected(bool checkselected); 00232 00233 //! Mark the checkselected flag as not set. 00234 void unsetCheckSelected(); 00235 00236 //! Get the checkselected flag. 00237 /*! 00238 \return checkselected 00239 */ 00240 bool getCheckSelected(); 00241 00242 /* friends */ 00243 friend class MMSThemeManager; 00244 friend class MMSDialogManager; 00245 }; 00246 00247 #endif /*MMSARROWWIDGETCLASS_H_*/