Go to the documentation of this file.00001
00002 #include <uxtheme.h>
00003 #include <dwmapi.h>
00004 #include <gdiplus.h>
00005 #pragma comment(lib, "User32.lib")
00006 #pragma comment(lib, "dwmapi.lib")
00007 #pragma comment(lib, "gdiplus.lib")
00008
00009 #define NAMESPACE REALWINDOW
00010 #define NAMESPACE_START namespace REALWINDOW{
00011 #define NAMESPACE_END }
00012 #define LOG(text) if(logger) logger->print(TEXT(text))
00013 #define LOGLN(text) if(logger) logger->println(TEXT(text))
00014
00015 #include "MouseDevice.h"
00016 #include "KeyboardDevice.h"
00017 #include "InputWindow.h"
00018
00019 NAMESPACE_START
00020 class Window; typedef Window* pWindow;
00021 NAMESPACE_END
00022
00023 extern Log* logger;
00024 extern NAMESPACE::InputWindow inputWindow;
00025 extern ::ArrayList<NAMESPACE::pWindow> windowList;
00026
00027 NAMESPACE_START
00028
00029 struct WindowInfo {
00030 wchar* title;
00031 ::pIWindow parent;
00032 ::STATE state;
00033 ::STYLE style;
00034 ::pCursor cursor;
00035 };
00036
00038 class Window :
00039 public ::IWindow {
00040 public:
00041 Window();
00042 virtual ~Window();
00043
00044 bool init(int x, int y, int width, int height, const wchar* title,
00045 ::STATE state, ::STYLE style,
00046 ::pIWindow parent, float alpha);
00047 void uninit(void);
00048
00049 int fileDialog(wchar* out, uint outSize, const wchar* title, ::DIALOGFLAGS flags, const wchar* filter);
00050
00051 void* getWindow(void);
00052 void* getDisplay(void);
00053 ::pIWindow getParent(void);
00054
00055 void setSize(int x, int y, int width, int height);
00056 void setSize(::WindowSize);
00057 ::WindowSize getSize(void);
00058
00059 void setState(::STATE);
00060 ::STATE getState(void);
00061
00062 void setStyle(::STYLE);
00063 ::STYLE getStyle(void);
00064
00065 void setTitle(const wchar*);
00066 const wchar* getTitle(void);
00067
00068 const ::MouseMap& getMouseMap(void){return mouseMap;}
00069 const ::KeyboardMap& getKeyboardMap(void){return keyboardMap;}
00070
00071 bool activateInput(::DEVICE);
00072 void deactivateInput(::DEVICE);
00073 uint getDevices(::DeviceInfo* array, uint size);
00074 ::pDevice activateDevice(::DEVICE type, int ID);
00075 void deactivateDevice(::pDevice device);
00076
00077 ::pCursor createCursor(const wchar* file);
00078 void freeCursor(::pCursor&);
00079 void setCursor(::pCursor);
00080 ::pCursor getCursor(void);
00081 void showCursor(bool show);
00082 void setCursorPosition(int x, int y);
00083 void setCursorPosition(::CursorPosition);
00084 ::CursorPosition getCursorPosition(void);
00085
00086 void addListener(::pEventRenderListener);
00087 void addListener(::pEventWindowListener);
00088 void addListener(::pEventDeviceListener);
00089 void removeListener(::pEventRenderListener);
00090 void removeListener(::pEventWindowListener);
00091 void removeListener(::pEventDeviceListener);
00092
00093 ::pScreen createScreen(const wchar* imageFile, float alpha);
00094 void freeScreen(::pScreen& screen);
00095
00096 void loop(void);
00097
00098 void close(void);
00099
00100 private:
00101 static LRESULT CALLBACK MessageHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
00102
00103 bool init(const wchar* title, ::STATE state, ::STYLE style,
00104 ::IWindow* parent, const wchar* imageFile, float alpha);
00105
00106 int m_mouseX, m_mouseY;
00107 int m_wndX, m_wndY;
00108
00109 RECT m_rc;
00110 HWND m_hWnd;
00111 HANDLE m_image;
00112 bool m_loadScreenUsed;
00113 static wchar* windowClassName;
00114 static HINSTANCE m_hInstance;
00115 static Window* m_curWindow;
00116 static bool m_wndClassCreated;
00117
00118 WindowInfo info;
00119 ::ArrayList<::pEventRenderListener> renderListeners;
00120 ::ArrayList<::pEventWindowListener> windowListeners;
00121 ::ArrayList<::pEventDeviceListener> deviceListeners;
00122 bool initialized;
00123 };
00124
00125 NAMESPACE_END
00126
00127 #include "InputWindow.inl"