]> git.sesse.net Git - vlc/blobdiff - activex/plugin.h
Also control plugin export table
[vlc] / activex / plugin.h
index 0e5c9d1976ecba747d7f5779ea7b271f9e773069..1dba8151eba40fedd388a015f278383933dbb032 100644 (file)
@@ -17,7 +17,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 #ifndef __PLUGIN_H__
@@ -80,58 +80,123 @@ public:
     STDMETHODIMP_(ULONG) Release(void);
 
     /* custom methods */
-    HRESULT getTypeLib(LCID lcid, ITypeLib **pTL)
-        { return LoadRegTypeLib(LIBID_AXVLC, 1, 0, lcid, pTL); };
+    HRESULT getTypeLib(LCID lcid, ITypeLib **pTL) { return LoadRegTypeLib(LIBID_AXVLC, 1, 0, lcid, pTL); };
     REFCLSID getClassID(void) { return (REFCLSID)CLSID_VLCPlugin; };
     REFIID getDispEventID(void) { return (REFIID)DIID_DVLCEvents; };
 
-    HRESULT onInit(void);
-    HRESULT onLoad(void);
-    HRESULT onClientSiteChanged(LPOLECLIENTSITE pActiveSite);
-    HRESULT onClose(DWORD dwSaveOption);
+    /*
+    ** persistant properties
+    */
+    void setMRL(BSTR mrl)
+    {
+        SysFreeString(_bstr_mrl);
+        _bstr_mrl = SysAllocStringLen(mrl, SysStringLen(mrl));
+        setDirty(TRUE);
+    };
+    const BSTR getMRL(void) { return _bstr_mrl; };
+
+    inline void setAutoPlay(BOOL autoplay)
+    {
+        _b_autoplay = autoplay;
+        setDirty(TRUE);
+    };
+    inline BOOL getAutoPlay(void) { return _b_autoplay; };
+
+    inline void setAutoLoop(BOOL autoloop) 
+    {
+        _b_autoloop = autoloop;
+        setDirty(TRUE);
+    };
+    inline BOOL getAutoLoop(void) { return _b_autoloop;};
+
+    void setVolume(int volume);
+    int getVolume(void) { return _i_volume; };
 
-    BOOL isInPlaceActive(void);
-    HRESULT onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprcPosRect, LPCRECT lprcClipRect);
-    HRESULT onInPlaceDeactivate(void);
-    HWND getInPlaceWindow(void) const { return _inplacewnd; };
+    void setVisible(BOOL fVisible);
+    BOOL getVisible(void) { return _b_visible; };
+    BOOL isVisible(void) { return _b_visible || (! _b_usermode); };
+
+    void setTime(int time);
+    int  getTime(void) { return _i_time; };
+
+    // control size in HIMETRIC
+    inline void setExtent(const SIZEL& extent)
+    {
+        _extent = extent;
+        setDirty(TRUE);
+    };
+    const SIZEL& getExtent(void) { return _extent; };
 
+    // transient properties 
+    inline void setMute(BOOL mute) { _b_mute = mute; };
+
+    inline void setPicture(LPPICTURE pict)
+    {
+        if( NULL != _p_pict )
+            _p_pict->Release();
+        if( NULL != pict )
+            _p_pict->AddRef();
+        _p_pict = pict;
+    };
+
+    inline LPPICTURE getPicture(void)
+    {
+        if( NULL != _p_pict )
+            _p_pict->AddRef();
+        return _p_pict;
+    };
+    
     BOOL hasFocus(void);
     void setFocus(BOOL fFocus);
 
-    UINT getCodePage(void) { return _codepage; };
-    void setCodePage(UINT cp) { _codepage = cp; };
+    inline UINT getCodePage(void) { return _i_codepage; };
+    inline void setCodePage(UINT cp)
+    {
+        // accept new codepage only if it works on this system
+        size_t mblen = WideCharToMultiByte(cp,
+                0, L"test", -1, NULL, 0, NULL, NULL);
+        if( mblen > 0 )
+            _i_codepage = cp;
+    };
 
-    int  getVLCObject(void) { return _i_vlc; };
+    inline BOOL isUserMode(void) { return _b_usermode; };
+    inline void setUserMode(BOOL um) { _b_usermode = um; };
 
-    // persistent control properties, may be overriden by HTML & javascript
-    void setSourceURL(const char *url) { _psz_src = strdup(url); };
-    void setAutoStart(BOOL autostart) { _b_autostart = autostart; };
-    void setLoopMode(BOOL loopmode) { _b_loopmode = loopmode; };
-    void setMute(BOOL mute) { _b_mute = mute; };
-    void setVisible(BOOL fVisible);
-    BOOL getVisible(void) { return _b_visible; };
-    LPPICTURE getPicture(void) { if( NULL != _pict ) _pict->AddRef(); return _pict; };
-    
-    // container events
+    inline BOOL isDirty(void) { return _b_dirty; };
+    inline void setDirty(BOOL dirty) { _b_dirty = dirty; };
+
+    inline BOOL isRunning(void) { return 0 != _i_vlc; };
+    HRESULT getVLCObject(int *i_vlc);
+
+
+    // control geometry within container
+    RECT getPosRect(void) { return _posRect; }; 
+    inline HWND getInPlaceWindow(void) const { return _inplacewnd; };
+    BOOL isInPlaceActive(void);
+
+    /*
+    ** container events
+    */
+    HRESULT onInit(void);
+    HRESULT onLoad(void);
+    HRESULT onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprcPosRect, LPCRECT lprcClipRect);
+    HRESULT onInPlaceDeactivate(void);
+    HRESULT onAmbientChanged(LPUNKNOWN pContainer, DISPID dispID);
+    HRESULT onClose(DWORD dwSaveOption);
     void onPositionChange(LPCRECT lprcPosRect, LPCRECT lprcClipRect);
     void onDraw(DVTARGETDEVICE * ptd, HDC hicTargetDev,
             HDC hdcDraw, LPCRECTL lprcBounds, LPCRECTL lprcWBounds);
     void onPaint(HDC hdc, const RECT &bounds, const RECT &pr);
 
-    // control events
+    /*
+    ** control events
+    */
     void freezeEvents(BOOL freeze);
     void firePropChangedEvent(DISPID dispid);
     void fireOnPlayEvent(void);
     void fireOnPauseEvent(void);
     void fireOnStopEvent(void);
 
-    // control size in HIMETRIC
-    const SIZEL& getExtent(void) { return _extent; };
-    void  setExtent(const SIZEL& extent) { _extent = extent; };
-
-    // control geometry within container
-    RECT getPosRect(void) { return _posRect; }; 
-
     // controlling IUnknown interface
     LPUNKNOWN pUnkOuter;
 
@@ -164,17 +229,23 @@ private:
     VLCPluginClass *_p_class;
     ULONG _i_ref;
 
-    LPPICTURE _pict;
-    UINT _codepage;
-    char *_psz_src;
-    BOOL _b_autostart;
-    BOOL _b_loopmode;
-    BOOL _b_visible;
-    BOOL _b_mute;
+    UINT _i_codepage;
+    BOOL _b_usermode;
     int  _i_vlc;
+    RECT _posRect;
 
+    // persistable properties
+    BSTR _bstr_mrl;
+    BOOL _b_autoplay;
+    BOOL _b_autoloop;
+    BOOL _b_visible;
+    BOOL _b_mute;
+    int  _i_volume;
+    int  _i_time;
     SIZEL _extent;
-    RECT _posRect;
+    LPPICTURE _p_pict;
+    // indicates whether properties needs persisting
+    BOOL _b_dirty;
 };
 
 #endif