00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 #include "mmsgui/mmssliderwidget.h"
00034 
00035 MMSSliderWidget::MMSSliderWidget(MMSWindow *root, string className, MMSTheme *theme) {
00036     create(root, className, theme);
00037 }
00038 
00039 MMSSliderWidget::~MMSSliderWidget() {
00040     
00041     if (this->onSliderIncrement) delete this->onSliderIncrement;
00042     if (this->onSliderDecrement) delete this->onSliderDecrement;
00043 }
00044 
00045 bool MMSSliderWidget::create(MMSWindow *root, string className, MMSTheme *theme) {
00046     this->type = MMSWIDGETTYPE_SLIDER;
00047     this->className = className;
00048 
00049     
00050     this->da = new MMSWIDGET_DRAWABLE_ATTRIBUTES;
00051     if (theme) this->da->theme = theme; else this->da->theme = globalTheme;
00052     this->sliderWidgetClass = this->da->theme->getSliderWidgetClass(className);
00053     this->da->baseWidgetClass = &(this->da->theme->sliderWidgetClass.widgetClass);
00054     if (this->sliderWidgetClass) this->da->widgetClass = &(this->sliderWidgetClass->widgetClass); else this->da->widgetClass = NULL;
00055 
00056     
00057     this->imagepath_set = false;
00058     this->selimagepath_set = false;
00059 
00060     this->imagepath_p_set = false;
00061     this->selimagepath_p_set = false;
00062 
00063     this->imagepath_i_set = false;
00064     this->selimagepath_i_set = false;
00065 
00066     this->barimagepath_set = false;
00067     this->selbarimagepath_set = false;
00068 
00069     this->image = NULL;
00070     this->selimage = NULL;
00071     this->image_p = NULL;
00072     this->selimage_p = NULL;
00073     this->image_i = NULL;
00074     this->selimage_i = NULL;
00075     this->barimage = NULL;
00076     this->selbarimage = NULL;
00077 
00078     this->vertical = true;
00079     this->current_fgset = false;
00080 
00081     
00082     this->onSliderIncrement = new sigc::signal<bool, MMSWidget*>::accumulated<neg_bool_accumulator>;
00083     this->onSliderDecrement = new sigc::signal<bool, MMSWidget*>::accumulated<neg_bool_accumulator>;
00084 
00085     
00086     return MMSWidget::create(root, true, false, true, true, true, true, true);
00087 }
00088 
00089 MMSWidget *MMSSliderWidget::copyWidget() {
00090     
00091     MMSSliderWidget *newWidget = new MMSSliderWidget(this->rootwindow, className);
00092 
00093     newWidget->className = this->className;
00094     newWidget->sliderWidgetClass = this->sliderWidgetClass;
00095     newWidget->mySliderWidgetClass = this->mySliderWidgetClass;
00096 
00097     newWidget->imagepath_set = this->imagepath_set;
00098     newWidget->selimagepath_set = this->selimagepath_set;
00099 
00100     newWidget->imagepath_p_set = this->imagepath_p_set;
00101     newWidget->selimagepath_p_set = this->selimagepath_p_set;
00102 
00103     newWidget->imagepath_i_set = this->imagepath_i_set;
00104     newWidget->selimagepath_i_set = this->selimagepath_i_set;
00105 
00106     newWidget->barimagepath_set = this->barimagepath_set;
00107     newWidget->selbarimagepath_set = this->selbarimagepath_set;
00108 
00109     newWidget->current_fgset = this->current_fgset;
00110     newWidget->current_fgimage = this->current_fgimage;
00111     newWidget->current_fgbarimage = this->current_fgbarimage;
00112 
00113     
00114     MMSWidget::copyWidget((MMSWidget*)newWidget);
00115 
00116     
00117     newWidget->image = NULL;
00118     newWidget->selimage = NULL;
00119     newWidget->image_p = NULL;
00120     newWidget->selimage_p = NULL;
00121     newWidget->image_i = NULL;
00122     newWidget->selimage_i = NULL;
00123     newWidget->barimage = NULL;
00124     newWidget->selbarimage = NULL;
00125     this->vertical = true;
00126     if (this->rootwindow) {
00127         newWidget->image = this->rootwindow->im->getImage(newWidget->getImagePath(), newWidget->getImageName());
00128         newWidget->selimage = this->rootwindow->im->getImage(newWidget->getSelImagePath(), newWidget->getSelImageName());
00129         newWidget->image_p = this->rootwindow->im->getImage(newWidget->getImagePath_p(), newWidget->getImageName_p());
00130         newWidget->selimage_p = this->rootwindow->im->getImage(newWidget->getSelImagePath_p(), newWidget->getSelImageName_p());
00131         newWidget->image_i = this->rootwindow->im->getImage(newWidget->getImagePath_i(), newWidget->getImageName_i());
00132         newWidget->selimage_i = this->rootwindow->im->getImage(newWidget->getSelImagePath_i(), newWidget->getSelImageName_i());
00133         newWidget->barimage = this->rootwindow->im->getImage(newWidget->getBarImagePath(), newWidget->getBarImageName());
00134         newWidget->selbarimage = this->rootwindow->im->getImage(newWidget->getSelBarImagePath(), newWidget->getSelBarImageName());
00135     }
00136 
00137     return newWidget;
00138 }
00139 
00140 bool MMSSliderWidget::init() {
00141     
00142     if (!MMSWidget::init())
00143         return false;
00144 
00145     
00146     this->image = this->rootwindow->im->getImage(getImagePath(), getImageName());
00147     this->selimage = this->rootwindow->im->getImage(getSelImagePath(), getSelImageName());
00148     this->image_p = this->rootwindow->im->getImage(getImagePath_p(), getImageName_p());
00149     this->selimage_p = this->rootwindow->im->getImage(getSelImagePath_p(), getSelImageName_p());
00150     this->image_i = this->rootwindow->im->getImage(getImagePath_i(), getImageName_i());
00151     this->selimage_i = this->rootwindow->im->getImage(getSelImagePath_i(), getSelImageName_i());
00152     this->barimage = this->rootwindow->im->getImage(getBarImagePath(), getBarImageName());
00153     this->selbarimage = this->rootwindow->im->getImage(getSelBarImagePath(), getSelBarImageName());
00154 
00155     return true;
00156 }
00157 
00158 bool MMSSliderWidget::release() {
00159     
00160     if (!MMSWidget::release())
00161         return false;
00162 
00163     
00164     this->rootwindow->im->releaseImage(this->image);
00165     this->image = NULL;
00166     this->rootwindow->im->releaseImage(this->selimage);
00167     this->selimage = NULL;
00168     this->rootwindow->im->releaseImage(this->image_p);
00169     this->image_p = NULL;
00170     this->rootwindow->im->releaseImage(this->selimage_p);
00171     this->selimage_p = NULL;
00172     this->rootwindow->im->releaseImage(this->image_i);
00173     this->image_i = NULL;
00174     this->rootwindow->im->releaseImage(this->selimage_i);
00175     this->selimage_i = NULL;
00176     this->rootwindow->im->releaseImage(this->barimage);
00177     this->barimage = NULL;
00178     this->rootwindow->im->releaseImage(this->selbarimage);
00179     this->selbarimage = NULL;
00180 
00181     return true;
00182 }
00183 
00184 void MMSSliderWidget::getImage(MMSFBSurface **suf) {
00185     
00186     *suf = NULL;
00187 
00188     if (isActivated()) {
00189         if (isSelected())
00190             *suf = this->selimage;
00191         else
00192             *suf = this->image;
00193         if (isPressed()) {
00194             if (isSelected()) {
00195                 if (this->selimage_p)
00196                     *suf = this->selimage_p;
00197             }
00198             else {
00199                 if (this->image_p)
00200                     *suf = this->image_p;
00201             }
00202         }
00203     }
00204     else {
00205         if (isSelected())
00206             *suf = this->selimage_i;
00207         else
00208             *suf = this->image_i;
00209     }
00210 }
00211 
00212 void MMSSliderWidget::getBarImage(MMSFBSurface **suf) {
00213     
00214     *suf = NULL;
00215 
00216     if (isSelected())
00217         *suf = this->selbarimage;
00218     else
00219         *suf = this->barimage;
00220 }
00221 
00222 void MMSSliderWidget::calcPos(MMSFBSurface *suf, MMSFBRectangle *surfaceGeom, bool *vertical,
00223                               MMSFBSurface *barsuf, MMSFBRectangle *src_barGeom, MMSFBRectangle *dst_barGeom) {
00224     
00225     int w = 0, h = 0;
00226     if (suf) {
00227         
00228         suf->getSize(&w, &h);
00229     }
00230 
00231     if (barsuf && src_barGeom) {
00232         
00233         src_barGeom->x = 0;
00234         src_barGeom->y = 0;
00235         barsuf->getSize(&src_barGeom->w, &src_barGeom->h);
00236     }
00237 
00238     if (dst_barGeom) *dst_barGeom = *surfaceGeom;
00239     if (surfaceGeom->w < w) w = surfaceGeom->w;
00240     if (surfaceGeom->h < h) h = surfaceGeom->h;
00241     if (surfaceGeom->w - w < surfaceGeom->h - h) {
00242         
00243         surfaceGeom->y += ((surfaceGeom->h - h) * getPosition()) / 100;
00244         if (dst_barGeom) {
00245             dst_barGeom->y = surfaceGeom->y + h / 2;
00246             dst_barGeom->h = surfaceGeom->h - surfaceGeom->y - h / 2;
00247             if (src_barGeom) {
00248                 
00249                 if (src_barGeom->h == surfaceGeom->h - h / 2) {
00250                     
00251                     src_barGeom->y+= src_barGeom->h - dst_barGeom->h;
00252                     src_barGeom->h = dst_barGeom->h;
00253                 }
00254                 else {
00255                     
00256                     int hh = ((src_barGeom->h * dst_barGeom->h * 100) / (surfaceGeom->h - h / 2) + 50) / 100;
00257                     src_barGeom->y+= src_barGeom->h - hh;
00258                     src_barGeom->h = hh;
00259                 }
00260             }
00261         }
00262         surfaceGeom->h = h;
00263         *vertical = true;
00264     }
00265     else {
00266         
00267         surfaceGeom->x += ((surfaceGeom->w - w) * getPosition()) / 100;
00268         if (dst_barGeom) {
00269             dst_barGeom->x = surfaceGeom->x + w / 2;
00270             dst_barGeom->w = surfaceGeom->w - surfaceGeom->x - w / 2;
00271             if (src_barGeom) {
00272                 
00273                 if (src_barGeom->w == surfaceGeom->w - w / 2) {
00274                     
00275                     src_barGeom->x+= src_barGeom->w - dst_barGeom->w;
00276                     src_barGeom->w = dst_barGeom->w;
00277                 }
00278                 else {
00279                     
00280                     int ww = ((src_barGeom->w * dst_barGeom->w * 100) / (surfaceGeom->w - w / 2) + 50) / 100;
00281                     src_barGeom->x+= src_barGeom->w - ww;
00282                     src_barGeom->w = ww;
00283                 }
00284             }
00285         }
00286         surfaceGeom->w = w;
00287         *vertical = false;
00288     }
00289 }
00290 
00291 
00292 void MMSSliderWidget::getForeground(MMSFBSurface **image, MMSFBSurface **barimage) {
00293     getImage(image);
00294     getBarImage(barimage);
00295 
00296 }
00297 
00298 bool MMSSliderWidget::enableRefresh(bool enable) {
00299     if (!MMSWidget::enableRefresh(enable)) return false;
00300 
00301     
00302     this->current_fgset = false;
00303 
00304     return true;
00305 }
00306 
00307 bool MMSSliderWidget::checkRefreshStatus() {
00308     if (MMSWidget::checkRefreshStatus()) return true;
00309 
00310     if (this->current_fgset) {
00311         
00312         MMSFBSurface *image, *barimage;
00313         getForeground(&image, &barimage);
00314 
00315         if (image == this->current_fgimage && barimage == this->current_fgbarimage) {
00316             
00317             return false;
00318         }
00319     }
00320 
00321     
00322     enableRefresh();
00323 
00324     return true;
00325 }
00326 
00327 
00328 bool MMSSliderWidget::draw(bool *backgroundFilled) {
00329     bool myBackgroundFilled = false;
00330 
00331     if(!surface)
00332         return false;
00333 
00334     if (backgroundFilled) {
00335         if (this->has_own_surface)
00336             *backgroundFilled = false;
00337     }
00338     else
00339         backgroundFilled = &myBackgroundFilled;
00340 
00341     
00342     if (MMSWidget::draw(backgroundFilled)) {
00343 
00344         
00345         this->surface->lock();
00346 
00347         
00348         MMSFBRectangle surfaceGeom = getSurfaceGeometry();
00349 
00350         
00351         MMSFBSurface *suf, *barsuf;
00352         getForeground(&suf, &barsuf);
00353         this->current_fgimage   = suf;
00354         this->current_fgbarimage= barsuf;
00355         this->current_fgset     = true;
00356 
00357         
00358         MMSFBRectangle src_barGeom;
00359         MMSFBRectangle dst_barGeom;
00360         calcPos(suf, &surfaceGeom, &this->vertical, barsuf, &src_barGeom, &dst_barGeom);
00361 
00362         if (barsuf) {
00363             
00364             this->surface->setBlittingFlagsByBrightnessAlphaAndOpacity(this->brightness, 255, opacity);
00365 
00366             barsuf->lock();
00367             
00368             this->surface->stretchBlit(barsuf, &src_barGeom, &dst_barGeom);
00369             barsuf->unlock();
00370         }
00371 
00372         if (suf) {
00373             
00374             this->surface->setBlittingFlagsByBrightnessAlphaAndOpacity(this->brightness, 255, opacity);
00375 
00376             suf->lock();
00377             
00378             this->surface->stretchBlit(suf, NULL, &surfaceGeom);
00379             suf->unlock();
00380         }
00381 
00382         
00383         this->surface->unlock();
00384 
00385         
00386         updateWindowSurfaceWithSurface(!*backgroundFilled);
00387     }
00388 
00389     
00390     return MMSWidget::drawDebug();
00391 }
00392 
00393 
00394 void MMSSliderWidget::switchArrowWidgets() {
00395     
00396     loadArrowWidgets();
00397 
00398     
00399     int pos = (int)getPosition();
00400 
00401     if (this->vertical) {
00402         
00403         if (this->da->upArrowWidget) {
00404             if (pos <= 0)
00405                 this->da->upArrowWidget->setSelected(false);
00406             else
00407                 this->da->upArrowWidget->setSelected(true);
00408         }
00409 
00410         if (this->da->downArrowWidget) {
00411             if (pos >= 100)
00412                 this->da->downArrowWidget->setSelected(false);
00413             else
00414                 this->da->downArrowWidget->setSelected(true);
00415         }
00416     }
00417     else {
00418         
00419         if (this->da->leftArrowWidget) {
00420             if (pos <= 0)
00421                 this->da->leftArrowWidget->setSelected(false);
00422             else
00423                 this->da->leftArrowWidget->setSelected(true);
00424         }
00425 
00426         if (this->da->rightArrowWidget) {
00427             if (pos >= 100)
00428                 this->da->rightArrowWidget->setSelected(false);
00429             else
00430                 this->da->rightArrowWidget->setSelected(true);
00431         }
00432     }
00433 }
00434 
00435 bool MMSSliderWidget::scrollDown(unsigned int count, bool refresh, bool test, bool leave_selection) {
00436     
00437     if (!this->vertical)
00438         return false;
00439 
00440     
00441     int pos = (int)getPosition();
00442     if (pos >= 100)
00443         return false;
00444 
00445     
00446     if (test)
00447         return true;
00448 
00449     
00450     setPosition(pos+1);
00451 
00452     return true;
00453 }
00454 
00455 
00456 bool MMSSliderWidget::scrollUp(unsigned int count, bool refresh, bool test, bool leave_selection) {
00457     
00458     if (!this->vertical)
00459         return false;
00460 
00461     
00462     int pos = (int)getPosition();
00463     if (pos <= 0)
00464         return false;
00465 
00466     
00467     if (test)
00468         return true;
00469 
00470     
00471     setPosition(pos-1);
00472 
00473     return true;
00474 }
00475 
00476 
00477 bool MMSSliderWidget::scrollRight(unsigned int count, bool refresh, bool test, bool leave_selection) {
00478     
00479     if (this->vertical)
00480         return false;
00481 
00482     
00483     int pos = (int)getPosition();
00484     if (pos >= 100)
00485         return false;
00486 
00487     
00488     if (test)
00489         return true;
00490 
00491     
00492     setPosition(pos+1);
00493 
00494     return true;
00495 }
00496 
00497 
00498 bool MMSSliderWidget::scrollLeft(unsigned int count, bool refresh, bool test, bool leave_selection) {
00499     
00500     if (this->vertical)
00501         return false;
00502 
00503     
00504     int pos = (int)getPosition();
00505     if (pos <= 0)
00506         return false;
00507 
00508     
00509     if (test)
00510         return true;
00511 
00512     
00513     setPosition(pos-1);
00514 
00515     return true;
00516 }
00517 
00518 
00519 bool MMSSliderWidget::scrollTo(int posx, int posy, bool refresh, bool *changed) {
00520     if (changed)
00521         *changed = false;
00522 
00523     
00524     MMSFBSurface *suf = NULL;
00525     getImage(&suf);
00526     if (suf) {
00527         
00528         MMSFBRectangle sgeom = getGeometry();
00529         calcPos(suf, &sgeom, &this->vertical);
00530 
00531         if (this->vertical) {
00532             
00533             if (posy < sgeom.y) {
00534                 
00535                 if (!this->onSliderDecrement->emit(this)) {
00536                     
00537 
00538                 }
00539                 if (changed) *changed = true;
00540                 return true;
00541             }
00542             else
00543             if (posy >= sgeom.y + sgeom.h) {
00544                 
00545                 if (!this->onSliderIncrement->emit(this)) {
00546                     
00547 
00548                 }
00549                 if (changed) *changed = true;
00550                 return true;
00551             }
00552         }
00553         else {
00554             
00555             if (posx < sgeom.x) {
00556                 
00557                 if (!this->onSliderDecrement->emit(this)) {
00558                     
00559 
00560                 }
00561                 if (changed) *changed = true;
00562                 return true;
00563             }
00564             else
00565             if (posx >= sgeom.x + sgeom.w) {
00566                 
00567                 if (!this->onSliderIncrement->emit(this)) {
00568                     
00569 
00570                 }
00571                 if (changed) *changed = true;
00572                 return true;
00573             }
00574         }
00575     }
00576 
00577     return false;
00578 }
00579 
00580 
00581 
00582 
00583 
00584 #define GETSLIDER(x) \
00585     if (this->mySliderWidgetClass.is##x()) return mySliderWidgetClass.get##x(); \
00586     else if ((sliderWidgetClass)&&(sliderWidgetClass->is##x())) return sliderWidgetClass->get##x(); \
00587     else return this->da->theme->sliderWidgetClass.get##x();
00588 
00589 string MMSSliderWidget::getImagePath() {
00590     GETSLIDER(ImagePath);
00591 }
00592 
00593 string MMSSliderWidget::getImageName() {
00594     GETSLIDER(ImageName);
00595 }
00596 
00597 string MMSSliderWidget::getSelImagePath() {
00598     GETSLIDER(SelImagePath);
00599 }
00600 
00601 string MMSSliderWidget::getSelImageName() {
00602     GETSLIDER(SelImageName);
00603 }
00604 
00605 string MMSSliderWidget::getImagePath_p() {
00606     GETSLIDER(ImagePath_p);
00607 }
00608 
00609 string MMSSliderWidget::getImageName_p() {
00610     GETSLIDER(ImageName_p);
00611 }
00612 
00613 string MMSSliderWidget::getSelImagePath_p() {
00614     GETSLIDER(SelImagePath_p);
00615 }
00616 
00617 string MMSSliderWidget::getSelImageName_p() {
00618     GETSLIDER(SelImageName_p);
00619 }
00620 
00621 string MMSSliderWidget::getImagePath_i() {
00622     GETSLIDER(ImagePath_i);
00623 }
00624 
00625 string MMSSliderWidget::getImageName_i() {
00626     GETSLIDER(ImageName_i);
00627 }
00628 
00629 string MMSSliderWidget::getSelImagePath_i() {
00630     GETSLIDER(SelImagePath_i);
00631 }
00632 
00633 string MMSSliderWidget::getSelImageName_i() {
00634     GETSLIDER(SelImageName_i);
00635 }
00636 
00637 unsigned int MMSSliderWidget::getPosition() {
00638     GETSLIDER(Position);
00639 }
00640 
00641 string MMSSliderWidget::getBarImagePath() {
00642     GETSLIDER(BarImagePath);
00643 }
00644 
00645 string MMSSliderWidget::getBarImageName() {
00646     GETSLIDER(BarImageName);
00647 }
00648 
00649 string MMSSliderWidget::getSelBarImagePath() {
00650     GETSLIDER(SelBarImagePath);
00651 }
00652 
00653 string MMSSliderWidget::getSelBarImageName() {
00654     GETSLIDER(SelBarImageName);
00655 }
00656 
00657 
00658 
00659 
00660 
00661 
00662 void MMSSliderWidget::setImagePath(string imagepath, bool load, bool refresh) {
00663     mySliderWidgetClass.setImagePath(imagepath);
00664     this->imagepath_set = true;
00665     if (load) {
00666         if (this->rootwindow) {
00667             
00668             enableRefresh((this->image == this->current_fgimage));
00669 
00670             this->rootwindow->im->releaseImage(this->image);
00671             this->image = this->rootwindow->im->getImage(getImagePath(), getImageName());
00672         }
00673     }
00674 
00675     this->refresh(refresh);
00676 }
00677 
00678 void MMSSliderWidget::setImageName(string imagename, bool load, bool refresh) {
00679     if (!this->imagepath_set) mySliderWidgetClass.unsetImagePath();
00680     mySliderWidgetClass.setImageName(imagename);
00681     if (load) {
00682         if (this->rootwindow) {
00683             
00684             enableRefresh((this->image == this->current_fgimage));
00685 
00686             this->rootwindow->im->releaseImage(this->image);
00687             this->image = this->rootwindow->im->getImage(getImagePath(), getImageName());
00688         }
00689     }
00690 
00691     this->refresh(refresh);
00692 }
00693 
00694 void MMSSliderWidget::setImage(string imagepath, string imagename, bool load, bool refresh) {
00695     mySliderWidgetClass.setImagePath(imagepath);
00696     mySliderWidgetClass.setImageName(imagename);
00697     if (load) {
00698         if (this->rootwindow) {
00699             
00700             enableRefresh((this->image == this->current_fgimage));
00701 
00702             this->rootwindow->im->releaseImage(this->image);
00703             this->image = this->rootwindow->im->getImage(getImagePath(), getImageName());
00704         }
00705     }
00706 
00707     this->refresh(refresh);
00708 }
00709 
00710 void MMSSliderWidget::setSelImagePath(string selimagepath, bool load, bool refresh) {
00711     if (!this->selimagepath_set) mySliderWidgetClass.unsetSelImagePath();
00712     mySliderWidgetClass.setSelImagePath(selimagepath);
00713     this->selimagepath_set = true;
00714     if (load) {
00715         if (this->rootwindow) {
00716             
00717             enableRefresh((this->selimage == this->current_fgimage));
00718 
00719             this->rootwindow->im->releaseImage(this->selimage);
00720             this->selimage = this->rootwindow->im->getImage(getSelImagePath(), getSelImageName());
00721         }
00722     }
00723 
00724     this->refresh(refresh);
00725 }
00726 
00727 void MMSSliderWidget::setSelImageName(string selimagename, bool load, bool refresh) {
00728     mySliderWidgetClass.setSelImageName(selimagename);
00729     if (load) {
00730         if (this->rootwindow) {
00731             
00732             enableRefresh((this->selimage == this->current_fgimage));
00733 
00734             this->rootwindow->im->releaseImage(this->selimage);
00735             this->selimage = this->rootwindow->im->getImage(getSelImagePath(), getSelImageName());
00736         }
00737     }
00738 
00739     this->refresh(refresh);
00740 }
00741 
00742 void MMSSliderWidget::setSelImage(string selimagepath, string selimagename, bool load, bool refresh) {
00743     mySliderWidgetClass.setSelImagePath(selimagepath);
00744     mySliderWidgetClass.setSelImageName(selimagename);
00745     if (load) {
00746         if (this->rootwindow) {
00747             
00748             enableRefresh((this->selimage == this->current_fgimage));
00749 
00750             this->rootwindow->im->releaseImage(this->selimage);
00751             this->selimage = this->rootwindow->im->getImage(getSelImagePath(), getSelImageName());
00752         }
00753     }
00754 
00755     this->refresh(refresh);
00756 }
00757 
00758 void MMSSliderWidget::setImagePath_p(string imagepath_p, bool load, bool refresh) {
00759     if (!this->imagepath_p_set) mySliderWidgetClass.unsetImagePath_p();
00760     mySliderWidgetClass.setImagePath_p(imagepath_p);
00761     this->imagepath_p_set = true;
00762     if (load) {
00763         if (this->rootwindow) {
00764             
00765             enableRefresh((this->image_p == this->current_fgimage));
00766 
00767             this->rootwindow->im->releaseImage(this->image_p);
00768             this->image_p = this->rootwindow->im->getImage(getImagePath_p(), getImageName_p());
00769         }
00770     }
00771 
00772     this->refresh(refresh);
00773 }
00774 
00775 void MMSSliderWidget::setImageName_p(string imagename_p, bool load, bool refresh) {
00776     mySliderWidgetClass.setImageName_p(imagename_p);
00777     if (load) {
00778         if (this->rootwindow) {
00779             
00780             enableRefresh((this->image_p == this->current_fgimage));
00781 
00782             this->rootwindow->im->releaseImage(this->image_p);
00783             this->image_p = this->rootwindow->im->getImage(getImagePath_p(), getImageName_p());
00784         }
00785     }
00786 
00787     this->refresh(refresh);
00788 }
00789 
00790 void MMSSliderWidget::setImage_p(string imagepath_p, string imagename_p, bool load, bool refresh) {
00791     mySliderWidgetClass.setImagePath_p(imagepath_p);
00792     mySliderWidgetClass.setImageName_p(imagename_p);
00793     if (load) {
00794         if (this->rootwindow) {
00795             
00796             enableRefresh((this->image_p == this->current_fgimage));
00797 
00798             this->rootwindow->im->releaseImage(this->image_p);
00799             this->image_p = this->rootwindow->im->getImage(getImagePath_p(), getImageName_p());
00800         }
00801     }
00802 
00803     this->refresh(refresh);
00804 }
00805 
00806 void MMSSliderWidget::setSelImagePath_p(string selimagepath_p, bool load, bool refresh) {
00807     if (!this->selimagepath_p_set) mySliderWidgetClass.unsetSelImagePath_p();
00808     mySliderWidgetClass.setSelImagePath_p(selimagepath_p);
00809     this->selimagepath_p_set = true;
00810     if (load) {
00811         if (this->rootwindow) {
00812             
00813             enableRefresh((this->selimage_p == this->current_fgimage));
00814 
00815             this->rootwindow->im->releaseImage(this->selimage_p);
00816             this->selimage_p = this->rootwindow->im->getImage(getSelImagePath_p(), getSelImageName_p());
00817         }
00818     }
00819 
00820     this->refresh(refresh);
00821 }
00822 
00823 void MMSSliderWidget::setSelImageName_p(string selimagename_p, bool load, bool refresh) {
00824     mySliderWidgetClass.setSelImageName_p(selimagename_p);
00825     if (load) {
00826         if (this->rootwindow) {
00827             
00828             enableRefresh((this->selimage_p == this->current_fgimage));
00829 
00830             this->rootwindow->im->releaseImage(this->selimage_p);
00831             this->selimage_p = this->rootwindow->im->getImage(getSelImagePath_p(), getSelImageName_p());
00832         }
00833     }
00834 
00835     this->refresh(refresh);
00836 }
00837 
00838 void MMSSliderWidget::setSelImage_p(string selimagepath_p, string selimagename_p, bool load, bool refresh) {
00839     mySliderWidgetClass.setSelImagePath_p(selimagepath_p);
00840     mySliderWidgetClass.setSelImageName_p(selimagename_p);
00841     if (load) {
00842         if (this->rootwindow) {
00843             
00844             enableRefresh((this->selimage_p == this->current_fgimage));
00845 
00846             this->rootwindow->im->releaseImage(this->selimage_p);
00847             this->selimage_p = this->rootwindow->im->getImage(getSelImagePath_p(), getSelImageName_p());
00848         }
00849     }
00850 
00851     this->refresh(refresh);
00852 }
00853 
00854 void MMSSliderWidget::setImagePath_i(string imagepath_i, bool load, bool refresh) {
00855     if (!this->imagepath_i_set) mySliderWidgetClass.unsetImagePath_i();
00856     mySliderWidgetClass.setImagePath_i(imagepath_i);
00857     this->imagepath_i_set = true;
00858     if (load) {
00859         if (this->rootwindow) {
00860             
00861             enableRefresh((this->image_i == this->current_fgimage));
00862 
00863             this->rootwindow->im->releaseImage(this->image_i);
00864             this->image_i = this->rootwindow->im->getImage(getImagePath_i(), getImageName_i());
00865         }
00866     }
00867 
00868     this->refresh(refresh);
00869 }
00870 
00871 void MMSSliderWidget::setImageName_i(string imagename_i, bool load, bool refresh) {
00872     mySliderWidgetClass.setImageName_i(imagename_i);
00873     if (load) {
00874         if (this->rootwindow) {
00875             
00876             enableRefresh((this->image_i == this->current_fgimage));
00877 
00878             this->rootwindow->im->releaseImage(this->image_i);
00879             this->image_i = this->rootwindow->im->getImage(getImagePath_i(), getImageName_i());
00880         }
00881     }
00882 
00883     this->refresh(refresh);
00884 }
00885 
00886 void MMSSliderWidget::setImage_i(string imagepath_i, string imagename_i, bool load, bool refresh) {
00887     mySliderWidgetClass.setImagePath_i(imagepath_i);
00888     mySliderWidgetClass.setImageName_i(imagename_i);
00889     if (load) {
00890         if (this->rootwindow) {
00891             
00892             enableRefresh((this->image_i == this->current_fgimage));
00893 
00894             this->rootwindow->im->releaseImage(this->image_i);
00895             this->image_i = this->rootwindow->im->getImage(getImagePath_i(), getImageName_i());
00896         }
00897     }
00898 
00899     this->refresh(refresh);
00900 }
00901 
00902 void MMSSliderWidget::setSelImagePath_i(string selimagepath_i, bool load, bool refresh) {
00903     if (!this->selimagepath_i_set) mySliderWidgetClass.unsetSelImagePath_i();
00904     mySliderWidgetClass.setSelImagePath_i(selimagepath_i);
00905     this->selimagepath_i_set = true;
00906     if (load) {
00907         if (this->rootwindow) {
00908             
00909             enableRefresh((this->selimage_i == this->current_fgimage));
00910 
00911             this->rootwindow->im->releaseImage(this->selimage_i);
00912             this->selimage_i = this->rootwindow->im->getImage(getSelImagePath_i(), getSelImageName_i());
00913         }
00914     }
00915 
00916     this->refresh(refresh);
00917 }
00918 
00919 void MMSSliderWidget::setSelImageName_i(string selimagename_i, bool load, bool refresh) {
00920     mySliderWidgetClass.setSelImageName_i(selimagename_i);
00921     if (load) {
00922         if (this->rootwindow) {
00923             
00924             enableRefresh((this->selimage_i == this->current_fgimage));
00925 
00926             this->rootwindow->im->releaseImage(this->selimage_i);
00927             this->selimage_i = this->rootwindow->im->getImage(getSelImagePath_i(), getSelImageName_i());
00928         }
00929     }
00930 
00931     this->refresh(refresh);
00932 }
00933 
00934 void MMSSliderWidget::setSelImage_i(string selimagepath_i, string selimagename_i, bool load, bool refresh) {
00935     mySliderWidgetClass.setSelImagePath_i(selimagepath_i);
00936     mySliderWidgetClass.setSelImageName_i(selimagename_i);
00937     if (load) {
00938         if (this->rootwindow) {
00939             
00940             enableRefresh((this->selimage_i == this->current_fgimage));
00941 
00942             this->rootwindow->im->releaseImage(this->selimage_i);
00943             this->selimage_i = this->rootwindow->im->getImage(getSelImagePath_i(), getSelImageName_i());
00944         }
00945     }
00946 
00947     this->refresh(refresh);
00948 }
00949 
00950 void MMSSliderWidget::setPosition(unsigned int pos, bool refresh) {
00951     
00952     unsigned int cpos = getPosition();
00953     if (pos == cpos)
00954         return;
00955     if (pos > 100) {
00956         if (cpos == 100)
00957             return;
00958         pos = 100;
00959     }
00960 
00961     
00962     mySliderWidgetClass.setPosition(pos);
00963 
00964     
00965     enableRefresh();
00966 
00967     this->refresh(refresh);
00968 }
00969 
00970 
00971 
00972 void MMSSliderWidget::setBarImagePath(string barimagepath, bool load, bool refresh) {
00973     mySliderWidgetClass.setBarImagePath(barimagepath);
00974     this->barimagepath_set = true;
00975     if (load) {
00976         if (this->rootwindow) {
00977             
00978             enableRefresh((this->barimage == this->current_fgbarimage));
00979 
00980             this->rootwindow->im->releaseImage(this->barimage);
00981             this->barimage = this->rootwindow->im->getImage(getBarImagePath(), getBarImageName());
00982         }
00983     }
00984 
00985     this->refresh(refresh);
00986 }
00987 
00988 void MMSSliderWidget::setBarImageName(string barimagename, bool load, bool refresh) {
00989     if (!this->barimagepath_set) mySliderWidgetClass.unsetBarImagePath();
00990     mySliderWidgetClass.setBarImageName(barimagename);
00991     if (load) {
00992         if (this->rootwindow) {
00993             
00994             enableRefresh((this->barimage == this->current_fgbarimage));
00995 
00996             this->rootwindow->im->releaseImage(this->barimage);
00997             this->barimage = this->rootwindow->im->getImage(getBarImagePath(), getBarImageName());
00998         }
00999     }
01000 
01001     this->refresh(refresh);
01002 }
01003 
01004 void MMSSliderWidget::setBarImage(string barimagepath, string barimagename, bool load, bool refresh) {
01005     mySliderWidgetClass.setBarImagePath(barimagepath);
01006     mySliderWidgetClass.setBarImageName(barimagename);
01007     if (load) {
01008         if (this->rootwindow) {
01009             
01010             enableRefresh((this->barimage == this->current_fgbarimage));
01011 
01012             this->rootwindow->im->releaseImage(this->barimage);
01013             this->barimage = this->rootwindow->im->getImage(getBarImagePath(), getBarImageName());
01014         }
01015     }
01016 
01017     this->refresh(refresh);
01018 }
01019 
01020 void MMSSliderWidget::setSelBarImagePath(string selbarimagepath, bool load, bool refresh) {
01021     if (!this->selbarimagepath_set) mySliderWidgetClass.unsetSelBarImagePath();
01022     mySliderWidgetClass.setSelBarImagePath(selbarimagepath);
01023     this->selbarimagepath_set = true;
01024     if (load) {
01025         if (this->rootwindow) {
01026             
01027             enableRefresh((this->selbarimage == this->current_fgbarimage));
01028 
01029             this->rootwindow->im->releaseImage(this->selbarimage);
01030             this->selbarimage = this->rootwindow->im->getImage(getSelBarImagePath(), getSelBarImageName());
01031         }
01032     }
01033 
01034     this->refresh(refresh);
01035 }
01036 
01037 void MMSSliderWidget::setSelBarImageName(string selbarimagename, bool load, bool refresh) {
01038     mySliderWidgetClass.setSelBarImageName(selbarimagename);
01039     if (load) {
01040         if (this->rootwindow) {
01041             
01042             enableRefresh((this->selbarimage == this->current_fgbarimage));
01043 
01044             this->rootwindow->im->releaseImage(this->selbarimage);
01045             this->selbarimage = this->rootwindow->im->getImage(getSelBarImagePath(), getSelBarImageName());
01046         }
01047     }
01048 
01049     this->refresh(refresh);
01050 }
01051 
01052 void MMSSliderWidget::setSelBarImage(string selbarimagepath, string selbarimagename, bool load, bool refresh) {
01053     mySliderWidgetClass.setSelBarImagePath(selbarimagepath);
01054     mySliderWidgetClass.setSelBarImageName(selbarimagename);
01055     if (load) {
01056         if (this->rootwindow) {
01057             
01058             enableRefresh((this->selbarimage == this->current_fgbarimage));
01059 
01060             this->rootwindow->im->releaseImage(this->selbarimage);
01061             this->selbarimage = this->rootwindow->im->getImage(getSelBarImagePath(), getSelBarImageName());
01062         }
01063     }
01064 
01065     this->refresh(refresh);
01066 }
01067 
01068 
01069 
01070 
01071 void MMSSliderWidget::updateFromThemeClass(MMSSliderWidgetClass *themeClass) {
01072     if (themeClass->isImagePath())
01073         setImagePath(themeClass->getImagePath());
01074     if (themeClass->isImageName())
01075         setImageName(themeClass->getImageName());
01076     if (themeClass->isSelImagePath())
01077         setSelImagePath(themeClass->getSelImagePath());
01078     if (themeClass->isSelImageName())
01079         setSelImageName(themeClass->getSelImageName());
01080     if (themeClass->isImagePath_p())
01081         setImagePath_p(themeClass->getImagePath_p());
01082     if (themeClass->isImageName_p())
01083         setImageName_p(themeClass->getImageName_p());
01084     if (themeClass->isSelImagePath_p())
01085         setSelImagePath_p(themeClass->getSelImagePath_p());
01086     if (themeClass->isSelImageName_p())
01087         setSelImageName_p(themeClass->getSelImageName_p());
01088     if (themeClass->isImagePath_i())
01089         setImagePath_i(themeClass->getImagePath_i());
01090     if (themeClass->isImageName_i())
01091         setImageName_i(themeClass->getImageName_i());
01092     if (themeClass->isSelImagePath_i())
01093         setSelImagePath_i(themeClass->getSelImagePath_i());
01094     if (themeClass->isSelImageName_i())
01095         setSelImageName_i(themeClass->getSelImageName_i());
01096     if (themeClass->isPosition())
01097         setPosition(themeClass->getPosition());
01098     if (themeClass->isBarImagePath())
01099         setBarImagePath(themeClass->getBarImagePath());
01100     if (themeClass->isBarImageName())
01101         setBarImageName(themeClass->getBarImageName());
01102     if (themeClass->isSelBarImagePath())
01103         setSelBarImagePath(themeClass->getSelBarImagePath());
01104     if (themeClass->isSelBarImageName())
01105         setSelBarImageName(themeClass->getSelBarImageName());
01106 
01107     MMSWidget::updateFromThemeClass(&(themeClass->widgetClass));
01108 }
01109 
01110 
01111 
01112