Back to index

libsfml  1.6+dfsg2
WindowImplCocoa.hpp
Go to the documentation of this file.
00001 
00002 //
00003 // SFML - Simple and Fast Multimedia Library
00004 // Copyright (C) 2007-2009 Lucas Soltic (ceylow@gmail.com) and 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_WINDOWIMPLCOCOA_HPP
00026 #define SFML_WINDOWIMPLCOCOA_HPP
00027 
00029 // Headers
00031 #include <SFML/Window/Event.hpp>
00032 #include <SFML/Window/WindowImpl.hpp>
00033 #include <string>
00034 
00035 #ifdef __OBJC__
00036 @class sfPrivWindow;
00037 typedef sfPrivWindow* sfPrivWindowRef;
00038 #else
00039 typedef void* sfPrivWindowRef;
00040 #endif
00041 
00042 namespace sf
00043 {
00044 namespace priv
00045 {
00046 
00050 class WindowImplCocoa : public WindowImpl
00051 {
00052 public :
00053 
00059     WindowImplCocoa();
00060 
00069     WindowImplCocoa(WindowHandle Handle, WindowSettings& params);
00070 
00080     WindowImplCocoa(VideoMode Mode, const std::string& Title, unsigned long WindowStyle, WindowSettings& params);
00081 
00086     ~WindowImplCocoa();
00087 
00094     static bool IsContextActive();
00095        
00099        void HandleNotifiedEvent(Event& eventRef);
00100        
00105        void HandleKeyDown(void *eventRef);
00106        void HandleKeyUp(void *eventRef);
00107        void HandleModifierKey(void *eventRef);
00108        void HandleMouseDown(void *eventRef);
00109        void HandleMouseUp(void *eventRef);
00110        void HandleMouseMove(void *eventRef);
00111        void HandleMouseWheel(void *eventRef);
00112        
00116        static bool IsTextEvent(void *event);
00117 private :
00118 
00123     virtual void Display();
00124 
00129     virtual void ProcessEvents();
00130        
00135     virtual void SetActive(bool Active = true) const;
00136 
00141     virtual void UseVerticalSync(bool Enabled);
00142 
00147     virtual void ShowMouseCursor(bool Show);
00148 
00153     virtual void SetCursorPosition(unsigned int Left, unsigned int Top);
00154 
00159     virtual void SetPosition(int Left, int Top);
00160        
00165     virtual void SetSize(unsigned int Width, unsigned int Height);
00166        
00171     virtual void Show(bool State);
00172        
00177     virtual void EnableKeyRepeat(bool Enabled);
00178        
00183     virtual void SetIcon(unsigned int Width, unsigned int Height, const Uint8* Pixels);
00184        
00185        
00186        
00190        
00191        
00193     // Member data
00195        sfPrivWindowRef myWrapper;  
00196        bool myUseKeyRepeat;
00197        bool myMouseIn;
00198        float myWheelStatus;
00199 };
00200 
00201 } // namespace priv
00202 
00203 } // namespace sf
00204 
00205 #endif // SFML_WINDOWIMPLCOCOA_HPP