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

mmsborderclass.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 MMSBORDERCLASS_H_
00034 #define MMSBORDERCLASS_H_
00035 
00036 #include "mmsgui/theme/mmsthemebase.h"
00037 
00038 //! describe attributes for MMSBorder
00039 namespace MMSGUI_BORDER_ATTR {
00040 
00041     #define MMSGUI_BORDER_ATTR_ATTRDESC \
00042         { "border.color", TAFF_ATTRTYPE_COLOR }, \
00043         { "border.color.a", TAFF_ATTRTYPE_UCHAR }, \
00044         { "border.color.r", TAFF_ATTRTYPE_UCHAR }, \
00045         { "border.color.g", TAFF_ATTRTYPE_UCHAR }, \
00046         { "border.color.b", TAFF_ATTRTYPE_UCHAR }, \
00047         { "border.selcolor", TAFF_ATTRTYPE_COLOR }, \
00048         { "border.selcolor.a", TAFF_ATTRTYPE_UCHAR }, \
00049         { "border.selcolor.r", TAFF_ATTRTYPE_UCHAR }, \
00050         { "border.selcolor.g", TAFF_ATTRTYPE_UCHAR }, \
00051         { "border.selcolor.b", TAFF_ATTRTYPE_UCHAR }, \
00052         { "border.image.path", TAFF_ATTRTYPE_STRING }, \
00053         { "border.image.top-left", TAFF_ATTRTYPE_STRING }, \
00054         { "border.image.top", TAFF_ATTRTYPE_STRING }, \
00055         { "border.image.top-right", TAFF_ATTRTYPE_STRING }, \
00056         { "border.image.right", TAFF_ATTRTYPE_STRING }, \
00057         { "border.image.bottom-right", TAFF_ATTRTYPE_STRING }, \
00058         { "border.image.bottom", TAFF_ATTRTYPE_STRING }, \
00059         { "border.image.bottom-left", TAFF_ATTRTYPE_STRING }, \
00060         { "border.image.left", TAFF_ATTRTYPE_STRING }, \
00061         { "border.selimage.path", TAFF_ATTRTYPE_STRING }, \
00062         { "border.selimage.top-left", TAFF_ATTRTYPE_STRING }, \
00063         { "border.selimage.top", TAFF_ATTRTYPE_STRING }, \
00064         { "border.selimage.top-right", TAFF_ATTRTYPE_STRING }, \
00065         { "border.selimage.right", TAFF_ATTRTYPE_STRING }, \
00066         { "border.selimage.bottom-right", TAFF_ATTRTYPE_STRING }, \
00067         { "border.selimage.bottom", TAFF_ATTRTYPE_STRING }, \
00068         { "border.selimage.bottom-left", TAFF_ATTRTYPE_STRING }, \
00069         { "border.selimage.left", TAFF_ATTRTYPE_STRING }, \
00070         { "border.thickness", TAFF_ATTRTYPE_UCHAR }, \
00071         { "border.margin", TAFF_ATTRTYPE_UCHAR }, \
00072         { "border.rcorners", TAFF_ATTRTYPE_BOOL }
00073 
00074     #define MMSGUI_BORDER_ATTR_IDS \
00075         MMSGUI_BORDER_ATTR_IDS_border_color, \
00076         MMSGUI_BORDER_ATTR_IDS_border_color_a, \
00077         MMSGUI_BORDER_ATTR_IDS_border_color_r, \
00078         MMSGUI_BORDER_ATTR_IDS_border_color_g, \
00079         MMSGUI_BORDER_ATTR_IDS_border_color_b, \
00080         MMSGUI_BORDER_ATTR_IDS_border_selcolor, \
00081         MMSGUI_BORDER_ATTR_IDS_border_selcolor_a, \
00082         MMSGUI_BORDER_ATTR_IDS_border_selcolor_r, \
00083         MMSGUI_BORDER_ATTR_IDS_border_selcolor_g, \
00084         MMSGUI_BORDER_ATTR_IDS_border_selcolor_b, \
00085         MMSGUI_BORDER_ATTR_IDS_border_image_path, \
00086         MMSGUI_BORDER_ATTR_IDS_border_image_top_left, \
00087         MMSGUI_BORDER_ATTR_IDS_border_image_top, \
00088         MMSGUI_BORDER_ATTR_IDS_border_image_top_right, \
00089         MMSGUI_BORDER_ATTR_IDS_border_image_right, \
00090         MMSGUI_BORDER_ATTR_IDS_border_image_bottom_right, \
00091         MMSGUI_BORDER_ATTR_IDS_border_image_bottom, \
00092         MMSGUI_BORDER_ATTR_IDS_border_image_bottom_left, \
00093         MMSGUI_BORDER_ATTR_IDS_border_image_left, \
00094         MMSGUI_BORDER_ATTR_IDS_border_selimage_path, \
00095         MMSGUI_BORDER_ATTR_IDS_border_selimage_top_left, \
00096         MMSGUI_BORDER_ATTR_IDS_border_selimage_top, \
00097         MMSGUI_BORDER_ATTR_IDS_border_selimage_top_right, \
00098         MMSGUI_BORDER_ATTR_IDS_border_selimage_right, \
00099         MMSGUI_BORDER_ATTR_IDS_border_selimage_bottom_right, \
00100         MMSGUI_BORDER_ATTR_IDS_border_selimage_bottom, \
00101         MMSGUI_BORDER_ATTR_IDS_border_selimage_bottom_left, \
00102         MMSGUI_BORDER_ATTR_IDS_border_selimage_left, \
00103         MMSGUI_BORDER_ATTR_IDS_border_thickness, \
00104         MMSGUI_BORDER_ATTR_IDS_border_margin, \
00105         MMSGUI_BORDER_ATTR_IDS_border_rcorners
00106 
00107     #define MMSGUI_BORDER_ATTR_INIT { \
00108         MMSGUI_BASE_ATTR_ATTRDESC, \
00109         MMSGUI_BORDER_ATTR_ATTRDESC, \
00110         { NULL, TAFF_ATTRTYPE_NONE } \
00111     }
00112 
00113     typedef enum {
00114         MMSGUI_BASE_ATTR_IDS,
00115         MMSGUI_BORDER_ATTR_IDS
00116     } ids;
00117 }
00118 
00119 //! 8 possible border images
00120 #define MMSBORDER_IMAGE_NUM_SIZE    8
00121 
00122 //! describes the 8 possible border images
00123 typedef enum {
00124     MMSBORDER_IMAGE_NUM_TOP_LEFT = 0,
00125     MMSBORDER_IMAGE_NUM_TOP,
00126     MMSBORDER_IMAGE_NUM_TOP_RIGHT,
00127     MMSBORDER_IMAGE_NUM_RIGHT,
00128     MMSBORDER_IMAGE_NUM_BOTTOM_RIGHT,
00129     MMSBORDER_IMAGE_NUM_BOTTOM,
00130     MMSBORDER_IMAGE_NUM_BOTTOM_LEFT,
00131     MMSBORDER_IMAGE_NUM_LEFT
00132 } MMSBORDER_IMAGE_NUM;
00133 
00134 
00135 //! A data access class for the border of widgets and windows.
00136 /*!
00137 This class is the base for the MMSBorder class.
00138 With this data store you have access to all changeable border attributes.
00139 It is also one of the base classes for MMSThemeManager and MMSDialogManager
00140 which are main features of the MMSGUI.
00141 \note This class will be internally used by class MMSBorder.
00142 \author Jens Schneider
00143 */
00144 class MMSBorderClass {
00145     private:
00146         struct {
00147             bool         iscolor;
00148             MMSFBColor   color;
00149             bool         isselcolor;
00150             MMSFBColor   selcolor;
00151             bool         isimagepath;
00152             bool         isimagenames;
00153             bool         isselimagepath;
00154             bool         isselimagenames;
00155             bool         isthickness;
00156             unsigned int thickness;
00157             bool         ismargin;
00158             unsigned int margin;
00159             bool         isrcorners;
00160             bool         rcorners;
00161         } id;
00162 
00163         struct {
00164             string       *imagepath;
00165             string       *imagenames[MMSBORDER_IMAGE_NUM_SIZE];
00166             string       *selimagepath;
00167             string       *selimagenames[MMSBORDER_IMAGE_NUM_SIZE];
00168         } ed;
00169 
00170         /* init routines */
00171         void initColor();
00172         void initSelColor();
00173 
00174         void initImagePath();
00175         void initImageNames();
00176         void initSelImagePath();
00177         void initSelImageNames();
00178 
00179         void initThickness();
00180         void initMargin();
00181         void initRCorners();
00182 
00183         /* free routines */
00184         void freeColor();
00185         void freeSelColor();
00186 
00187         void freeImagePath();
00188         void freeImageNames();
00189         void freeSelImagePath();
00190         void freeSelImageNames();
00191 
00192         void freeThickness();
00193         void freeMargin();
00194         void freeRCorners();
00195 
00196         //! Read and set all attributes from the given TAFF buffer.
00197         /*!
00198         \param tafff        pointer to the TAFF buffer
00199         \param prefix       optional, prefix to all attribute names (<prefix><attrname>=<attrvalue>)
00200         \param path         optional, path needed for empty path values from the TAFF buffer
00201         \param reset_paths  optional, should reset all path attributes?
00202         */
00203         void setAttributesFromTAFF(MMSTaffFile *tafff, string *prefix = NULL, string *path = NULL,
00204                                    bool reset_paths = false);
00205 
00206     public:
00207         MMSBorderClass();
00208         ~MMSBorderClass();
00209         MMSBorderClass &operator=(const MMSBorderClass &c);
00210         //
00211         void unsetAll();
00212 
00213         bool isColor();
00214         void unsetColor();
00215         void setColor(const MMSFBColor &color);
00216         bool getColor(MMSFBColor &color);
00217         //
00218         bool isSelColor();
00219         void unsetSelColor();
00220         void setSelColor(const MMSFBColor &selcolor);
00221         bool getSelColor(MMSFBColor &selcolor);
00222         //
00223         bool isImagePath();
00224         void unsetImagePath();
00225         void setImagePath(const string &imagepath);
00226         bool getImagePath(string &imagepath);
00227         //
00228         bool isImageNames();
00229         void unsetImageNames();
00230         void setImageNames(const string &imagename_1, const string &imagename_2, const string &imagename_3, const string &imagename_4,
00231                            const string &imagename_5, const string &imagename_6, const string &imagename_7, const string &imagename_8);
00232         void setImageNames(MMSBORDER_IMAGE_NUM num, const string &imagename);
00233         bool getImageNames(MMSBORDER_IMAGE_NUM num, string &imagename);
00234         //
00235         bool isSelImagePath();
00236         void unsetSelImagePath();
00237         void setSelImagePath(const string &selimagepath);
00238         bool getSelImagePath(string &selimagepath);
00239         //
00240         bool isSelImageNames();
00241         void unsetSelImageNames();
00242         void setSelImageNames(const string &selimagename_1, const string &selimagename_2, const string &selimagename_3, const string &selimagename_4,
00243                               const string &selimagename_5, const string &selimagename_6, const string &selimagename_7, const string &selimagename_8);
00244         void setSelImageNames(MMSBORDER_IMAGE_NUM num, const string &selimagename);
00245         bool getSelImageNames(MMSBORDER_IMAGE_NUM num, string &selimagename);
00246         //
00247         bool isThickness();
00248         void unsetThickness();
00249         void setThickness(unsigned int thickness);
00250         bool getThickness(unsigned int &thickness);
00251         //
00252         bool isMargin();
00253         void unsetMargin();
00254         void setMargin(unsigned int margin);
00255         bool getMargin(unsigned int &margin);
00256         //
00257         bool isRCorners();
00258         void unsetRCorners();
00259         void setRCorners(bool rcorners);
00260         bool getRCorners(bool &rcorners);
00261 
00262     /* friends */
00263     friend class MMSThemeManager;
00264     friend class MMSDialogManager;
00265 };
00266 
00267 #endif /*MMSBORDERCLASS_H_*/

Generated by doxygen