WindowImpl.hpp

00001 
00002 //
00003 // SFML - Simple and Fast Multimedia Library
00004 // Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
00005 //
00006 // This software is provided 'as-is', without any express or implied warranty.
00007 // In no event will the authors be held liable for any damages arising from the use of this software.
00008 //
00009 // Permission is granted to anyone to use this software for any purpose,
00010 // including commercial applications, and to alter it and redistribute it freely,
00011 // subject to the following restrictions:
00012 //
00013 // 1. The origin of this software must not be misrepresented;
00014 //    you must not claim that you wrote the original software.
00015 //    If you use this software in a product, an acknowledgment
00016 //    in the product documentation would be appreciated but is not required.
00017 //
00018 // 2. Altered source versions must be plainly marked as such,
00019 //    and must not be misrepresented as being the original software.
00020 //
00021 // 3. This notice may not be removed or altered from any source distribution.
00022 //
00024 
00025 #ifndef SFML_WINDOWIMPL_HPP
00026 #define SFML_WINDOWIMPL_HPP
00027 
00029 // Headers
00031 #include <SFML/Config.hpp>
00032 #include <SFML/System/NonCopyable.hpp>
00033 #include <SFML/Window/VideoMode.hpp>
00034 #include <SFML/Window/WindowHandle.hpp>
00035 #include <set>
00036 #include <string>
00037 
00038 class sfEvent;
00039 class sfWindowListener;
00040 
00041 
00042 namespace sf_private
00043 {
00047 class sfWindowImpl : sfNonCopyable
00048 {
00049 public :
00050 
00057     static sfWindowImpl* New();
00058 
00069     static sfWindowImpl* New(sfVideoMode Mode, const std::string& Title, bool Fullscreen);
00070 
00079     static sfWindowImpl* New(sfWindowHandle Handle);
00080 
00081 public :
00082 
00087     virtual ~sfWindowImpl();
00088 
00095     void AddListener(sfWindowListener* Listener);
00096 
00103     void RemoveListener(sfWindowListener* Listener);
00104 
00111     unsigned int GetWidth() const;
00112 
00119     unsigned int GetHeight() const;
00120 
00127     unsigned int GetDepthBits() const;
00128 
00135     unsigned int GetStencilBits() const;
00136 
00141     void SetCurrent() const;
00142 
00147     virtual void Display() = 0;
00148 
00153     virtual void ProcessEvents() = 0;
00154 
00161     virtual void UseVerticalSync(bool Enabled) = 0;
00162 
00169     virtual void ShowMouseCursor(bool Show) = 0;
00170 
00171 protected :
00172 
00177     sfWindowImpl();
00178 
00185     void SendEvent(const sfEvent& Event);
00186 
00188     // Member data
00190     unsigned int myWidth;       
00191     unsigned int myHeight;      
00192     unsigned int myDepthBits;   
00193     unsigned int myStencilBits; 
00194 
00195 private :
00196 
00201     virtual void MakeCurrent() const = 0;
00202 
00204     // Static member data
00206     static const sfWindowImpl* ourCurrent; 
00207 
00209     // Member data
00211     std::set<sfWindowListener*> myListeners; 
00212 };
00213 
00214 } // namespace sf_private
00215 
00216 #endif // SFML_WINDOWIMPL_HPP