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_EDIT_BOX_H 00024 #define REGCOM_GUI_EDIT_BOX_H 00025 00026 // PROJECT INCLUDES 00027 #include "regcom/gui/StaticText.h" 00028 #include "regcom/gui/Color.h" 00029 00030 // NAMESPACES 00031 namespace regcom { 00032 namespace gui { 00033 00035 // CLASS: EditBox 00041 class EditBox : public StaticText 00042 { 00043 public: 00044 00045 // PUBLIC METHODS 00046 00048 EditBox(); 00049 00051 virtual ~EditBox(); 00052 00054 virtual void Draw(Rect rect); 00055 00057 virtual bool CanFocus() { return true; } 00058 00060 virtual void OnFocus(bool hasFocus); 00061 00063 virtual void OnKeyDown(SDL_KeyboardEvent sdlEvent); 00064 00066 virtual void OnMouseMove(Point point); 00067 00069 virtual void OnMouseDown(int n, Point point); 00070 00072 virtual void OnMouseUp(int n, Point point); 00073 00075 virtual void OnTimer(float deltaTime); 00076 00077 private: 00078 00080 static const int CURSOR_BLINK_RATE_MS = 500; 00081 00082 // PRIVATE METHODS 00083 00085 size_t ConvertPointToCursor(Point point); 00086 00087 // MEMBER VARIABLES 00088 00090 bool m_HasFocus; 00091 00093 size_t m_Cursor; 00094 00096 size_t m_StartCursor; 00097 00099 bool m_Dragging; 00100 00102 int m_Offset; 00103 00105 Color m_HighlightColor; 00106 00108 float m_CursorTimer; 00109 00111 bool m_CursorActive; 00112 }; 00113 00114 } // namespace gui 00115 } // namespace regcom 00116 00117 #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