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 MMSINPUTWIDGETCLASS_H_ 00034 #define MMSINPUTWIDGETCLASS_H_ 00035 00036 #include "mmsgui/theme/mmstextbaseclass.h" 00037 00038 //! describe attributes for MMSInputWidget which are additional to the MMSWidgetClass 00039 namespace MMSGUI_INPUTWIDGET_ATTR { 00040 00041 #define MMSGUI_INPUTWIDGET_ATTR_ATTRDESC \ 00042 { "cursor_state", TAFF_ATTRTYPE_STATE } 00043 00044 #define MMSGUI_INPUTWIDGET_ATTR_IDS \ 00045 MMSGUI_INPUTWIDGET_ATTR_IDS_cursor_state 00046 00047 #define MMSGUI_INPUTWIDGET_ATTR_INIT { \ 00048 MMSGUI_BASE_ATTR_ATTRDESC, \ 00049 MMSGUI_BORDER_ATTR_ATTRDESC, \ 00050 MMSGUI_WIDGET_ATTR_ATTRDESC, \ 00051 MMSGUI_FONT_ATTR_ATTRDESC, \ 00052 MMSGUI_SHADOW_ATTR_ATTRDESC, \ 00053 MMSGUI_TEXTINFO_ATTR_ATTRDESC, \ 00054 MMSGUI_INPUTWIDGET_ATTR_ATTRDESC, \ 00055 { NULL, TAFF_ATTRTYPE_NONE } \ 00056 } 00057 00058 typedef enum { 00059 MMSGUI_BASE_ATTR_IDS, 00060 MMSGUI_BORDER_ATTR_IDS, 00061 MMSGUI_WIDGET_ATTR_IDS, 00062 MMSGUI_FONT_ATTR_IDS, 00063 MMSGUI_SHADOW_ATTR_IDS, 00064 MMSGUI_TEXTINFO_ATTR_IDS, 00065 MMSGUI_INPUTWIDGET_ATTR_IDS 00066 } ids; 00067 } 00068 00069 extern TAFF_ATTRDESC MMSGUI_INPUTWIDGET_ATTR_I[]; 00070 00071 00072 //! A data access class for the input widget. 00073 /*! 00074 This class is the base for the MMSInputWidget class and is derived from 00075 MMSTextBaseClass which is the base for all widgets with text output. 00076 With this data store you have access to all changeable widget attributes. 00077 It is also one of the base classes for MMSThemeManager and MMSDialogManager 00078 which are main features of the MMSGUI. 00079 \note This class will be internally used by class MMSInputWidget. 00080 \author Jens Schneider 00081 */ 00082 class MMSInputWidgetClass : public MMSTextBaseClass { 00083 private: 00084 //! name of the theme class 00085 string className; 00086 00087 //! is cursor state set? 00088 bool iscursor_state; 00089 00090 //! requested cursor state 00091 MMSSTATE cursor_state; 00092 00093 //! Read and set all attributes from the given TAFF buffer. 00094 /*! 00095 \param tafff pointer to the TAFF buffer 00096 \param prefix optional, prefix to all attribute names (<prefix><attrname>=<attrvalue>) 00097 \param path optional, path needed for empty path values from the TAFF buffer 00098 \param reset_paths optional, should reset all path attributes? 00099 */ 00100 void setAttributesFromTAFF(MMSTaffFile *tafff, string *prefix = NULL, string *path = NULL, 00101 bool reset_paths = false); 00102 00103 public: 00104 //! stores base widget attributes 00105 MMSWidgetClass widgetClass; 00106 00107 //! Constructor of class MMSInputWidgetClass. 00108 MMSInputWidgetClass(); 00109 00110 //! Destructor of class MMSInputWidgetClass. 00111 virtual ~MMSInputWidgetClass(); 00112 00113 //! Mark all attributes as not set. 00114 void unsetAll(); 00115 00116 //! Set the name of the theme class. 00117 /*! 00118 \param classname name of the class 00119 */ 00120 void setClassName(string className); 00121 00122 //! Get the name of the theme class. 00123 /*! 00124 \return name of the class 00125 */ 00126 string getClassName(); 00127 00128 //! Check if the cursor state is set. 00129 bool isCursorState(); 00130 00131 //! Set the cursor state. 00132 /*! 00133 \param cursor_state state: true, false, auto 00134 */ 00135 void setCursorState(MMSSTATE cursor_state); 00136 00137 //! Mark the cursor state as not set. 00138 void unsetCursorState(); 00139 00140 //! Get the current cursor state. 00141 /*! 00142 \return cursor state 00143 */ 00144 MMSSTATE getCursorState(); 00145 00146 // friends 00147 friend class MMSThemeManager; 00148 friend class MMSDialogManager; 00149 }; 00150 00151 #endif /*MMSINPUTWIDGETCLASS_H_*/