]> git.sesse.net Git - vlc/blob - activex/plugin.h
- miscelleanous fixes and improvements
[vlc] / activex / plugin.h
1 /*****************************************************************************\r
2  * plugin.h: ActiveX control for VLC\r
3  *****************************************************************************\r
4  * Copyright (C) 2005 VideoLAN\r
5  *\r
6  * Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>\r
7  *\r
8  * This program is free software; you can redistribute it and/or modify\r
9  * it under the terms of the GNU General Public License as published by\r
10  * the Free Software Foundation; either version 2 of the License, or\r
11  * (at your option) any later version.\r
12  *\r
13  * This program is distributed in the hope that it will be useful,\r
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
16  * GNU General Public License for more details.\r
17  *\r
18  * You should have received a copy of the GNU General Public License\r
19  * along with this program; if not, write to the Free Software\r
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.\r
21  *****************************************************************************/\r
22 \r
23 #ifndef __PLUGIN_H__\r
24 #define __PLUGIN_H__\r
25 \r
26 #include <ole2.h>\r
27 #include <olectl.h>\r
28 \r
29 #include <vlc/vlc.h>\r
30 \r
31 extern const GUID CLSID_VLCPlugin; \r
32 extern const GUID LIBID_AXVLC; \r
33 extern const GUID DIID_DVLCEvents; \r
34 \r
35 class VLCPluginClass : public IClassFactory\r
36 {\r
37 \r
38 public:\r
39 \r
40     VLCPluginClass(LONG *p_class_ref,HINSTANCE hInstance);\r
41 \r
42     /* IUnknown methods */\r
43     STDMETHODIMP QueryInterface(REFIID riid, void **ppv);\r
44     STDMETHODIMP_(ULONG) AddRef(void);\r
45     STDMETHODIMP_(ULONG) Release(void);\r
46 \r
47     /* IClassFactory methods */\r
48     STDMETHODIMP CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppv);\r
49     STDMETHODIMP LockServer(BOOL fLock);\r
50 \r
51     LPCSTR getInPlaceWndClassName(void) const { return TEXT("VLC Plugin In-Place"); };\r
52     LPCSTR getVideoWndClassName(void) const { return TEXT("VLC Plugin Video"); };\r
53     HINSTANCE getHInstance(void) const { return _hinstance; };\r
54     HBITMAP getInPlacePict(void) const { return _inplace_hbitmap; };\r
55 \r
56 protected:\r
57 \r
58     virtual ~VLCPluginClass();\r
59 \r
60 private:\r
61 \r
62     LPLONG      _p_class_ref;\r
63     HINSTANCE   _hinstance;\r
64     ATOM        _inplace_wndclass_atom;\r
65     ATOM        _video_wndclass_atom;\r
66     HBITMAP     _inplace_hbitmap;\r
67 };\r
68 \r
69 class VLCPlugin : public IUnknown\r
70 {\r
71 \r
72 public:\r
73 \r
74     VLCPlugin(VLCPluginClass *p_class);\r
75 \r
76     /* IUnknown methods */\r
77     STDMETHODIMP QueryInterface(REFIID riid, void **ppv);\r
78     STDMETHODIMP_(ULONG) AddRef(void);\r
79     STDMETHODIMP_(ULONG) Release(void);\r
80 \r
81     /* custom methods */\r
82     HRESULT getTypeLib(LCID lcid, ITypeLib **pTL)\r
83         { return LoadRegTypeLib(LIBID_AXVLC, 1, 0, lcid, pTL); };\r
84     REFCLSID getClassID(void) { return (REFCLSID)CLSID_VLCPlugin; };\r
85     REFIID getDispEventID(void) { return (REFIID)DIID_DVLCEvents; };\r
86 \r
87     HRESULT onInitNew(void);\r
88     HRESULT onClose(DWORD dwSaveOption);\r
89 \r
90     BOOL isInPlaceActive(void);\r
91     HRESULT onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprcPosRect, LPCRECT lprcClipRect);\r
92     HRESULT onInPlaceDeactivate(void);\r
93     HWND getInPlaceWindow(void) const { return _inplacewnd; };\r
94 \r
95     BOOL hasFocus(void);\r
96     void setFocus(BOOL fFocus);\r
97 \r
98     UINT getCodePage(void) { return _codepage; };\r
99     void setCodePage(UINT cp) { _codepage = cp; };\r
100 \r
101     int  getVLCObject(void) { return _i_vlc; };\r
102 \r
103     // control properties\r
104     void setSourceURL(const char *url) { _psz_src = strdup(url); };\r
105     void setAutoStart(BOOL autostart) { _b_autostart = autostart; };\r
106     void setLoopMode(BOOL loopmode) { _b_loopmode = loopmode; };\r
107     void setMute(BOOL mute) {\r
108         if( mute && _i_vlc )\r
109         {\r
110             VLC_VolumeMute(_i_vlc);\r
111         }\r
112     };\r
113     void setSendEvents(BOOL sendevents) { _b_sendevents = sendevents; };\r
114     void setVisible(BOOL fVisible);\r
115     BOOL getVisible(void) { return _b_visible; };\r
116 \r
117     // container events\r
118     void onPositionChange(LPCRECT lprcPosRect, LPCRECT lprcClipRect);\r
119     void onPaint(PAINTSTRUCT &ps, RECT &pr);\r
120 \r
121     // control events\r
122     void firePropChangedEvent(DISPID dispid);\r
123     void fireOnPlayEvent(void);\r
124     void fireOnPauseEvent(void);\r
125     void fireOnStopEvent(void);\r
126 \r
127 protected:\r
128 \r
129     virtual ~VLCPlugin();\r
130 \r
131 private:\r
132 \r
133     void calcPositionChange(LPRECT lprPosRect, LPCRECT lprcClipRect);\r
134 \r
135     //implemented interfaces\r
136     class VLCOleObject *vlcOleObject;\r
137     class VLCOleControl *vlcOleControl;\r
138     class VLCOleInPlaceObject *vlcOleInPlaceObject;\r
139     class VLCOleInPlaceActiveObject *vlcOleInPlaceActiveObject;\r
140     class VLCPersistStreamInit *vlcPersistStreamInit;\r
141     class VLCPersistStorage *vlcPersistStorage;\r
142     class VLCPersistPropertyBag *vlcPersistPropertyBag;\r
143     class VLCProvideClassInfo *vlcProvideClassInfo;\r
144     class VLCConnectionPointContainer *vlcConnectionPointContainer;\r
145     class VLCObjectSafety *vlcObjectSafety;\r
146     class VLCControl *vlcControl;\r
147 \r
148     // in place activated window (Clipping window)\r
149     HWND _inplacewnd;\r
150     // video window (Drawing window)\r
151     HWND _videownd;\r
152     RECT _bounds;\r
153 \r
154     VLCPluginClass *_p_class;\r
155     ULONG _i_ref;\r
156 \r
157     UINT _codepage;\r
158     char *_psz_src;\r
159     BOOL _b_autostart;\r
160     BOOL _b_loopmode;\r
161     BOOL _b_visible;\r
162     BOOL _b_sendevents;\r
163     int _i_vlc;\r
164 };\r
165 \r
166 #endif\r
167 \r