SO3Engine
SO3ObjWindowWidget.h
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OpenSpace3D
4For the latest info, see http://www.openspace3d.com
5
6Copyright (c) 2012 I-maginer
7
8This program is free software; you can redistribute it and/or modify it under
9the terms of the GNU Lesser General Public License as published by the Free Software
10Foundation; either version 2 of the License, or (at your option) any later
11version.
12
13This program is distributed in the hope that it will be useful, but WITHOUT
14ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16
17You should have received a copy of the GNU Lesser General Public License along with
18this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20http://www.gnu.org/copyleft/lesser.txt
21
22-----------------------------------------------------------------------------
23*/
24
32#ifndef __SO3_OBJ_WIN_WIDGET_H__
33#define __SO3_OBJ_WIN_WIDGET_H__
34
36#include "SO3Widget.h"
37
38namespace SO3
39{
40
41#define SO3_OBJ_WINDOW_WIDGET_TYPE "ObjWindowWidget"
42
43#ifdef _WIN32
45{
46public:
47protected:
48private:
49 ScolWindowHandle targetWindowHandle;
50 long lastWindowWithBordersWidth;
51 long lastWindowWithBordersHeight;
52 HBITMAP memoryBitmap;
53 void* pixelsData;
54 HDC targetWindowDC;
55 HDC memoryBitmapDC;
56 bool drawBorders;
57
58public:
62 SObjWindowWidget(SScene* targetScene, const std::string& bitmapWidgetName, const int& xPos, const int& yPos, const unsigned short& widgetWidth, const unsigned short& widgetHeight, SViewPort* targetViewport, const unsigned int& widgetZOrder);
63
67 SObjWindowWidget(SScene* targetScene, const std::string& bitmapWidgetName, const int& xPos, const int& yPos, const unsigned short& widgetWidth, const unsigned short& widgetHeight, SViewPort* targetViewport);
68
72 SObjWindowWidget(SScene* targetScene, const std::string& bitmapWidgetName, const unsigned short& widgetWidth, const unsigned short& widgetHeight, SMaterial* targetMaterial, const unsigned short& targetTechnique, const unsigned short& targetPass, const unsigned short& targetTextureUnit);
73
78
83
87 virtual void LoadURL(const std::string& url);
88
92 virtual void LoadFile(const std::string& file);
93
97 virtual void InjectMouseMove(const int& xPos, const int& yPos, const MouseButtonId& button);
98
102 virtual void InjectMouseWheel(const int& scrollX, const int& scrollY, const int& relativeScroll);
103
107 virtual void InjectMouseDown(const int& xPos, const int& yPos, const MouseButtonId& button);
108
112 virtual void InjectMouseUp(const int& xPos, const int& yPos, const MouseButtonId& button);
113
117 virtual void InjectTouchAdd(const int& xPos, const int& yPos, const int& touchid);
118
122 virtual void InjectTouchRemove(const int& touchid);
123
127 virtual void InjectTouchUpdate(const int& xPos, const int& yPos, const int& vx, const int& vy, const int& touchid);
128
132 virtual void InjectKeyEvent(const UINT& msg, const ScolWindowHandle& hwnd, const WPARAM& wParam, const LPARAM& lParam);
133
137 virtual void InjectTextEvent(const std::string& utf8);
138
142 virtual void RunScriptFunction(const std::string& functionName, const std::vector<std::string>& argumentList);
143
147 void SetTargetWindow(const ScolWindowHandle& targetWindowHandlePtr);
148
151 void Update();
152
156 bool GetBorderVisible();
157
161 void SetBorderVisible(const bool& drawBordersEnable);
162protected:
166 virtual void SetFocusImpl(const bool& focusOnWidget);
167
171 virtual void SetTransparencyImpl(const bool& enableTransparency);
172
176 virtual void SetKeyboardEnableImpl(const bool& enableKeyboardOnWidget);
177
181 virtual void SetMouseEnableImpl(const bool& enableMouseOnWidget);
182
186 virtual void SetSizeImpl(const unsigned short& newWidth, const unsigned short& newHeight);
187
191 virtual bool CheckPixelAlpha(const int& posX, const int& posY);
192private:
195 void InjectMouseMessage(const int& xPos, const int& yPos, const unsigned int& message, const WPARAM& wParam = 0);
196
199 void CreateDevicesContexts();
200
203 void DestroyDevicesContexts();
204
207 void CreateMemoryBitmap(const long& targetWindowWidth, const long& targetWindowHeight);
208
211 void DestroyMemoryBitmap();
212
215 bool CheckWindowIsStillValid();
216
219 bool GetMinimizeMaximizeAnimation();
220
223 void SetMinimizeMaximizeAnimation(const bool& status);
224};
225
226#endif //_WIN32
227}
228
229#endif
unsigned int UINT
Definition SO3Android.h:58
librairies include
virtual void SetSizeImpl(const unsigned short &newWidth, const unsigned short &newHeight)
virtual void InjectTouchUpdate(const int &xPos, const int &yPos, const int &vx, const int &vy, const int &touchid)
virtual void InjectMouseWheel(const int &scrollX, const int &scrollY, const int &relativeScroll)
virtual void InjectTextEvent(const std::string &utf8)
virtual void SetFocusImpl(const bool &focusOnWidget)
virtual bool CheckPixelAlpha(const int &posX, const int &posY)
virtual void SetKeyboardEnableImpl(const bool &enableKeyboardOnWidget)
virtual void InjectMouseUp(const int &xPos, const int &yPos, const MouseButtonId &button)
void SetBorderVisible(const bool &drawBordersEnable)
virtual void InjectKeyEvent(const UINT &msg, const ScolWindowHandle &hwnd, const WPARAM &wParam, const LPARAM &lParam)
virtual void InjectTouchRemove(const int &touchid)
virtual void InjectMouseMove(const int &xPos, const int &yPos, const MouseButtonId &button)
virtual void SetMouseEnableImpl(const bool &enableMouseOnWidget)
virtual void SetTransparencyImpl(const bool &enableTransparency)
virtual void InjectTouchAdd(const int &xPos, const int &yPos, const int &touchid)
void SetTargetWindow(const ScolWindowHandle &targetWindowHandlePtr)
virtual void RunScriptFunction(const std::string &functionName, const std::vector< std::string > &argumentList)
virtual void LoadURL(const std::string &url)
virtual void InjectMouseDown(const int &xPos, const int &yPos, const MouseButtonId &button)
virtual void LoadFile(const std::string &file)