Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cOleFlash.h
Go to the documentation of this file.
1 //
4 //
5 #ifndef _INC_cOleFlash_H
6 #define _INC_cOleFlash_H
7 #ifndef NO_PRAGMA_ONCE
8 #pragma once
9 #endif
10 #include "cOleControl.h"
11 #include "cOleFlashCall.h"
12 
13 #if defined(_WIN32) && defined(_MSC_VER) && defined(USE_FLASH)
14 
15 namespace ShockwaveFlashObjects
16 {
17  struct IShockwaveFlash;
18 }
19 
20 namespace GrayLib
21 {
22  UNITTEST2_PREDEF(cOleFlash);
23 
24  struct IOleFlashListener
25  {
30 
31  virtual void onFlashCall(INT_PTR nChildId, cOleFlashCall* pFC)
32  {
33  // NOTE: we have no control over what thread this is called from.
34  UNREFERENCED_PARAMETER(nChildId);
36  }
37  virtual void OnProgress(long nPercentDone)
38  {
39  UNREFERENCED_PARAMETER(nPercentDone);
40  }
41  virtual void OnReadyStateChange(long newState) // dispIdMember = 0xfffffd9f = DISPID_READYSTATECHANGE
42  {
43  UNREFERENCED_PARAMETER(newState);
44  }
45  };
46 
47  class GRAYLIB_LINK cOleFlash
48  : public cOleControl
49  {
54 
55  friend class cOleFlashHelper;
56  typedef cOleControl SUPER_t;
57 
58  public:
59  enum QUALITY_TYPE
60  {
61  QUALITY_LOW,
62  QUALITY_HIGH,
63  QUALITY_AUTOLOW,
64  QUALITY_AUTOHIGH,
65  QUALITY_QTY
66  };
67 
68  enum SCALEMODE_TYPE
69  {
70  SCALEMODE_showAll, // 0 (http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_12059)
71  SCALEMODE_noBorder,
72  SCALEMODE_exactFit,
73  SCALEMODE_noScale, // undocumented?
74  SCALEMODE_QTY
75  };
76 
77  private:
78  tagREADYSTATE m_eReadyState;
79  int m_iLoadingPercent;
80  bool m_bPlaying;
81 
82  IOleFlashListener* m_pFlashListener;
83  cIUnkPtr<ShockwaveFlashObjects::IShockwaveFlash> m_pFlashInterface;
84  cRefPtr<cOleFlashHelper> m_pFlashHelper;
85 
86  public:
87  cOleFlash(INT_PTR nChildId, IOleFlashListener* pFlashListener, cOleWebBrowserRedir* pBrowserRedir);
88  virtual ~cOleFlash();
89 
90  virtual bool isDisposed() const override
91  {
92  return m_pFlashListener == nullptr;
93  }
94  virtual void DisposeThis() override;
95 
96  virtual tagREADYSTATE get_ReadyState() const override
97  {
98  return m_eReadyState;
99  }
100 
101  HRESULT DisableLocalSecurity();
102  static HRESULT GRAYCALL DisableLocalDialog();
103 
104  virtual HRESULT InitOleControl(OLE_WINDOW_TYPE eDesireWindowType, bool bDesireTransparent) override;
105  virtual HRESULT LoadOleContent(const FILECHAR_t* pszFullPath) override;
106 
107  HRESULT Pause();
108  HRESULT Play();
109  HRESULT Rewind();
110  HRESULT Back();
111  HRESULT Forward();
112 
113  bool isLoaded() const;
114  cStringA get_Movie() const;
115 
116  HRESULT get_CurrentFrame() const;
117  HRESULT put_CurrentFrame(int theFrameNum);
118  HRESULT get_TotalFrames() const;
119 
120  cStringA GetCurrentLabel(const char* theTimeline) const;
121  HRESULT CallLabel(const char* theTimeline, const char* theLabel);
122  HRESULT CallFrame(const char* theTimeline, int theFrameNum);
123 
124  HRESULT CallFunction(const char* pszRequest, cStringA* psResp = nullptr);
125 
126  cStringA GetVariable(const char* theName) const;
127  HRESULT SetVariable(const char* theName, const char* theValue);
128 
129  HRESULT put_Quality(QUALITY_TYPE eQuality);
130  HRESULT put_BackgroundColor(COLORREF color);
131  HRESULT put_ScaleMode(SCALEMODE_TYPE eScaleMode);
132  HRESULT put_Transparent(bool bTransparent);
133 
134  HRESULT SetReturnValue(const OLECHAR* pszStr);
135  HRESULT SetReturnValue(const char* pszStr);
136 
137  HRESULT get_OriginalWidth() const;
138  HRESULT get_OriginalHeight() const;
139 
140  virtual LRESULT OnWindowMessage1(MSG& msg) override;
141 
142 #ifdef USE_DX9
143  virtual HRESULT DrawControl(IDirect3DSurface9* pSurface) override;
144 #endif
145 
146  virtual void OnMouseMove(MBUTTON_TYPE button, const POINT& pt) override;
147 
148  UNITTEST2_PREDEF(cOleFlash);
149  };
150 
151  typedef cRefPtr<cOleFlash> cOleFlashPtr;
152 }
153 
154 #endif
155 #endif
interface IShockwaveFlash IShockwaveFlash
Definition: Flash_h.h:45
#define GRAYCALL
declare calling convention for static functions so everyone knows the arg passing scheme....
Definition: GrayCore.h:36
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
#define UNREFERENCED_PARAMETER(P)
< _WIN32 type thing. get rid of stupid warning.
Definition: SysTypes.h:299
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
UINT32 COLORREF
ABGR (high to low bits)
Definition: cVariantData.h:21
Definition: cMesh.h:22
UNITTEST2_PREDEF(cQuadtree)
MBUTTON_TYPE
Definition: cInputBase.h:40
char FILECHAR_t
a UTF8 char in a file name. like TCHAR
Definition: FileName.h:22
cStringT< char > cStringA
Definition: cString.h:635
Definition: Flash.IDL:16