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 MMSCANVASWIDGETCLASS_H_ 00034 #define MMSCANVASWIDGETCLASS_H_ 00035 00036 #include "mmsgui/theme/mmswidgetclass.h" 00037 00038 //! describe attributes for MMSCanvasWidget which are additional to the MMSWidgetClass 00039 namespace MMSGUI_CANVASWIDGET_ATTR { 00040 00041 #define MMSGUI_CANVASWIDGET_ATTR_ATTRDESC \ 00042 { "attributes", TAFF_ATTRTYPE_STRING } 00043 00044 #define MMSGUI_CANVASWIDGET_ATTR_IDS \ 00045 MMSGUI_CANVASWIDGET_ATTR_IDS_attributes 00046 00047 #define MMSGUI_CANVASWIDGET_ATTR_INIT { \ 00048 MMSGUI_BASE_ATTR_ATTRDESC, \ 00049 MMSGUI_BORDER_ATTR_ATTRDESC, \ 00050 MMSGUI_WIDGET_ATTR_ATTRDESC, \ 00051 MMSGUI_CANVASWIDGET_ATTR_ATTRDESC, \ 00052 { NULL, TAFF_ATTRTYPE_NONE } \ 00053 } 00054 00055 typedef enum { 00056 MMSGUI_BASE_ATTR_IDS, 00057 MMSGUI_BORDER_ATTR_IDS, 00058 MMSGUI_WIDGET_ATTR_IDS, 00059 MMSGUI_CANVASWIDGET_ATTR_IDS 00060 } ids; 00061 } 00062 00063 extern TAFF_ATTRDESC MMSGUI_CANVASWIDGET_ATTR_I[]; 00064 00065 00066 //! A data access class for the canvas widget. 00067 /*! 00068 This class is the base for the MMSCanvasWidget class. 00069 With this data store you have access to all changeable widget attributes. 00070 It is also one of the base classes for MMSThemeManager and MMSDialogManager 00071 which are main features of the MMSGUI. 00072 \note This class will be internally used by class MMSCanvasWidget. 00073 \author Stefan Schwarzer 00074 */ 00075 class MMSCanvasWidgetClass { 00076 private: 00077 //! name of the theme class 00078 string className; 00079 00080 //! generic attributes 00081 string attributes; 00082 00083 //! generic attributes are set 00084 bool isattributes; 00085 00086 //! Read and set all attributes from the given TAFF buffer. 00087 /*! 00088 \param tafff pointer to the TAFF buffer 00089 \param prefix optional, prefix to all attribute names (<prefix><attrname>=<attrvalue>) 00090 \param path optional, path needed for empty path values from the TAFF buffer 00091 \param reset_paths optional, should reset all path attributes? 00092 */ 00093 void setAttributesFromTAFF(MMSTaffFile *tafff, string *prefix = NULL, string *path = NULL, 00094 bool reset_paths = false); 00095 00096 public: 00097 //! stores base widget attributes 00098 MMSWidgetClass widgetClass; 00099 00100 //! Constructor of class MMSCanvasWidgetClass. 00101 MMSCanvasWidgetClass(); 00102 00103 //! Mark all attributes as not set. 00104 void unsetAll(); 00105 00106 //! Set the name of the theme class. 00107 /*! 00108 \param className name of the class 00109 */ 00110 void setClassName(string className); 00111 00112 //! Get the name of the theme class. 00113 /*! 00114 \return name of the class 00115 */ 00116 string getClassName(); 00117 00118 //! Check if the attributes string that is handed to the derived class is set. 00119 bool isAttributes(); 00120 00121 //! Set the attributes string that is handed to the derived class. 00122 /*! 00123 \param imagepath_p path to pressed unselected image 00124 */ 00125 void setAttributes(string attributes); 00126 00127 //! Mark the attributes string that is handed to the derived class as not set. 00128 void unsetAttributes(); 00129 00130 //! Get the attributes string that is handed to the derived class. 00131 /*! 00132 \return path to the pressed unselected image 00133 */ 00134 string getAttributes(); 00135 00136 00137 00138 00139 /* friends */ 00140 friend class MMSThemeManager; 00141 friend class MMSDialogManager; 00142 }; 00143 00144 #endif /*MMSCANVASWIDGETCLASS_H_*/