00001 /* Crown and Cutlass 00002 * Crown and Cutlass Button Header 00003 */ 00004 00005 #if !defined( _CCBUTTON_H_ ) 00006 #define _CCBUTTON_H_ 00007 00008 #include <guichan.hpp> 00009 #include <string> 00010 00011 class cCallback; 00012 class CCFont; 00013 00014 class CCButton : 00015 public gcn::Button, 00016 public gcn::ActionListener 00017 { 00018 public: 00019 CCButton(const std::string& caption, 00020 const std::string& eventId, 00021 const std::string mainFontName, 00022 const std::string highlightFontName, 00023 const std::string disabledFontName, 00024 cCallback *recallFunction); 00025 ~CCButton(); 00026 00027 void SetMainFont(std::string fontName); 00028 void SetHighlightFont(std::string fontName); 00029 void SetDisabledFont(std::string fontName); 00030 00031 /* 00032 * Inherited from Widget 00033 */ 00034 void draw(gcn::Graphics* graphics); 00035 void setEnabled(bool enable); 00036 void mouseIn(); 00037 void mouseOut(); 00038 00039 // This is inherited from ActionListener 00040 void action(const std::string &eventId); 00041 00042 void SetRecallFunction(cCallback *recallFunc); 00043 00044 void SetID(int id); 00045 int GetID(); 00046 00047 private: 00048 std::auto_ptr<CCFont> m_mainFont; 00049 std::auto_ptr<CCFont> m_highlightFont; 00050 std::auto_ptr<CCFont> m_disabledFont; 00051 cCallback *m_recallFunction; 00052 int m_id; 00053 }; 00054 00055 #endif
1.4.7