00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012 #ifndef _AX_MEDIACTRLPANEL_H_
00013 #define _AX_MEDIACTRLPANEL_H_
00014
00015
00016
00017
00018
00019
00021 #include "wx/mediactrl.h"
00023
00024 #include "wx/timer.h"
00025
00026 #include "ax_resource/ax_resource.h"
00027 #include "ax/ax_ui_adaptation.h"
00028
00033
00034 class wxMediaCtrl;
00036
00037 class wxMediaEvent;
00038
00039
00040
00041
00042
00044 #define SYMBOL_AXMEDIACTRLPANEL_STYLE wxRESIZE_BORDER|wxTAB_TRAVERSAL
00045 #define SYMBOL_AXMEDIACTRLPANEL_TITLE wxEmptyString
00046 #define SYMBOL_AXMEDIACTRLPANEL_IDNAME wxID_ANY
00047 #define SYMBOL_AXMEDIACTRLPANEL_SIZE wxSize(20, 20)
00048 #define SYMBOL_AXMEDIACTRLPANEL_POSITION wxDefaultPosition
00050
00051
00061 class AxMediaCtrlPanel: public wxScrolledWindow
00062 {
00063 DECLARE_DYNAMIC_CLASS( AxMediaCtrlPanel )
00064 DECLARE_EVENT_TABLE()
00065
00066 public:
00068 AxMediaCtrlPanel();
00069 AxMediaCtrlPanel( wxWindow* parent, wxWindowID id = SYMBOL_AXMEDIACTRLPANEL_IDNAME, const wxPoint& pos = SYMBOL_AXMEDIACTRLPANEL_POSITION, const wxSize& size = SYMBOL_AXMEDIACTRLPANEL_SIZE, long style = SYMBOL_AXMEDIACTRLPANEL_STYLE );
00070
00072 bool Create( wxWindow* parent, wxWindowID id = SYMBOL_AXMEDIACTRLPANEL_IDNAME, const wxPoint& pos = SYMBOL_AXMEDIACTRLPANEL_POSITION, const wxSize& size = SYMBOL_AXMEDIACTRLPANEL_SIZE, long style = SYMBOL_AXMEDIACTRLPANEL_STYLE );
00073
00075 ~AxMediaCtrlPanel();
00076
00078 void Init();
00079
00081 void CreateControls();
00082
00084 void SetPlaylist(const wxArrayString& playlist, bool clearFirst = true);
00085 void SetPlaylist(const AxResource& playlist, bool clearFirst = true);
00086
00088
00089
00091 int GetCurrentItem() const { return m_currentItem; }
00092
00094 bool Play(int idx = -1);
00095
00097 bool IsPlaying() const;
00098
00100 bool IsPaused() const;
00101
00103 bool Pause();
00104
00106 bool Resume();
00107
00109 bool Stop();
00110
00112 void ClearPlaylist();
00113
00115 bool GoToStart();
00116
00118 bool GoToEnd();
00119
00121 bool GoToNext();
00122
00124 bool GoToPrevious();
00125
00127 void OnMediaFinished(wxMediaEvent& event);
00128
00130 void OnMediaLoaded(wxMediaEvent& event);
00131
00133 bool IsBeingDragged();
00134
00136 void Notify(wxTimerEvent& event);
00137
00138 void OnBeginSeek(wxScrollEvent& event);
00139 void OnEndSeek(wxScrollEvent& event);
00140
00142 int FindByFilename(const wxString& filename) const;
00143
00144 void SetAutoPlay(bool autoPlay) { m_autoPlay = autoPlay; }
00145 bool GetAutoPlay() const { return m_autoPlay; }
00146
00148
00150 void OnMediactrlpanelPlaylistSelected( wxCommandEvent& event );
00151
00153 void OnMediactrlpanelPreviousClick( wxCommandEvent& event );
00154
00156 void OnMediactrlpanelPreviousUpdate( wxUpdateUIEvent& event );
00157
00159 void OnMediactrlpanelPlayClick( wxCommandEvent& event );
00160
00162 void OnMediactrlpanelPlayUpdate( wxUpdateUIEvent& event );
00163
00165 void OnMediactrlpanelStopClick( wxCommandEvent& event );
00166
00168 void OnMediactrlpanelStopUpdate( wxUpdateUIEvent& event );
00169
00171 void OnMediactrlpanelNextClick( wxCommandEvent& event );
00172
00174 void OnMediactrlpanelNextUpdate( wxUpdateUIEvent& event );
00175
00177 void OnMediactrlpanelVolumeSliderUpdated( wxCommandEvent& event );
00178
00180
00182
00184 wxBitmap GetBitmapResource( const wxString& name );
00185
00187 wxIcon GetIconResource( const wxString& name );
00189
00191 static bool ShowToolTips();
00192
00194 wxMediaCtrl* m_mediaCtrl;
00195 wxListBox* m_playlistCtrl;
00196 wxSlider* m_timerSliderCtrl;
00197 wxButton* m_previousCtrl;
00198 wxButton* m_playCtrl;
00199 wxButton* m_stopCtrl;
00200 wxButton* m_nextCtrl;
00201 wxSlider* m_volumeSliderCtrl;
00203 enum {
00204 ID_MEDIACTRLPANEL_MEDIACTRL = 17401,
00205 ID_MEDIACTRLPANEL_PLAYLIST = 17402,
00206 ID_MEDIACTRLPANEL_TIME_SLIDER = 17407,
00207 ID_MEDIACTRLPANEL_PREVIOUS = 17403,
00208 ID_MEDIACTRLPANEL_PLAY = 17404,
00209 ID_MEDIACTRLPANEL_STOP = 17405,
00210 ID_MEDIACTRLPANEL_NEXT = 17406,
00211 ID_MEDIACTRLPANEL_VOLUME_SLIDER = 17408
00212 };
00214
00215 AxResource m_playlist;
00216 int m_currentItem;
00217 bool m_bIsBeingDragged;
00218 wxTimer m_timer;
00219 bool m_disableUpdates;
00220 bool m_autoPlay;
00221 AxSelfVoicing m_selfVoicing;
00222 };
00223
00224 #endif
00225