Desktop.h

Go to the documentation of this file.
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_DESKTOP_H
00024 #define REGCOM_GUI_DESKTOP_H
00025 
00026 // PROJECT INCLUDES
00027 #include "regcom/gui/Window.h"
00028 #include "regcom/gui/Cursor.h"
00029 
00030 // NAMESPACES
00031 namespace regcom {
00032 namespace gui {
00033 
00034 // FORWARD REFERENCES
00035 class Point;
00036 
00038 //  CLASS: Desktop
00044 class Desktop : public Window
00045 {
00046 public:
00047 
00048     // PUBLIC METHODS
00049 
00051     Desktop();
00052 
00054     virtual ~Desktop();
00055 
00057     virtual void Invalidate(Rect rect);
00058 
00060     virtual void Invalidate();
00061 
00063     virtual void Update(Rect rect);
00064 
00066     virtual void Update();
00067 
00069     void ToggleDirtyDebug();
00070 
00072     void HideCursor();
00073 
00075     void ShowCursor();
00076 
00078     void SetCursorPosition(Point point);
00079 
00081     virtual Window* FindWindow(Point point);
00082 
00084     void SetFocus(Window* pWindow)
00085     {
00086         if (m_pFocus) m_pFocus->OnFocus(false);
00087         m_pFocus = pWindow; 
00088         if (m_pFocus) m_pFocus->OnFocus(true);
00089     }
00090 
00092     virtual void OnMouseButtonDown(SDL_MouseButtonEvent sdlEvent);
00093 
00095     virtual void OnMouseButtonUp(SDL_MouseButtonEvent sdlEvent);
00096 
00098     virtual void OnKeyDown(SDL_KeyboardEvent sdlEvent);
00099 
00101     virtual void OnKeyUp(SDL_KeyboardEvent sdlEvent);
00102 
00103 private:
00104 
00105     // PRIVATE CONSTANTS
00106 
00108     static const int DESKTOP_MAXDIRTY = 200;
00109 
00110     // MEMBER VARIABLES
00111 
00113     Rect m_DirtyRects[DESKTOP_MAXDIRTY];
00114 
00116     int m_DirtyCount;
00117 
00119     bool m_DirtyDebug;
00120 
00122     Cursor m_Cursor;
00123 
00125     Window* m_pFocus;
00126 };
00127 
00128 } // namespace gui
00129 } // namespace regcom
00130 
00131 #endif