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

mmsimagewidgetclass.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 MMSIMAGEWIDGETCLASS_H_
00034 #define MMSIMAGEWIDGETCLASS_H_
00035 
00036 #include "mmsgui/theme/mmswidgetclass.h"
00037 
00038 //! describe attributes for MMSImageWidget which are additional to the MMSWidgetClass
00039 namespace MMSGUI_IMAGEWIDGET_ATTR {
00040 
00041     #define MMSGUI_IMAGEWIDGET_ATTR_ATTRDESC \
00042         { "image", TAFF_ATTRTYPE_STRING }, \
00043         { "image.path", TAFF_ATTRTYPE_STRING }, \
00044         { "image.name", TAFF_ATTRTYPE_STRING }, \
00045         { "selimage", TAFF_ATTRTYPE_STRING }, \
00046         { "selimage.path", TAFF_ATTRTYPE_STRING }, \
00047         { "selimage.name", TAFF_ATTRTYPE_STRING }, \
00048         { "image_p", TAFF_ATTRTYPE_STRING }, \
00049         { "image_p.path", TAFF_ATTRTYPE_STRING }, \
00050         { "image_p.name", TAFF_ATTRTYPE_STRING }, \
00051         { "selimage_p", TAFF_ATTRTYPE_STRING }, \
00052         { "selimage_p.path", TAFF_ATTRTYPE_STRING }, \
00053         { "selimage_p.name", TAFF_ATTRTYPE_STRING }, \
00054         { "image_i", TAFF_ATTRTYPE_STRING }, \
00055         { "image_i.path", TAFF_ATTRTYPE_STRING }, \
00056         { "image_i.name", TAFF_ATTRTYPE_STRING }, \
00057         { "selimage_i", TAFF_ATTRTYPE_STRING }, \
00058         { "selimage_i.path", TAFF_ATTRTYPE_STRING }, \
00059         { "selimage_i.name", TAFF_ATTRTYPE_STRING }, \
00060         { "useratio", TAFF_ATTRTYPE_BOOL }, \
00061         { "fit_width", TAFF_ATTRTYPE_BOOL }, \
00062         { "fit_height", TAFF_ATTRTYPE_BOOL }, \
00063         { "alignment", TAFF_ATTRTYPE_STRING }, \
00064         { "mirror_size", TAFF_ATTRTYPE_INT }, \
00065         { "gen_taff", TAFF_ATTRTYPE_BOOL }
00066 
00067     #define MMSGUI_IMAGEWIDGET_ATTR_IDS \
00068         MMSGUI_IMAGEWIDGET_ATTR_IDS_image, \
00069         MMSGUI_IMAGEWIDGET_ATTR_IDS_image_path, \
00070         MMSGUI_IMAGEWIDGET_ATTR_IDS_image_name, \
00071         MMSGUI_IMAGEWIDGET_ATTR_IDS_selimage, \
00072         MMSGUI_IMAGEWIDGET_ATTR_IDS_selimage_path, \
00073         MMSGUI_IMAGEWIDGET_ATTR_IDS_selimage_name, \
00074         MMSGUI_IMAGEWIDGET_ATTR_IDS_image_p, \
00075         MMSGUI_IMAGEWIDGET_ATTR_IDS_image_p_path, \
00076         MMSGUI_IMAGEWIDGET_ATTR_IDS_image_p_name, \
00077         MMSGUI_IMAGEWIDGET_ATTR_IDS_selimage_p, \
00078         MMSGUI_IMAGEWIDGET_ATTR_IDS_selimage_p_path, \
00079         MMSGUI_IMAGEWIDGET_ATTR_IDS_selimage_p_name, \
00080         MMSGUI_IMAGEWIDGET_ATTR_IDS_image_i, \
00081         MMSGUI_IMAGEWIDGET_ATTR_IDS_image_i_path, \
00082         MMSGUI_IMAGEWIDGET_ATTR_IDS_image_i_name, \
00083         MMSGUI_IMAGEWIDGET_ATTR_IDS_selimage_i, \
00084         MMSGUI_IMAGEWIDGET_ATTR_IDS_selimage_i_path, \
00085         MMSGUI_IMAGEWIDGET_ATTR_IDS_selimage_i_name, \
00086         MMSGUI_IMAGEWIDGET_ATTR_IDS_useratio, \
00087         MMSGUI_IMAGEWIDGET_ATTR_IDS_fit_width, \
00088         MMSGUI_IMAGEWIDGET_ATTR_IDS_fit_height, \
00089         MMSGUI_IMAGEWIDGET_ATTR_IDS_alignment, \
00090         MMSGUI_IMAGEWIDGET_ATTR_IDS_mirror_size, \
00091         MMSGUI_IMAGEWIDGET_ATTR_IDS_gen_taff
00092 
00093     #define MMSGUI_IMAGEWIDGET_ATTR_INIT { \
00094         MMSGUI_BASE_ATTR_ATTRDESC, \
00095         MMSGUI_BORDER_ATTR_ATTRDESC, \
00096         MMSGUI_WIDGET_ATTR_ATTRDESC, \
00097         MMSGUI_IMAGEWIDGET_ATTR_ATTRDESC, \
00098         { NULL, TAFF_ATTRTYPE_NONE } \
00099     }
00100 
00101     typedef enum {
00102         MMSGUI_BASE_ATTR_IDS,
00103         MMSGUI_BORDER_ATTR_IDS,
00104         MMSGUI_WIDGET_ATTR_IDS,
00105         MMSGUI_IMAGEWIDGET_ATTR_IDS
00106     } ids;
00107 }
00108 
00109 extern TAFF_ATTRDESC MMSGUI_IMAGEWIDGET_ATTR_I[];
00110 
00111 
00112 //! A data access class for the image widget.
00113 /*!
00114 This class is the base for the MMSImageWidget class.
00115 With this data store you have access to all changeable widget attributes.
00116 It is also one of the base classes for MMSThemeManager and MMSDialogManager
00117 which are main features of the MMSGUI.
00118 \note This class will be internally used by class MMSImageWidget.
00119 \author Jens Schneider
00120 */
00121 class MMSImageWidgetClass {
00122     private:
00123         //! name of the theme class
00124         string       className;
00125 
00126         //! is imagepath set?
00127         bool         isimagepath;
00128 
00129         //! path to the image if the widget is not selected
00130         string       imagepath;
00131 
00132         //! is imagename set?
00133         bool         isimagename;
00134 
00135         //! image filename if the widget is not selected
00136         string       imagename;
00137 
00138         //! is selimagepath set?
00139         bool         isselimagepath;
00140 
00141         //! path to the image if the widget is selected
00142         string       selimagepath;
00143 
00144         //! is selimagename set?
00145         bool         isselimagename;
00146 
00147         //! image filename if the widget is selected
00148         string       selimagename;
00149 
00150         //! is pressed imagepath set?
00151         bool         isimagepath_p;
00152 
00153         //! path to the pressed image if the widget is not selected
00154         string       imagepath_p;
00155 
00156         //! is pressed imagename set?
00157         bool         isimagename_p;
00158 
00159         //! pressed image filename if the widget is not selected
00160         string       imagename_p;
00161 
00162         //! is pressed selimagepath set?
00163         bool         isselimagepath_p;
00164 
00165         //! path to the pressed image if the widget is selected
00166         string       selimagepath_p;
00167 
00168         //! is pressed selimagename set?
00169         bool         isselimagename_p;
00170 
00171         //! pressed image filename if the widget is selected
00172         string       selimagename_p;
00173 
00174         //! is inactive imagepath set?
00175         bool         isimagepath_i;
00176 
00177         //! path to the inactive image if the widget is not selected
00178         string       imagepath_i;
00179 
00180         //! is inactive imagename set?
00181         bool         isimagename_i;
00182 
00183         //! inactive image filename if the widget is not selected
00184         string       imagename_i;
00185 
00186         //! is inactive selimagepath set?
00187         bool         isselimagepath_i;
00188 
00189         //! path to the inactive image if the widget is selected
00190         string       selimagepath_i;
00191 
00192         //! is inactive selimagename set?
00193         bool         isselimagename_i;
00194 
00195         //! inactive image filename if the widget is selected
00196         string       selimagename_i;
00197 
00198         //! is use aspect ratio flag set?
00199         bool         isuseratio;
00200 
00201         //! use aspect ratio of the images (true/false)
00202         bool         useratio;
00203 
00204         //! is fitwidth set?
00205         bool         isfitwidth;
00206 
00207         //! image width should be the same as widget width
00208         bool         fitwidth;
00209 
00210         //! is fitheight set?
00211         bool         isfitheight;
00212 
00213         //! image height should be the same as widget height
00214         bool         fitheight;
00215 
00216         //! is the alignment set?
00217         bool         isalignment;
00218 
00219         //! the alignment of the image within the widget
00220         MMSALIGNMENT alignment;
00221 
00222         //! is the mirror size set?
00223         bool         ismirrorsize;
00224 
00225         //! the size of the mirror effect
00226         unsigned int mirrorsize;
00227 
00228         //! is gen taff flag set?
00229         bool         isgentaff;
00230 
00231         //! generate taff files while reading images true/false
00232         bool         gentaff;
00233 
00234 
00235         //! Read and set all attributes from the given TAFF buffer.
00236         /*!
00237         \param tafff        pointer to the TAFF buffer
00238         \param prefix       optional, prefix to all attribute names (<prefix><attrname>=<attrvalue>)
00239         \param path         optional, path needed for empty path values from the TAFF buffer
00240         \param reset_paths  optional, should reset all path attributes?
00241         */
00242         void setAttributesFromTAFF(MMSTaffFile *tafff, string *prefix = NULL, string *path = NULL,
00243                                    bool reset_paths = false);
00244 
00245     public:
00246         //! stores base widget attributes
00247         MMSWidgetClass widgetClass;
00248 
00249         //! Constructor of class MMSImageWidgetClass.
00250         MMSImageWidgetClass();
00251 
00252         //! Mark all attributes as not set.
00253         void unsetAll();
00254 
00255         //! Set the name of the theme class.
00256         /*!
00257         \param classname  name of the class
00258         */
00259         void setClassName(string className);
00260 
00261         //! Get the name of the theme class.
00262         /*!
00263         \return name of the class
00264         */
00265         string getClassName();
00266 
00267         //! Check if the imagepath is set. This path will be used for the unselected widget.
00268         bool isImagePath();
00269 
00270         //! Set the imagepath which is used to draw the unselected widget.
00271         /*!
00272         \param imagepath  path to unselected image
00273         */
00274         void setImagePath(string imagepath);
00275 
00276         //! Mark the imagepath as not set.
00277         void unsetImagePath();
00278 
00279         //! Get the imagepath which is used to draw the unselected widget.
00280         /*!
00281         \return path to the unselected image
00282         */
00283         string getImagePath();
00284 
00285         //! Check if the imagename is set. This name will be used for the unselected widget.
00286         bool isImageName();
00287 
00288         //! Set the imagename which is used to draw the unselected widget.
00289         /*!
00290         \param imagename  name of the unselected image
00291         */
00292         void setImageName(string imagename);
00293 
00294         //! Mark the imagename as not set.
00295         void unsetImageName();
00296 
00297         //! Get the imagename which is used to draw the unselected widget.
00298         /*!
00299         \return name of the unselected image
00300         */
00301         string getImageName();
00302 
00303         //! Check if the selimagepath is set. This path will be used for the selected widget.
00304         bool isSelImagePath();
00305 
00306         //! Set the selimagepath which is used to draw the selected widget.
00307         /*!
00308         \param selimagepath  path to selected image
00309         */
00310         void setSelImagePath(string selimagepath);
00311 
00312         //! Mark the selimagepath as not set.
00313         void unsetSelImagePath();
00314 
00315         //! Get the selimagepath which is used to draw the selected widget.
00316         /*!
00317         \return path to the selected image
00318         */
00319         string getSelImagePath();
00320 
00321         //! Check if the selimagename is set. This name will be used for the selected widget.
00322         bool isSelImageName();
00323 
00324         //! Set the selimagename which is used to draw the selected widget.
00325         /*!
00326         \param selimagename  name of the selected image
00327         */
00328         void setSelImageName(string selimagename);
00329 
00330         //! Mark the selimagename as not set.
00331         void unsetSelImageName();
00332 
00333         //! Get the selimagename which is used to draw the selected widget.
00334         /*!
00335         \return name of the selected image
00336         */
00337         string getSelImageName();
00338 
00339         //! Check if the pressed imagepath is set. This path will be used for the unselected widget.
00340         bool isImagePath_p();
00341 
00342         //! Set the pressed imagepath which is used to draw the unselected widget.
00343         /*!
00344         \param imagepath_p  path to pressed unselected image
00345         */
00346         void setImagePath_p(string imagepath_p);
00347 
00348         //! Mark the pressed imagepath as not set.
00349         void unsetImagePath_p();
00350 
00351         //! Get the pressed imagepath which is used to draw the unselected widget.
00352         /*!
00353         \return path to the pressed unselected image
00354         */
00355         string getImagePath_p();
00356 
00357         //! Check if the pressed imagename is set. This name will be used for the unselected widget.
00358         bool isImageName_p();
00359 
00360         //! Set the pressed imagename which is used to draw the unselected widget.
00361         /*!
00362         \param imagename_p  name of the pressed unselected image
00363         */
00364         void setImageName_p(string imagename_p);
00365 
00366         //! Mark the pressed imagename as not set.
00367         void unsetImageName_p();
00368 
00369         //! Get the pressed imagename which is used to draw the unselected widget.
00370         /*!
00371         \return name of the pressed unselected image
00372         */
00373         string getImageName_p();
00374 
00375         //! Check if the pressed selimagepath is set. This path will be used for the selected widget.
00376         bool isSelImagePath_p();
00377 
00378         //! Set the pressed selimagepath which is used to draw the selected widget.
00379         /*!
00380         \param selimagepath_p  path to pressed selected image
00381         */
00382         void setSelImagePath_p(string selimagepath_p);
00383 
00384         //! Mark the pressed selimagepath as not set.
00385         void unsetSelImagePath_p();
00386 
00387         //! Get the pressed selimagepath which is used to draw the selected widget.
00388         /*!
00389         \return path to the pressed selected image
00390         */
00391         string getSelImagePath_p();
00392 
00393         //! Check if the pressed selimagename is set. This name will be used for the selected widget.
00394         bool isSelImageName_p();
00395 
00396         //! Set the pressed selimagename which is used to draw the selected widget.
00397         /*!
00398         \param selimagename_p  name of the pressed selected image
00399         */
00400         void setSelImageName_p(string selimagename_p);
00401 
00402         //! Mark the pressed selimagename as not set.
00403         void unsetSelImageName_p();
00404 
00405         //! Get the pressed selimagename which is used to draw the selected widget.
00406         /*!
00407         \return name of the pressed selected image
00408         */
00409         string getSelImageName_p();
00410 
00411         //! Check if the inactive imagepath is set. This path will be used for the unselected widget.
00412         bool isImagePath_i();
00413 
00414         //! Set the inactive imagepath which is used to draw the unselected widget.
00415         /*!
00416         \param imagepath_i  path to inactive unselected image
00417         */
00418         void setImagePath_i(string imagepath_i);
00419 
00420         //! Mark the inactive imagepath as not set.
00421         void unsetImagePath_i();
00422 
00423         //! Get the inactive imagepath which is used to draw the unselected widget.
00424         /*!
00425         \return path to the inactive unselected image
00426         */
00427         string getImagePath_i();
00428 
00429         //! Check if the inactive imagename is set. This name will be used for the unselected widget.
00430         bool isImageName_i();
00431 
00432         //! Set the inactive imagename which is used to draw the unselected widget.
00433         /*!
00434         \param imagename_i  name of the inactive unselected image
00435         */
00436         void setImageName_i(string imagename_i);
00437 
00438         //! Mark the inactive imagename as not set.
00439         void unsetImageName_i();
00440 
00441         //! Get the inactive imagename which is used to draw the unselected widget.
00442         /*!
00443         \return name of the inactive unselected image
00444         */
00445         string getImageName_i();
00446 
00447         //! Check if the inactive selimagepath is set. This path will be used for the selected widget.
00448         bool isSelImagePath_i();
00449 
00450         //! Set the inactive selimagepath which is used to draw the selected widget.
00451         /*!
00452         \param selimagepath_i  path to inactive selected image
00453         */
00454         void setSelImagePath_i(string selimagepath_i);
00455 
00456         //! Mark the inactive selimagepath as not set.
00457         void unsetSelImagePath_i();
00458 
00459         //! Get the inactive selimagepath which is used to draw the selected widget.
00460         /*!
00461         \return path to the inactive selected image
00462         */
00463         string getSelImagePath_i();
00464 
00465         //! Check if the inactive selimagename is set. This name will be used for the selected widget.
00466         bool isSelImageName_i();
00467 
00468         //! Set the inactive selimagename which is used to draw the selected widget.
00469         /*!
00470         \param selimagename_i  name of the inactive selected image
00471         */
00472         void setSelImageName_i(string selimagename_i);
00473 
00474         //! Mark the inactive selimagename as not set.
00475         void unsetSelImageName_i();
00476 
00477         //! Get the inactive selimagename which is used to draw the selected widget.
00478         /*!
00479         \return name of the inactive selected image
00480         */
00481         string getSelImageName_i();
00482 
00483         //! Check if the use acpect ratio is set.
00484         bool isUseRatio();
00485 
00486         //! Set the use aspect ratio flag.
00487         /*!
00488         \param useratio  use aspect ratio true/false
00489         */
00490         void setUseRatio(bool useratio);
00491 
00492         //! Mark the use aspect ratio as not set.
00493         void unsetUseRatio();
00494 
00495         //! Get the use aspect ratio flag.
00496         /*!
00497         \return use aspect ratio flag
00498         */
00499         bool getUseRatio();
00500 
00501         //! Check if the fitwidth flag is set.
00502         bool isFitWidth();
00503 
00504         //! Set the fitwidth flag.
00505         /*!
00506         \param fitwidth  fit width true/false
00507         */
00508         void setFitWidth(bool fitwidth);
00509 
00510         //! Mark the fitwidth as not set.
00511         void unsetFitWidth();
00512 
00513         //! Get the fitwidth flag.
00514         /*!
00515         \return fitwidth flag
00516         */
00517         bool getFitWidth();
00518 
00519         //! Check if the fitheight flag is set.
00520         bool isFitHeight();
00521 
00522         //! Set the fitheight flag.
00523         /*!
00524         \param fitheight  fit height true/false
00525         */
00526         void setFitHeight(bool fitheight);
00527 
00528         //! Mark the fitheight as not set.
00529         void unsetFitHeight();
00530 
00531         //! Get the fitheight flag.
00532         /*!
00533         \return fitheight flag
00534         */
00535         bool getFitHeight();
00536 
00537         //! Check if the alignment of the image is set.
00538         bool isAlignment();
00539 
00540         //! Set the alignment of the image.
00541         /*!
00542         \param alignment    alignment of the image within the widget area
00543         */
00544         void setAlignment(MMSALIGNMENT alignment);
00545 
00546         //! Mark the alignment as not set.
00547         void unsetAlignment();
00548 
00549         //! Get the alignment.
00550         /*!
00551         \return alignment of the image within the widget
00552         */
00553         MMSALIGNMENT getAlignment();
00554 
00555         //! Check if the mirror size is set.
00556         bool isMirrorSize();
00557 
00558         //! Set the mirror size.
00559         /*!
00560         \param mirrorsize size of the mirror effect in pixel
00561         */
00562         void setMirrorSize(unsigned int mirrorsize);
00563 
00564         //! Mark the mirror size as not set.
00565         void unsetMirrorSize();
00566 
00567         //! Get the mirror size.
00568         /*!
00569         \return size of the mirror in pixel
00570         */
00571         unsigned int getMirrorSize();
00572 
00573         //! Check if the gen taff flag is set.
00574         bool isGenTaff();
00575 
00576         //! Set the gen taff flag.
00577         /*!
00578         \param gentaff  generate taff files while reading images if set to true
00579         \note Taff files will never generated, if you load images e.g. from http:// or ftp://.
00580         */
00581         void setGenTaff(bool gentaff);
00582 
00583         //! Mark the gen taff flag as not set.
00584         void unsetGenTaff();
00585 
00586         //! Get the gen taff flag.
00587         /*!
00588         \return gen taff flag
00589         */
00590         bool getGenTaff();
00591 
00592 
00593     /* friends */
00594     friend class MMSThemeManager;
00595     friend class MMSDialogManager;
00596 };
00597 
00598 #endif /*MMSIMAGEWIDGETCLASS_H_*/

Generated by doxygen