00001 //********************************************************************** 00002 // 00003 // REGCOM: Regimental Command 00004 // Copyright (C) 2008 Randi J. Relander 00005 // <rjrelander@users.sourceforge.net> 00006 // 00007 // This program is free software; you can redistribute it and/or 00008 // modify it under the terms of the GNU General Public License 00009 // as published by the Free Software Foundation; either version 3 00010 // of the License, or (at your option) any later version. 00011 // 00012 // This program is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU General Public 00018 // License along with this program. If not, see 00019 // <http://www.gnu.org/licenses/>. 00020 // 00021 //********************************************************************** 00022 00023 #ifndef REGCOM_GUI_BUTTON_H 00024 #define REGCOM_GUI_BUTTON_H 00025 00026 // SYSTEM INNCLUDES 00027 #include <string> 00028 00029 // PROJECT INCLUDES 00030 #include "regcom/gui/Window.h" 00031 00032 // NAMESPACES 00033 namespace regcom { 00034 namespace gui { 00035 00036 // FORWARD REFERENCES 00037 class ButtonImp; 00038 class StringView; 00039 00041 // CLASS: Button 00047 class Button : public Window 00048 { 00049 public: 00050 00051 // FORWARD DECLARATIONS 00052 00053 enum Image; 00054 00055 // PUBLIC METHODS 00056 00058 Button(); 00059 00061 virtual ~Button(); 00062 00064 void SetStatus(StringView* pView, const std::string& rStatus); 00065 00067 void SetCode(int code); 00068 00070 virtual void Draw(Rect rect); 00071 00073 virtual void OnMouseMove(Point point); 00074 00076 virtual void OnMouseDown(int n, Point point); 00077 00079 virtual void OnMouseUp(int n, Point point); 00080 00082 void Load(Surface* surface); 00083 00085 void Load(Surface* surface, Rect rect); 00086 00088 void LoadImage(Image image, const std::string& rName); 00089 00091 enum Image 00092 { 00093 IMAGE_NORMAL, 00094 IMAGE_HILITE, 00095 IMAGE_PRESSED, 00096 IMAGE_DISABLED, 00097 00098 IMAGE_MAXIMAGE 00099 }; 00100 00101 private: 00102 00104 enum State 00105 { 00106 STATE_IDLE, 00107 STATE_HOVER, 00108 STATE_ACTIVE, 00109 STATE_PENDING 00110 }; 00111 00113 State m_State; 00114 00116 Surface* m_pImage[IMAGE_MAXIMAGE]; 00117 00119 std::string m_Status; 00120 00122 StringView* m_pStringView; 00123 00125 int m_Code; 00126 00128 void* m_pData1; 00129 00131 void* m_pData2; 00132 }; 00133 00134 } // namespace gui 00135 } // namespace regcom 00136 00137 #endif
Navigation
Home Page
Screen Shots
Developers
Documentation
Doxygen
Namespace List
Class List
Class Hierarchy
File List
Todo List
Links
SDL Library
License
SourceForge Project
Forums
Download
Regimental Command
Copyright © 2008
Randi J. Relander