00001 #ifdef WIN32 00002 #pragma warning(disable : 4786 ) 00003 #endif 00004 00005 #include "CSLabel.h" 00006 #include "CSBorder.h" 00007 #include "CSFont.h" 00008 #include "CSLAF.h" 00009 00010 const char *CSLabel::CLASS = "CSLabel"; 00011 00012 CSLabel::CSLabel() : CSGrafikElement(0, 0) 00013 { 00014 static char *functionName="CSLabel"; 00015 LOG_ENTER 00016 mString = ""; 00017 LOG_EXIT 00018 } 00019 00020 CSLabel::CSLabel(const std::string &string) : CSGrafikElement(0, 0) 00021 { 00022 static char *functionName="CSLabel"; 00023 LOG_ENTER 00024 mString = string; 00025 LOG_EXIT 00026 } 00027 00028 void CSLabel::paint(SDL_Surface *destination, SDL_Rect *parentViewport) 00029 { 00030 static char *functionName="paint"; 00031 SDL_Rect elementArea = getElementArea(); 00032 elementArea.x += parentViewport->x; 00033 elementArea.y += parentViewport->y; 00034 putString(destination, &elementArea, getHorizontalElementSpacing(), getVerticalElementSpacing(), getTextColor(), mString.c_str()); 00035 } 00036 00037 void CSLabel::layoutSetupLabel() 00038 { 00039 static char *functionName="layoutSetupLabel"; 00040 LOG_ENTER 00041 mMinHeight = mHeight = getFont()->getHeight()-2; 00042 mMinWidth = mWidth = getFont()->getWidth(mString.c_str()); 00043 LOG_EXIT 00044 }