Subversion Repositories AndroidProjects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
244 chris 1
#ifndef __FLASHWIDGET_H__
2
#define __FLASHWIDGET_H__
3
 
4
#include "Common.h"
5
#include "Widget.h"
6
 
7
struct IOleObject;
8
struct IOleInPlaceObjectWindowless;
9
 
10
namespace ShockwaveFlashObjects
11
{
12
        struct IShockwaveFlash;
13
}
14
 
15
namespace Sexy
16
{
17
 
18
class Image;
19
class FlashSink;
20
class MemoryImage;
21
class DDImage;
22
class ControlSite;
23
 
24
class FlashListener
25
{
26
public:
27
        virtual void                    FlashAnimEnded(int theId) {}
28
        virtual void                    FlashCommand(int theId, const std::string& theCommand, const std::string& theParam) {}
29
};
30
 
31
class FlashWidget : public Widget
32
{
33
public:
34
        enum
35
        {
36
                STATE_IDLE,
37
                STATE_PLAYING,
38
                STATE_STOPPED
39
        };
40
 
41
        enum
42
        {
43
                QUALITY_LOW,
44
                QUALITY_MEDIUM,
45
                QUALITY_HIGH
46
        };
47
 
48
public:
49
        int                                             mState;
50
        int                                             mId;
51
        FlashListener*                  mFlashListener;
52
        HMODULE                                 mFlashLibHandle;               
53
 
54
        ControlSite*                    mControlSite;
55
        FlashSink*                              mFlashSink;
56
        ShockwaveFlashObjects::IShockwaveFlash* mFlashInterface;
57
        IOleObject*                             mOleObject;
58
        IOleInPlaceObjectWindowless* mWindowlessObject;
59
 
60
        int                                             mCOMCount;
61
        DDImage*                                mImage;
62
        int                                             mPauseCount;
63
        bool                                    mHasLostFocus;
64
 
65
        Rect                                    mDirtyRect;
66
        bool                                    mFlashDirty;
67
 
68
        int                                             mCurCursor;
69
        HCURSOR                                 mCurOverrideCursor;
70
 
71
        bool                                    mAutoPause;
72
        Image*                                  mBkgImage;
73
        Rect                                    mBkgImageSrcRect;
74
        Color                                   mBkgColor;                             
75
 
76
public:
77
        void                                    CleanupImages();
78
        void                                    RebuildImages();
79
        void                                    CheckCursor();
80
 
81
protected:
82
        virtual void                    DrawFlashBackground(Graphics* g);
83
 
84
public:
85
        FlashWidget(int theId, FlashListener* theFlashListener);
86
        ~FlashWidget();
87
 
88
        static double                   GetFlashVersion();
89
 
90
        bool                                    StartAnimation(const std::string& theFileName);
91
        void                                    SetQuality(int theQuality);
92
        void                                    Pause();
93
        void                                    Unpause();
94
        bool                                    IsPlaying();   
95
        void                                    Rewind();
96
        void                                    Back();
97
        void                                    Forward();     
98
        void                                    GotoFrame(int theFrameNum);
99
        int                                             GetCurrentFrame();
100
        std::string                             GetCurrentLabel(const std::string& theTimeline);
101
        void                                    CallFrame(const std::string& theTimeline, int theFrameNum);
102
        void                                    CallLabel(const std::string& theTimeline, const std::string& theLabel);
103
        std::string                             GetVariable(const std::string& theName);
104
        void                                    SetVariable(const std::string& theName, const std::string& theValue);
105
 
106
        virtual void                    Resize(int theX, int theY, int theWidth, int theHeight);
107
 
108
        virtual void                    Update();
109
        virtual void                    Draw(Graphics* g);
110
 
111
        virtual void                    MouseDown(int x, int y, int theBtnNum, int theClickCount);             
112
        virtual void                    MouseUp(int x, int y, int theBtnNum, int theClickCount);
113
        virtual void                    MouseMove(int x, int y);
114
        virtual void                    MouseDrag(int x, int y);
115
 
116
        virtual void                    MouseLeave();
117
 
118
        virtual void                    SysColorChanged();
119
};
120
 
121
}
122
 
123
#endif //__FLASHWIDGET_H__