Main Page | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

CSLAF.cpp

Go to the documentation of this file.
00001 #ifdef WIN32
00002 #pragma warning(disable : 4786 )
00003 #endif
00004 
00005 #include "CSLAF.h"
00006 #include "SDLMain.h"
00007 #include "CSGrafikElement.h"
00008 #include "CSMouseCursor.h"
00009 #include "CSFont.h"
00010 #include "CSIcon.h"
00011 #include "CSBorder.h"
00012 #include "CSArea.h"
00013 #include "CSHelper.h"
00014 #include "CSButton.h"
00015 #include "CSWindow.h"
00016 #include "CSCheckBox.h"
00017 #include "CSCombobox.h"
00018 #include "CSListbox.h"
00019 #include "CSLabel.h"
00020 #include "CSMenu.h"
00021 #include "CSMenuBar.h"
00022 #include "CSMenuItem.h"
00023 #include "CSScrollbar.h"
00024 #include "CSPanel.h"
00025 #include "CSTextfield.h"
00026 #include "CSTextarea.h"
00027 #include "CSHTMLPanel.h"
00028 #include "CSHTMLarea.h"
00029 
00030 
00031 #pragma warning(disable : 4786 )
00032 
00033     //! \todo rectFill überall beseitigen! 
00034 
00035 
00036 CSLAF *CSLAF::mLAF = 0;
00037 CSGrafikElements CSLAF::mGUIElements;
00038 int CSLAF::mCurrentLAFId = 0;
00039 const char *CSLAF::CLASS = "CSLAF";
00040 
00041 void CSLAF::setCurrentLAF(CSLAF &laf)
00042 {
00043     (*mLAF) = laf;
00044     // pointers are copied also!
00045     // beware, that we don't delete pointers of the class we are copiing from
00046     // therefor we set the actual CSMouseCursor instances to 0!
00047     mLAF->mSizingMouseCursorInstance = 0;
00048     mLAF->mDefaultMouseCursorInstance = 0;
00049     lafChanged();
00050 }
00051 
00052 CSLAF *CSLAF::getCurrentLAF()
00053 {
00054     if (mLAF == 0)
00055     {
00056         mLAF = new CSLAF();
00057     }
00058     return mLAF;
00059 }
00060 
00061 CSLAF::CSLAF() 
00062 {
00063     mSizingMouseCursorInstance = 0;
00064     mDefaultMouseCursorInstance = 0;
00065     reset();
00066 }
00067 
00068 CSLAF::~CSLAF()
00069 {
00070     destroyMouseCursors();
00071 }
00072 
00073 
00074 void CSLAF::addElement(CSGrafikElement *element)
00075 {
00076     static char *functionName="addElement";
00077     LOG_ENTER 
00078     element->setCurrentLAFId(mCurrentLAFId);
00079     mGUIElements.push_back(element);
00080     LOG_EXIT
00081 }
00082 
00083 void CSLAF::removeElement(CSGrafikElement *element)
00084 {
00085     static char *functionName="removeElement";
00086     LOG_ENTER 
00087     CSGrafikElements::iterator iter = mGUIElements.begin();
00088     while (iter != mGUIElements.end())
00089     {
00090         if ((*iter) == element)
00091         {
00092             mGUIElements.erase(iter);
00093             iter = mGUIElements.begin();    // restart!
00094         }
00095         else
00096         {
00097             iter++;
00098         }
00099     }
00100     LOG_EXIT
00101 }
00102 
00103 void CSLAF::lafChanged()
00104 {
00105     static char *functionName="lafChanged";
00106     LOG_ENTER 
00107     if (mLAF != 0)
00108     {
00109         mLAF->destroyMouseCursors();
00110     }
00111     mCurrentLAFId++;
00112     
00113     CSGrafikElements::iterator iter = mGUIElements.begin();
00114     while (iter != mGUIElements.end())
00115     {
00116         CSGrafikElement *element = *iter;
00117         int id = element->getCurrentLAFId();
00118         if (id != mCurrentLAFId)
00119         {
00120             element->lafChanged(mCurrentLAFId);
00121             element->setCurrentLAFId(mCurrentLAFId);
00122             iter = mGUIElements.begin();
00123         }
00124         else
00125         {
00126             iter++;
00127         }
00128     }
00129 
00130     LOG_EXIT
00131 }
00132 
00133 int CSLAF::getHorizontalElementSpacingInternal(const std::string &classType)
00134 {
00135     if (classType.compare(CSButton::CLASS) == 0)
00136     {
00137         return buttonHorizontalSpacing;
00138     }
00139     if (classType.compare(CSDragButton::CLASS) == 0)
00140     {
00141         return buttonHorizontalSpacing;
00142     }
00143     if (classType.compare("Title") == 0)
00144     {
00145         return windowTitleInterIconOffset;
00146     }
00147     if (classType.compare(CSMenuBar::CLASS) == 0)
00148     {
00149         return menuBarHorizontalSpacing;
00150     }
00151     if (classType.compare(CSMenu::CLASS) == 0)
00152     {
00153         return menuItemHorzintalSpacing;
00154     }
00155     if (classType.compare("Menu") == 0)
00156     {
00157         return menuItemHorzintalSpacing;
00158     }
00159     if (classType.compare("MenuWindow") == 0)
00160     {
00161         return menuItemHorzintalSpacing;
00162     }
00163     if (classType.compare(CSMenuItem::CLASS) == 0)
00164     {
00165         return menuItemHorzintalSpacing;
00166     }
00167     if ( (classType.compare("CSIcon") == 0) || (classType.compare("CSPictureIcon") == 0)  || (classType.compare("CSTextIcon") == 0) )
00168     {
00169         return 0;
00170     }
00171     if (classType.compare(CSCheckBox::CLASS) == 0)
00172     {
00173         return buttonHorizontalSpacing;
00174     }
00175     if (classType.compare(CSListbox::CLASS) == 0)
00176     {
00177         return listboxHorizontalLineSpacing;
00178     }
00179     if (classType.compare(CSTextfield::CLASS) == 0)
00180     {
00181         return textfieldHorizontalSpacing;
00182     }
00183     if (classType.compare(CSTextarea::CLASS) == 0)
00184     {
00185         return textAreaHorizontalLineSpacing;
00186     }
00187     return elementHorizontalSpacing;
00188 }
00189 
00190 int CSLAF::getVerticalElementSpacingInternal(const std::string &classType)
00191 {
00192     if (classType.compare(CSButton::CLASS) == 0)
00193     {
00194         return buttonVerticalSpacing;
00195     }
00196     if (classType.compare(CSDragButton::CLASS) == 0)
00197     {
00198         return buttonVerticalSpacing;
00199     }
00200     if (classType.compare("Title") == 0)
00201     {
00202         return windowTitleInterIconOffset;
00203     }
00204     if (classType.compare(CSMenuBar::CLASS) == 0)
00205     {
00206         return menuBarVerticalSpacing;
00207     }
00208     if (classType.compare(CSMenu::CLASS) == 0)
00209     {
00210         return menuItemVerticalSpacing;
00211     }
00212     if (classType.compare("MenuWindow") == 0)
00213     {
00214         return menuItemVerticalSpacing;
00215     }
00216     if (classType.compare("Menu") == 0)
00217     {
00218         return menuItemVerticalSpacing;
00219     }
00220     if (classType.compare(CSMenuItem::CLASS) == 0)
00221     {
00222         return menuItemVerticalSpacing;
00223     }
00224     if ( (classType.compare("CSIcon") == 0) || (classType.compare("CSPictureIcon") == 0)  || (classType.compare("CSTextIcon") == 0) )
00225     {
00226         return 0;
00227     }
00228     if (classType.compare(CSCheckBox::CLASS) == 0)
00229     {
00230         return buttonVerticalSpacing;
00231     }
00232     if (classType.compare(CSListbox::CLASS) == 0)
00233     {
00234         return listboxVerticalLineSpacing;
00235     }
00236     if (classType.compare(CSTextfield::CLASS) == 0)
00237     {
00238         return textfieldVerticalSpacing;
00239     }
00240     if (classType.compare(CSTextarea::CLASS) == 0)
00241     {
00242         return textAreaVerticalLineSpacing;
00243     }
00244     return elementVerticalSpacing;
00245 }
00246         
00247 CSArea *CSLAF::getAreaInternal(const std::string &classType, int state)
00248 {
00249     static CSArea *area = new CSArea();
00250     if (classType.compare(CSLabel::CLASS) == 0)
00251     {
00252         static CSArea *area = new CSArea();
00253         return 0;
00254         //return area;
00255     }
00256     if (classType.compare(CSPanel::CLASS) == 0)
00257     {
00258         static CSArea *area = new CSArea();
00259         return 0;
00260         //return area;
00261     }
00262     if (classType.compare(CSButton::CLASS) == 0)
00263     {
00264         static CSRoundedArea *area = new CSRoundedArea();
00265         area->setCorner(3);
00266         return area;
00267     }
00268     if (classType.compare(CSDragButton::CLASS) == 0)
00269     {
00270         static CSRoundedArea *area = new CSRoundedArea();
00271         area->setCorner(4);
00272         return area;
00273     }
00274     if (classType.compare(CSWindow::CLASS) == 0)
00275     {
00276         static CSRoundedArea *area = new CSRoundedArea();
00277         area->setCorner(3);
00278 //      static CSPictureArea *area = new CSPictureArea();
00279 //      area->setPicture(CSPictureDirectLoader::INSTANCE.load("PAC_MAN.bmp"));
00280         return area;
00281     }
00282 
00283     if (classType.compare(CSMenuBar::CLASS) == 0)
00284     {
00285         static CSGradientArea *area = new CSGradientArea();
00286         area->setColor(CSHelper::colorPercent(getBackgroundColorEnabledInternal(classType), 50));
00287         area->setColor(CSHelper::colorPercent(0xffffff, 50));
00288         area->setSecondColor(CSHelper::colorPercent(getBackgroundColorEnabledInternal(classType), 50));
00289         area->setSecondColor(CSHelper::colorPercent(00000000, 50));
00290         area->setType(TYPE_VERTICAL);
00291         return area;
00292     }
00293     if (classType.compare(CSTextfield::CLASS) == 0)
00294     {
00295         static CSRoundedArea *area = new CSRoundedArea();
00296         area->setCorner(6);
00297         return area;
00298     }
00299     if (classType.compare(CSBar::CLASS) == 0)
00300     {
00301         static CSGradientArea *area = new CSGradientArea();
00302         area->setColor(CSHelper::colorPercent(getBackgroundColorEnabledInternal(classType), 50));
00303         area->setSecondColor(CSHelper::colorPercent(getBackgroundColorEnabledInternal(classType), 50));
00304         return area;
00305     }
00306     if (classType.compare(CSTextarea::CLASS) == 0)
00307     {
00308         static CSRoundedArea *area = new CSRoundedArea();
00309         area->setCorner(6);
00310         return area;
00311     }
00312     return area;
00313 }
00314 
00315 CSFont *CSLAF::getFontInternal(const std::string &classType)
00316 {
00317     static char *functionName="getProportionalFont";
00318     if (classType.compare("MonoSpaced"))
00319     {
00320         static CSFont *font = CSFontLoader::INSTANCE.load(monoSpacedFontName);
00321         font->setSolid(false);
00322         return font;
00323     }
00324     else if (classType.compare(CSTextarea::CLASS))
00325     {
00326         static CSFont *font = CSFontLoader::INSTANCE.load(monoSpacedFontName);
00327         font->setSolid(false);
00328         return font;
00329     }
00330     static CSFont *font = CSFontLoader::INSTANCE.load(proportionalFontName);
00331     font->setSolid(false);
00332     return font;
00333 }
00334 
00335 CSMouseCursor *CSLAF::getMouseCursorInternal(int type)
00336 {
00337     switch (type)
00338     {
00339         case LAF_MOUSE_CURSOR_DEFAULT:
00340         {
00341             if (mDefaultMouseCursorInstance == 0)
00342             {
00343                 mDefaultMouseCursorInstance = new CSMouseCursor(mDefaultMouseCursor);
00344             }
00345             return mDefaultMouseCursorInstance;
00346         }
00347         case LAF_MOUSE_CURSOR_SIZING_DOWN_RIGHT:
00348         case LAF_MOUSE_CURSOR_SIZING_DOWN_LEFT:
00349         case LAF_MOUSE_CURSOR_SIZING_UP_RIGHT:
00350         case LAF_MOUSE_CURSOR_SIZING_UP_LEFT:
00351         case LAF_MOUSE_CURSOR_SIZING_DOWN:
00352         case LAF_MOUSE_CURSOR_SIZING_UP:
00353         case LAF_MOUSE_CURSOR_SIZING_LEFT:
00354         case LAF_MOUSE_CURSOR_SIZING_RIGHT:
00355         {
00356             if (mSizingMouseCursorInstance == 0)
00357             {
00358                 mSizingMouseCursorInstance = new CSMouseCursor(mSizingMouseCursor);
00359             }
00360             return mSizingMouseCursorInstance;
00361         }
00362     }
00363     return 0;
00364 }
00365 
00366 int CSLAF::getBackgroundColorEnabledInternal(const std::string &classType) 
00367 {
00368     if (classType.compare(CSPanel::CLASS) == 0)
00369     {
00370         return windowBackColorEnabled;
00371     }
00372     if (classType.compare(CSDragButton::CLASS) == 0)
00373     {
00374         return buttonBackColorEnabled;
00375     }
00376     if (classType.compare(CSButton::CLASS) == 0)
00377     {
00378         return buttonBackColorEnabled;
00379     }
00380     if (classType.compare(CSWindow::CLASS) == 0)
00381     {
00382         return windowBackColorEnabled;
00383     }
00384     if (classType.compare("Title") == 0)
00385     {
00386         return titleColorEnabled;
00387     }
00388     if (classType.compare(CSMenuBar::CLASS) == 0)
00389     {
00390         return menuBarBackColorEnabled;
00391     }
00392     if (classType.compare(CSMenu::CLASS) == 0)
00393     {
00394         return menuBarBackColorEnabled;
00395     }
00396     if (classType.compare("MenuWindow") == 0)
00397     {
00398         return menuBackColorEnabled;
00399     }
00400     if (classType.compare("Menu") == 0)
00401     {
00402         return menuBackColorEnabled;
00403     }
00404     if (classType.compare(CSMenuItem::CLASS) == 0)
00405     {
00406         return menuBackColorEnabled;
00407     }
00408     if (classType.compare(CSCheckBox::CLASS) == 0)
00409     {
00410         return checkBoxColorEnabled;
00411     }
00412     if (classType.compare(CSScrollbar::CLASS) == 0)
00413     {
00414         return scrollbarBackColor;
00415     }
00416     if (classType.compare(CSListbox::CLASS) == 0)
00417     {
00418         return listboxColorEnabled;
00419     }
00420     if (classType.compare(CSCombobox::CLASS) == 0)
00421     {
00422         return textfieldColorEnabled;
00423     }
00424     if (classType.compare(CSTextfield::CLASS) == 0)
00425     {
00426         return textfieldColorEnabled;
00427     }
00428     if (classType.compare(CSTextarea::CLASS) == 0)
00429     {
00430         return textAreaColorEnabled;
00431     }
00432     return -1;
00433 }
00434 
00435 int CSLAF::getBackgroundColorDisabledInternal(const std::string &classType) 
00436 {
00437     if (classType.compare(CSPanel::CLASS) == 0)
00438     {
00439         return windowBackColorDisabled;
00440     }
00441     if (classType.compare(CSDragButton::CLASS) == 0)
00442     {
00443         return buttonBackColorDisabled;
00444     }
00445     if (classType.compare(CSButton::CLASS) == 0)
00446     {
00447         return buttonBackColorDisabled;
00448     }
00449     if (classType.compare(CSWindow::CLASS) == 0)
00450     {
00451         return windowBackColorDisabled;
00452     }
00453     if (classType.compare("Title") == 0)
00454     {
00455         return titleColorDisabled;
00456     }
00457     if (classType.compare(CSCheckBox::CLASS) == 0)
00458     {
00459         return checkBoxColorDisabled;
00460     }
00461     if (classType.compare(CSListbox::CLASS) == 0)
00462     {
00463         return listboxColorDisabled;
00464     }
00465     if (classType.compare(CSCombobox::CLASS) == 0)
00466     {
00467         return textfieldColorDisabled;
00468     }
00469     if (classType.compare(CSTextfield::CLASS) == 0)
00470     {
00471         return textfieldColorDisabled;
00472     }
00473     if (classType.compare(CSTextarea::CLASS) == 0)
00474     {
00475         return textAreaColorDisabled;
00476     }
00477     return -1;
00478 }
00479 
00480 int CSLAF::getTextColorEnabledInternal(const std::string &classType) 
00481 {
00482     if (classType.compare(CSPanel::CLASS) == 0)
00483     {
00484         return windowTextColorEnabled;
00485     }
00486     if (classType.compare(CSWindow::CLASS) == 0)
00487     {
00488         return windowTextColorEnabled;
00489     }
00490     if (classType.compare("Title") == 0)
00491     {
00492         return titleTextColorEnabled;
00493     }
00494     if (classType.compare(CSMenu::CLASS) == 0)
00495     {
00496         return menuTextColorEnabled;
00497     }
00498     if (classType.compare("MenuWindow") == 0)
00499     {
00500         return menuTextColorEnabled;
00501     }
00502     if (classType.compare("Menu") == 0)
00503     {
00504         return menuTextColorEnabled;
00505     }
00506     if (classType.compare(CSMenuItem::CLASS) == 0)
00507     {
00508         return menuTextColorEnabled;
00509     }
00510     if (classType.compare(CSListbox::CLASS) == 0)
00511     {
00512         return listboxTextColorEnabled;
00513     }
00514     if (classType.compare(CSTextarea::CLASS) == 0)
00515     {
00516         return textAreaTextColorEnabled;
00517     }
00518     return -1;
00519 }
00520 
00521 int CSLAF::getTextColorDisabledInternal(const std::string &classType) 
00522 {
00523     if (classType.compare(CSPanel::CLASS) == 0)
00524     {
00525         return windowTextColorDisabled;
00526     }
00527     if (classType.compare(CSWindow::CLASS) == 0)
00528     {
00529         return windowTextColorDisabled;
00530     }
00531     if (classType.compare("Title") == 0)
00532     {
00533         return titleTextColorDisabled;
00534     }
00535     if (classType.compare(CSMenu::CLASS) == 0)
00536     {
00537         return menuTextColorDisabled;
00538     }
00539     if (classType.compare("MenuWindow") == 0)
00540     {
00541         return menuTextColorDisabled;
00542     }
00543     if (classType.compare("Menu") == 0)
00544     {
00545         return menuTextColorDisabled;
00546     }
00547     if (classType.compare(CSMenuItem::CLASS) == 0)
00548     {
00549         return menuTextColorDisabled;
00550     }
00551     if (classType.compare(CSListbox::CLASS) == 0)
00552     {
00553         return listboxTextColorDisabled;
00554     }
00555     if (classType.compare(CSCombobox::CLASS) == 0)
00556     {
00557         return textfieldTextColorDisabled;
00558     }
00559     if (classType.compare(CSTextfield::CLASS) == 0)
00560     {
00561         return textfieldTextColorDisabled;
00562     }
00563     if (classType.compare(CSTextarea::CLASS) == 0)
00564     {
00565         return textAreaTextColorDisabled;
00566     }
00567     return -1;
00568 }
00569 
00570 CSBorder *CSLAF::getBorderInternal(const std::string &classType, int state)
00571 {
00572     static CSBorder *theBorder = CSBorder::getBorder(BORDER_TYPE_NONE);
00573 
00574     // default
00575     int type = -1;
00576     if (classType.compare(CSPanel::CLASS) == 0)
00577     {
00578         static CSBorder *border = CSBorder::getBorder(BORDER_TYPE_NONE);
00579 //      static CSRoundedBorder *border = CSRoundedBorder::getBorder(BORDER_TYPE_WINDOW);
00580 //      border->setState(state);
00581 //      border->setCorner(3);
00582         return border;
00583     }
00584     if (classType.compare(CSButton::CLASS) == 0)
00585     {
00586 //      static CSBorder *border = CSBorder::getBorder(BORDER_TYPE_BUTTON);
00587 //      border->setState(state);
00588         static CSRoundedBorder *border = CSRoundedBorder::getBorder(BORDER_TYPE_BUTTON);
00589         border->setState(state);
00590         border->setCorner(4);
00591         return border;
00592     }
00593     if (classType.compare(CSDragButton::CLASS) == 0)
00594     {
00595 //      static CSBorder *border = CSBorder::getBorder(BORDER_TYPE_BUTTON);
00596 //      border->setState(state);
00597         static CSRoundedBorder *border = CSRoundedBorder::getBorder(BORDER_TYPE_BUTTON);
00598         border->setState(state);
00599         border->setCorner(6);
00600         return border;
00601     }
00602     if (classType.compare(CSWindow::CLASS) == 0)
00603     {
00604 //      static CSBorder *border = CSBorder::getBorder(BORDER_TYPE_WINDOW);
00605 //      border->setState(state);
00606         static CSRoundedBorder *border = CSRoundedBorder::getBorder(BORDER_TYPE_WINDOW);
00607         border->setState(state);
00608         border->setCorner(3);
00609         return border;
00610     }
00611     if (classType.compare(CSBar::CLASS) == 0)
00612     {
00613         static CSBorder *border = CSBorder::getBorder(BORDER_TYPE_UP);
00614         border->setState(state);
00615         return border;
00616     }
00617     if (classType.compare("Title") == 0)
00618     {
00619         static CSBorder *border = CSBorder::getBorder(BORDER_TYPE_UP);
00620         border->setState(state);
00621         return border;
00622     }
00623     if (classType.compare(CSMenu::CLASS) == 0)
00624     {
00625         static CSBorder *border = CSBorder::getBorder(BORDER_TYPE_MENU);
00626         border->setState(state);
00627         return border;
00628     }
00629     if (classType.compare("Menu") == 0)
00630     {
00631         static CSBorder *border = CSBorder::getBorder(BORDER_TYPE_MENU);
00632         border->setState(state);
00633         return border;
00634     }
00635     if (classType.compare(CSMenuBar::CLASS) == 0)
00636     {
00637         static CSBorder *border = CSBorder::getBorder(BORDER_TYPE_UP);
00638         border->setState(state);
00639         return border;
00640     }
00641     if (classType.compare("MenuWindow") == 0)
00642     {
00643         static CSBorder *border = CSBorder::getBorder(BORDER_TYPE_WINDOW);
00644         border->setState(state);
00645         return border;
00646     }
00647     if (classType.compare(CSMenuItem::CLASS) == 0)
00648     {
00649         static CSBorder *border = CSBorder::getBorder(BORDER_TYPE_MENU);
00650         border->setState(state);
00651         return border;
00652     }
00653     if (classType.compare(CSCheckBox::CLASS) == 0)
00654     {
00655         static CSBorder *border = CSBorder::getBorder(BORDER_TYPE_CHECK_BUTTON);
00656         border->setState(state);
00657         return border;
00658     }
00659     if (classType.compare(CSListbox::CLASS) == 0)
00660     {
00661         static CSBorder *border = CSBorder::getBorder(BORDER_TYPE_TEXTFIELD);
00662         border->setState(state);
00663         return border;
00664     }
00665     if (classType.compare(CSCombobox::CLASS) == 0)
00666     {
00667         static CSBorder *border = CSBorder::getBorder(BORDER_TYPE_TEXTFIELD);
00668         border->setState(state);
00669         return border;
00670     }
00671     if (classType.compare(CSTextfield::CLASS) == 0)
00672     {
00673 //      static CSBorder *border = CSBorder::getBorder(BORDER_TYPE_TEXTFIELD);
00674 //      border->setState(state);
00675         static CSRoundedBorder *border = CSRoundedBorder::getBorder(BORDER_TYPE_TEXTFIELD);
00676         border->setState(state);
00677         border->setCorner(6);
00678         return border;
00679     }
00680     if (classType.compare(CSTextarea::CLASS) == 0)
00681     {
00682         static CSRoundedBorder *border = CSRoundedBorder::getBorder(BORDER_TYPE_TEXTFIELD);
00683         border->setState(state);
00684         border->setCorner(6);
00685 //      static CSBorder *border = CSBorder::getBorder(BORDER_TYPE_TEXTFIELD);
00686 //      border->setState(state);
00687         return border;
00688     }
00689     if (classType.compare(CSHTMLPanel::CLASS) == 0)
00690     {
00691         static CSBorder *border = CSBorder::getBorder(BORDER_TYPE_NONE);
00692         border->setState(state);
00693         return border;
00694     }
00695     if (classType.compare(CSLabel::CLASS) == 0)
00696     {
00697         static CSBorder *border = CSBorder::getBorder(BORDER_TYPE_NONE);
00698         border->setState(state);
00699         return border;
00700     }
00701 /*  
00702     if (classType.compare(CSHTMLArea::CLASS) == 0)
00703     {
00704         static CSBorder *border = CSBorder::getBorder(BORDER_TYPE_TEXTFIELD);
00705         border->setState(state);
00706         return border;
00707     }
00708 */
00709     return theBorder;
00710 }
00711         
00712 CSIcon *CSLAF::getIconInternal(int iconType)
00713 {
00714     switch (iconType)
00715     {
00716         case LAF_ICON_TYPE_CLOSE:
00717             return CSPictureIcon::buildIcon(closeIconFileEnabled, closeIconFileDisabled);       
00718         case LAF_ICON_TYPE_WARN:
00719             return CSPictureIcon::buildIcon(warnIconFileEnabled, warnIconFileDisabled);
00720         case LAF_ICON_TYPE_ERROR:
00721             return CSPictureIcon::buildIcon(errorIconFileEnabled, errorIconFileDisabled);
00722         case LAF_ICON_TYPE_INFO:
00723             return CSPictureIcon::buildIcon(infoIconFileEnabled, infoIconFileDisabled);
00724         case LAF_ICON_TYPE_QUESTION:
00725             return CSPictureIcon::buildIcon(questionIconFileEnabled, questionIconFileDisabled);
00726         case LAF_ICON_TYPE_UP:
00727             return CSPictureIcon::buildIcon(upIconFileEnabled, upIconFileDisabled);
00728         case LAF_ICON_TYPE_LEFT:
00729             return CSPictureIcon::buildIcon(leftIconFileEnabled, leftIconFileDisabled);
00730         case LAF_ICON_TYPE_DOWN:
00731             return CSPictureIcon::buildIcon(downIconFileEnabled, downIconFileDisabled);
00732         case LAF_ICON_TYPE_RIGHT:
00733             return CSPictureIcon::buildIcon(rightIconFileEnabled, rightIconFileDisabled);
00734     }
00735     return 0;
00736 }
00737 
00738 void CSLAF::reset(void)
00739 {
00740     static char *functionName="reset";
00741     LOG_ENTER 
00742 
00743     borderDefaultBrightestColor = 0xe0e0e0;
00744     windowBackColorEnabled = 0xc0c0c0;
00745     windowBackColorDisabled = 0xc0c0c0;
00746     windowTextColorEnabled = 0xffffff;
00747     windowTextColorDisabled = 0x101010;
00748 
00749     buttonBackColorEnabled = 0xc0c0c0;
00750     buttonBackColorDisabled = 0xc0c0c0;
00751     scrollbarBackColor = 0xd0d0d0;
00752     menuBarBackColorEnabled = 0xc0c0c0;
00753     menuBarBackColorDisabled = 0xc0c0c0;
00754     menuBackColorEnabled = 0xc0c0c0;
00755     menuBackColorDisabled = 0xc0c0c0;
00756     menuTextColorEnabled = 0xffffff;
00757     menuTextColorDisabled = 0xffffff;
00758 
00759     titleTextColorEnabled = 0xe0e0e0;
00760     titleTextColorDisabled = 0xe0e0e0;
00761     titleColorEnabled = 0x000080;
00762     titleColorDisabled = 0xc0c0c0;
00763 
00764     checkBoxColorEnabled = 0xffffff;
00765     checkBoxColorDisabled = 0xa0a0a0;
00766     listboxColorEnabled = 0xffffff;
00767     listboxColorDisabled = 0xa0a0a0;
00768     listboxTextColorEnabled = 0x101010;
00769     listboxTextColorDisabled = 0x101010;
00770 
00771     textfieldColorDisabled = 0xa0a0a0;
00772     textfieldColorEnabled = 0xffffff;
00773     textfieldTextColorEnabled = 0x101010;
00774     textfieldTextColorDisabled = 0xffffff;
00775     
00776     textAreaTextColorEnabled = 0x101010;
00777     textAreaTextColorDisabled = 0xffffff;
00778     textAreaColorEnabled = 0xffffff;
00779     textAreaColorDisabled = 0xa0a0a0;
00780     textAreaCursorColor = 0x101010;
00781 
00782     proportionalFontName = "font\\win_font.xml";
00783     monoSpacedFontName = "font\\defaultMonoFont.xml";
00784 
00785     comboboxItemsShown = 4;
00786     menuOpenXOffset = 0;
00787     menuOpenYOffset = 2;
00788     tooltipThreshold = 2000;
00789 
00790     windowTitleInterIconOffset = 0;
00791     windowTitleIconBorderVerticalOffset = 1;
00792     windowTitleIconBorderHorizontalOffset = 3;
00793     windowSizingOffset = 20;
00794 
00795     menuItemHorzintalSpacing = 2;
00796     menuItemVerticalSpacing = 2;
00797     menuBarHorizontalSpacing = 2;
00798     menuBarVerticalSpacing = 0;
00799     elementHorizontalSpacing = 2;
00800     elementVerticalSpacing = 2;
00801     textfieldHorizontalSpacing = 2;
00802     
00803     textfieldVerticalSpacing = 2;       
00804     labelHorizontalSpacing = 2;     
00805     labelVerticalSpacing = 2;
00806     buttonHorizontalSpacing = 2;    
00807     buttonVerticalSpacing = 2;
00808     textAreaVerticalLineSpacing = 2;
00809     textAreaHorizontalLineSpacing = 2;
00810 
00811     listboxVerticalLineSpacing = 4; 
00812     listboxHorizontalLineSpacing = 2;
00813 
00814     cursorRate = 500; // 500 milliseconds
00815     checkBoxSize = 12;
00816 
00817     closeIconFileEnabled="picture\\WindowClose.xml";
00818     closeIconFileDisabled="picture\\WindowClose.xml";
00819 
00820     warnIconFileEnabled="picture\\IconWarning.xml";
00821     warnIconFileDisabled="picture\\IconWarning.xml";
00822 
00823     errorIconFileEnabled="picture\\IconError.xml";
00824     errorIconFileDisabled="picture\\IconError.xml";
00825 
00826     infoIconFileEnabled="picture\\IconInfo.xml";
00827     infoIconFileDisabled="picture\\IconInfo.xml";
00828 
00829     questionIconFileEnabled="picture\\IconQuestion.xml";
00830     questionIconFileDisabled="picture\\IconQuestion.xml";
00831 
00832     upIconFileEnabled="picture\\IconArrowUpSmall.xml";
00833     upIconFileDisabled="picture\\IconArrowUpSmall.xml";
00834 
00835     downIconFileEnabled="picture\\IconArrowDownSmall.xml";
00836     downIconFileDisabled="picture\\IconArrowDownSmall.xml";
00837 
00838     leftIconFileEnabled="picture\\IconArrowLeftSmall.xml";
00839     leftIconFileDisabled="picture\\IconArrowLeftSmall.xml";
00840 
00841     rightIconFileEnabled="picture\\IconArrowRightSmall.xml";
00842     rightIconFileDisabled="picture\\IconArrowRightSmall.xml";
00843     
00844     mDefaultMouseCursor = "picture\\ArrowCursor.xml";
00845     mSizingMouseCursor = "picture\\SizingCursor.xml";
00846 
00847     LOG_EXIT
00848 }
00849 
00850 void CSLAF::destroyMouseCursors()
00851 {
00852     if (mSizingMouseCursorInstance)
00853     {
00854         delete (mSizingMouseCursorInstance);
00855         mSizingMouseCursorInstance = 0;
00856     }
00857     if (mDefaultMouseCursorInstance)
00858     {
00859         delete (mDefaultMouseCursorInstance);
00860         mDefaultMouseCursorInstance = 0;
00861     }
00862 }
00863 

Generated on Wed Jul 14 00:43:30 2004 for CSLib by doxygen 1.3.6