Logo
  • Main Page
  • Related Pages
  • Modules
  • Classes
  • Files

mmstextboxwidgetclass.h

Go to the documentation of this file.
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 MMSTEXTBOXWIDGETCLASS_H_
00034 #define MMSTEXTBOXWIDGETCLASS_H_
00035 
00036 #include "mmsgui/theme/mmstextbaseclass.h"
00037 
00038 //! describe attributes for MMSTextBoxWidget which are additional to the MMSWidgetClass
00039 namespace MMSGUI_TEXTBOXWIDGET_ATTR {
00040 
00041     #define MMSGUI_TEXTBOXWIDGET_ATTR_ATTRDESC \
00042         { "wrap", TAFF_ATTRTYPE_BOOL }, \
00043         { "splitwords", TAFF_ATTRTYPE_BOOL }, \
00044         { "translate", TAFF_ATTRTYPE_BOOL }, \
00045         { "file.path", TAFF_ATTRTYPE_STRING }, \
00046         { "file.name", TAFF_ATTRTYPE_STRING }
00047 
00048     #define MMSGUI_TEXTBOXWIDGET_ATTR_IDS \
00049         MMSGUI_TEXTBOXWIDGET_ATTR_IDS_wrap, \
00050         MMSGUI_TEXTBOXWIDGET_ATTR_IDS_splitwords, \
00051         MMSGUI_TEXTBOXWIDGET_ATTR_IDS_translate, \
00052         MMSGUI_TEXTBOXWIDGET_ATTR_IDS_file_path, \
00053         MMSGUI_TEXTBOXWIDGET_ATTR_IDS_file_name
00054 
00055     #define MMSGUI_TEXTBOXWIDGET_ATTR_INIT { \
00056         MMSGUI_BASE_ATTR_ATTRDESC, \
00057         MMSGUI_BORDER_ATTR_ATTRDESC, \
00058         MMSGUI_WIDGET_ATTR_ATTRDESC, \
00059         MMSGUI_FONT_ATTR_ATTRDESC, \
00060         MMSGUI_SHADOW_ATTR_ATTRDESC, \
00061         MMSGUI_TEXTINFO_ATTR_ATTRDESC, \
00062         MMSGUI_TEXTBOXWIDGET_ATTR_ATTRDESC, \
00063         { NULL, TAFF_ATTRTYPE_NONE } \
00064     }
00065 
00066     typedef enum {
00067         MMSGUI_BASE_ATTR_IDS,
00068         MMSGUI_BORDER_ATTR_IDS,
00069         MMSGUI_WIDGET_ATTR_IDS,
00070         MMSGUI_FONT_ATTR_IDS,
00071         MMSGUI_SHADOW_ATTR_IDS,
00072         MMSGUI_TEXTINFO_ATTR_IDS,
00073         MMSGUI_TEXTBOXWIDGET_ATTR_IDS
00074     } ids;
00075 }
00076 
00077 extern TAFF_ATTRDESC MMSGUI_TEXTBOXWIDGET_ATTR_I[];
00078 
00079 
00080 //! A data access class for the textbox widget.
00081 /*!
00082 This class is the base for the MMSTextBoxWidget class and is derived from
00083 MMSTextBaseClass which is the base for all widgets with text output.
00084 With this data store you have access to all changeable widget attributes.
00085 It is also one of the base classes for MMSThemeManager and MMSDialogManager
00086 which are main features of the MMSGUI.
00087 \note This class will be internally used by class MMSTextBoxWidget.
00088 \author Jens Schneider
00089 */
00090 class MMSTextBoxWidgetClass : public MMSTextBaseClass {
00091     private:
00092         //! name of the theme class
00093         string          className;
00094 
00095         //! is wrap flag set?
00096         bool            iswrap;
00097 
00098         //! wrap (true/false) the text
00099         bool            wrap;
00100 
00101         //! is splitwords flag set?
00102         bool            issplitwords;
00103 
00104         //! splitwords (true/false)
00105         bool            splitwords;
00106 
00107         //! is translate set?
00108         bool            istranslate;
00109 
00110         //! if true the text will be translated before displayed
00111         bool            translate;
00112 
00113         //! is filepath set?
00114         bool            isfilepath;
00115 
00116         //! path to the file
00117         string          filepath;
00118 
00119         //! is filename set?
00120         bool            isfilename;
00121 
00122         //! name of the file
00123         string          filename;
00124 
00125         //! Read and set all attributes from the given TAFF buffer.
00126         /*!
00127         \param tafff        pointer to the TAFF buffer
00128         \param prefix       optional, prefix to all attribute names (<prefix><attrname>=<attrvalue>)
00129         \param path         optional, path needed for empty path values from the TAFF buffer
00130         \param reset_paths  optional, should reset all path attributes?
00131         */
00132         void setAttributesFromTAFF(MMSTaffFile *tafff, string *prefix = NULL, string *path = NULL,
00133                                    bool reset_paths = false);
00134 
00135     public:
00136         //! stores base widget attributes
00137         MMSWidgetClass widgetClass;
00138 
00139         //! Constructor of class MMSTextBoxWidgetClass.
00140         MMSTextBoxWidgetClass();
00141 
00142         //! Mark all attributes as not set.
00143         void unsetAll();
00144 
00145         //! Set the name of the theme class.
00146         /*!
00147         \param classname  name of the class
00148         */
00149         void setClassName(string className);
00150 
00151         //! Get the name of the theme class.
00152         /*!
00153         \return name of the class
00154         */
00155         string getClassName();
00156 
00157         //! Check if the wrap flag is set.
00158         bool isWrap();
00159 
00160         //! Set the wrap flag.
00161         /*!
00162         \param wrap  wrap the text if set to true
00163         */
00164         void setWrap(bool wrap);
00165 
00166         //! Mark the wrap flag as not set.
00167         void unsetWrap();
00168 
00169         //! Get the wrap flag.
00170         /*!
00171         \return wrap flag
00172         */
00173         bool getWrap();
00174 
00175         //! Check if splitwords is set.
00176         bool isSplitWords();
00177 
00178         //! Set the splitwords flag.
00179         /*!
00180         \param splitwords  split words at the end of a line
00181         \note This works only if the wrap flag is set.
00182         */
00183         void setSplitWords(bool splitwords);
00184 
00185         //! Mark splitwords as not set.
00186         void unsetSplitWords();
00187 
00188         //! Get the splitwords flag.
00189         /*!
00190         \return splitwords flag
00191         */
00192         bool getSplitWords();
00193 
00194         //! Check if the translate flag is set.
00195         bool isTranslate();
00196 
00197         //! Set the translate flag.
00198         /*!
00199         \param translate  true/false
00200         */
00201         void setTranslate(bool translate);
00202 
00203         //! Mark the translate flag as not set.
00204         void unsetTranslate();
00205 
00206         //! Get the translate flag.
00207         /*!
00208         \return true/false
00209         */
00210         bool getTranslate();
00211 
00212         //! Check if the filepath is set.
00213         bool isFilePath();
00214 
00215         //! Set the filepath which is used to load the text.
00216         /*!
00217         \param filepath  path to the file
00218         */
00219         void setFilePath(string filepath);
00220 
00221         //! Mark the filepath as not set.
00222         void unsetFilePath();
00223 
00224         //! Get the filepath which is used to load the text.
00225         /*!
00226         \return path to the file
00227         */
00228         string getFilePath();
00229 
00230         //! Check if the filename is set.
00231         bool isFileName();
00232 
00233         //! Set the filename which is used to load the text.
00234         /*!
00235         \param filename  name of the file
00236         */
00237         void setFileName(string filename);
00238 
00239         //! Mark the filename as not set.
00240         void unsetFileName();
00241 
00242         //! Get the filename which is used to load the text.
00243         /*!
00244         \return name of the file
00245         */
00246         string getFileName();
00247 
00248     /* friends */
00249     friend class MMSThemeManager;
00250     friend class MMSDialogManager;
00251 };
00252 
00253 #endif /*MMSTEXTBOXWIDGETCLASS_H_*/

Generated by doxygen