From 5c3a762d492eeb362979cea122746738ee05257e Mon Sep 17 00:00:00 2001 From: Francesco Montorsi Date: Thu, 25 Sep 2008 18:14:44 +0000 Subject: [PATCH] revisions by Utensil Candel git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55886 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- interface/wx/mdi.h | 217 +++++++++++++------ interface/wx/mediactrl.h | 437 +++++++++++++++++++-------------------- 2 files changed, 370 insertions(+), 284 deletions(-) diff --git a/interface/wx/mdi.h b/interface/wx/mdi.h index efb0c59854..6e37b9af78 100644 --- a/interface/wx/mdi.h +++ b/interface/wx/mdi.h @@ -8,19 +8,41 @@ /** @class wxMDIClientWindow + @wxheader{mdi.h} An MDI client window is a child of wxMDIParentFrame, and manages zero or more wxMDIChildFrame objects. @library{wxcore} - @category{FIXME} + @category{managedwnd} + + @remarks + + The client window is the area where MDI child windows exist. It doesn't have to + cover the whole parent frame; other windows such as toolbars and a help window + might coexist with it. There can be scrollbars on a client window, which are + controlled by the parent window style. + + The wxMDIClientWindow class is usually adequate without further derivation, and + it is created automatically when the MDI parent frame is created. If the application + needs to derive a new class, the function wxMDIParentFrame::OnCreateClient() must + be overridden in order to give an opportunity to use a different class of client + window. + + Under Windows 95, the client window will automatically have a sunken border style + when the active child is not maximized, and no border style when a child is maximized. @see wxMDIChildFrame, wxMDIParentFrame, wxFrame */ class wxMDIClientWindow : public wxWindow { public: - //@{ + + /** + Default constructor. + */ + wxMDIClientWindow(); + /** Constructor, creating the window. @@ -29,14 +51,11 @@ public: @param style The window style. Currently unused. - @remarks The second style of constructor is called within - wxMDIParentFrame::OnCreateClient. + @remarks This constructor is called within wxMDIParentFrame::OnCreateClient(). - @see wxMDIParentFrame::wxMDIParentFrame, wxMDIParentFrame::OnCreateClient + @see wxMDIParentFrame::wxMDIParentFrame(), wxMDIParentFrame::OnCreateClient() */ - wxMDIClientWindow(); wxMDIClientWindow(wxMDIParentFrame* parent, long style = 0); - //@} /** Destructor. @@ -54,18 +73,39 @@ public: /** @class wxMDIParentFrame + @wxheader{mdi.h} An MDI (Multiple Document Interface) parent frame is a window which can contain MDI child frames in its own 'desktop'. It is a convenient way to avoid window - clutter, - and is used in many popular Windows applications, such as Microsoft Word(TM). + clutter, and is used in many popular Windows applications, such as Microsoft Word(TM). + + @remarks + + There may be multiple MDI parent frames in a single application, but this probably + only makes sense within programming development environments. + + Child frames may be of class wxMDIChildFrame (contained within the parent frame) + or wxFrame (shown as a top-level frame). + + An MDI parent frame always has a wxMDIClientWindow associated with it, which is the + parent for MDI child frames. This client window may be resized to accommodate non-MDI + windows, as seen in Microsoft Visual C++ (TM) and Microsoft Publisher (TM), where + a documentation window is placed to one side of the workspace. + + MDI remains popular despite dire warnings from Microsoft itself that MDI is an obsolete + user interface style. + + The implementation is native in Windows, and simulated under Motif. Under Motif, the + child window frames will often have a different appearance from other frames because + the window decorations are simulated. + @beginStyleTable @style{wxCAPTION} Puts a caption on the frame. @style{wxDEFAULT_FRAME_STYLE} - Defined as wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxTHICK_FRAME | - wxSYSTEM_MENU | wxCAPTION. + Defined as @c wxMINIMIZE_BOX | @c wxMAXIMIZE_BOX | @c wxTHICK_FRAME | + @c wxSYSTEM_MENU | @c wxCAPTION. @style{wxHSCROLL} Displays a horizontal scrollbar in the client window, allowing the user to view child frames that are off the current view. @@ -76,12 +116,12 @@ public: @style{wxMAXIMIZE_BOX} Displays a maximize box on the frame (Windows and Motif only). @style{wxMINIMIZE} - Identical to wxICONIZE. + Identical to @c wxICONIZE. @style{wxMINIMIZE_BOX} Displays a minimize box on the frame (Windows and Motif only). @style{wxRESIZE_BORDER} Displays a resizeable border around the window (Motif only; for - Windows, it is implicit in wxTHICK_FRAME). + Windows, it is implicit in @c wxTHICK_FRAME). @style{wxSTAY_ON_TOP} Stay on top of other windows (Windows only). @style{wxSYSTEM_MENU} @@ -104,7 +144,12 @@ public: class wxMDIParentFrame : public wxFrame { public: - //@{ + + /** + Default constructor. + */ + wxMDIParentFrame(); + /** Constructor, creating the window. @@ -112,39 +157,34 @@ public: The window parent. This should be @NULL. @param id The window identifier. It may take a value of -1 to indicate a default - value. + value. @param title The caption to be displayed on the frame's title bar. @param pos - The window position. The value wxDefaultPosition indicates a default position, - chosen by - either the windowing system or wxWidgets, depending on platform. + The window position. The value @c wxDefaultPosition indicates a default position, + chosen by either the windowing system or wxWidgets, depending on platform. @param size - The window size. The value wxDefaultSize indicates a default size, chosen by + The window size. The value @c wxDefaultSize indicates a default size, chosen by either the windowing system or wxWidgets, depending on platform. @param style The window style. See wxMDIParentFrame. @param name - The name of the window. This parameter is used to associate a name with the - item, - allowing the application user to set Motif resource values for - individual windows. + The name of the window. This parameter is used to associate a name + with the item, allowing the application user to set Motif resource values + for individual windows. @remarks During the construction of the frame, the client window will be - created. To use a different class from - wxMDIClientWindow, override + created. To use a different class from wxMDIClientWindow, override OnCreateClient(). @see Create(), OnCreateClient() */ - wxMDIParentFrame(); wxMDIParentFrame(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, const wxString& name = "frame"); - //@} /** Destructor. Destroys all child windows and menu bar if present. @@ -203,12 +243,37 @@ public: @param height Receives the client height in pixels. - @remarks The client area is the area which may be drawn on by the - programmer, excluding title bar, border, status bar, - and toolbar if present. + @remarks - @see GetToolBar(), SetToolBar(), - wxMDIClientWindow + The client area is the area which may be drawn on by the programmer, excluding + title bar, border, status bar, and toolbar if present. + + If you wish to manage your own toolbar (or perhaps you have more than one), + provide an @b OnSize event handler. Call GetClientSize() to find how much space + there is for your windows and don't forget to set the size and position of + the MDI client window as well as your toolbar and other windows (but not the + status bar). + + If you have set a toolbar with wxMDIParentFrame::SetToolbar(), the client size + returned will have subtracted the toolbar height. However, the available positions + for the client window and other windows of the frame do not start at zero - you + must add the toolbar height. + + The position and size of the status bar and toolbar (if known to the frame) are + always managed by wxMDIParentFrame, regardless of what behaviour is defined in + your @b OnSize event handler. However, the client window position and size are always + set in @b OnSize, so if you override this event handler, make sure you deal with the + client window. + + You do not have to manage the size and position of MDI child windows, since they + are managed automatically by the client window. + + @see GetToolBar(), SetToolBar(), wxMDIClientWindow + + @beginWxPythonOnly + The wxPython version of this method takes no arguments and returns a tuple containing + width and height. + @endWxPythonOnly */ virtual void GetClientSize(int* width, int* height) const; @@ -235,15 +300,23 @@ public: /** Override this to return a different kind of client window. If you override this - function, - you must create your parent frame in two stages, or your function will never be - called, - due to the way C++ treats virtual functions called from constructors. For - example: + function, you must create your parent frame in two stages, or your function will + never be called, due to the way C++ treats virtual functions called from constructors. + For example: + + @code + frame = new MyParentFrame; + frame->Create(parent, myParentFrameId, wxT("My Parent Frame")); + @endcode - @remarks You might wish to derive from wxMDIClientWindow in order to - implement different erase behaviour, for example, such - as painting a bitmap on the background. + @remarks + + You might wish to derive from wxMDIClientWindow in order to implement different + erase behaviour, for example, such as painting a bitmap on the background. + + Note that it is probably impossible to have a client window that scrolls + as well as painting a bitmap or pattern, since in @b OnScroll, the scrollbar + positions always return zero. (Solutions to: julian.smart@btopenworld.com). @see GetClientWindow(), wxMDIClientWindow */ @@ -257,9 +330,23 @@ public: @param toolbar Toolbar to manage. - @remarks When the frame is resized, the toolbar is resized to be the - width of the frame client area, and the toolbar height - is kept the same. + @remarks + + When the frame is resized, the toolbar is resized to be the width of the frame + client area, and the toolbar height is kept the same. + + When the frame is resized, the toolbar is resized to be the width of the frame + client area, and the toolbar height is kept the same. + + The parent of the toolbar must be this frame. + + If you wish to manage your own toolbar (or perhaps you have more than one), + don't call this function, and instead manage your subwindows and the MDI client + window by providing an @b OnSize event handler. Call wxMDIParentFrame::GetClientSize() + to find how much space there is for your windows. + + Note that SDI (normal) frames and MDI child windows must always have their toolbars + managed by the application. @see GetToolBar(), GetClientSize() */ @@ -267,16 +354,18 @@ public: /** Call this to change the current Window menu. Ownership of the menu object - passes to - the frame when you call this function. + passes to the frame when you call this function. + This call is available under Windows only. - To remove the window completely, use the wxFRAME_NO_WINDOW_MENU window style. + + To remove the window completely, use the @c wxFRAME_NO_WINDOW_MENU window style. */ void SetWindowMenu(wxMenu* menu); /** Tiles the MDI child windows either horizontally or vertically depending on - whether @a orient is wxHORIZONTAL or wxVERTICAL. + whether @a orient is @c wxHORIZONTAL or @c wxVERTICAL. + Currently only implemented for MSW, does nothing under the other platforms. */ void Tile(wxOrientation orient = wxHORIZONTAL); @@ -286,6 +375,7 @@ public: /** @class wxMDIChildFrame + @wxheader{mdi.h} An MDI child frame is a frame that can only exist on a wxMDIClientWindow, which is itself a child of wxMDIParentFrame. @@ -294,8 +384,8 @@ public: @style{wxCAPTION} Puts a caption on the frame. @style{wxDEFAULT_FRAME_STYLE} - Defined as wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxTHICK_FRAME | - wxSYSTEM_MENU | wxCAPTION. + Defined as @c wxMINIMIZE_BOX | @c wxMAXIMIZE_BOX | @c wxTHICK_FRAME | + @c wxSYSTEM_MENU | @c wxCAPTION. @style{wxICONIZE} Display the frame iconized (minimized) (Windows only). @style{wxMAXIMIZE} @@ -303,12 +393,12 @@ public: @style{wxMAXIMIZE_BOX} Displays a maximize box on the frame (Windows and Motif only). @style{wxMINIMIZE} - Identical to wxICONIZE. + Identical to @c wxICONIZE. @style{wxMINIMIZE_BOX} Displays a minimize box on the frame (Windows and Motif only). @style{wxRESIZE_BORDER} Displays a resizeable border around the window (Motif only; for - Windows, it is implicit in wxTHICK_FRAME). + Windows, it is implicit in @c wxTHICK_FRAME). @style{wxSTAY_ON_TOP} Stay on top of other windows (Windows only). @style{wxSYSTEM_MENU} @@ -325,7 +415,12 @@ public: class wxMDIChildFrame : public wxFrame { public: - //@{ + + /** + Default constructor. + */ + wxMDIChildFrame(); + /** Constructor, creating the window. @@ -333,36 +428,30 @@ public: The window parent. This should not be @NULL. @param id The window identifier. It may take a value of -1 to indicate a default - value. + value. @param title The caption to be displayed on the frame's title bar. @param pos - The window position. The value wxDefaultPosition indicates a default position, - chosen by - either the windowing system or wxWidgets, depending on platform. + The window position. The value @c wxDefaultPosition indicates a default position, + chosen by either the windowing system or wxWidgets, depending on platform. @param size - The window size. The value wxDefaultSize indicates a default size, chosen by + The window size. The value @c wxDefaultSize indicates a default size, chosen by either the windowing system or wxWidgets, depending on platform. @param style The window style. See wxMDIChildFrame. @param name The name of the window. This parameter is used to associate a name with the - item, - allowing the application user to set Motif resource values for - individual windows. - - @remarks None. + item, allowing the application user to set Motif resource values for individual + windows. @see Create() */ - wxMDIChildFrame(); wxMDIChildFrame(wxMDIParentFrame* parent, wxWindowID id, const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame"); - //@} /** Destructor. Destroys all child windows and menu bar if present. diff --git a/interface/wx/mediactrl.h b/interface/wx/mediactrl.h index d8938501e1..b04172ef0d 100644 --- a/interface/wx/mediactrl.h +++ b/interface/wx/mediactrl.h @@ -6,18 +6,58 @@ // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// + +enum wxMediaCtrlPlayerControls +{ + /** No controls. return wxMediaCtrl to its default state. */ + wxMEDIACTRLPLAYERCONTROLS_NONE = 0, + + /** Step controls like fastfoward, step one frame etc. */ + wxMEDIACTRLPLAYERCONTROLS_STEP = 1 << 0, + + /** Volume controls like the speaker icon, volume slider, etc. */ + wxMEDIACTRLPLAYERCONTROLS_VOLUME = 1 << 1, + + /** Default controls for the toolkit. Currently a combination for + @c wxMEDIACTRLPLAYERCONTROLS_STEP and @c wxMEDIACTRLPLAYERCONTROLS_VOLUME. */ + wxMEDIACTRLPLAYERCONTROLS_DEFAULT = + wxMEDIACTRLPLAYERCONTROLS_STEP | + wxMEDIACTRLPLAYERCONTROLS_VOLUME +}; + /** @class wxMediaEvent Event wxMediaCtrl uses. + @beginEventTable{wxMediaEvent} + @event{EVT_MEDIA_LOADED(id\, func)} + Sent when a media has loaded enough data that it can start playing. + @event{EVT_MEDIA_STOP(id\, func)} + Sent when a media has switched to the @c wxMEDIASTATE_STOPPED state. + You may be able to Veto this event to prevent it from stopping, + causing it to continue playing - even if it has reached that end of + the media (note that this may not have the desired effect - if you + want to loop the media, for example, catch the @c EVT_MEDIA_FINISHED + and play there instead). + @event{EVT_MEDIA_FINISHED(id\, func)} + Sent when a media has finished playing in a wxMediaCtrl. + @event{EVT_MEDIA_STATECHANGED(id\, func)} + Sent when a media has switched its state (from any media state). + @event{EVT_MEDIA_PLAY(id\, func)} + Sent when a media has switched to the @c wxMEDIASTATE_PLAYING state. + @event{EVT_MEDIA_PAUSE(id\, func)} + Sent when a media has switched to the @c wxMEDIASTATE_PAUSED state. + @endEventTable + @library{wxmedia} - @category{FIXME} + @category{events} */ class wxMediaEvent : public wxNotifyEvent { public: - + /** Default ctor. */ + wxMediaEvent(wxEventType commandType = wxEVT_NULL, int winid = 0); }; @@ -36,27 +76,131 @@ public: @category{media} @see wxMediaEvent + + @section class_mediactrl_rendering_media Rendering media + + Depending upon the backend, wxMediaCtrl can render and display pretty much any + kind of media that the native system can - such as an image, mpeg video, or mp3 + (without license restrictions - since it relies on native system calls that may + not technically have mp3 decoding available, for example, it falls outside + the realm of licensing restrictions). + + For general operation, all you need to do is call Load() to load the file you + want to render, catch the @c EVT_MEDIA_LOADED event, and then call Play() + to show the video/audio of the media in that event. + + More complex operations are generally more heavily dependant on the capabilities + of the backend. For example, QuickTime cannot set the playback rate of certain + streaming media - while DirectShow is slightly more flexible in that regard. + + @section class_mediactrl_operation Operation + + When wxMediaCtrl plays a file, it plays until the stop position is reached + (currently the end of the file/stream). Right before it hits the end of the stream, + it fires off a @c EVT_MEDIA_STOP event to its parent window, at which point the event + handler can choose to veto the event, preventing the stream from actually stopping. + + Example: + + @code + //connect to the media event + this->Connect(wxMY_ID, wxEVT_MEDIA_STOP, (wxObjectEventFunction) + (wxEventFunction)(wxMediaEventFunction) &MyFrame::OnMediaStop); + + //... + void MyFrame::OnMediaStop(const wxMediaEvent& evt) + { + if(bUserWantsToSeek) + { + m_mediactrl->SetPosition( + m_mediactrl->GetDuration() << 1 + ); + evt.Veto(); + } + } + @endcode + + When wxMediaCtrl stops, either by the @c EVT_MEDIA_STOP not being vetoed, or by manually + calling Stop(), where it actually stops is not at the beginning, rather, but at the beginning + of the stream. That is, when it stops and play is called, playback is gauranteed to start at + the beginning of the media. This is because some streams are not seekable, and when stop is + called on them they return to the beginning, thus wxMediaCtrl tries to keep consistant for all types + of media. + + Note that when changing the state of the media through Play() and other methods, the media may not + actually be in the @c wxMEDIASTATE_PLAYING, for example. If you are relying on the media being in + certain state catch the event relevant to the state. See wxMediaEvent for the kinds of events that + you can catch. + + @section class_mediactrl_video_size Video size + + By default, wxMediaCtrl will scale the size of the video to the requested amount passed to either + its constructor or Create(). After calling Load or performing an equivilant operation, you can + subsequently obtain the "real" size of the video (if there is any) by calling GetBestSize(). + Note that the actual result on the display will be slightly different when ShowPlayerControls is + activated and the actual video size will be less then specified due to the extra controls provided + by the native toolkit. In addition, the backend may modify GetBestSize() to include the size of + the extra controls - so if you want the real size of the video just disable ShowPlayerControls(). + + The idea with setting GetBestSize() to the size of the video is that GetBestSize() is a wxWindow-derived + function that is called when sizers on a window recalculate. What this means is that if you use sizers + by default the video will show in its original size without any extra assistance needed from the user. + + @section class_mediactrl_player_controls Player controls + + Normally, when you use wxMediaCtrl it is just a window for the video to play in. However, some toolkits + have their own media player interface. For example, QuickTime generally has a bar below the video with + a slider. A special feature available to wxMediaCtrl, you can use the toolkits interface instead of making + your own by using the ShowPlayerControls() function. There are several options for the flags parameter, + with the two general flags being @c wxMEDIACTRLPLAYERCONTROLS_NONE which turns off the native interface, + and @c wxMEDIACTRLPLAYERCONTROLS_DEFAULT which lets wxMediaCtrl decide what native controls on the interface. + Be sure to review the caveats outlined in Video size before doing so. + + @section class_mediactrl_choosing_backend Choosing a backend + + Generally, you should almost certainly leave this part up to wxMediaCtrl - but if you need a certain backend + for a particular reason, such as QuickTime for playing .mov files, all you need to do to choose a specific + backend is to pass the name of the backend class to Create(). + + The following are valid backend identifiers: + + @beginTable + @row2col{@b wxMEDIABACKEND_DIRECTSHOW, Use ActiveMovie/DirectShow. Uses the native ActiveMovie (I.E. DirectShow) control. Default backend on Windows and supported by nearly all Windows versions, even some Windows CE versions. May display a windows media player logo while inactive.} + @row2col{@b wxMEDIABACKEND_QUICKTIME, Use QuickTime. Mac Only. WARNING: May not working correctly embedded in a wxNotebook.} + @row2col{@b wxMEDIABACKEND_GSTREAMER, Use GStreamer. Unix Only. Requires GStreamer 0.8 along with at the very least the xvimagesink, xoverlay, and gst-play modules of gstreamer to function. You need the correct modules to play the relavant files, for example the mad module to play mp3s, etc.} + @row2col{@b wxMEDIABACKEND_WMP10, Uses Windows Media Player 10 (Windows only) - works on mobile machines with Windows Media Player 10 and desktop machines with either Windows Media Player 9 or 10} + @endTable + + Note that other backends such as wxMEDIABACKEND_MCI can now be found at wxCode(http://wxcode.sourceforge.net/). + + @section class_mediactrl_creating_backend Creating a backend + + Creating a backend for wxMediaCtrl is a rather simple process. Simply derive from wxMediaBackendCommonBase + and implement the methods you want. The methods in wxMediaBackend correspond to those in wxMediaCtrl except + for CreateControl which does the actual creation of the control, in cases where a custom control is not + needed you may simply call wxControl::Create(). + + You need to make sure to use the @c DECLARE_CLASS and @c IMPLEMENT_CLASS macros. + + The only real tricky part is that you need to make sure the file in compiled in, which if there are + just backends in there will not happen and you may need to use a force link hack + (see http://www.wxwidgets.org/wiki/index.php/RTTI). + + This is a rather simple example of how to create a backend in the wxActiveXContainer documentation. */ class wxMediaCtrl : public wxControl { public: - //@{ /** - , - wxPoint& - - @param pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& szBackend = wxT(""), - const wxValidatorvalidator = wxDefaultValidator, - const wxString& name = wxPanelNameStr - ) - - Constructor that calls Create. You may prefer to call Create directly to check + Default constructor - you MUST call Create before calling any other methods of wxMediaCtrl. + */ + wxMediaCtrl(); + + /** + Constructor that calls Create(). You may prefer to call Create() directly to check to see if wxMediaCtrl is available on the system. - parent + @param parent parent of this control. Must not be @NULL. @param id id to use for events @@ -76,71 +220,21 @@ public: @param name Window name. */ - wxMediaCtrl() const; - wxMediaCtrl(wxWindow* parent, wxWindowID id) const; - //@} - - /** - Generally, you should almost certainly leave this part up to - wxMediaCtrl - but if you need a certain backend for a particular - reason, such as QuickTime for playing .mov files, all you need - to do to choose a specific backend is to pass the - name of the backend class to - Create(). - The following are valid backend identifiers - - - @b wxMEDIABACKEND_DIRECTSHOW - - - Use ActiveMovie/DirectShow. Uses the native ActiveMovie - (I.E. DirectShow) control. Default backend on Windows and - supported by nearly all Windows versions, even some - Windows CE versions. May display a windows media player - logo while inactive. - - @b wxMEDIABACKEND_QUICKTIME - - Use QuickTime. Mac Only. - WARNING: May not working correctly embedded in a wxNotebook. - - @b wxMEDIABACKEND_GSTREAMER - - Use GStreamer. Unix Only. Requires GStreamer 0.8 along - with at the very least the xvimagesink, xoverlay, and - gst-play modules of gstreamer to function. You need the correct - modules to play the relavant files, for example the mad module - to play mp3s, etc. - - @b wxMEDIABACKEND_WMP10 - - Uses Windows Media Player 10 (Windows only) - works on mobile - machines with Windows Media Player 10 and desktop machines with - either Windows Media Player 9 or 10 - - Note that other backends such as wxMEDIABACKEND_MCI can now be - found at wxCode. - */ + wxMediaCtrl( wxWindow* parent, wxWindowID id, const wxString& fileName = wxT(""), + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = 0, const wxString& szBackend = wxT(""), const wxValidatorvalidator = wxDefaultValidator, + const wxString& name = wxPanelNameStr ); /** - , - wxPoint& + Creates this control. Returns @false if it can't load the movie located at @a fileName + or it cannot load one of its native backends. - @param pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& szBackend = wxT(""), - const wxValidatorvalidator = wxDefaultValidator, - const wxString& name = wxPanelNameStr - ) + If you specify a file to open via @a fileName and you don't specify a backend to + use, wxMediaCtrl tries each of its backends until one that can render the path referred to + by @a fileName can be found. - Creates this control. Returns @false if it can't load the movie located at - fileName or it cannot load one of its native backends. - - If you specify a file to open via fileName and you don't specify a backend to - use, wxMediaCtrl tries each of its backends until one that can render the path referred to by fileName can be found. - - parent + @param parent parent of this control. Must not be @NULL. @param id id to use for events @@ -160,27 +254,14 @@ public: @param name Window name. */ - bool Create(wxWindow* parent, wxWindowID id) const; - - /** - Creating a backend for wxMediaCtrl is a rather simple process. Simply derive - from wxMediaBackendCommonBase and implement the methods you want. The methods - in wxMediaBackend correspond to those in wxMediaCtrl except for CreateControl - which does the actual creation of the control, in cases where a custom control - is not needed you may simply call wxControl::Create. - You need to make sure to use the DECLARE_CLASS and IMPLEMENT_CLASS macros. - The only real tricky part is that you need to make sure the file in compiled - in, which if there are just backends in there will not happen and you may need - to use a force link hack (see http://www.wxwidgets.org/wiki/index.php/RTTI). - This is a rather simple example of how to create a backend in the - wxActiveXContainer documentation. - */ - + bool Create( wxWindow* parent, wxWindowID id, const wxString& fileName = wxT(""), + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = 0, const wxString& szBackend = wxT(""), const wxValidatorvalidator = wxDefaultValidator, + const wxString& name = wxPanelNameStr ); /** Obtains the best size relative to the original/natural size of the - video, if there is any. See @ref overview_videosizewxmediactrl "Video size" - for more information. + video, if there is any. See @ref class_mediactrl_video_size for more information. */ wxSize GetBestSize(); @@ -188,30 +269,27 @@ public: Obtains the playback rate, or speed of the media. @c 1.0 represents normal speed, while @c 2.0 represents twice the normal speed of the media, for example. Not supported on the GStreamer (Unix) backend. - Returns 0 on failure. + + @return zero on failure. */ double GetPlaybackrate(); /** Obtains the state the playback of the media is in - - @b wxMEDIASTATE_STOPPED - - The movie has stopped. - - @b wxMEDIASTATE_PAUSED - - The movie is paused. - - @b wxMEDIASTATE_PLAYING - - The movie is currently playing. + @beginTable + @row2col{wxMEDIASTATE_STOPPED, The movie has stopped.} + @row2col{wxMEDIASTATE_PAUSED, The movie is paused.} + @row2col{wxMEDIASTATE_PLAYING, The movie is currently playing.} + @endTable */ wxMediaCtrlState GetState(); /** - Gets the volume of the media from a 0.0 to 1.0 range. Note that due to rounding - and other errors this may not be the exact value sent to SetVolume. + Gets the volume of the media from a 0.0 to 1.0 range. + + @note Due to rounding and other errors the value returned may not be the exact value + sent to SetVolume(). */ double GetVolume(); @@ -221,47 +299,32 @@ public: wxFileOffset Length(); /** - Loads the location that @c uri refers to with the proxy @c proxy. Not - implemented on most backends so it should be called with caution. Returns @false if loading fails. + Loads the file that fileName refers to. Returns @false if loading fails. */ - bool Load(const wxURI& uri, const wxURI& proxy); + bool Load(const wxString& fileName); /** - Same as @ref loaduri() Load. Kept for wxPython compatability. + Loads the location that uri refers to. Note that this is very implementation-dependant, + although HTTP URI/URLs are generally supported, for example. Returns @false if loading fails. */ - bool LoadURI(const wxURI& uri); + bool Load(const wxURI& uri); /** - Same as @ref loaduriwithproxy() Load. Kept for wxPython compatability. + Loads the location that @c uri refers to with the proxy @c proxy. + Not implemented on most backends so it should be called with caution. + Returns @false if loading fails. */ - bool LoadURIWithProxy(const wxURI& uri, const wxURI& proxy); + bool Load(const wxURI& uri, const wxURI& proxy); /** - When wxMediaCtrl plays a file, it plays until the stop position - is reached (currently the end of the file/stream). Right before - it hits the end of the stream, it fires off a EVT_MEDIA_STOP - event to its parent window, at which point the event handler - can choose to veto the event, preventing the stream from actually - stopping. - Example: - - When wxMediaCtrl stops, either by the EVT_MEDIA_STOP not being - vetoed, or by manually calling - Stop(), where it actually - stops is not at the beginning, rather, but at the beginning of - the stream. That is, when it stops and play is called, playback - is gauranteed to start at the beginning of the media. This is - because some streams are not seekable, and when stop is called - on them they return to the beginning, thus wxMediaCtrl tries - to keep consistant for all types of media. - Note that when changing the state of the media through Play() - and other methods, the media may not actually be in the - wxMEDIASTATE_PLAYING, for example. If you are relying on the - media being in certain state catch the event relevant to the state. - See wxMediaEvent for the kinds of events - that you can catch. + Same as Load(const wxURI& uri). Kept for wxPython compatibility. */ + bool LoadURI(const wxURI& uri); + /** + Same as Load(const wxURI& uri, const wxURI& proxy). Kept for wxPython compatibility. + */ + bool LoadURIWithProxy(const wxURI& uri, const wxURI& proxy); /** Pauses playback of the movie. @@ -273,48 +336,16 @@ public: */ bool Play(); - /** - Normally, when you use wxMediaCtrl it is just a window for the video to - play in. However, some toolkits have their own media player interface. - For example, QuickTime generally has a bar below the video with a slider. - A special feature available to wxMediaCtrl, you can use the toolkit's interface - instead of - making your own by using the ShowPlayerControls() - function. There are several options for the flags parameter, with - the two general flags being wxMEDIACTRLPLAYERCONTROLS_NONE which turns off - the native interface, and wxMEDIACTRLPLAYERCONTROLS_DEFAULT which lets - wxMediaCtrl decide what native controls on the interface. Be sure to review - the caveats outlined in @ref overview_videosizewxmediactrl "Video size" before - doing so. - */ - - - /** - Depending upon the backend, wxMediaCtrl can render - and display pretty much any kind of media that the native system can - - such as an image, mpeg video, or mp3 (without license restrictions - - since it relies on native system calls that may not technically - have mp3 decoding available, for example, it falls outside the - realm of licensing restrictions). - For general operation, all you need to do is call - Load() to load the file - you want to render, catch the EVT_MEDIA_LOADED event, - and then call Play() - to show the video/audio of the media in that event. - More complex operations are generally more heavily dependant on the - capabilities of the backend. For example, QuickTime cannot set - the playback rate of certain streaming media - while DirectShow is - slightly more flexible in that regard. - */ - - /** Seeks to a position within the movie. + + @todo Document the wxSeekMode parameter @a mode, and perhaps also the + wxFileOffset and wxSeekMode themselves. */ wxFileOffset Seek(wxFileOffset where, wxSeekMode mode); /** - Sets the playback rate, or speed of the media, to that referred by @c dRate. + Sets the playback rate, or speed of the media, to that referred by @a dRate. @c 1.0 represents normal speed, while @c 2.0 represents twice the normal speed of the media, for example. Not supported on the GStreamer (Unix) backend. Returns @true if successful. @@ -324,9 +355,11 @@ public: /** Sets the volume of the media from a 0.0 to 1.0 range to that referred by @c dVolume. @c 1.0 represents full volume, while @c 0.5 - represents half (50 percent) volume, for example. Note that this may not be - exact due to conversion and rounding errors, although setting the volume to - full or none is always exact. Returns @true if successful. + represents half (50 percent) volume, for example. + + @note The volume may not be exact due to conversion and rounding errors, + although setting the volume to full or none is always exact. + Returns @true if successful. */ bool SetVolume(double dVolume); @@ -335,39 +368,22 @@ public: QuickTime usually have a scrollbar, play button, and more provided to them by the toolkit. By default wxMediaCtrl does not do this. However, on the directshow and quicktime backends you can show or hide the native controls - provided by the underlying toolkit at will using ShowPlayerControls. Simply + provided by the underlying toolkit at will using ShowPlayerControls(). Simply calling the function with default parameters tells wxMediaCtrl to use the default controls provided by the toolkit. The function takes a - @c wxMediaCtrlPlayerControls enumeration as follows: - - @b wxMEDIACTRLPLAYERCONTROLS_NONE - - No controls. return wxMediaCtrl to it's default state. - - @b wxMEDIACTRLPLAYERCONTROLS_STEP + wxMediaCtrlPlayerControls enumeration, please see available show modes there. - Step controls like fastfoward, step one frame etc. + For more see @ref class_mediactrl_player_controls. - @b wxMEDIACTRLPLAYERCONTROLS_VOLUME - - Volume controls like the speaker icon, volume slider, etc. - - @b wxMEDIACTRLPLAYERCONTROLS_DEFAULT - - Default controls for the toolkit. Currently a typedef for - wxMEDIACTRLPLAYERCONTROLS_STEP and wxMEDIACTRLPLAYERCONTROLS_VOLUME. - - For more see @ref overview_playercontrolswxmediactrl "Player controls". - Currently - only implemented on the QuickTime and DirectShow backends. The function - returns @true on success. + Currently only implemented on the QuickTime and DirectShow backends. + The function returns @true on success. */ bool ShowPlayerControls(wxMediaCtrlPlayerControls flags = wxMEDIACTRLPLAYERCONTROLS_DEFAULT); /** Stops the media. - See Operation() for an overview of how - stopping works. + + See @ref class_mediactrl_operation for an overview of how stopping works. */ bool Stop(); @@ -375,24 +391,5 @@ public: Obtains the current position in time within the movie in milliseconds. */ wxFileOffset Tell(); - - /** - By default, wxMediaCtrl will scale the size of the video to the - requested amount passed to either it's constructor or Create(). - After calling Load or performing an equivilant operation, you - can subsequently obtain the "real" size of the video (if there - is any) by calling GetBestSize(). Note that the actual result - on the display will be slightly different when ShowPlayerControls - is activated and the actual video size will be less then - specified due to the extra controls provided by the native toolkit. - In addition, the backend may modify GetBestSize() to include the - size of the extra controls - so if you want the real size of the - video just disable ShowPlayerControls(). - The idea with setting GetBestSize to the size of the video is - that GetBestSize is a wxWindow-derived function that is called - when sizers on a window recalculate. What this means is that - if you use sizers by default the video will show in it's - original size without any extra assistance needed from the user. - */ }; -- 2.45.2