00001 #ifndef CSButton_h 00002 #define CSButton_h 00003 00004 // USES SDL_Surface 00005 00006 #ifdef WIN32 00007 #pragma warning(disable : 4786 ) 00008 #endif 00009 00010 #include <vector> 00011 #include <string> 00012 00013 #include "CSGrafikElement.h" 00014 #include "CSIcon.h" 00015 #include "CSMessage.h" 00016 #include "CSLog.h" 00017 #include "CSBorder.h" 00018 00019 00020 class CSButton; 00021 typedef std::vector<CSButton *> CSButtons; 00022 00023 class CSButton : public CSGrafikElement 00024 { 00025 private: 00026 void initButton(); 00027 protected: 00028 CSIcon *mIcon; 00029 GuiMessage MESSAGE_BUTTON_PRESSED; 00030 GuiMessage MESSAGE_BUTTON_RELEASED; 00031 void layoutSetupButton(); 00032 00033 public: 00034 static const char *CLASS; 00035 virtual std::string getType() {return (std::string) CLASS;} 00036 00037 CSButton(CSIcon *icon); // Button frees Icon! 00038 CSButton(const std::string &text); 00039 virtual ~CSButton(); 00040 void reactOnMessageButton(CSMessage *message); 00041 virtual void reactOnMessage(CSMessage *message); 00042 virtual void layoutSetup() {layoutSetupButton();} 00043 00044 virtual int getButtonState() {return mBorderState;} 00045 }; 00046 00047 class CSDragButton : public CSButton 00048 { 00049 private: 00050 GuiMessage MESSAGE_BUTTON_DRAGGED; 00051 bool mDragging; 00052 int mDragStartX; 00053 int mDragStartY; 00054 protected: 00055 public: 00056 static const char *CLASS; 00057 virtual std::string getType() {return (std::string) CLASS;} 00058 CSDragButton(CSIcon *icon); // Button frees Icon! 00059 void reactOnMessageDragButton(CSMessage *message); 00060 virtual void reactOnMessage(CSMessage *message); 00061 }; 00062 00063 #endif // CSButton_h