SO3Engine
SO3FlashWidget.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_FLASH_WIDGET_H__
33#define __SO3_FLASH_WIDGET_H__
34
36#include "SO3Widget.h"
37
38namespace SO3
39{
40
41#define SO3_FLASH_WIDGET_TYPE "FlashWidget"
42
58
59#ifdef SO3_FLASH_ENABLE
60class SFlashWidget : public SWidget,
61 protected Hikari::IFlashControl // Set to protected to avoid all the IFlashControl members variables to be public
62{
63public:
64protected:
65private:
66 typedef HRESULT (__stdcall *GetClassObject)(REFCLSID rclsid, REFIID riid, LPVOID * ppv);
67 Hikari::HikariManager* mCreator;
68 FlashRenderQuality renderingQuality;
69 FlashScaleMode scaleMode;
70 int lastDirtyWidth;
71 int lastDirtyHeight;
72 ScolWindowHandle getTopWindow();
73public:
77 SFlashWidget(SScene* targetScene, const std::string& flashWidgetName, const int& xPos, const int& yPos, const unsigned short& widgetWidth, const unsigned short& widgetHeight, SViewPort* targetViewport, const unsigned int& widgetZOrder);
78
82 SFlashWidget(SScene* targetScene, const std::string& flashWidgetName, const int& xPos, const int& yPos, const unsigned short& widgetWidth, const unsigned short& widgetHeight, SViewPort* targetViewport);
83
87 SFlashWidget(SScene* targetScene, const std::string& flashWidgetName, const unsigned short& widgetWidth, const unsigned short& widgetHeight, SMaterial* targetMaterial, const unsigned short& targetTechnique, const unsigned short& targetPass, const unsigned short& targetTextureUnit);
88
92 void CommonConstructorSequence(const bool& overlayedFlashControl);
93
98
102 virtual void LoadURL(const std::string& url);
103
107 virtual void LoadFile(const std::string& file);
108
112 virtual void InjectMouseMove(const int& xPos, const int& yPos, const MouseButtonId& button);
113
117 virtual void InjectMouseWheel(const int& scrollX, const int& scrollY, const int& relativeScroll);
118
122 virtual void InjectMouseDown(const int& xPos, const int& yPos, const MouseButtonId& button);
123
127 virtual void InjectTouchAdd(const int& xPos, const int& yPos, const int& touchid);
128
132 virtual void InjectTouchRemove(const int& touchid);
133
137 virtual void InjectTouchUpdate(const int& xPos, const int& yPos, const int& vx, const int& vy, const int& touchid);
138
142 virtual void InjectMouseUp(const int& xPos, const int& yPos, const MouseButtonId& button);
143
147 virtual void InjectKeyEvent(const UINT& msg, const ScolWindowHandle& hwnd, const WPARAM& wParam, const LPARAM& lParam);
148
152 virtual void InjectTextEvent(const std::string& utf8);
153
158
162 void SetRenderingQuality(const FlashRenderQuality& newQuality);
163
167 void Play();
168
172 void Stop();
173
177 void Rewind();
178
182 void Seek(const long& seekFrame);
183
187 void SetScaleMode(const FlashScaleMode& widgetScaleMode);
188
193
197 virtual void RunScriptFunction(const std::string& functionName, const std::vector<std::string>& argumentList);
198protected:
202 virtual void SetFocusImpl(const bool& focusOnWidget);
203
207 virtual void SetTransparencyImpl(const bool& enableTransparency);
208
212 virtual void SetKeyboardEnableImpl(const bool& enableKeyboardOnWidget);
213
217 virtual void SetMouseEnableImpl(const bool& enableMouseOnWidget);
218
222 virtual void SetSizeImpl(const unsigned short& newWidth, const unsigned short& newHeight);
223
227 virtual bool CheckPixelAlpha(const int& posX, const int& posY);
228
232 virtual void setZOrder(unsigned short zorder);
233
237 virtual unsigned short getZOrder();
238
242 virtual int getRelativeX(int absX);
243
247 virtual int getRelativeY(int absY);
248
252 virtual bool isPointOverMe(int screenX, int screenY);
253
257 virtual void invalidateTotally();
258
262 virtual void handleFlashCall(const std::wstring& xmlString);
263
267 virtual void update();
268
272 virtual void load(const std::string& movieFilename, Hikari::HikariManager* hikariMgr, int type);
273
277 virtual void play();
278
282 virtual void stop();
283
287 virtual void rewind();
288
292 virtual void gotoFrame(long frameNum);
293
297 virtual void setLoop(bool shouldLoop);
298
302 virtual void setTransparent(bool isWidgetTransparent, bool useAlphaHack = false);
303
307 virtual void setQuality(short renderQuality);
308
312 virtual void setScaleMode(short widgetScaleMode);
313
317 virtual void setDraggable(bool widgetDraggable);
318
322 virtual void setIgnoreTransparentPixels(bool shouldIgnore, float threshold = 0.04);
323
327 virtual const std::string& getName() const;
328
332 virtual const std::string& getMaterialName() const;
333
337 virtual void bind(const std::wstring& funcName, const Hikari::FlashDelegate& callback);
338
342 virtual void unbind(const std::wstring& funcName);
343
347 virtual Hikari::FlashValue callFunction(const std::wstring& funcName, const Hikari::Arguments& args = Hikari::Args());
348
352 virtual void hide();
353
357 virtual void show();
358
362 virtual bool getVisibility() const;
363
367 virtual void setOpacity(float opacity);
368
372 virtual void focus();
373
377 virtual void move(int deltaX, int deltaY);
378
382 virtual void getExtents(unsigned short& width, unsigned short& height) const;
383
387 virtual void getUVScale(float& uScale, float& vScale) const;
388
392 virtual void injectMouseMove(int xPos, int yPos, int btn);
393
397 virtual void injectMouseDown(int xPos, int yPos, int index);
398
402 virtual void injectMouseUp(int xPos, int yPos, int index);
403
407 virtual void injectMouseWheel(int relScroll, int xPos, int yPos);
408
412 virtual void handleKeyEvent(UINT msg, WPARAM wParam, LPARAM lParam);
413private:
417 UINT MouseButtonMessageConverter(const int& button, const bool& pressed);
418};
419
420#endif
421}
422
423#endif
unsigned int UINT
Definition SO3Android.h:58
librairies include
virtual void InjectMouseWheel(const int &scrollX, const int &scrollY, const int &relativeScroll)
virtual void setZOrder(unsigned short zorder)
virtual void setIgnoreTransparentPixels(bool shouldIgnore, float threshold=0.04)
virtual void load(const std::string &movieFilename, Hikari::HikariManager *hikariMgr, int type)
virtual void LoadFile(const std::string &file)
virtual void focus()
void SetScaleMode(const FlashScaleMode &widgetScaleMode)
virtual void setLoop(bool shouldLoop)
virtual void injectMouseUp(int xPos, int yPos, int index)
virtual const std::string & getMaterialName() const
virtual void injectMouseWheel(int relScroll, int xPos, int yPos)
virtual void play()
FlashScaleMode GetScaleMode()
virtual void injectMouseDown(int xPos, int yPos, int index)
virtual bool getVisibility() const
virtual void InjectTouchAdd(const int &xPos, const int &yPos, const int &touchid)
virtual void setTransparent(bool isWidgetTransparent, bool useAlphaHack=false)
virtual void unbind(const std::wstring &funcName)
virtual bool CheckPixelAlpha(const int &posX, const int &posY)
virtual int getRelativeX(int absX)
virtual const std::string & getName() const
virtual void InjectTouchRemove(const int &touchid)
virtual void setQuality(short renderQuality)
virtual void setOpacity(float opacity)
virtual void InjectTextEvent(const std::string &utf8)
virtual void InjectTouchUpdate(const int &xPos, const int &yPos, const int &vx, const int &vy, const int &touchid)
virtual int getRelativeY(int absY)
virtual bool isPointOverMe(int screenX, int screenY)
FlashRenderQuality GetRenderingQuality()
virtual void LoadURL(const std::string &url)
virtual void SetSizeImpl(const unsigned short &newWidth, const unsigned short &newHeight)
virtual void setScaleMode(short widgetScaleMode)
virtual void InjectMouseMove(const int &xPos, const int &yPos, const MouseButtonId &button)
virtual void show()
virtual void InjectKeyEvent(const UINT &msg, const ScolWindowHandle &hwnd, const WPARAM &wParam, const LPARAM &lParam)
void SetRenderingQuality(const FlashRenderQuality &newQuality)
virtual Hikari::FlashValue callFunction(const std::wstring &funcName, const Hikari::Arguments &args=Hikari::Args())
virtual void InjectMouseUp(const int &xPos, const int &yPos, const MouseButtonId &button)
virtual void handleFlashCall(const std::wstring &xmlString)
virtual void update()
virtual void InjectMouseDown(const int &xPos, const int &yPos, const MouseButtonId &button)
void CommonConstructorSequence(const bool &overlayedFlashControl)
virtual void bind(const std::wstring &funcName, const Hikari::FlashDelegate &callback)
virtual void SetMouseEnableImpl(const bool &enableMouseOnWidget)
void Seek(const long &seekFrame)
virtual void rewind()
virtual void handleKeyEvent(UINT msg, WPARAM wParam, LPARAM lParam)
virtual unsigned short getZOrder()
virtual void getUVScale(float &uScale, float &vScale) const
virtual void invalidateTotally()
virtual void move(int deltaX, int deltaY)
virtual void SetTransparencyImpl(const bool &enableTransparency)
virtual void getExtents(unsigned short &width, unsigned short &height) const
virtual void hide()
virtual void SetFocusImpl(const bool &focusOnWidget)
virtual void setDraggable(bool widgetDraggable)
virtual void stop()
virtual void injectMouseMove(int xPos, int yPos, int btn)
virtual void RunScriptFunction(const std::string &functionName, const std::vector< std::string > &argumentList)
virtual void SetKeyboardEnableImpl(const bool &enableKeyboardOnWidget)
virtual void gotoFrame(long frameNum)
_HikariExport std::vector< FlashValue > Arguments
Definition FlashValue.h:188
@ SO3_FLASH_SCALE_EXACTFIT
@ SO3_FLASH_SCALE_NOBORDER
@ SO3_FLASH_SCALE_SHOWALL
FlashRenderQuality
@ SO3_FLASH_QUALITY_LOW
@ SO3_FLASH_QUALITY_AUTOHIGH
@ SO3_FLASH_QUALITY_MEDIUM
@ SO3_FLASH_QUALITY_BEST
@ SO3_FLASH_QUALITY_HIGH
@ SO3_FLASH_QUALITY_AUTOLOW