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 MMSSLIDERWIDGETCLASS_H_ 00034 #define MMSSLIDERWIDGETCLASS_H_ 00035 00036 #include "mmsgui/theme/mmswidgetclass.h" 00037 00038 //! describe attributes for MMSSliderWidget which are additional to the MMSWidgetClass 00039 namespace MMSGUI_SLIDERWIDGET_ATTR { 00040 00041 #define MMSGUI_SLIDERWIDGET_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 { "position", TAFF_ATTRTYPE_UCHAR100 }, \ 00061 { "barimage", TAFF_ATTRTYPE_STRING }, \ 00062 { "barimage.path", TAFF_ATTRTYPE_STRING }, \ 00063 { "barimage.name", TAFF_ATTRTYPE_STRING }, \ 00064 { "selbarimage", TAFF_ATTRTYPE_STRING }, \ 00065 { "selbarimage.path", TAFF_ATTRTYPE_STRING }, \ 00066 { "selbarimage.name", TAFF_ATTRTYPE_STRING } 00067 00068 #define MMSGUI_SLIDERWIDGET_ATTR_IDS \ 00069 MMSGUI_SLIDERWIDGET_ATTR_IDS_image, \ 00070 MMSGUI_SLIDERWIDGET_ATTR_IDS_image_path, \ 00071 MMSGUI_SLIDERWIDGET_ATTR_IDS_image_name, \ 00072 MMSGUI_SLIDERWIDGET_ATTR_IDS_selimage, \ 00073 MMSGUI_SLIDERWIDGET_ATTR_IDS_selimage_path, \ 00074 MMSGUI_SLIDERWIDGET_ATTR_IDS_selimage_name, \ 00075 MMSGUI_SLIDERWIDGET_ATTR_IDS_image_p, \ 00076 MMSGUI_SLIDERWIDGET_ATTR_IDS_image_p_path, \ 00077 MMSGUI_SLIDERWIDGET_ATTR_IDS_image_p_name, \ 00078 MMSGUI_SLIDERWIDGET_ATTR_IDS_selimage_p, \ 00079 MMSGUI_SLIDERWIDGET_ATTR_IDS_selimage_p_path, \ 00080 MMSGUI_SLIDERWIDGET_ATTR_IDS_selimage_p_name, \ 00081 MMSGUI_SLIDERWIDGET_ATTR_IDS_image_i, \ 00082 MMSGUI_SLIDERWIDGET_ATTR_IDS_image_i_path, \ 00083 MMSGUI_SLIDERWIDGET_ATTR_IDS_image_i_name, \ 00084 MMSGUI_SLIDERWIDGET_ATTR_IDS_selimage_i, \ 00085 MMSGUI_SLIDERWIDGET_ATTR_IDS_selimage_i_path, \ 00086 MMSGUI_SLIDERWIDGET_ATTR_IDS_selimage_i_name, \ 00087 MMSGUI_SLIDERWIDGET_ATTR_IDS_position, \ 00088 MMSGUI_SLIDERWIDGET_ATTR_IDS_barimage, \ 00089 MMSGUI_SLIDERWIDGET_ATTR_IDS_barimage_path, \ 00090 MMSGUI_SLIDERWIDGET_ATTR_IDS_barimage_name, \ 00091 MMSGUI_SLIDERWIDGET_ATTR_IDS_selbarimage, \ 00092 MMSGUI_SLIDERWIDGET_ATTR_IDS_selbarimage_path, \ 00093 MMSGUI_SLIDERWIDGET_ATTR_IDS_selbarimage_name 00094 00095 #define MMSGUI_SLIDERWIDGET_ATTR_INIT { \ 00096 MMSGUI_BASE_ATTR_ATTRDESC, \ 00097 MMSGUI_BORDER_ATTR_ATTRDESC, \ 00098 MMSGUI_WIDGET_ATTR_ATTRDESC, \ 00099 MMSGUI_SLIDERWIDGET_ATTR_ATTRDESC, \ 00100 { NULL, TAFF_ATTRTYPE_NONE } \ 00101 } 00102 00103 typedef enum { 00104 MMSGUI_BASE_ATTR_IDS, 00105 MMSGUI_BORDER_ATTR_IDS, 00106 MMSGUI_WIDGET_ATTR_IDS, 00107 MMSGUI_SLIDERWIDGET_ATTR_IDS 00108 } ids; 00109 } 00110 00111 extern TAFF_ATTRDESC MMSGUI_SLIDERWIDGET_ATTR_I[]; 00112 00113 00114 //! A data access class for the slider widget. 00115 /*! 00116 This class is the base for the MMSSliderWidget class. 00117 With this data store you have access to all changeable widget attributes. 00118 It is also one of the base classes for MMSThemeManager and MMSDialogManager 00119 which are main features of the MMSGUI. 00120 \note This class will be internally used by class MMSSliderWidget. 00121 \author Jens Schneider 00122 */ 00123 class MMSSliderWidgetClass { 00124 private: 00125 //! name of the theme class 00126 string className; 00127 00128 //! is imagepath set? 00129 bool isimagepath; 00130 00131 //! path to the image if the widget is not selected 00132 string imagepath; 00133 00134 //! is imagename set? 00135 bool isimagename; 00136 00137 //! image filename if the widget is not selected 00138 string imagename; 00139 00140 //! is selimagepath set? 00141 bool isselimagepath; 00142 00143 //! path to the image if the widget is selected 00144 string selimagepath; 00145 00146 //! is selimagename set? 00147 bool isselimagename; 00148 00149 //! image filename if the widget is selected 00150 string selimagename; 00151 00152 //! is pressed imagepath set? 00153 bool isimagepath_p; 00154 00155 //! path to the pressed image if the widget is not selected 00156 string imagepath_p; 00157 00158 //! is pressed imagename set? 00159 bool isimagename_p; 00160 00161 //! pressed image filename if the widget is not selected 00162 string imagename_p; 00163 00164 //! is pressed selimagepath set? 00165 bool isselimagepath_p; 00166 00167 //! path to the pressed image if the widget is selected 00168 string selimagepath_p; 00169 00170 //! is pressed selimagename set? 00171 bool isselimagename_p; 00172 00173 //! pressed image filename if the widget is selected 00174 string selimagename_p; 00175 00176 //! is inactive imagepath set? 00177 bool isimagepath_i; 00178 00179 //! path to the inactive image if the widget is not selected 00180 string imagepath_i; 00181 00182 //! is inactive imagename set? 00183 bool isimagename_i; 00184 00185 //! inactive image filename if the widget is not selected 00186 string imagename_i; 00187 00188 //! is inactive selimagepath set? 00189 bool isselimagepath_i; 00190 00191 //! path to the inactive image if the widget is selected 00192 string selimagepath_i; 00193 00194 //! is inactive selimagename set? 00195 bool isselimagename_i; 00196 00197 //! inactive image filename if the widget is selected 00198 string selimagename_i; 00199 00200 //! is position set? 00201 bool isposition; 00202 00203 //! position between 0 and 100 percent 00204 unsigned int position; 00205 00206 00207 00208 //! is barimagepath set? 00209 bool isbarimagepath; 00210 00211 //! path to the barimage if the widget is not selected 00212 string barimagepath; 00213 00214 //! is barimagename set? 00215 bool isbarimagename; 00216 00217 //! barimage filename if the widget is not selected 00218 string barimagename; 00219 00220 //! is selbarimagepath set? 00221 bool isselbarimagepath; 00222 00223 //! path to the barimage if the widget is selected 00224 string selbarimagepath; 00225 00226 //! is selbarimagename set? 00227 bool isselbarimagename; 00228 00229 //! barimage filename if the widget is selected 00230 string selbarimagename; 00231 00232 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 MMSSliderWidgetClass. 00250 MMSSliderWidgetClass(); 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 00484 bool isPosition(); 00485 void setPosition(unsigned int position); 00486 void unsetPosition(); 00487 unsigned int getPosition(); 00488 00489 00490 00491 00492 //! Check if the barimagepath is set. This path will be used for the unselected widget. 00493 bool isBarImagePath(); 00494 00495 //! Set the barimagepath which is used to draw the unselected widget. 00496 /*! 00497 \param barimagepath path to unselected barimage 00498 */ 00499 void setBarImagePath(string barimagepath); 00500 00501 //! Mark the barimagepath as not set. 00502 void unsetBarImagePath(); 00503 00504 //! Get the barimagepath which is used to draw the unselected widget. 00505 /*! 00506 \return path to the unselected barimage 00507 */ 00508 string getBarImagePath(); 00509 00510 //! Check if the barimagename is set. This name will be used for the unselected widget. 00511 bool isBarImageName(); 00512 00513 //! Set the barimagename which is used to draw the unselected widget. 00514 /*! 00515 \param barimagename name of the unselected barimage 00516 */ 00517 void setBarImageName(string barimagename); 00518 00519 //! Mark the barimagename as not set. 00520 void unsetBarImageName(); 00521 00522 //! Get the barimagename which is used to draw the unselected widget. 00523 /*! 00524 \return name of the unselected barimage 00525 */ 00526 string getBarImageName(); 00527 00528 //! Check if the selbarimagepath is set. This path will be used for the selected widget. 00529 bool isSelBarImagePath(); 00530 00531 //! Set the selbarimagepath which is used to draw the selected widget. 00532 /*! 00533 \param selbarimagepath path to selected barimage 00534 */ 00535 void setSelBarImagePath(string selbarimagepath); 00536 00537 //! Mark the selbarimagepath as not set. 00538 void unsetSelBarImagePath(); 00539 00540 //! Get the selbarimagepath which is used to draw the selected widget. 00541 /*! 00542 \return path to the selected barimage 00543 */ 00544 string getSelBarImagePath(); 00545 00546 //! Check if the selbarimagename is set. This name will be used for the selected widget. 00547 bool isSelBarImageName(); 00548 00549 //! Set the selbarimagename which is used to draw the selected widget. 00550 /*! 00551 \param selbarimagename name of the selected barimage 00552 */ 00553 void setSelBarImageName(string selbarimagename); 00554 00555 //! Mark the selbarimagename as not set. 00556 void unsetSelBarImageName(); 00557 00558 //! Get the selbarimagename which is used to draw the selected widget. 00559 /*! 00560 \return name of the selected barimage 00561 */ 00562 string getSelBarImageName(); 00563 00564 00565 00566 /* friends */ 00567 friend class MMSThemeManager; 00568 friend class MMSDialogManager; 00569 }; 00570 00571 #endif /*MMSSLIDERWIDGETCLASS_H_*/