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

mmsthemebase.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 MMSTHEMEBASE_H_
00034 #define MMSTHEMEBASE_H_
00035 
00036 #include "mmstools/mmstafffile.h"
00037 #include "mmsgui/mmsguitools.h"
00038 
00039 
00040 
00041 //! alignment type, used e.g. for positioning of windows, text in labels or textboxes, ...
00042 typedef enum {
00043     //! not set
00044     MMSALIGNMENT_NOTSET=0,
00045     //! centered, horizontal and vertical
00046     MMSALIGNMENT_CENTER,
00047     //! left aligned, vertical centered
00048     MMSALIGNMENT_LEFT,
00049     //! right aligned, vertical centered
00050     MMSALIGNMENT_RIGHT,
00051     //! horizontal justified, vertical centered
00052     MMSALIGNMENT_JUSTIFY,
00053     //! horizontal centered, top aligned
00054     MMSALIGNMENT_TOP_CENTER,
00055     //! left and top aligned
00056     MMSALIGNMENT_TOP_LEFT,
00057     //! right and top aligned
00058     MMSALIGNMENT_TOP_RIGHT,
00059     //! horizontal justified, top aligned
00060     MMSALIGNMENT_TOP_JUSTIFY,
00061     //! horizontal centered, bottom aligned
00062     MMSALIGNMENT_BOTTOM_CENTER,
00063     //! left and bottom aligned
00064     MMSALIGNMENT_BOTTOM_LEFT,
00065     //! right and bottom aligned
00066     MMSALIGNMENT_BOTTOM_RIGHT,
00067     //! horizontal justified, bottom aligned
00068     MMSALIGNMENT_BOTTOM_JUSTIFY
00069 } MMSALIGNMENT;
00070 
00071 
00072 MMSALIGNMENT getAlignmentFromString(string inputstr);
00073 MMSALIGNMENT swapAlignmentHorizontal(MMSALIGNMENT alignment);
00074 
00075 typedef enum {
00076     MMSDIRECTION_NOTSET=0,
00077     MMSDIRECTION_LEFT,
00078     MMSDIRECTION_RIGHT,
00079     MMSDIRECTION_UP,
00080     MMSDIRECTION_DOWN,
00081     MMSDIRECTION_UP_LEFT,
00082     MMSDIRECTION_UP_RIGHT,
00083     MMSDIRECTION_DOWN_LEFT,
00084     MMSDIRECTION_DOWN_RIGHT,
00085     MMSDIRECTION_SIZE
00086 } MMSDIRECTION;
00087 
00088 
00089 MMSDIRECTION getDirectionFromString(string inputstr);
00090 
00091 
00092 typedef enum {
00093     MMSPOSITION_NOTSET=0,
00094     MMSPOSITION_LEFT,
00095     MMSPOSITION_RIGHT,
00096     MMSPOSITION_TOP,
00097     MMSPOSITION_BOTTOM,
00098     MMSPOSITION_TOP_LEFT,
00099     MMSPOSITION_TOP_RIGHT,
00100     MMSPOSITION_BOTTOM_LEFT,
00101     MMSPOSITION_BOTTOM_RIGHT,
00102     MMSPOSITION_SIZE
00103 } MMSPOSITION;
00104 
00105 
00106 MMSPOSITION getPositionFromString(string inputstr);
00107 
00108 
00109 #define MMSTHEMECLASS_INIT_STRING(x) \
00110     this->ed.x = NULL; \
00111     this->id.is##x = false;
00112 
00113 #define MMSTHEMECLASS_FREE_STRING(x) \
00114     if (this->ed.x) delete this->ed.x; \
00115     this->ed.x = NULL; \
00116     this->id.is##x = false;
00117 
00118 #define MMSTHEMECLASS_SET_STRING(x) \
00119     if (!this->ed.x) this->ed.x = new string(x); \
00120     else *(this->ed.x) = x; \
00121     this->id.is##x = true;
00122 
00123 #define MMSTHEMECLASS_GET_STRING(x) \
00124     if (!this->id.is##x) return false; \
00125     x = *(this->ed.x); \
00126     return true;
00127 
00128 
00129 
00130 #define MMSTHEMECLASS_INIT_STRINGS(x,c) \
00131     for (int cc=0;cc<c;cc++) \
00132         this->ed.x[cc] = NULL; \
00133     this->id.is##x = false;
00134 
00135 #define MMSTHEMECLASS_FREE_STRINGS(x,c) \
00136     for (int cc=0;cc<c;cc++) { \
00137         if (this->ed.x[cc]) delete this->ed.x[cc]; \
00138         this->ed.x[cc] = NULL; \
00139     } \
00140     this->id.is##x = false;
00141 
00142 #define MMSTHEMECLASS_SET_STRINGS(x,c,y) \
00143     if (!this->ed.x[c]) this->ed.x[c] = new string(y); \
00144     else *(this->ed.x[c]) = y; \
00145     this->id.is##x = true;
00146 
00147 #define MMSTHEMECLASS_GET_STRINGS(x,c,y) \
00148     if (!this->id.is##x) return false; \
00149     if (!this->ed.x[c]) return false; \
00150     y = *(this->ed.x[c]); \
00151     return true;
00152 
00153 #define MMSTHEMECLASS_UNSET_STRINGS(x,c) \
00154     for (int cc=0;cc<c;cc++) \
00155         if (this->ed.x[cc]) *(this->ed.x[cc]) = ""; \
00156     this->id.is##x = false;
00157 
00158 
00159 
00160 #define MMSTHEMECLASS_INIT_BASIC(x) \
00161     this->id.is##x = false;
00162 
00163 #define MMSTHEMECLASS_FREE_BASIC(x) \
00164     this->id.is##x = false;
00165 
00166 #define MMSTHEMECLASS_SET_BASIC(x) \
00167     this->id.x = x; \
00168     this->id.is##x = true;
00169 
00170 #define MMSTHEMECLASS_GET_BASIC(x) \
00171     if (!this->id.is##x) return false; \
00172     x = this->id.x; \
00173     return true;
00174 
00175 
00176 #define MMSTHEMECLASS_UNSET(x) \
00177     this->id.is##x = false;
00178 
00179 #define MMSTHEMECLASS_ISSET(x) \
00180     return this->id.is##x;
00181 
00182 
00183 
00184 
00185 #define startTAFFScan \
00186     { bool first=true; int attrid; char *attrval_str; int attrval_int; \
00187     while (1) { \
00188         if (first) { attrid=tafff->getFirstAttribute(&attrval_str, &attrval_int); first=false; } else \
00189         attrid=tafff->getNextAttribute(&attrval_str, &attrval_int); \
00190         if (attrid<0) break;
00191 
00192 #define endTAFFScan } }
00193 
00194 
00195 #define startTAFFScan_WITHOUT_ID \
00196     { bool first=true; int attrid; char *attrval_str; int attrval_int; char *attrname; \
00197     while (1) { \
00198         if (first) { attrid=tafff->getFirstAttribute(&attrval_str, &attrval_int, &attrname); first=false; } else \
00199         attrid=tafff->getNextAttribute(&attrval_str, &attrval_int, &attrname); \
00200         while((attrid>=0)&&(attrid!=MMSTAFF_ATTR_WITHOUT_ID)) attrid=tafff->getNextAttribute(&attrval_str,&attrval_int,&attrname); \
00201         if (attrid<0) break;
00202 
00203 #define endTAFFScan_WITHOUT_ID } }
00204 
00205 
00206 //! macro for widget specific setAttributesFromTAFF() implementation
00207 #define ISATTRNAME(aname) ((strcmp(attrname, GETATTRNAME(aname))==0)?(tafff->convertString2TaffAttributeType(GETATTRTYPE(aname), attrval_str, &attrval_str_valid, &int_val_set, &byte_val_set, p_int_val, attrname, attrid, tafff->getCurrentTagName())):(0))
00208 
00209 
00210 
00211 
00212 namespace MMSGUI_MMSDIALOG_ATTR {
00213 
00214     #define MMSGUI_MMSDIALOG_ATTR_ATTRDESC \
00215         { "name", TAFF_ATTRTYPE_STRING }
00216 
00217     #define MMSGUI_MMSDIALOG_ATTR_IDS \
00218         MMSGUI_MMSDIALOG_ATTR_IDS_name
00219 
00220     #define MMSGUI_MMSDIALOG_ATTR_INIT { \
00221         MMSGUI_MMSDIALOG_ATTR_ATTRDESC, \
00222         { NULL, TAFF_ATTRTYPE_NONE } \
00223     }
00224 
00225     typedef enum {
00226         MMSGUI_MMSDIALOG_ATTR_IDS
00227     } ids;
00228 }
00229 
00230 
00231 namespace MMSGUI_BASE_ATTR {
00232 
00233     #define MMSGUI_BASE_ATTR_ATTRDESC \
00234         { "name", TAFF_ATTRTYPE_NE_STRING }, \
00235         { "type", TAFF_ATTRTYPE_NE_STRING }, \
00236         { "class", TAFF_ATTRTYPE_NE_STRING }, \
00237         { "size", TAFF_ATTRTYPE_STRING }, \
00238         { "min_width", TAFF_ATTRTYPE_STRING }, \
00239         { "min_height", TAFF_ATTRTYPE_STRING }, \
00240         { "max_width", TAFF_ATTRTYPE_STRING }, \
00241         { "max_height", TAFF_ATTRTYPE_STRING }, \
00242         { "show", TAFF_ATTRTYPE_BOOL }
00243 
00244     #define MMSGUI_BASE_ATTR_IDS \
00245         MMSGUI_BASE_ATTR_IDS_name, \
00246         MMSGUI_BASE_ATTR_IDS_type, \
00247         MMSGUI_BASE_ATTR_IDS_class, \
00248         MMSGUI_BASE_ATTR_IDS_size, \
00249         MMSGUI_BASE_ATTR_IDS_min_width, \
00250         MMSGUI_BASE_ATTR_IDS_min_height, \
00251         MMSGUI_BASE_ATTR_IDS_max_width, \
00252         MMSGUI_BASE_ATTR_IDS_max_height, \
00253         MMSGUI_BASE_ATTR_IDS_show
00254 
00255     #define MMSGUI_BASE_ATTR_INIT { \
00256         MMSGUI_BASE_ATTR_ATTRDESC, \
00257         { NULL, TAFF_ATTRTYPE_NONE } \
00258     }
00259 
00260     typedef enum {
00261         MMSGUI_BASE_ATTR_IDS
00262     } ids;
00263 }
00264 
00265 
00266 
00267 
00268 
00269 #endif /*MMSTHEMEBASE_H_*/
00270 
00271 

Generated by doxygen