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

mmssliderwidget.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 MMSSLIDERWIDGET_H_
00034 #define MMSSLIDERWIDGET_H_
00035 
00036 #include "mmsgui/mmswidget.h"
00037 
00038 //! With this class you can display a slider.
00039 /*!
00040 The slider consists of an image which will be positioned within the slider widget area.
00041 The slider widget cannot be focused.
00042 \author Jens Schneider
00043 */
00044 class MMSSliderWidget : public MMSWidget {
00045     private:
00046         string                  className;
00047         MMSSliderWidgetClass    *sliderWidgetClass;
00048         MMSSliderWidgetClass    mySliderWidgetClass;
00049 
00050         bool imagepath_set;
00051         bool selimagepath_set;
00052 
00053         bool imagepath_p_set;
00054         bool selimagepath_p_set;
00055 
00056         bool imagepath_i_set;
00057         bool selimagepath_i_set;
00058 
00059         bool barimagepath_set;
00060         bool selbarimagepath_set;
00061 
00062         MMSFBSurface    *image;
00063         MMSFBSurface    *selimage;
00064         MMSFBSurface    *image_p;
00065         MMSFBSurface    *selimage_p;
00066         MMSFBSurface    *image_i;
00067         MMSFBSurface    *selimage_i;
00068 
00069         MMSFBSurface    *barimage;
00070         MMSFBSurface    *selbarimage;
00071 
00072         bool    vertical;
00073 
00074         //! current foreground values set?
00075         bool            current_fgset;
00076 
00077         //! current foreground image
00078         MMSFBSurface    *current_fgimage;
00079 
00080         //! current foreground bar image
00081         MMSFBSurface    *current_fgbarimage;
00082 
00083         bool create(MMSWindow *root, string className, MMSTheme *theme);
00084 
00085         bool init();
00086         bool release();
00087 
00088         void getImage(MMSFBSurface **suf);
00089         void getBarImage(MMSFBSurface **suf);
00090         void calcPos(MMSFBSurface *suf, MMSFBRectangle *surfaceGeom, bool *vertical,
00091                      MMSFBSurface *barsuf = NULL, MMSFBRectangle *src_barGeom = NULL, MMSFBRectangle *dst_barGeom = NULL);
00092 
00093         void getForeground(MMSFBSurface **image, MMSFBSurface **barimage);
00094         bool enableRefresh(bool enable = true);
00095         bool checkRefreshStatus();
00096 
00097         bool draw(bool *backgroundFilled = NULL);
00098         void switchArrowWidgets();
00099 
00100     public:
00101         MMSSliderWidget(MMSWindow *root, string className, MMSTheme *theme = NULL);
00102         ~MMSSliderWidget();
00103 
00104         MMSWidget *copyWidget();
00105 
00106         bool scrollDown(unsigned int count = 1, bool refresh = true, bool test = false, bool leave_selection = false);
00107         bool scrollUp(unsigned int count = 1, bool refresh = true, bool test = false, bool leave_selection = false);
00108         bool scrollRight(unsigned int count = 1, bool refresh = true, bool test = false, bool leave_selection = false);
00109         bool scrollLeft(unsigned int count = 1, bool refresh = true, bool test = false, bool leave_selection = false);
00110 
00111         bool scrollTo(int posx, int posy, bool refresh = true, bool *changed = NULL);
00112 
00113         sigc::signal<bool, MMSWidget*>::accumulated<neg_bool_accumulator> *onSliderIncrement;
00114         sigc::signal<bool, MMSWidget*>::accumulated<neg_bool_accumulator> *onSliderDecrement;
00115 
00116     public:
00117         /* theme access methods */
00118         string getImagePath();
00119         string getImageName();
00120         string getSelImagePath();
00121         string getSelImageName();
00122         string getImagePath_p();
00123         string getImageName_p();
00124         string getSelImagePath_p();
00125         string getSelImageName_p();
00126         string getImagePath_i();
00127         string getImageName_i();
00128         string getSelImagePath_i();
00129         string getSelImageName_i();
00130         unsigned int getPosition();
00131         string getBarImagePath();
00132         string getBarImageName();
00133         string getSelBarImagePath();
00134         string getSelBarImageName();
00135 
00136         void setImagePath(string imagepath, bool load = true, bool refresh = true);
00137         void setImageName(string imagename, bool load = true, bool refresh = true);
00138         void setImage(string imagepath, string imagename, bool load = true, bool refresh = true);
00139         void setSelImagePath(string selimagepath, bool load = true, bool refresh = true);
00140         void setSelImageName(string selimagename, bool load = true, bool refresh = true);
00141         void setSelImage(string selimagepath, string selimagename, bool load = true, bool refresh = true);
00142         void setImagePath_p(string imagepath_p, bool load = true, bool refresh = true);
00143         void setImageName_p(string imagename_p, bool load = true, bool refresh = true);
00144         void setImage_p(string imagepath_p, string imagename_p, bool load = true, bool refresh = true);
00145         void setSelImagePath_p(string selimagepath_p, bool load = true, bool refresh = true);
00146         void setSelImageName_p(string selimagename_p, bool load = true, bool refresh = true);
00147         void setSelImage_p(string selimagepath_p, string selimagename_p, bool load = true, bool refresh = true);
00148         void setImagePath_i(string imagepath_i, bool load = true, bool refresh = true);
00149         void setImageName_i(string imagename_i, bool load = true, bool refresh = true);
00150         void setImage_i(string imagepath_i, string imagename_i, bool load = true, bool refresh = true);
00151         void setSelImagePath_i(string selimagepath_i, bool load = true, bool refresh = true);
00152         void setSelImageName_i(string selimagename_i, bool load = true, bool refresh = true);
00153         void setSelImage_i(string selimagepath_i, string selimagename_i, bool load = true, bool refresh = true);
00154         void setPosition(unsigned int pos, bool refresh = true);
00155         void setBarImagePath(string barimagepath, bool load = true, bool refresh = true);
00156         void setBarImageName(string barimagename, bool load = true, bool refresh = true);
00157         void setBarImage(string barimagepath, string barimagename, bool load = true, bool refresh = true);
00158         void setSelBarImagePath(string selbarimagepath, bool load = true, bool refresh = true);
00159         void setSelBarImageName(string selbarimagename, bool load = true, bool refresh = true);
00160         void setSelBarImage(string selbarimagepath, string selbarimagename, bool load = true, bool refresh = true);
00161 
00162         void updateFromThemeClass(MMSSliderWidgetClass *themeClass);
00163 };
00164 
00165 #endif /*MMSSLIDERWIDGET_H_*/

Generated by doxygen