]> git.sesse.net Git - vlc/blob - activex/plugin.h
7c01409f7fc14405039df1100ddf3d07a2545421
[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(ITypeLib **pTL)\r
83         { return LoadRegTypeLib(LIBID_AXVLC, 1, 0, LOCALE_USER_DEFAULT, 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 isVisible(void);\r
96     void setVisible(BOOL fVisible);\r
97 \r
98     BOOL hasFocus(void);\r
99     void setFocus(BOOL fFocus);\r
100 \r
101     UINT getCodePage(void) { return _codepage; };\r
102     void setCodePage(UINT cp) { _codepage = cp; };\r
103 \r
104     int  getVLCObject(void) { return _i_vlc; };\r
105 \r
106     // control properties\r
107     void setSourceURL(const char *url) { _psz_src = strdup(url); };\r
108     void setAutoStart(BOOL autostart) { _b_autostart = autostart; };\r
109     void setLoopMode(BOOL loopmode) { _b_loopmode = loopmode; };\r
110     void setMute(BOOL mute) {\r
111         if( mute && _i_vlc )\r
112         {\r
113             VLC_VolumeMute(_i_vlc);\r
114         }\r
115     };\r
116     void setShowDisplay(BOOL show) { _b_showdisplay = show; };\r
117     BOOL getShowDisplay(void) { return _b_showdisplay; };\r
118     void setSendEvents(BOOL sendevents) { _b_sendevents = sendevents; };\r
119 \r
120     // container events\r
121     void onPositionChange(LPCRECT lprcPosRect, LPCRECT lprcClipRect);\r
122     void onPaint(PAINTSTRUCT &ps, RECT &pr);\r
123 \r
124     // control events\r
125     void fireOnPlayEvent(void);\r
126     void fireOnPauseEvent(void);\r
127     void fireOnStopEvent(void);\r
128 \r
129 protected:\r
130 \r
131     virtual ~VLCPlugin();\r
132 \r
133 private:\r
134 \r
135     void calcPositionChange(LPRECT lprPosRect, LPCRECT lprcClipRect);\r
136 \r
137     //implemented interfaces\r
138     class VLCOleObject *vlcOleObject;\r
139     class VLCOleControl *vlcOleControl;\r
140     class VLCOleInPlaceObject *vlcOleInPlaceObject;\r
141     class VLCOleInPlaceActiveObject *vlcOleInPlaceActiveObject;\r
142     class VLCPersistStreamInit *vlcPersistStreamInit;\r
143     class VLCPersistStorage *vlcPersistStorage;\r
144     class VLCPersistPropertyBag *vlcPersistPropertyBag;\r
145     class VLCProvideClassInfo *vlcProvideClassInfo;\r
146     class VLCConnectionPointContainer *vlcConnectionPointContainer;\r
147     class VLCObjectSafety *vlcObjectSafety;\r
148     class VLCControl *vlcControl;\r
149 \r
150     // in place activated window (Clipping window)\r
151     HWND _inplacewnd;\r
152     // video window (Drawing window)\r
153     HWND _videownd;\r
154     RECT _bounds;\r
155 \r
156     VLCPluginClass *_p_class;\r
157     ULONG _i_ref;\r
158 \r
159     UINT _codepage;\r
160     char *_psz_src;\r
161     BOOL _b_autostart;\r
162     BOOL _b_loopmode;\r
163     BOOL _b_showdisplay;\r
164     BOOL _b_sendevents;\r
165     int _i_vlc;\r
166 };\r
167 \r
168 #endif\r
169 \r