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 MMSLABELWIDGETCLASS_H_ 00034 #define MMSLABELWIDGETCLASS_H_ 00035 00036 #include "mmsgui/theme/mmstextbaseclass.h" 00037 00038 //! describe attributes for MMSLabelWidget which are additional to the MMSWidgetClass 00039 namespace MMSGUI_LABELWIDGET_ATTR { 00040 00041 #define MMSGUI_LABELWIDGET_ATTR_ATTRDESC \ 00042 { "slidable", TAFF_ATTRTYPE_BOOL }, \ 00043 { "slide_speed", TAFF_ATTRTYPE_UCHAR }, \ 00044 { "translate", TAFF_ATTRTYPE_BOOL } 00045 00046 #define MMSGUI_LABELWIDGET_ATTR_IDS \ 00047 MMSGUI_LABELWIDGET_ATTR_IDS_slidable, \ 00048 MMSGUI_LABELWIDGET_ATTR_IDS_slide_speed, \ 00049 MMSGUI_LABELWIDGET_ATTR_IDS_translate 00050 00051 #define MMSGUI_LABELWIDGET_ATTR_INIT { \ 00052 MMSGUI_BASE_ATTR_ATTRDESC, \ 00053 MMSGUI_BORDER_ATTR_ATTRDESC, \ 00054 MMSGUI_WIDGET_ATTR_ATTRDESC, \ 00055 MMSGUI_FONT_ATTR_ATTRDESC, \ 00056 MMSGUI_SHADOW_ATTR_ATTRDESC, \ 00057 MMSGUI_TEXTINFO_ATTR_ATTRDESC, \ 00058 MMSGUI_LABELWIDGET_ATTR_ATTRDESC, \ 00059 { NULL, TAFF_ATTRTYPE_NONE } \ 00060 } 00061 00062 typedef enum { 00063 MMSGUI_BASE_ATTR_IDS, 00064 MMSGUI_BORDER_ATTR_IDS, 00065 MMSGUI_WIDGET_ATTR_IDS, 00066 MMSGUI_FONT_ATTR_IDS, 00067 MMSGUI_SHADOW_ATTR_IDS, 00068 MMSGUI_TEXTINFO_ATTR_IDS, 00069 MMSGUI_LABELWIDGET_ATTR_IDS 00070 } ids; 00071 } 00072 00073 extern TAFF_ATTRDESC MMSGUI_LABELWIDGET_ATTR_I[]; 00074 00075 00076 //! A data access class for the label widget. 00077 /*! 00078 This class is the base for the MMSLabelWidget class and is derived from 00079 MMSTextBaseClass which is the base for all widgets with text output. 00080 With this data store you have access to all changeable widget attributes. 00081 It is also one of the base classes for MMSThemeManager and MMSDialogManager 00082 which are main features of the MMSGUI. 00083 \note This class will be internally used by class MMSLabelWidget. 00084 \author Jens Schneider 00085 */ 00086 class MMSLabelWidgetClass : public MMSTextBaseClass { 00087 private: 00088 //! name of the theme class 00089 string className; 00090 00091 //! is slidable set? 00092 bool isslidable; 00093 00094 //! if true and size of the text string is greater than widget dimension, the text will slide over the widget 00095 bool slidable; 00096 00097 //! is slide speed set? 00098 bool isslidespeed; 00099 00100 //! slide speed used if slidable set to true 00101 unsigned int slidespeed; 00102 00103 //! is translate set? 00104 bool istranslate; 00105 00106 //! if true the text will be translated before displayed 00107 bool translate; 00108 00109 00110 //! Read and set all attributes from the given TAFF buffer. 00111 /*! 00112 \param tafff pointer to the TAFF buffer 00113 \param prefix optional, prefix to all attribute names (<prefix><attrname>=<attrvalue>) 00114 \param path optional, path needed for empty path values from the TAFF buffer 00115 \param reset_paths optional, should reset all path attributes? 00116 */ 00117 void setAttributesFromTAFF(MMSTaffFile *tafff, string *prefix = NULL, string *path = NULL, 00118 bool reset_paths = false); 00119 00120 public: 00121 //! stores base widget attributes 00122 MMSWidgetClass widgetClass; 00123 00124 //! Constructor of class MMSLabelWidgetClass. 00125 MMSLabelWidgetClass(); 00126 00127 //! Mark all attributes as not set. 00128 void unsetAll(); 00129 00130 //! Set the name of the theme class. 00131 /*! 00132 \param classname name of the class 00133 */ 00134 void setClassName(string className); 00135 00136 //! Get the name of the theme class. 00137 /*! 00138 \return name of the class 00139 */ 00140 string getClassName(); 00141 00142 00143 //! Check if the slidable flag is set. 00144 bool isSlidable(); 00145 00146 //! Set the slidable flag. 00147 /*! 00148 \param slidable true/false 00149 */ 00150 void setSlidable(bool slidable); 00151 00152 //! Mark the slidable flag as not set. 00153 void unsetSlidable(); 00154 00155 //! Get the slidable flag. 00156 /*! 00157 \return true/false 00158 */ 00159 bool getSlidable(); 00160 00161 //! Check if the slide speed is set. 00162 bool isSlideSpeed(); 00163 00164 //! Set the slide speed. 00165 /*! 00166 \param slidespeed speed in pixel per second 00167 */ 00168 void setSlideSpeed(unsigned char slidespeed); 00169 00170 //! Mark the slide speed as not set. 00171 void unsetSlideSpeed(); 00172 00173 //! Get the slide speed. 00174 /*! 00175 \return slide speed 00176 */ 00177 unsigned char getSlideSpeed(); 00178 00179 00180 //! Check if the translate flag is set. 00181 bool isTranslate(); 00182 00183 //! Set the translate flag. 00184 /*! 00185 \param translate true/false 00186 */ 00187 void setTranslate(bool translate); 00188 00189 //! Mark the translate flag as not set. 00190 void unsetTranslate(); 00191 00192 //! Get the translate flag. 00193 /*! 00194 \return true/false 00195 */ 00196 bool getTranslate(); 00197 00198 00199 // friends 00200 friend class MMSThemeManager; 00201 friend class MMSDialogManager; 00202 }; 00203 00204 #endif /*MMSLABELWIDGETCLASS_H_*/