00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00035 #ifndef __SO3_FLASH_WIDGET_H__
00036 #define __SO3_FLASH_WIDGET_H__
00037
00038 #include "..\SCOLBasic\SO3Std.h"
00039 #include "SO3Widget.h"
00040 #include "Hikari.h"
00041 #include "IFlashControl.h"
00042
00043 namespace SO3
00044 {
00045
00046 #define SO3_FLASH_WIDGET_TYPE "FlashWidget"
00047
00048 class SFlashWidget : public SWidget,
00049 protected Hikari::IFlashControl
00050 {
00051 public:
00052 enum FlashRenderQuality
00053 {
00054 SO3_FLASH_QUALITY_LOW,
00055 SO3_FLASH_QUALITY_MEDIUM,
00056 SO3_FLASH_QUALITY_HIGH,
00057 SO3_FLASH_QUALITY_BEST,
00058 SO3_FLASH_QUALITY_AUTOLOW,
00059 SO3_FLASH_QUALITY_AUTOHIGH
00060 };
00061 enum FlashScaleMode
00062 {
00063 SO3_FLASH_SCALE_SHOWALL = 0,
00064 SO3_FLASH_SCALE_NOBORDER,
00065 SO3_FLASH_SCALE_EXACTFIT
00066 };
00067 protected:
00068 private:
00069 typedef HRESULT (__stdcall *GetClassObject)(REFCLSID rclsid, REFIID riid, LPVOID * ppv);
00070 Hikari::HikariManager* mCreator;
00071 FlashRenderQuality renderingQuality;
00072 FlashScaleMode scaleMode;
00073 int lastDirtyWidth;
00074 int lastDirtyHeight;
00075 WindowHandle getTopWindow();
00076 public:
00080 SFlashWidget(SScene* targetScene, std::string flashWidgetName, int xPos, int yPos, unsigned short widgetWidth, unsigned short widgetHeight, SViewPort* targetViewport, unsigned int widgetZOrder);
00081
00085 SFlashWidget(SScene* targetScene, std::string flashWidgetName, int xPos, int yPos, unsigned short widgetWidth, unsigned short widgetHeight, SViewPort* targetViewport);
00086
00090 SFlashWidget(SScene* targetScene, std::string flashWidgetName, unsigned short widgetWidth, unsigned short widgetHeight, SMaterial* targetMaterial, unsigned short targetTechnique, unsigned short targetPass, unsigned short targetTextureUnit);
00091
00095 void CommonConstructorSequence(bool overlayedFlashControl);
00096
00100 ~SFlashWidget();
00101
00105 virtual void LoadURL(const std::string& url);
00106
00110 virtual void LoadFile(const std::string& file);
00111
00115 virtual void InjectMouseMove(int xPos, int yPos, MouseButtonId button);
00116
00120 virtual void InjectMouseWheel(int scrollX, int scrollY, int relativeScroll);
00121
00125 virtual void InjectMouseDown(int xPos, int yPos, MouseButtonId button);
00126
00130 virtual void InjectMouseUp(int xPos, int yPos, MouseButtonId button);
00131
00135 virtual void InjectKeyEvent(UINT msg, WindowHandle hwnd, WPARAM wParam, LPARAM lParam);
00136
00140 virtual void InjectTextEvent(std::string utf8);
00141
00145 FlashRenderQuality GetRenderingQuality();
00146
00150 void SetRenderingQuality(FlashRenderQuality newQuality);
00151
00155 void Play();
00156
00160 void Stop();
00161
00165 void Rewind();
00166
00170 void Seek(long seekFrame);
00171
00175 void SetScaleMode(FlashScaleMode widgetScaleMode);
00176
00180 FlashScaleMode GetScaleMode();
00181
00185 virtual void RunScriptFunction(std::string functionName, std::vector<std::string> argumentList);
00186 protected:
00190 virtual void SetFocusImpl(bool focusOnWidget);
00191
00195 virtual void SetTransparencyImpl(bool enableTransparency);
00196
00200 virtual void SetKeyboardEnableImpl(bool enableKeyboardOnWidget);
00201
00205 virtual void SetMouseEnableImpl(bool enableMouseOnWidget);
00206
00210 virtual void SetSizeImpl(unsigned short newWidth, unsigned short newHeight);
00211
00215 virtual int GetPixelUnder(int posX, int posY);
00216
00220 virtual void setZOrder(unsigned short zorder);
00221
00225 virtual unsigned short getZOrder();
00226
00230 virtual int getRelativeX(int absX);
00231
00235 virtual int getRelativeY(int absY);
00236
00240 virtual bool isPointOverMe(int screenX, int screenY);
00241
00245 virtual void invalidateTotally();
00246
00250 virtual void handleFlashCall(const std::wstring& xmlString);
00251
00255 virtual void update();
00256
00260 virtual void load(const std::string& movieFilename, Hikari::HikariManager* hikariMgr, int type);
00261
00265 virtual void play();
00266
00270 virtual void stop();
00271
00275 virtual void rewind();
00276
00280 virtual void gotoFrame(long frameNum);
00281
00285 virtual void setLoop(bool shouldLoop);
00286
00290 virtual void setTransparent(bool isWidgetTransparent, bool useAlphaHack = false);
00291
00295 virtual void setQuality(short renderQuality);
00296
00300 virtual void setScaleMode(short widgetScaleMode);
00301
00305 virtual void setDraggable(bool widgetDraggable);
00306
00310 virtual void setIgnoreTransparentPixels(bool shouldIgnore, float threshold = 0.04);
00311
00315 virtual const std::string& getName() const;
00316
00320 virtual const std::string& getMaterialName() const;
00321
00325 virtual void bind(const std::wstring& funcName, const Hikari::FlashDelegate& callback);
00326
00330 virtual void unbind(const std::wstring& funcName);
00331
00335 virtual Hikari::FlashValue callFunction(const std::wstring& funcName, const Hikari::Arguments& args = Hikari::Args());
00336
00340 virtual void hide();
00341
00345 virtual void show();
00346
00350 virtual bool getVisibility() const;
00351
00355 virtual void setOpacity(float opacity);
00356
00360 virtual void focus();
00361
00365 virtual void move(int deltaX, int deltaY);
00366
00370 virtual void getExtents(unsigned short& width, unsigned short& height) const;
00371
00375 virtual void getUVScale(float& uScale, float& vScale) const;
00376
00380 virtual void injectMouseMove(int xPos, int yPos, int btn);
00381
00385 virtual void injectMouseDown(int xPos, int yPos, int index);
00386
00390 virtual void injectMouseUp(int xPos, int yPos, int index);
00391
00395 virtual void injectMouseWheel(int relScroll, int xPos, int yPos);
00396
00400 virtual void handleKeyEvent(UINT msg, WPARAM wParam, LPARAM lParam);
00401 private:
00405 UINT MouseButtonMessageConverter(const int button, bool pressed);
00406 };
00407
00408 }
00409
00410 #endif