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/mmslabelwidget.h"
00034 #include "mmsgui/mmstextbase.h"
00035 
00036 
00037 MMSLabelWidget::MMSLabelWidget(MMSWindow *root, string className, MMSTheme *theme) : MMSWidget() {
00038     create(root, className, theme);
00039 }
00040 
00041 MMSLabelWidget::~MMSLabelWidget() {
00042     if (labelThread) {
00043         labelThread->stop();
00044         labelThread=NULL;
00045     }
00046 }
00047 
00048 bool MMSLabelWidget::create(MMSWindow *root, string className, MMSTheme *theme) {
00049     this->type = MMSWIDGETTYPE_LABEL;
00050     this->className = className;
00051 
00052     
00053     this->da = new MMSWIDGET_DRAWABLE_ATTRIBUTES;
00054     if (theme) this->da->theme = theme; else this->da->theme = globalTheme;
00055     this->labelWidgetClass = this->da->theme->getLabelWidgetClass(className);
00056     this->da->baseWidgetClass = &(this->da->theme->labelWidgetClass.widgetClass);
00057     if (this->labelWidgetClass) this->da->widgetClass = &(this->labelWidgetClass->widgetClass); else this->da->widgetClass = NULL;
00058 
00059     
00060     initLanguage();
00061     this->fontpath = "";
00062     this->fontname = "";
00063     this->fontsize = 0;
00064     this->font = NULL;
00065     this->load_font = true;
00066     this->slide_width = 0;
00067     this->slide_offset = 0;
00068     this->frame_delay = 100;
00069     this->frame_delay_set = false;
00070     this->labelThread = NULL;
00071     this->translated = false;
00072     this->swap_left_right = false;
00073     this->current_fgset = false;
00074 
00075     return MMSWidget::create(root, true, false, false, true, false, false, false);
00076 }
00077 
00078 MMSWidget *MMSLabelWidget::copyWidget() {
00079     
00080     MMSLabelWidget *newWidget = new MMSLabelWidget(this->rootwindow, className);
00081 
00082     newWidget->className = this->className;
00083     newWidget->labelWidgetClass = this->labelWidgetClass;
00084     newWidget->myLabelWidgetClass = this->myLabelWidgetClass;
00085 
00086     newWidget->lang = this->lang;
00087     newWidget->translated_text = this->translated_text;
00088     newWidget->current_fgcolor = this->current_fgcolor;
00089 
00090     
00091     MMSWidget::copyWidget((MMSWidget*)newWidget);
00092 
00093     
00094     initLanguage(newWidget);
00095     newWidget->fontpath = "";
00096     newWidget->fontname = "";
00097     newWidget->fontsize = 0;
00098     newWidget->font = NULL;
00099     newWidget->load_font = true;
00100     newWidget->slide_width = 0;
00101     newWidget->slide_offset = 0;
00102     newWidget->frame_delay = 100;
00103     newWidget->frame_delay_set = false;
00104     newWidget->labelThread = NULL;
00105     newWidget->translated = false;
00106     newWidget->swap_left_right = false;
00107     newWidget->current_fgset = false;
00108     if (this->rootwindow) {
00109         
00110         loadFont(newWidget);
00111 
00112         
00113         if (newWidget->getSlidable()) {
00114             newWidget->setSlidable(true);
00115         }
00116     }
00117 
00118     return newWidget;
00119 }
00120 
00121 
00122 void MMSLabelWidget::initLanguage(MMSLabelWidget *widget) {
00123     if (!widget) widget = this;
00124 
00125     widget->lang = (!this->rootwindow)?MMSLANG_NONE:this->rootwindow->windowmanager->getTranslator()->getTargetLang();
00126 }
00127 
00128 void MMSLabelWidget::loadFont(MMSLabelWidget *widget) {
00129     if (!this->load_font) return;
00130     if (!widget) widget = this;
00131 
00132     if (this->rootwindow) {
00133         
00134         widget->lang = this->rootwindow->windowmanager->getTranslator()->getTargetLang();
00135         if (widget->font) this->rootwindow->fm->releaseFont(widget->font);
00136         widget->fontpath = widget->getFontPath();
00137         widget->fontname = widget->getFontName(widget->lang);
00138         widget->fontsize = widget->getFontSize();
00139         widget->font = this->rootwindow->fm->getFont(widget->fontpath, widget->fontname, widget->fontsize);
00140         if (widget->font) {
00141             widget->load_font = false;
00142         }
00143     }
00144 }
00145 
00146 bool MMSLabelWidget::init() {
00147     
00148     if (!MMSWidget::init())
00149         return false;
00150 
00151     
00152     initLanguage();
00153 
00154     
00155     loadFont();
00156 
00157     
00158     if (getSlidable()) {
00159         setSlidable(true);
00160     }
00161 
00162     return true;
00163 }
00164 
00165 bool MMSLabelWidget::release() {
00166     
00167     if (!MMSWidget::release())
00168         return false;
00169 
00170     
00171     this->rootwindow->fm->releaseFont(this->font);
00172     this->fontpath = "";
00173     this->fontname = "";
00174     this->fontsize = 0;
00175     this->font = NULL;
00176     this->load_font = true;
00177 
00178     return true;
00179 }
00180 
00181 
00182 bool MMSLabelWidget::prepareText(int *width, int *height, bool recalc) {
00183     
00184     this->surface->lock();
00185 
00186     loadFont();
00187 
00188     if (!this->font) {
00189         this->surface->unlock();
00190         return false;
00191     }
00192 
00193     
00194     this->surface->setFont(this->font);
00195 
00196     this->surface->unlock();
00197 
00198     if (!this->translated) {
00199         
00200         if ((this->rootwindow)&&(this->rootwindow->windowmanager)&&(getTranslate())) {
00201             
00202             string source;
00203             getText(source);
00204             this->rootwindow->windowmanager->getTranslator()->translate(source, this->translated_text);
00205         }
00206         else {
00207             
00208             getText(this->translated_text);
00209         }
00210 
00211         
00212         this->swap_left_right = false;
00213 
00214         
00215         MMSLanguage targetlang = this->rootwindow->windowmanager->getTranslator()->getTargetLang();
00216         if ((targetlang == MMSLANG_IL) || (targetlang == MMSLANG_AR)) {
00217             if (convBidiString(this->translated_text, this->translated_text), (targetlang == MMSLANG_AR) ? true : false) {
00218                 
00219                 this->swap_left_right = true;
00220             }
00221         }
00222 
00223         
00224         this->translated = true;
00225     }
00226 
00227     
00228     int realWidth, realHeight;
00229     this->font->getStringWidth(this->translated_text, -1, &realWidth);
00230     this->font->getHeight(&realHeight);
00231 
00232     if (!this->minmax_set) {
00233         if (width)  *width = realWidth;
00234         if (height) *height = realHeight;
00235     }
00236     else {
00237         if (recalc) {
00238             
00239 
00240             
00241             int maxWidth = getMaxWidthPix();
00242             if (maxWidth <= 0) maxWidth = getInnerGeometry().w;
00243             int maxHeight = getMaxHeightPix();
00244             if (maxHeight <= 0) maxHeight = getInnerGeometry().h;
00245 
00246             
00247             int minWidth = getMinWidthPix();
00248             int minHeight = getMinHeightPix();
00249 
00250             if (width)  {
00251                 if (realWidth < minWidth)
00252                     *width = minWidth;
00253                 else
00254                 if (realWidth > maxWidth)
00255                     *width = maxWidth;
00256                 else
00257                     *width = realWidth;
00258 
00259                 if (*width <= 0) *width = 1;
00260             }
00261 
00262             if (height) {
00263                 if (realHeight < minHeight)
00264                     *height = minHeight;
00265                 else
00266                 if (realHeight > maxHeight)
00267                     *height = maxHeight;
00268                 else
00269                     *height = realHeight;
00270 
00271                 if (*height <= 0) *height = 1;
00272             }
00273         }
00274         else {
00275             if (width)  *width = realWidth;
00276             if (height) *height = realHeight;
00277         }
00278     }
00279 
00280     return true;
00281 }
00282 
00283 
00284 void MMSLabelWidget::calcContentSize() {
00285     int width, height;
00286 
00287     if (prepareText(&width, &height, true)) {
00288         
00289         setContentSize(width, height);
00290     }
00291 }
00292 
00293 
00294 void MMSLabelWidget::getForeground(MMSFBColor *color) {
00295     color->a = 0;
00296 
00297     if (isActivated()) {
00298         if (isSelected()) {
00299             *color = getSelColor();
00300         }
00301         else {
00302             *color = getColor();
00303         }
00304         if (isPressed()) {
00305             MMSFBColor mycol;
00306             if (isSelected()) {
00307                 mycol = getSelColor_p();
00308                 if (mycol.a>0) *color=mycol;
00309             }
00310             else {
00311                 mycol = getColor_p();
00312                 if (mycol.a>0) *color=mycol;
00313             }
00314         }
00315     }
00316     else {
00317         if (isSelected()) {
00318             *color = getSelColor_i();
00319         }
00320         else {
00321             *color = getColor_i();
00322         }
00323     }
00324 }
00325 
00326 bool MMSLabelWidget::enableRefresh(bool enable) {
00327     if (!MMSWidget::enableRefresh(enable)) return false;
00328 
00329     
00330     this->current_fgset = false;
00331 
00332     return true;
00333 }
00334 
00335 bool MMSLabelWidget::checkRefreshStatus() {
00336     if (MMSWidget::checkRefreshStatus()) return true;
00337 
00338     if (this->current_fgset) {
00339         
00340         MMSFBColor color;
00341         getForeground(&color);
00342 
00343         if (color == this->current_fgcolor) {
00344             
00345             return false;
00346         }
00347     }
00348 
00349     
00350     enableRefresh();
00351 
00352     return true;
00353 }
00354 
00355 
00356 bool MMSLabelWidget::draw(bool *backgroundFilled) {
00357     int width, height, x, y;
00358     bool myBackgroundFilled = false;
00359 
00360     if(!surface)
00361         return false;
00362 
00363     if (backgroundFilled) {
00364         if (this->has_own_surface)
00365             *backgroundFilled = false;
00366     }
00367     else
00368         backgroundFilled = &myBackgroundFilled;
00369 
00370     
00371     this->surface->lock();
00372 
00373     
00374     if (MMSWidget::draw(backgroundFilled)) {
00375         
00376         if (prepareText(&width, &height)) {
00377             
00378             MMSFBRectangle surfaceGeom = getSurfaceGeometry();
00379 
00380             
00381             this->slide_width = width;
00382 
00383             switch ((!this->swap_left_right) ? getAlignment() : swapAlignmentHorizontal(getAlignment())) {
00384                 case MMSALIGNMENT_LEFT:
00385                     x = surfaceGeom.x;
00386                     y = ((surfaceGeom.h - height) / 2) + surfaceGeom.y;
00387                     break;
00388                 case MMSALIGNMENT_RIGHT:
00389                     x = surfaceGeom.x + surfaceGeom.w - width;
00390                     y = ((surfaceGeom.h - height) / 2) + surfaceGeom.y;
00391                     break;
00392                 case MMSALIGNMENT_CENTER:
00393                     x = ((surfaceGeom.w - width) / 2) + surfaceGeom.x;
00394                     y = ((surfaceGeom.h - height) / 2) + surfaceGeom.y;
00395                     break;
00396                 case MMSALIGNMENT_TOP_CENTER:
00397                     x = ((surfaceGeom.w - width) / 2) + surfaceGeom.x;
00398                     y = surfaceGeom.y;
00399                     break;
00400                 case MMSALIGNMENT_TOP_LEFT:
00401                     x = surfaceGeom.x;
00402                     y = surfaceGeom.y;
00403                     break;
00404                 case MMSALIGNMENT_TOP_RIGHT:
00405                     x = surfaceGeom.x + surfaceGeom.w - width;
00406                     y = surfaceGeom.y;
00407                     break;
00408                 case MMSALIGNMENT_BOTTOM_CENTER:
00409                     x = ((surfaceGeom.w - width) / 2) + surfaceGeom.x;
00410                     y = surfaceGeom.y + surfaceGeom.h - height;
00411                     break;
00412                 case MMSALIGNMENT_BOTTOM_LEFT:
00413                     x = surfaceGeom.x;
00414                     y = surfaceGeom.y + surfaceGeom.h - height;
00415                     break;
00416                 case MMSALIGNMENT_BOTTOM_RIGHT:
00417                     x = surfaceGeom.x + surfaceGeom.w - width;
00418                     y = surfaceGeom.y + surfaceGeom.h - height;
00419                     break;
00420                 default:
00421                     x = ((surfaceGeom.w - width) / 2) + surfaceGeom.x;
00422                     y = ((surfaceGeom.h - height) / 2) + surfaceGeom.y;
00423                     break;
00424             }
00425 
00426             
00427             MMSFBColor color;
00428             getForeground(&color);
00429             this->current_fgcolor   = color;
00430             this->current_fgset     = true;
00431 
00432             if (color.a) {
00433                 
00434                 this->surface->setDrawingColorAndFlagsByBrightnessAndOpacity(
00435                                     color,
00436                                     (isSelected())?getSelShadowColor(MMSPOSITION_TOP):getShadowColor(MMSPOSITION_TOP),
00437                                     (isSelected())?getSelShadowColor(MMSPOSITION_BOTTOM):getShadowColor(MMSPOSITION_BOTTOM),
00438                                     (isSelected())?getSelShadowColor(MMSPOSITION_LEFT):getShadowColor(MMSPOSITION_LEFT),
00439                                     (isSelected())?getSelShadowColor(MMSPOSITION_RIGHT):getShadowColor(MMSPOSITION_RIGHT),
00440                                     (isSelected())?getSelShadowColor(MMSPOSITION_TOP_LEFT):getShadowColor(MMSPOSITION_TOP_LEFT),
00441                                     (isSelected())?getSelShadowColor(MMSPOSITION_TOP_RIGHT):getShadowColor(MMSPOSITION_TOP_RIGHT),
00442                                     (isSelected())?getSelShadowColor(MMSPOSITION_BOTTOM_LEFT):getShadowColor(MMSPOSITION_BOTTOM_LEFT),
00443                                     (isSelected())?getSelShadowColor(MMSPOSITION_BOTTOM_RIGHT):getShadowColor(MMSPOSITION_BOTTOM_RIGHT),
00444                                     getBrightness(), getOpacity());
00445 
00446                 
00447                 this->surface->drawString(this->translated_text, -1, x - this->slide_offset, y);
00448             }
00449         }
00450 
00451         
00452         updateWindowSurfaceWithSurface(!*backgroundFilled);
00453     }
00454 
00455     
00456     this->surface->unlock();
00457 
00458     
00459     return MMSWidget::drawDebug();
00460 }
00461 
00462 void MMSLabelWidget::targetLangChanged(MMSLanguage lang) {
00463     this->translated = false;
00464     this->load_font = true;
00465     loadFont();
00466 
00467     
00468     
00469     recalcContentSize(false);
00470 }
00471 
00472 
00473 int MMSLabelWidget::getStringWidth(const char *text) {
00474     int realWidth = 0;
00475 
00476     loadFont();
00477     if(text)
00478         this->font->getStringWidth(text, -1, &realWidth);
00479     else
00480         this->font->getStringWidth(this->translated_text, -1, &realWidth);
00481 
00482     return realWidth;
00483 }
00484 
00485 
00486 
00487 
00488 
00489 #define GETLABEL(x) \
00490     if (this->myLabelWidgetClass.is##x()) return myLabelWidgetClass.get##x(); \
00491     else if ((labelWidgetClass)&&(labelWidgetClass->is##x())) return labelWidgetClass->get##x(); \
00492     else return this->da->theme->labelWidgetClass.get##x();
00493 
00494 #define GETLABEL2(x,y) \
00495     if (this->myLabelWidgetClass.is##x()) y=myLabelWidgetClass.get##x(); \
00496     else if ((labelWidgetClass)&&(labelWidgetClass->is##x())) y=labelWidgetClass->get##x(); \
00497     else y=this->da->theme->labelWidgetClass.get##x();
00498 
00499 #define GETLABELFONT(lang) \
00500     if (this->myLabelWidgetClass.isFontName(lang)) return myLabelWidgetClass.getFontName(lang); \
00501     else if (this->myLabelWidgetClass.isFontName(MMSLANG_NONE)) return myLabelWidgetClass.getFontName(MMSLANG_NONE); \
00502     else if ((labelWidgetClass)&&(labelWidgetClass->isFontName(lang))) return labelWidgetClass->getFontName(lang); \
00503     else if ((labelWidgetClass)&&(labelWidgetClass->isFontName(MMSLANG_NONE))) return labelWidgetClass->getFontName(MMSLANG_NONE); \
00504     else return this->da->theme->labelWidgetClass.getFontName();
00505 
00506 #define GETLABELSHADOW(x) \
00507     if (this->myLabelWidgetClass.isShadowColor(x)) return myLabelWidgetClass.getShadowColor(x); \
00508     else if ((labelWidgetClass)&&(labelWidgetClass->isShadowColor(x))) return labelWidgetClass->getShadowColor(x); \
00509     else return this->da->theme->labelWidgetClass.getShadowColor(x);
00510 
00511 #define GETLABELSHADOWSEL(x) \
00512     if (this->myLabelWidgetClass.isSelShadowColor(x)) return myLabelWidgetClass.getSelShadowColor(x); \
00513     else if ((labelWidgetClass)&&(labelWidgetClass->isSelShadowColor(x))) return labelWidgetClass->getSelShadowColor(x); \
00514     else return this->da->theme->labelWidgetClass.getSelShadowColor(x);
00515 
00516 
00517 string MMSLabelWidget::getFontPath() {
00518     GETLABEL(FontPath);
00519 }
00520 
00521 string MMSLabelWidget::getFontName(MMSLanguage lang) {
00522     GETLABELFONT(lang);
00523 }
00524 
00525 unsigned int MMSLabelWidget::getFontSize() {
00526     GETLABEL(FontSize);
00527 }
00528 
00529 MMSALIGNMENT MMSLabelWidget::getAlignment() {
00530     GETLABEL(Alignment);
00531 }
00532 
00533 MMSFBColor MMSLabelWidget::getColor() {
00534     GETLABEL(Color);
00535 }
00536 
00537 MMSFBColor MMSLabelWidget::getSelColor() {
00538     GETLABEL(SelColor);
00539 }
00540 
00541 MMSFBColor MMSLabelWidget::getColor_p() {
00542     GETLABEL(Color_p);
00543 }
00544 
00545 MMSFBColor MMSLabelWidget::getSelColor_p() {
00546     GETLABEL(SelColor_p);
00547 }
00548 
00549 MMSFBColor MMSLabelWidget::getColor_i() {
00550     GETLABEL(Color_i);
00551 }
00552 
00553 MMSFBColor MMSLabelWidget::getSelColor_i() {
00554     GETLABEL(SelColor_i);
00555 }
00556 
00557 string MMSLabelWidget::getText() {
00558     GETLABEL(Text);
00559 }
00560 
00561 void MMSLabelWidget::getText(string &text) {
00562     GETLABEL2(Text, text);
00563 }
00564 
00565 bool MMSLabelWidget::getSlidable() {
00566     GETLABEL(Slidable);
00567 }
00568 
00569 unsigned char MMSLabelWidget::getSlideSpeed() {
00570     GETLABEL(SlideSpeed);
00571 }
00572 
00573 bool MMSLabelWidget::getTranslate() {
00574     GETLABEL(Translate);
00575 }
00576 
00577 
00578 MMSFBColor MMSLabelWidget::getShadowColor(MMSPOSITION position) {
00579     GETLABELSHADOW(position);
00580 }
00581 
00582 MMSFBColor MMSLabelWidget::getSelShadowColor(MMSPOSITION position) {
00583     GETLABELSHADOWSEL(position);
00584 }
00585 
00586 
00587 
00588 
00589 
00590 
00591 void MMSLabelWidget::setFontPath(string fontpath, bool load, bool refresh) {
00592     myLabelWidgetClass.setFontPath(fontpath);
00593     if (load) {
00594         this->load_font = true;
00595         loadFont();
00596     }
00597 
00598     
00599     enableRefresh();
00600 
00601     this->refresh(refresh);
00602 }
00603 
00604 void MMSLabelWidget::setFontName(MMSLanguage lang, string fontname, bool load, bool refresh) {
00605     myLabelWidgetClass.setFontName(fontname, lang);
00606     if (load) {
00607         this->load_font = true;
00608         loadFont();
00609     }
00610 
00611     
00612     enableRefresh();
00613 
00614     this->refresh(refresh);
00615 }
00616 
00617 void MMSLabelWidget::setFontName(string fontname, bool load, bool refresh) {
00618     setFontName(MMSLANG_NONE, fontname, load, refresh);
00619 }
00620 
00621 void MMSLabelWidget::setFontSize(unsigned int fontsize, bool load, bool refresh) {
00622     myLabelWidgetClass.setFontSize(fontsize);
00623     if (load) {
00624         this->load_font = true;
00625         loadFont();
00626     }
00627 
00628     
00629     enableRefresh();
00630 
00631     this->refresh(refresh);
00632 }
00633 
00634 void MMSLabelWidget::setFont(MMSLanguage lang, string fontpath, string fontname, unsigned int fontsize, bool load, bool refresh) {
00635     myLabelWidgetClass.setFontPath(fontpath);
00636     myLabelWidgetClass.setFontName(fontname, lang);
00637     myLabelWidgetClass.setFontSize(fontsize);
00638     if (load) {
00639         this->load_font = true;
00640         loadFont();
00641     }
00642 
00643     
00644     enableRefresh();
00645 
00646     this->refresh(refresh);
00647 }
00648 
00649 void MMSLabelWidget::setFont(string fontpath, string fontname, unsigned int fontsize, bool load, bool refresh) {
00650     setFont(MMSLANG_NONE, fontpath, fontname, fontsize, load, refresh);
00651 }
00652 
00653 void MMSLabelWidget::setAlignment(MMSALIGNMENT alignment, bool refresh) {
00654     myLabelWidgetClass.setAlignment(alignment);
00655 
00656     
00657     enableRefresh();
00658 
00659     this->refresh(refresh);
00660 }
00661 
00662 void MMSLabelWidget::setColor(MMSFBColor color, bool refresh) {
00663     myLabelWidgetClass.setColor(color);
00664 
00665     
00666     enableRefresh((color != this->current_fgcolor));
00667 
00668     this->refresh(refresh);
00669 }
00670 
00671 void MMSLabelWidget::setSelColor(MMSFBColor selcolor, bool refresh) {
00672     myLabelWidgetClass.setSelColor(selcolor);
00673 
00674     
00675     enableRefresh((selcolor != this->current_fgcolor));
00676 
00677     this->refresh(refresh);
00678 }
00679 
00680 void MMSLabelWidget::setColor_p(MMSFBColor color_p, bool refresh) {
00681     myLabelWidgetClass.setColor_p(color_p);
00682 
00683     
00684     enableRefresh((color_p != this->current_fgcolor));
00685 
00686     this->refresh(refresh);
00687 }
00688 
00689 void MMSLabelWidget::setSelColor_p(MMSFBColor selcolor_p, bool refresh) {
00690     myLabelWidgetClass.setSelColor_p(selcolor_p);
00691 
00692     
00693     enableRefresh((selcolor_p != this->current_fgcolor));
00694 
00695     this->refresh(refresh);
00696 }
00697 
00698 void MMSLabelWidget::setColor_i(MMSFBColor color_i, bool refresh) {
00699     myLabelWidgetClass.setColor_i(color_i);
00700 
00701     
00702     enableRefresh((color_i != this->current_fgcolor));
00703 
00704     this->refresh(refresh);
00705 }
00706 
00707 void MMSLabelWidget::setSelColor_i(MMSFBColor selcolor_i, bool refresh) {
00708     myLabelWidgetClass.setSelColor_i(selcolor_i);
00709 
00710     
00711     enableRefresh((selcolor_i != this->current_fgcolor));
00712 
00713     this->refresh(refresh);
00714 }
00715 
00716 
00717 void MMSLabelWidget::setText(string text, bool refresh) {
00718     myLabelWidgetClass.setText(text);
00719     this->translated = false;
00720 
00721     
00722     enableRefresh();
00723 
00724     this->refresh(refresh);
00725 }
00726 
00727 void MMSLabelWidget::setSlidable(bool slidable) {
00728     myLabelWidgetClass.setSlidable(slidable);
00729     if (slidable) {
00730         
00731         this->slide_offset = 0;
00732 
00733         if (this->labelThread) {
00734             
00735             this->labelThread->pause(false);
00736         }
00737         else {
00738             
00739             this->labelThread = new MMSLabelWidgetThread(this);
00740             this->labelThread->start();
00741         }
00742     }
00743     else {
00744         
00745         if (labelThread)
00746             labelThread->stop();
00747         this->slide_offset = 0;
00748 
00749         
00750         enableRefresh();
00751 
00752         this->refresh();
00753     }
00754 }
00755 
00756 void MMSLabelWidget::setSlideSpeed(unsigned char slidespeed) {
00757     myLabelWidgetClass.setSlideSpeed(slidespeed);
00758     this->frame_delay = 100;
00759     this->frame_delay_set = false;
00760 }
00761 
00762 void MMSLabelWidget::setTranslate(bool translate, bool refresh) {
00763     myLabelWidgetClass.setTranslate(translate);
00764     this->translated = false;
00765 
00766     
00767     enableRefresh();
00768 
00769     this->refresh(refresh);
00770 }
00771 
00772 
00773 
00774 void MMSLabelWidget::setShadowColor(MMSPOSITION position, MMSFBColor color, bool refresh) {
00775     myLabelWidgetClass.setShadowColor(position, color);
00776 
00777     
00778     enableRefresh();
00779 
00780     this->refresh(refresh);
00781 }
00782 
00783 void MMSLabelWidget::setSelShadowColor(MMSPOSITION position, MMSFBColor selcolor, bool refresh) {
00784     myLabelWidgetClass.setSelShadowColor(position, selcolor);
00785 
00786     
00787     enableRefresh();
00788 
00789     this->refresh(refresh);
00790 }
00791 
00792 
00793 
00794 void MMSLabelWidget::updateFromThemeClass(MMSLabelWidgetClass *themeClass) {
00795 
00796     
00797     if (themeClass->isSlidable())
00798         setSlidable(themeClass->getSlidable());
00799     if (themeClass->isSlideSpeed())
00800         setSlideSpeed(themeClass->getSlideSpeed());
00801     if (themeClass->isTranslate())
00802         setTranslate(themeClass->getTranslate());
00803 
00804     
00805     MMSTEXTBASE_UPDATE_FROM_THEME_CLASS(this, themeClass);
00806 
00807     
00808     MMSWidget::updateFromThemeClass(&(themeClass->widgetClass));
00809 }
00810 
00811 
00812 
00813