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

mmsprogressbarwidgetclass.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 MMSPROGRESSBARWIDGETCLASS_H_
00034 #define MMSPROGRESSBARWIDGETCLASS_H_
00035 
00036 #include "mmsgui/theme/mmswidgetclass.h"
00037 
00038 //! describe attributes for MMSProgressBarWidget which are additional to the MMSWidgetClass
00039 namespace MMSGUI_PROGRESSBARWIDGET_ATTR {
00040 
00041     #define MMSGUI_PROGRESSBARWIDGET_ATTR_ATTRDESC \
00042         { "color", TAFF_ATTRTYPE_COLOR }, \
00043         { "color.a", TAFF_ATTRTYPE_UCHAR }, \
00044         { "color.r", TAFF_ATTRTYPE_UCHAR }, \
00045         { "color.g", TAFF_ATTRTYPE_UCHAR }, \
00046         { "color.b", TAFF_ATTRTYPE_UCHAR }, \
00047         { "selcolor", TAFF_ATTRTYPE_COLOR }, \
00048         { "selcolor.a", TAFF_ATTRTYPE_UCHAR }, \
00049         { "selcolor.r", TAFF_ATTRTYPE_UCHAR }, \
00050         { "selcolor.g", TAFF_ATTRTYPE_UCHAR }, \
00051         { "selcolor.b", TAFF_ATTRTYPE_UCHAR }, \
00052         { "progress", TAFF_ATTRTYPE_UCHAR100 }
00053 
00054     #define MMSGUI_PROGRESSBARWIDGET_ATTR_IDS \
00055         MMSGUI_PROGRESSBARWIDGET_ATTR_IDS_color, \
00056         MMSGUI_PROGRESSBARWIDGET_ATTR_IDS_color_a, \
00057         MMSGUI_PROGRESSBARWIDGET_ATTR_IDS_color_r, \
00058         MMSGUI_PROGRESSBARWIDGET_ATTR_IDS_color_g, \
00059         MMSGUI_PROGRESSBARWIDGET_ATTR_IDS_color_b, \
00060         MMSGUI_PROGRESSBARWIDGET_ATTR_IDS_selcolor, \
00061         MMSGUI_PROGRESSBARWIDGET_ATTR_IDS_selcolor_a, \
00062         MMSGUI_PROGRESSBARWIDGET_ATTR_IDS_selcolor_r, \
00063         MMSGUI_PROGRESSBARWIDGET_ATTR_IDS_selcolor_g, \
00064         MMSGUI_PROGRESSBARWIDGET_ATTR_IDS_selcolor_b, \
00065         MMSGUI_PROGRESSBARWIDGET_ATTR_IDS_progress
00066 
00067     #define MMSGUI_PROGRESSBARWIDGET_ATTR_INIT { \
00068         MMSGUI_BASE_ATTR_ATTRDESC, \
00069         MMSGUI_BORDER_ATTR_ATTRDESC, \
00070         MMSGUI_WIDGET_ATTR_ATTRDESC, \
00071         MMSGUI_PROGRESSBARWIDGET_ATTR_ATTRDESC, \
00072         { NULL, TAFF_ATTRTYPE_NONE } \
00073     }
00074 
00075     typedef enum {
00076         MMSGUI_BASE_ATTR_IDS,
00077         MMSGUI_BORDER_ATTR_IDS,
00078         MMSGUI_WIDGET_ATTR_IDS,
00079         MMSGUI_PROGRESSBARWIDGET_ATTR_IDS
00080     } ids;
00081 }
00082 
00083 extern TAFF_ATTRDESC MMSGUI_PROGRESSBARWIDGET_ATTR_I[];
00084 
00085 
00086 //! A data access class for the progressbar widget.
00087 /*!
00088 This class is the base for the MMSProgressBarWidget class.
00089 With this data store you have access to all changeable widget attributes.
00090 It is also one of the base classes for MMSThemeManager and MMSDialogManager
00091 which are main features of the MMSGUI.
00092 \note This class will be internally used by class MMSProgressBarWidget.
00093 \author Jens Schneider
00094 */
00095 class MMSProgressBarWidgetClass {
00096     private:
00097         //! name of the theme class
00098         string          className;
00099 
00100         //! is color set?
00101         bool            iscolor;
00102 
00103         //! color if the widget is not selected
00104         MMSFBColor      color;
00105 
00106         //! is selcolor set?
00107         bool            isselcolor;
00108 
00109         //! color if the widget is selected
00110         MMSFBColor      selcolor;
00111 
00112         //! is progress value set?
00113         bool            isprogress;
00114 
00115         //! progress value in percent
00116         unsigned int    progress;
00117 
00118         //! Read and set all attributes from the given TAFF buffer.
00119         /*!
00120         \param tafff        pointer to the TAFF buffer
00121         \param prefix       optional, prefix to all attribute names (<prefix><attrname>=<attrvalue>)
00122         \param path         optional, path needed for empty path values from the TAFF buffer
00123         \param reset_paths  optional, should reset all path attributes?
00124         */
00125         void setAttributesFromTAFF(MMSTaffFile *tafff, string *prefix = NULL, string *path = NULL,
00126                                    bool reset_paths = false);
00127 
00128     public:
00129         //! stores base widget attributes
00130         MMSWidgetClass widgetClass;
00131 
00132         //! Constructor of class MMSProgressBarWidgetClass.
00133         MMSProgressBarWidgetClass();
00134 
00135         //! Mark all attributes as not set.
00136         void unsetAll();
00137 
00138         //! Set the name of the theme class.
00139         /*!
00140         \param classname  name of the class
00141         */
00142         void setClassName(string className);
00143 
00144         //! Get the name of the theme class.
00145         /*!
00146         \return name of the class
00147         */
00148         string getClassName();
00149 
00150         //! Check if the color is set. This color will be used to draw the unselected progress bar.
00151         bool isColor();
00152 
00153         //! Set the color which is used to draw the unselected progress bar.
00154         /*!
00155         \param color  color for unselected bar
00156         */
00157         void setColor(MMSFBColor color);
00158 
00159         //! Mark the color as not set.
00160         void unsetColor();
00161 
00162         //! Get the color which is used to draw the unselected progress bar.
00163         /*!
00164         \return color which is used for the unselected progress bar
00165         */
00166         MMSFBColor getColor();
00167 
00168         //! Check if the color is set. This color will be used for the selected progress bar.
00169         bool isSelColor();
00170 
00171         //! Set the color which is used to draw the selected progress bar.
00172         /*!
00173         \param selcolor  color for selected bar
00174         */
00175         void setSelColor(MMSFBColor selcolor);
00176 
00177         //! Mark the color as not set.
00178         void unsetSelColor();
00179 
00180         //! Get the color which is used to draw the selected progress bar.
00181         /*!
00182         \return color which is used for the selected progress bar
00183         */
00184         MMSFBColor getSelColor();
00185 
00186         //! Check if the progress value is set.
00187         bool isProgress();
00188 
00189         //! Set the progress.
00190         /*!
00191         \param progress  progress in percent (0-100)
00192         */
00193         void setProgress(unsigned int progress);
00194 
00195         //! Mark the progress as not set.
00196         void unsetProgress();
00197 
00198         //! Get the progress.
00199         /*!
00200         \return progress
00201         */
00202         unsigned int getProgress();
00203 
00204     /* friends */
00205     friend class MMSThemeManager;
00206     friend class MMSDialogManager;
00207 };
00208 
00209 #endif /*MMSPROGRESSBARWIDGETCLASS_H_*/

Generated by doxygen