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

mmscheckboxwidget.cpp

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 #include "mmsgui/mmscheckboxwidget.h"
00034 
00035 MMSCheckBoxWidget::MMSCheckBoxWidget(MMSWindow *root, string className, MMSTheme *theme) : MMSWidget() {
00036     create(root, className, theme);
00037 }
00038 
00039 MMSCheckBoxWidget::~MMSCheckBoxWidget() {
00040 }
00041 
00042 bool MMSCheckBoxWidget::create(MMSWindow *root, string className, MMSTheme *theme) {
00043     this->type = MMSWIDGETTYPE_CHECKBOX;
00044     this->className = className;
00045 
00046     // init attributes for drawable widgets
00047     this->da = new MMSWIDGET_DRAWABLE_ATTRIBUTES;
00048     if (theme) this->da->theme = theme; else this->da->theme = globalTheme;
00049     this->checkBoxWidgetClass = this->da->theme->getCheckBoxWidgetClass(className);
00050     this->da->baseWidgetClass = &(this->da->theme->checkBoxWidgetClass.widgetClass);
00051     if (this->checkBoxWidgetClass) this->da->widgetClass = &(this->checkBoxWidgetClass->widgetClass); else this->da->widgetClass = NULL;
00052 
00053     /* clear */
00054     this->checked_bgimage = NULL;
00055     this->checked_selbgimage = NULL;
00056     this->checked_bgimage_p = NULL;
00057     this->checked_selbgimage_p = NULL;
00058     this->checked_bgimage_i = NULL;
00059     this->checked_selbgimage_i = NULL;
00060 
00061     this->current_checked_bgset = false;
00062 
00063     return MMSWidget::create(root, true, false, true, true, true, true, true);
00064 }
00065 
00066 void MMSCheckBoxWidget::handleInput(MMSInputEvent *inputevent) {
00067 
00068     // switch the check state
00069     if (inputevent->type == MMSINPUTEVENTTYPE_KEYPRESS) {
00070         if (inputevent->key == MMSKEY_SPACE) {
00071             // toggle the checked status and return
00072             bool c = false;
00073             getChecked(c);
00074             setChecked(!c);
00075             return;
00076         }
00077     }
00078     else
00079     if (inputevent->type == MMSINPUTEVENTTYPE_BUTTONRELEASE) {
00080         if (isPressed()) {
00081             // toggle the checked status with no refresh, because the base method will refresh the widget
00082             bool c = false;
00083             getChecked(c);
00084             setChecked(!c, false);
00085         }
00086     }
00087 
00088     // call base method
00089     MMSWidget::handleInput(inputevent);
00090 }
00091 
00092 MMSWidget *MMSCheckBoxWidget::copyWidget() {
00093     /* create widget */
00094     MMSCheckBoxWidget *newWidget = new MMSCheckBoxWidget(this->rootwindow, className);
00095 
00096     newWidget->className = this->className;
00097     newWidget->checkBoxWidgetClass = this->checkBoxWidgetClass;
00098     newWidget->myCheckBoxWidgetClass = this->myCheckBoxWidgetClass;
00099 
00100     newWidget->current_checked_bgset = this->current_checked_bgset;
00101     newWidget->current_checked_bgcolor = this->current_checked_bgcolor;
00102     newWidget->current_checked_bgimage = this->current_checked_bgimage;
00103 
00104     /* copy base widget */
00105     MMSWidget::copyWidget((MMSWidget*)newWidget);
00106 
00107     /* reload my images */
00108     newWidget->checked_bgimage = NULL;
00109     newWidget->checked_selbgimage = NULL;
00110     newWidget->checked_bgimage_p = NULL;
00111     newWidget->checked_selbgimage_p = NULL;
00112     newWidget->checked_bgimage_i = NULL;
00113     newWidget->checked_selbgimage_i = NULL;
00114 
00115     if (this->rootwindow) {
00116         string path, name;
00117 
00118         if (!newWidget->getCheckedBgImagePath(path)) path = "";
00119         if (!newWidget->getCheckedBgImageName(name)) name = "";
00120         newWidget->checked_bgimage = this->rootwindow->im->getImage(path, name);
00121 
00122         if (!newWidget->getCheckedSelBgImagePath(path)) path = "";
00123         if (!newWidget->getCheckedSelBgImageName(name)) name = "";
00124         newWidget->checked_selbgimage = this->rootwindow->im->getImage(path, name);
00125 
00126         if (!newWidget->getCheckedBgImagePath_p(path)) path = "";
00127         if (!newWidget->getCheckedBgImageName_p(name)) name = "";
00128         newWidget->checked_bgimage_p = this->rootwindow->im->getImage(path, name);
00129 
00130         if (!newWidget->getCheckedSelBgImagePath_p(path)) path = "";
00131         if (!newWidget->getCheckedSelBgImageName_p(name)) name = "";
00132         newWidget->checked_selbgimage_p = this->rootwindow->im->getImage(path, name);
00133 
00134         if (!newWidget->getCheckedBgImagePath_i(path)) path = "";
00135         if (!newWidget->getCheckedBgImageName_i(name)) name = "";
00136         newWidget->checked_bgimage_i = this->rootwindow->im->getImage(path, name);
00137 
00138         if (!newWidget->getCheckedSelBgImagePath_i(path)) path = "";
00139         if (!newWidget->getCheckedSelBgImageName_i(name)) name = "";
00140         newWidget->checked_selbgimage_i = this->rootwindow->im->getImage(path, name);
00141     }
00142 
00143     return newWidget;
00144 }
00145 
00146 bool MMSCheckBoxWidget::init() {
00147     // init widget basics
00148     if (!MMSWidget::init())
00149         return false;
00150 
00151     // load images
00152     string path, name;
00153 
00154     if (!getCheckedBgImagePath(path)) path = "";
00155     if (!getCheckedBgImageName(name)) name = "";
00156     this->checked_bgimage = this->rootwindow->im->getImage(path, name);
00157 
00158     if (!getCheckedSelBgImagePath(path)) path = "";
00159     if (!getCheckedSelBgImageName(name)) name = "";
00160     this->checked_selbgimage = this->rootwindow->im->getImage(path, name);
00161 
00162     if (!getCheckedBgImagePath_p(path)) path = "";
00163     if (!getCheckedBgImageName_p(name)) name = "";
00164     this->checked_bgimage_p = this->rootwindow->im->getImage(path, name);
00165 
00166     if (!getCheckedSelBgImagePath_p(path)) path = "";
00167     if (!getCheckedSelBgImageName_p(name)) name = "";
00168     this->checked_selbgimage_p = this->rootwindow->im->getImage(path, name);
00169 
00170     if (!getCheckedBgImagePath_i(path)) path = "";
00171     if (!getCheckedBgImageName_i(name)) name = "";
00172     this->checked_bgimage_i = this->rootwindow->im->getImage(path, name);
00173 
00174     if (!getCheckedSelBgImagePath_i(path)) path = "";
00175     if (!getCheckedSelBgImageName_i(name)) name = "";
00176     this->checked_selbgimage_i = this->rootwindow->im->getImage(path, name);
00177 
00178     return true;
00179 }
00180 
00181 bool MMSCheckBoxWidget::release() {
00182     // release widget basics
00183     if (!MMSWidget::release())
00184         return false;
00185 
00186     // release all images
00187     this->rootwindow->im->releaseImage(this->checked_bgimage);
00188     this->checked_bgimage = NULL;
00189     this->rootwindow->im->releaseImage(this->checked_selbgimage);
00190     this->checked_selbgimage = NULL;
00191     this->rootwindow->im->releaseImage(this->checked_bgimage_p);
00192     this->checked_bgimage_p = NULL;
00193     this->rootwindow->im->releaseImage(this->checked_selbgimage_p);
00194     this->checked_selbgimage_p = NULL;
00195     this->rootwindow->im->releaseImage(this->checked_bgimage_i);
00196     this->checked_bgimage_i = NULL;
00197     this->rootwindow->im->releaseImage(this->checked_selbgimage_i);
00198     this->checked_selbgimage_i = NULL;
00199 
00200     return true;
00201 }
00202 
00203 void MMSCheckBoxWidget::getCheckedBackground(MMSFBColor *color, MMSFBSurface **image) {
00204     color->a = 0;
00205     *image = NULL;
00206 
00207     if (isActivated()) {
00208         if (isSelected()) {
00209             getCheckedSelBgColor(*color);
00210             *image = this->checked_selbgimage;
00211         }
00212         else {
00213             getCheckedBgColor(*color);
00214             *image = this->checked_bgimage;
00215         }
00216         if (isPressed()) {
00217             MMSFBColor mycol;
00218             if (isSelected()) {
00219                 getCheckedSelBgColor_p(mycol);
00220                 if (mycol.a>0) *color=mycol;
00221                 if (this->checked_selbgimage_p)
00222                     *image = this->checked_selbgimage_p;
00223             }
00224             else {
00225                 getCheckedBgColor_p(mycol);
00226                 if (mycol.a>0) *color=mycol;
00227                 if (this->checked_bgimage_p)
00228                     *image = this->checked_bgimage_p;
00229             }
00230         }
00231     }
00232     else {
00233         if (isSelected()) {
00234             getCheckedSelBgColor_i(*color);
00235             *image = this->checked_selbgimage_i;
00236         }
00237         else {
00238             getCheckedBgColor_i(*color);
00239             *image = this->checked_bgimage_i;
00240         }
00241     }
00242 }
00243 
00244 bool MMSCheckBoxWidget::enableRefresh(bool enable) {
00245     if (!MMSWidget::enableRefresh(enable)) return false;
00246 
00247     // mark checked background as not set
00248     this->current_checked_bgset = false;
00249 
00250     return true;
00251 }
00252 
00253 bool MMSCheckBoxWidget::checkRefreshStatus() {
00254     // is checked?
00255     bool c = false;
00256     getChecked(c);
00257     if (!c) {
00258         // not checked, use widget status
00259         return MMSWidget::checkRefreshStatus();
00260     }
00261 
00262     if (!this->skip_refresh) {
00263         // there is no need to check, because refreshing is enabled
00264         return true;
00265     }
00266 
00267     if (this->current_checked_bgset) {
00268         // current checked background initialized
00269         MMSFBColor color;
00270         MMSFBSurface *image;
00271         getCheckedBackground(&color, &image);
00272 
00273         if (color == this->current_checked_bgcolor && image == this->current_checked_bgimage) {
00274             // checked background color and image not changed, so we do not enable refreshing
00275             return false;
00276         }
00277     }
00278 
00279     // (re-)enable refreshing
00280     enableRefresh();
00281 
00282     return true;
00283 }
00284 
00285 
00286 bool MMSCheckBoxWidget::draw(bool *backgroundFilled) {
00287     bool myBackgroundFilled = false;
00288     bool         retry = false;
00289 
00290     if (!this->initialized) {
00291         /* init widget (e.g. load images, fonts, ...) */
00292         init();
00293         this->initialized = true;
00294     }
00295 
00296     if(!surface)
00297         return false;
00298 
00299     if (backgroundFilled) {
00300         if (this->has_own_surface)
00301             *backgroundFilled = false;
00302     }
00303     else
00304         backgroundFilled = &myBackgroundFilled;
00305 
00306 
00307     if ((!this->geomset)||(!this->visible))
00308         return false;
00309 
00310     // is checked?
00311     bool c = false;
00312     getChecked(c);
00313 
00314     if (!c) {
00315         // not checked, let base widget draw
00316         MMSWidget::draw(backgroundFilled);
00317 
00318         this->current_checked_bgcolor   = MMSFBColor(0, 0, 0, 0);
00319         this->current_checked_bgimage   = NULL;
00320         this->current_checked_bgset     = true;
00321     }
00322     else {
00323         // checked, have to draw checked state
00324 
00325         // lock
00326         if (this->surface) this->surface->lock();
00327 
00328         // mark refresh as skipped for the next time
00329         this->skip_refresh = true;
00330 
00331         // draw background
00332         do {
00333             // searching for the background color or image
00334             MMSFBColor col;
00335             MMSFBSurface *suf = NULL;
00336             getCheckedBackground(&col, &suf);
00337             this->current_checked_bgcolor   = col;
00338             this->current_checked_bgimage   = suf;
00339             this->current_checked_bgset     = true;
00340 
00341             if (suf) {
00342                 if ((*backgroundFilled)||(retry)||(!this->has_own_surface)) {
00343                     // prepare for blitting
00344                     this->surface->setBlittingFlagsByBrightnessAlphaAndOpacity(brightness, (col.a)?col.a:255, opacity);
00345 
00346                     suf->lock();
00347                     // fill background
00348                     surface->stretchBlit(suf, NULL, &surfaceGeom);
00349                     suf->unlock();
00350                     *backgroundFilled = true;
00351 
00352                     // go out of the loop
00353                     break;
00354                 }
00355                 else
00356                     // the color has an alpha value and I need a background before drawing the image
00357                     retry = true;
00358             }
00359             else
00360             if (col.a) {
00361                 if ((*backgroundFilled)||(retry)||(!this->has_own_surface)||((col.a==255)&&(opacity==255))) {
00362                     // prepare for drawing
00363                     this->surface->setDrawingColorAndFlagsByBrightnessAndOpacity(col, brightness, opacity);
00364 
00365                     // fill background
00366                     this->surface->fillRectangle(surfaceGeom.x, surfaceGeom.y, surfaceGeom.w, surfaceGeom.h);
00367                     *backgroundFilled = true;
00368 
00369                     // go out of the loop
00370                     break;
00371                 }
00372                 else
00373                     // the color has an alpha value and I need a background for it
00374                     retry = true;
00375             }
00376             else {
00377                 if ((*backgroundFilled)||(!this->has_own_surface)) {
00378                     // go out of the loop
00379                     if (!*backgroundFilled) {
00380                         if (this->surface) {
00381                             // have no background, clear it
00382                             // this is in case of if I have no own surface
00383                             this->surface->clear();
00384                             *backgroundFilled = true;
00385                         }
00386                     }
00387                     break;
00388                 }
00389                 else
00390                     // no color, no image, I need to search for a background
00391                     retry = true;
00392             }
00393 
00394             // if not filled then
00395             if (!*backgroundFilled) {
00396                 // searching for the next parent widget
00397                 MMSWidget *widget = NULL;
00398                 vector<MMSWidget*> wlist;
00399                 if (this->parent)
00400                     widget = this->parent->getDrawableParent(false, false, false, &wlist);
00401 
00402                 // the widget found can be to far away from this widget
00403                 // if wlist is filled, i can search for a better parent which has already a own surface
00404                 for (unsigned int i=0; i < wlist.size(); i++) {
00405                     MMSWidget *w = wlist.at(i);
00406                     if ((w->drawable)&&(w->geomset)&&(w->visible)) {
00407                         widget = w;
00408                         break;
00409                     }
00410                 }
00411 
00412                 // clear it (complete transparent)
00413                 this->surface->clear();
00414 
00415                 if (widget) {
00416                     // drawable parent found, calculate rectangle to copy
00417                     widget->surface->lock();
00418                     MMSFBRectangle srcrect = widget->getVisibleSurfaceArea();
00419                     srcrect.x+= this->innerGeom.x - widget->innerGeom.x;
00420                     srcrect.y+= this->innerGeom.y - widget->innerGeom.y;
00421                     srcrect.w = this->innerGeom.w;
00422                     srcrect.h = this->innerGeom.h;
00423 
00424                     // copy background from parent
00425                     this->surface->setBlittingFlags(MMSFB_BLIT_NOFX);
00426                     this->surface->blit(widget->surface, &srcrect, 0, 0);
00427                     widget->surface->unlock();
00428                 }
00429                 else {
00430                     // no parent found, use background from window
00431                     if (this->rootwindow) {
00432                         MMSFBColor bgcolor;
00433                         this->rootwindow->getBgColor(bgcolor);
00434                         if (!this->rootwindow->bgimage) {
00435                             // draw background with window bgcolor
00436                             if (bgcolor.a) {
00437                                 // clear surface
00438                                 this->surface->clear(bgcolor.r, bgcolor.g, bgcolor.b, bgcolor.a);
00439                             }
00440                         }
00441                         else {
00442                             // draw background with a part of window bgimage
00443                             MMSFBRectangle src, dst;
00444                             int sw, sh;
00445 
00446                             this->rootwindow->bgimage->lock();
00447 
00448                             // get width and height of windows background image
00449                             this->rootwindow->bgimage->getSize(&sw, &sh);
00450 
00451                             // calculate with window width and height
00452                             int f1 = (this->rootwindow->innerGeom.w * 10000) / sw;
00453                             int f2 = (this->rootwindow->innerGeom.h * 10000) / sh;
00454 
00455                             // calculate the source rectangle
00456                             src.x = (5000 + 10000 *(this->innerGeom.x - this->rootwindow->innerGeom.x)) / f1;
00457                             src.w = (5000 + 10000 * this->innerGeom.w) / f1;
00458                             src.y = (5000 + 10000 *(this->innerGeom.y - this->rootwindow->innerGeom.y)) / f2;
00459                             src.h = (5000 + 10000 * this->innerGeom.h) / f2;
00460 
00461                             // the destination rectangle
00462                             dst.x = 0;
00463                             dst.w = this->innerGeom.w;
00464                             dst.y = 0;
00465                             dst.h = this->innerGeom.h;
00466 
00467                             // copy background from window's bgimage
00468                             this->surface->setBlittingFlagsByBrightnessAlphaAndOpacity(255, (bgcolor.a)?bgcolor.a:255, 255);
00469                             this->surface->stretchBlit(this->rootwindow->bgimage, &src, &dst);
00470 
00471                             this->rootwindow->bgimage->unlock();
00472                         }
00473                     }
00474                 }
00475 
00476                 *backgroundFilled = true;
00477             }
00478         } while (retry);
00479 
00480         // unlock
00481         if (this->surface) this->surface->unlock();
00482     }
00483 
00484     // draw widgets debug frame
00485     return MMSWidget::drawDebug();
00486 }
00487 
00488 
00489 
00490 /***********************************************/
00491 /* begin of theme access methods (get methods) */
00492 /***********************************************/
00493 
00494 #define GETCHECKBOX(x,y) \
00495     if (this->myCheckBoxWidgetClass.is##x()) return myCheckBoxWidgetClass.get##x(y); \
00496     else if ((checkBoxWidgetClass)&&(checkBoxWidgetClass->is##x())) return checkBoxWidgetClass->get##x(y); \
00497     else return this->da->theme->checkBoxWidgetClass.get##x(y);
00498 
00499 
00500 bool MMSCheckBoxWidget::getCheckedBgColor(MMSFBColor &checked_bgcolor) {
00501     GETCHECKBOX(CheckedBgColor, checked_bgcolor);
00502 }
00503 
00504 bool MMSCheckBoxWidget::getCheckedSelBgColor(MMSFBColor &checked_selbgcolor) {
00505     GETCHECKBOX(CheckedSelBgColor, checked_selbgcolor);
00506 }
00507 
00508 bool MMSCheckBoxWidget::getCheckedBgColor_p(MMSFBColor &checked_bgcolor_p) {
00509     GETCHECKBOX(CheckedBgColor_p, checked_bgcolor_p);
00510 }
00511 
00512 bool MMSCheckBoxWidget::getCheckedSelBgColor_p(MMSFBColor &checked_selbgcolor_p) {
00513     GETCHECKBOX(CheckedSelBgColor_p, checked_selbgcolor_p);
00514 }
00515 
00516 bool MMSCheckBoxWidget::getCheckedBgColor_i(MMSFBColor &checked_bgcolor_i) {
00517     GETCHECKBOX(CheckedBgColor_i, checked_bgcolor_i);
00518 }
00519 
00520 bool MMSCheckBoxWidget::getCheckedSelBgColor_i(MMSFBColor &checked_selbgcolor_i) {
00521     GETCHECKBOX(CheckedSelBgColor_i, checked_selbgcolor_i);
00522 }
00523 
00524 bool MMSCheckBoxWidget::getCheckedBgImagePath(string &checked_bgimagepath) {
00525     GETCHECKBOX(CheckedBgImagePath, checked_bgimagepath);
00526 }
00527 
00528 bool MMSCheckBoxWidget::getCheckedBgImageName(string &checked_bgimagename) {
00529     GETCHECKBOX(CheckedBgImageName, checked_bgimagename);
00530 }
00531 
00532 bool MMSCheckBoxWidget::getCheckedSelBgImagePath(string &checked_selbgimagepath) {
00533     GETCHECKBOX(CheckedSelBgImagePath, checked_selbgimagepath);
00534 }
00535 
00536 bool MMSCheckBoxWidget::getCheckedSelBgImageName(string &checked_selbgimagename) {
00537     GETCHECKBOX(CheckedSelBgImageName, checked_selbgimagename);
00538 }
00539 
00540 bool MMSCheckBoxWidget::getCheckedBgImagePath_p(string &checked_bgimagepath_p) {
00541     GETCHECKBOX(CheckedBgImagePath_p, checked_bgimagepath_p);
00542 }
00543 
00544 bool MMSCheckBoxWidget::getCheckedBgImageName_p(string &checked_bgimagename_p) {
00545     GETCHECKBOX(CheckedBgImageName_p, checked_bgimagename_p);
00546 }
00547 
00548 bool MMSCheckBoxWidget::getCheckedSelBgImagePath_p(string &checked_selbgimagepath_p) {
00549     GETCHECKBOX(CheckedSelBgImagePath_p, checked_selbgimagepath_p);
00550 }
00551 
00552 bool MMSCheckBoxWidget::getCheckedSelBgImageName_p(string &checked_selbgimagename_p) {
00553     GETCHECKBOX(CheckedSelBgImageName_p, checked_selbgimagename_p);
00554 }
00555 
00556 bool MMSCheckBoxWidget::getCheckedBgImagePath_i(string &checked_bgimagepath_i) {
00557     GETCHECKBOX(CheckedBgImagePath_i, checked_bgimagepath_i);
00558 }
00559 
00560 bool MMSCheckBoxWidget::getCheckedBgImageName_i(string &checked_bgimagename_i) {
00561     GETCHECKBOX(CheckedBgImageName_i, checked_bgimagename_i);
00562 }
00563 
00564 bool MMSCheckBoxWidget::getCheckedSelBgImagePath_i(string &checked_selbgimagepath_i) {
00565     GETCHECKBOX(CheckedSelBgImagePath_i, checked_selbgimagepath_i);
00566 }
00567 
00568 bool MMSCheckBoxWidget::getCheckedSelBgImageName_i(string &checked_selbgimagename_i) {
00569     GETCHECKBOX(CheckedSelBgImageName_i, checked_selbgimagename_i);
00570 }
00571 
00572 bool MMSCheckBoxWidget::getChecked(bool &checked) {
00573     GETCHECKBOX(Checked, checked);
00574 }
00575 
00576 
00577 
00578 /***********************************************/
00579 /* begin of theme access methods (set methods) */
00580 /***********************************************/
00581 
00582 void MMSCheckBoxWidget::setCheckedBgColor(MMSFBColor checked_bgcolor, bool refresh) {
00583     myCheckBoxWidgetClass.setCheckedBgColor(checked_bgcolor);
00584 
00585     // refresh required?
00586     enableRefresh((checked_bgcolor != this->current_checked_bgcolor));
00587 
00588     this->refresh(refresh);
00589 }
00590 
00591 void MMSCheckBoxWidget::setCheckedSelBgColor(MMSFBColor checked_selbgcolor, bool refresh) {
00592     myCheckBoxWidgetClass.setCheckedSelBgColor(checked_selbgcolor);
00593 
00594     // refresh required?
00595     enableRefresh((checked_selbgcolor != this->current_checked_bgcolor));
00596 
00597     this->refresh(refresh);
00598 }
00599 
00600 void MMSCheckBoxWidget::setCheckedBgColor_p(MMSFBColor checked_bgcolor_p, bool refresh) {
00601     myCheckBoxWidgetClass.setCheckedBgColor_p(checked_bgcolor_p);
00602 
00603     // refresh required?
00604     enableRefresh((checked_bgcolor_p != this->current_checked_bgcolor));
00605 
00606     this->refresh(refresh);
00607 }
00608 
00609 void MMSCheckBoxWidget::setCheckedSelBgColor_p(MMSFBColor checked_selbgcolor_p, bool refresh) {
00610     myCheckBoxWidgetClass.setCheckedSelBgColor(checked_selbgcolor_p);
00611 
00612     // refresh required?
00613     enableRefresh((checked_selbgcolor_p != this->current_checked_bgcolor));
00614 
00615     this->refresh(refresh);
00616 }
00617 
00618 void MMSCheckBoxWidget::setCheckedBgColor_i(MMSFBColor checked_bgcolor_i, bool refresh) {
00619     myCheckBoxWidgetClass.setCheckedBgColor_i(checked_bgcolor_i);
00620 
00621     // refresh required?
00622     enableRefresh((checked_bgcolor_i != this->current_checked_bgcolor));
00623 
00624     this->refresh(refresh);
00625 }
00626 
00627 void MMSCheckBoxWidget::setCheckedSelBgColor_i(MMSFBColor checked_selbgcolor_i, bool refresh) {
00628     myCheckBoxWidgetClass.setCheckedSelBgColor(checked_selbgcolor_i);
00629 
00630     // refresh required?
00631     enableRefresh((checked_selbgcolor_i != this->current_checked_bgcolor));
00632 
00633     this->refresh(refresh);
00634 }
00635 
00636 void MMSCheckBoxWidget::setCheckedBgImagePath(string checked_bgimagepath, bool load, bool refresh) {
00637     myCheckBoxWidgetClass.setCheckedBgImagePath(checked_bgimagepath);
00638     if (load)
00639         if (this->rootwindow) {
00640             // refresh required?
00641             enableRefresh((this->checked_bgimage == this->current_checked_bgimage));
00642 
00643             this->rootwindow->im->releaseImage(this->checked_bgimage);
00644             string path, name;
00645             if (!getCheckedBgImagePath(path)) path = "";
00646             if (!getCheckedBgImageName(name)) name = "";
00647             this->checked_bgimage = this->rootwindow->im->getImage(path, name);
00648         }
00649 
00650     this->refresh(refresh);
00651 }
00652 
00653 void MMSCheckBoxWidget::setCheckedBgImageName(string checked_bgimagename, bool load, bool refresh) {
00654     myCheckBoxWidgetClass.setCheckedBgImageName(checked_bgimagename);
00655     if (load)
00656         if (this->rootwindow) {
00657             // refresh required?
00658             enableRefresh((this->checked_bgimage == this->current_checked_bgimage));
00659 
00660             this->rootwindow->im->releaseImage(this->checked_bgimage);
00661             string path, name;
00662             if (!getCheckedBgImagePath(path)) path = "";
00663             if (!getCheckedBgImageName(name)) name = "";
00664             this->checked_bgimage = this->rootwindow->im->getImage(path, name);
00665         }
00666 
00667     this->refresh(refresh);
00668 }
00669 
00670 void MMSCheckBoxWidget::setCheckedSelBgImagePath(string checked_selbgimagepath, bool load, bool refresh) {
00671     myCheckBoxWidgetClass.setCheckedSelBgImagePath(checked_selbgimagepath);
00672     if (load)
00673         if (this->rootwindow) {
00674             // refresh required?
00675             enableRefresh((this->checked_selbgimage == this->current_checked_bgimage));
00676 
00677             this->rootwindow->im->releaseImage(this->checked_selbgimage);
00678             string path, name;
00679             if (!getCheckedSelBgImagePath(path)) path = "";
00680             if (!getCheckedSelBgImageName(name)) name = "";
00681             this->checked_selbgimage = this->rootwindow->im->getImage(path, name);
00682         }
00683 
00684     this->refresh(refresh);
00685 }
00686 
00687 void MMSCheckBoxWidget::setCheckedSelBgImageName(string checked_selbgimagename, bool load, bool refresh) {
00688     myCheckBoxWidgetClass.setCheckedSelBgImageName(checked_selbgimagename);
00689     if (load)
00690         if (this->rootwindow) {
00691             // refresh required?
00692             enableRefresh((this->checked_selbgimage == this->current_checked_bgimage));
00693 
00694             this->rootwindow->im->releaseImage(this->checked_selbgimage);
00695             string path, name;
00696             if (!getCheckedSelBgImagePath(path)) path = "";
00697             if (!getCheckedSelBgImageName(name)) name = "";
00698             this->checked_selbgimage = this->rootwindow->im->getImage(path, name);
00699         }
00700 
00701     this->refresh(refresh);
00702 }
00703 
00704 void MMSCheckBoxWidget::setCheckedBgImagePath_p(string checked_bgimagepath_p, bool load, bool refresh) {
00705     myCheckBoxWidgetClass.setCheckedBgImagePath_p(checked_bgimagepath_p);
00706     if (load)
00707         if (this->rootwindow) {
00708             // refresh required?
00709             enableRefresh((this->checked_bgimage_p == this->current_checked_bgimage));
00710 
00711             this->rootwindow->im->releaseImage(this->checked_bgimage_p);
00712             string path, name;
00713             if (!getCheckedBgImagePath_p(path)) path = "";
00714             if (!getCheckedBgImageName_p(name)) name = "";
00715             this->checked_bgimage_p = this->rootwindow->im->getImage(path, name);
00716         }
00717 
00718     this->refresh(refresh);
00719 }
00720 
00721 void MMSCheckBoxWidget::setCheckedBgImageName_p(string checked_bgimagename_p, bool load, bool refresh) {
00722     myCheckBoxWidgetClass.setCheckedBgImageName_p(checked_bgimagename_p);
00723     if (load)
00724         if (this->rootwindow) {
00725             // refresh required?
00726             enableRefresh((this->checked_bgimage_p == this->current_checked_bgimage));
00727 
00728             this->rootwindow->im->releaseImage(this->checked_bgimage_p);
00729             string path, name;
00730             if (!getCheckedBgImagePath_p(path)) path = "";
00731             if (!getCheckedBgImageName_p(name)) name = "";
00732             this->checked_bgimage_p = this->rootwindow->im->getImage(path, name);
00733         }
00734 
00735     this->refresh(refresh);
00736 }
00737 
00738 void MMSCheckBoxWidget::setCheckedSelBgImagePath_p(string checked_selbgimagepath_p, bool load, bool refresh) {
00739     myCheckBoxWidgetClass.setCheckedSelBgImagePath_p(checked_selbgimagepath_p);
00740     if (load)
00741         if (this->rootwindow) {
00742             // refresh required?
00743             enableRefresh((this->checked_selbgimage_p == this->current_checked_bgimage));
00744 
00745             this->rootwindow->im->releaseImage(this->checked_selbgimage_p);
00746             string path, name;
00747             if (!getCheckedSelBgImagePath_p(path)) path = "";
00748             if (!getCheckedSelBgImageName_p(name)) name = "";
00749             this->checked_selbgimage_p = this->rootwindow->im->getImage(path, name);
00750         }
00751 
00752     this->refresh(refresh);
00753 }
00754 
00755 void MMSCheckBoxWidget::setCheckedSelBgImageName_p(string checked_selbgimagename_p, bool load, bool refresh) {
00756     myCheckBoxWidgetClass.setCheckedSelBgImageName_p(checked_selbgimagename_p);
00757     if (load)
00758         if (this->rootwindow) {
00759             // refresh required?
00760             enableRefresh((this->checked_selbgimage_p == this->current_checked_bgimage));
00761 
00762             this->rootwindow->im->releaseImage(this->checked_selbgimage_p);
00763             string path, name;
00764             if (!getCheckedSelBgImagePath_p(path)) path = "";
00765             if (!getCheckedSelBgImageName_p(name)) name = "";
00766             this->checked_selbgimage_p = this->rootwindow->im->getImage(path, name);
00767         }
00768 
00769     this->refresh(refresh);
00770 }
00771 
00772 void MMSCheckBoxWidget::setCheckedBgImagePath_i(string checked_bgimagepath_i, bool load, bool refresh) {
00773     myCheckBoxWidgetClass.setCheckedBgImagePath_i(checked_bgimagepath_i);
00774     if (load)
00775         if (this->rootwindow) {
00776             // refresh required?
00777             enableRefresh((this->checked_bgimage_i == this->current_checked_bgimage));
00778 
00779             this->rootwindow->im->releaseImage(this->checked_bgimage_i);
00780             string path, name;
00781             if (!getCheckedBgImagePath_i(path)) path = "";
00782             if (!getCheckedBgImageName_i(name)) name = "";
00783             this->checked_bgimage_i = this->rootwindow->im->getImage(path, name);
00784         }
00785 
00786     this->refresh(refresh);
00787 }
00788 
00789 void MMSCheckBoxWidget::setCheckedBgImageName_i(string checked_bgimagename_i, bool load, bool refresh) {
00790     myCheckBoxWidgetClass.setCheckedBgImageName_i(checked_bgimagename_i);
00791     if (load)
00792         if (this->rootwindow) {
00793             // refresh required?
00794             enableRefresh((this->checked_bgimage_i == this->current_checked_bgimage));
00795 
00796             this->rootwindow->im->releaseImage(this->checked_bgimage_i);
00797             string path, name;
00798             if (!getCheckedBgImagePath_i(path)) path = "";
00799             if (!getCheckedBgImageName_i(name)) name = "";
00800             this->checked_bgimage_i = this->rootwindow->im->getImage(path, name);
00801         }
00802 
00803     this->refresh(refresh);
00804 }
00805 
00806 void MMSCheckBoxWidget::setCheckedSelBgImagePath_i(string checked_selbgimagepath_i, bool load, bool refresh) {
00807     myCheckBoxWidgetClass.setCheckedSelBgImagePath_i(checked_selbgimagepath_i);
00808     if (load)
00809         if (this->rootwindow) {
00810             // refresh required?
00811             enableRefresh((this->checked_selbgimage_i == this->current_checked_bgimage));
00812 
00813             this->rootwindow->im->releaseImage(this->checked_selbgimage_i);
00814             string path, name;
00815             if (!getCheckedSelBgImagePath_i(path)) path = "";
00816             if (!getCheckedSelBgImageName_i(name)) name = "";
00817             this->checked_selbgimage_i = this->rootwindow->im->getImage(path, name);
00818         }
00819 
00820     this->refresh(refresh);
00821 }
00822 
00823 void MMSCheckBoxWidget::setCheckedSelBgImageName_i(string checked_selbgimagename_i, bool load, bool refresh) {
00824     myCheckBoxWidgetClass.setCheckedSelBgImageName_i(checked_selbgimagename_i);
00825     if (load)
00826         if (this->rootwindow) {
00827             // refresh required?
00828             enableRefresh((this->checked_selbgimage_i == this->current_checked_bgimage));
00829 
00830             this->rootwindow->im->releaseImage(this->checked_selbgimage_i);
00831             string path, name;
00832             if (!getCheckedSelBgImagePath_i(path)) path = "";
00833             if (!getCheckedSelBgImageName_i(name)) name = "";
00834             this->checked_selbgimage_i = this->rootwindow->im->getImage(path, name);
00835         }
00836     if (refresh)
00837         this->refresh();
00838 }
00839 
00840 void MMSCheckBoxWidget::setChecked(bool checked, bool refresh) {
00841     myCheckBoxWidgetClass.setChecked(checked);
00842 
00843     // refresh is required
00844     enableRefresh();
00845 
00846     this->refresh(refresh);
00847 }
00848 
00849 
00850 
00851 void MMSCheckBoxWidget::updateFromThemeClass(MMSCheckBoxWidgetClass *themeClass) {
00852 
00853     bool            b;
00854     MMSFBColor      c;
00855     string          s;
00856 
00857     if (themeClass->getCheckedBgColor(c))
00858         setCheckedBgColor(c);
00859     if (themeClass->getCheckedSelBgColor(c))
00860         setCheckedSelBgColor(c);
00861     if (themeClass->getCheckedBgColor_p(c))
00862         setCheckedBgColor_p(c);
00863     if (themeClass->getCheckedSelBgColor_p(c))
00864         setCheckedSelBgColor_p(c);
00865     if (themeClass->getCheckedBgColor_i(c))
00866         setCheckedBgColor_i(c);
00867     if (themeClass->getCheckedSelBgColor_i(c))
00868         setCheckedSelBgColor_i(c);
00869     if (themeClass->getCheckedBgImagePath(s))
00870         setCheckedBgImagePath(s);
00871     if (themeClass->getCheckedBgImageName(s))
00872         setCheckedBgImageName(s);
00873     if (themeClass->getCheckedSelBgImagePath(s))
00874         setCheckedSelBgImagePath(s);
00875     if (themeClass->getCheckedSelBgImageName(s))
00876         setCheckedSelBgImageName(s);
00877     if (themeClass->getCheckedBgImagePath_p(s))
00878         setCheckedBgImagePath_p(s);
00879     if (themeClass->getCheckedBgImageName_p(s))
00880         setCheckedBgImageName_p(s);
00881     if (themeClass->getCheckedSelBgImagePath_p(s))
00882         setCheckedSelBgImagePath_p(s);
00883     if (themeClass->getCheckedSelBgImageName_p(s))
00884         setCheckedSelBgImageName_p(s);
00885     if (themeClass->getCheckedBgImagePath_i(s))
00886         setCheckedBgImagePath_i(s);
00887     if (themeClass->getCheckedBgImageName_i(s))
00888         setCheckedBgImageName_i(s);
00889     if (themeClass->getCheckedSelBgImagePath_i(s))
00890         setCheckedSelBgImagePath_i(s);
00891     if (themeClass->getCheckedSelBgImageName_i(s))
00892         setCheckedSelBgImageName_i(s);
00893     if (themeClass->getChecked(b))
00894         setChecked(b);
00895 
00896     MMSWidget::updateFromThemeClass(&(themeClass->widgetClass));
00897 }
00898 
00899 /***********************************************/
00900 /* end of theme access methods                 */
00901 /***********************************************/

Generated by doxygen