]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/carbon/mediactrl.h
The assumption that if SIZEOF_INT is defined then SIZEOF_SIZE_T is too
[wxWidgets.git] / include / wx / mac / carbon / mediactrl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/moviectrl.h
3 // Purpose: wxMediaCtrl mac
4 // Author: Ryan Norton <wxprojects@comcast.net>
5 // Modified by:
6 // Created: 11/07/04
7 // RCS-ID: $Id$
8 // Copyright: (c) Ryan Norton
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #include "wx/defs.h"
13
14 #if wxUSE_MEDIACTRL
15
16 #include "wx/control.h"
17 #include "wx/uri.h"
18
19 #ifdef __WXMSW__
20 typedef struct MovieRecord* WXMOVIE;
21 #else
22 typedef struct MovieType** WXMOVIE;
23 #endif
24
25 enum wxMediaState
26 {
27 wxMEDIASTATE_STOPPED,
28 wxMEDIASTATE_PAUSED,
29 wxMEDIASTATE_PLAYING
30 };
31
32
33 class wxMediaCtrl : public wxControl
34 {
35 public:
36 wxMediaCtrl() : m_bLoaded(false)
37 { }
38
39 wxMediaCtrl(wxWindow* parent, wxWindowID id, const wxString& fileName,
40 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
41 long style = 0, long driver = 0, const wxString& name = wxPanelNameStr) : m_bLoaded(false)
42 { Create(parent, id, fileName, pos, size, style, driver, name); }
43
44
45 wxMediaCtrl(wxWindow* parent, wxWindowID id, const wxURI& location,
46 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
47 long style = 0, long driver = 0, const wxString& name = wxPanelNameStr) : m_bLoaded(false)
48 { Create(parent, id, location, pos, size, style, driver, name); }
49
50 ~wxMediaCtrl();
51
52 bool Create(wxWindow* parent, wxWindowID id, const wxString& fileName,
53 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
54 long style = 0, long driver = 0, const wxString& name = wxPanelNameStr);
55
56 bool Create(wxWindow* parent, wxWindowID id, const wxURI& location,
57 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
58 long style = 0, long driver = 0, const wxString& name = wxPanelNameStr);
59
60 bool Play();
61 bool Pause();
62 bool Stop();
63
64 bool Load(const wxString& fileName);
65 bool Load(const wxURI& location);
66
67 wxMediaState GetState();
68
69 double GetPlaybackRate();
70 bool SetPlaybackRate(double dRate);
71
72 bool SetPosition(long where);
73 long GetPosition();
74 long GetDuration();
75
76 protected:
77 virtual void DoMoveWindow(int x, int y, int w, int h);
78 bool DoCreate(wxWindow* parent, wxWindowID id,
79 const wxPoint& pos, const wxSize& size,
80 long style, const wxString& name);
81
82 wxSize DoGetBestSize() const;
83 bool InitQT();
84 void Cleanup();
85 void FinishLoad();
86
87 bool m_bLoaded;
88
89 WXMOVIE m_movie;
90 wxSize m_bestSize;
91 class _wxQTTimer* m_timer;
92
93 friend class _wxQTTimer;
94
95 DECLARE_DYNAMIC_CLASS(wxMediaCtrl);
96 };
97
98 //Event stuff
99 class WXDLLEXPORT wxMediaEvent : public wxNotifyEvent
100 {
101 public:
102 wxMediaEvent(wxEventType commandType = wxEVT_NULL, int id = 0)
103 : wxNotifyEvent(commandType, id)
104 { }
105
106 wxMediaEvent(const wxMediaEvent &clone)
107 : wxNotifyEvent(clone.GetEventType(), clone.GetId())
108 { }
109
110 virtual wxEvent *Clone() const { return new wxMediaEvent(*this); }
111
112 DECLARE_DYNAMIC_CLASS(wxMediaEvent)
113 };
114
115 #define wxMEDIA_FINISHED_ID 13000
116 DECLARE_EVENT_TYPE(wxEVT_MEDIA_FINISHED, wxMEDIA_FINISHED_ID)
117 typedef void (wxEvtHandler::*wxMediaEventFunction)(wxMediaEvent&);
118 #define EVT_MEDIA_FINISHED(winid, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_FINISHED, winid, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxMediaEventFunction) & fn, (wxObject *) NULL ),
119
120 #endif // wxUSE_MOVIECTRL