00001 #ifndef CSBorder_h 00002 #define CSBorder_h 00003 00004 // USES SDL_Surface 00005 00006 #ifdef WIN32 00007 #pragma warning(disable : 4786 ) 00008 #endif 00009 00010 #include <string> 00011 00012 #include "SDLMain.h" 00013 #include "CSLog.h" 00014 00015 class CSBorder; 00016 typedef std::vector<CSBorder *> CSBorders; 00017 00018 const int BORDER_TYPE_NONE = 0; 00019 const int BORDER_TYPE_DOUBLE = 1; 00020 const int BORDER_TYPE_UP = 2; 00021 const int BORDER_TYPE_INTER = 4; 00022 const int BORDER_TYPE_SINGLE_COLOR = 8; 00023 const int BORDER_TYPE_HOVER = 16; 00024 00025 const int BORDER_TYPE_SELECTED = BORDER_TYPE_DOUBLE + BORDER_TYPE_UP + BORDER_TYPE_SINGLE_COLOR; 00026 const int BORDER_TYPE_WINDOW = BORDER_TYPE_DOUBLE + BORDER_TYPE_UP; 00027 const int BORDER_TYPE_BUTTON = BORDER_TYPE_DOUBLE + BORDER_TYPE_UP; 00028 const int BORDER_TYPE_CHECK_BUTTON= BORDER_TYPE_DOUBLE; 00029 const int BORDER_TYPE_TEXTFIELD = BORDER_TYPE_DOUBLE; 00030 const int BORDER_TYPE_MENU = BORDER_TYPE_UP + BORDER_TYPE_HOVER; 00031 00032 class CSBorder 00033 { 00034 private: 00035 protected: 00036 int mType; 00037 int mState; 00038 int mBorderOuterEdgeWidth; 00039 int mBorderInnerEdgeWidth; 00040 int mBorderInterEdgeWidth; 00041 00042 int mShadeBright; 00043 int mShadeBrighter; 00044 int mShadeDark; 00045 int mShadeDarker; 00046 CSBorder(); 00047 00048 public: 00049 static const char *CLASS; 00050 virtual std::string getType() {return (std::string) CLASS;} 00051 virtual ~CSBorder() {} 00052 static CSBorder *getBorder(int type); 00053 virtual void paint(SDL_Surface *destination, SDL_Rect *parentViewport); 00054 virtual void setType(int type) {mType = type;} 00055 virtual void setState(int state) {mState = state;} 00056 virtual int getTotalWidth(); 00057 virtual int getTotalHeight(); 00058 00059 virtual int getSizeSouth(); 00060 virtual int getSizeNorth(); 00061 virtual int getSizeEast(); 00062 virtual int getSizeWest(); 00063 }; 00064 00065 class CSRoundedBorder : public CSBorder 00066 { 00067 private: 00068 protected: 00069 int mCorner; 00070 CSRoundedBorder() 00071 { 00072 mCorner = 0; 00073 } 00074 00075 public: 00076 static const char *CLASS; 00077 virtual std::string getType() {return (std::string) CLASS;} 00078 virtual ~CSRoundedBorder() {} 00079 static CSRoundedBorder *getBorder(int type); 00080 virtual void paint(SDL_Surface *destination, SDL_Rect *parentViewport); 00081 virtual void setCorner(int corner) {mCorner = corner;} 00082 }; 00083 #endif // CSBorder_h