예제 #1
0
PlayerFrame::PlayerFrame(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size)
{
    //(*Initialize(PlayerFrame)
    Create(parent, id, _("xPlayer"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("id"));
    SetClientSize(wxDefaultSize);
    Move(wxDefaultPosition);

    Connect(wxID_ANY,wxEVT_CLOSE_WINDOW,(wxObjectEventFunction)&PlayerFrame::OnClose);
    //*)

    SetIcon(wxIcon(xlights_xpm));

    //
    //  Create and attach the sizer
    //
    wxFlexGridSizer* sizer = new wxFlexGridSizer(1);
    this->SetSizer(sizer);
    this->SetAutoLayout(true);
    sizer->AddGrowableRow(0);
    sizer->AddGrowableCol(0);

    //
    //  Create and attach the media control
    //
    MediaCtrl = new wxMediaCtrl();
    wxString MediaBackend;

#ifdef __WXMSW__
    // this causes Windows to use latest installed Windows Media Player version
    // On XP, users were getting WMP 6.4 without this
    MediaBackend = wxMEDIABACKEND_WMP10;
#endif

    playbackSpeed = 1.0;

    //  Make sure creation was successful
    bool bOK = MediaCtrl->Create(this, wxID_MEDIACTRL, wxEmptyString,
                                 wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, MediaBackend);

    wxASSERT_MSG(bOK, "Could not create media control!");
    wxUnusedVar(bOK);

    sizer->Add(MediaCtrl, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 0);
    PlayAfterLoad=false;
    Connect(wxID_MEDIACTRL, wxEVT_MEDIA_LOADED,
            wxMediaEventHandler(PlayerFrame::OnMediaLoaded));
}
예제 #2
0
void PlayerFrame::InitMediaPlayer() {
    if (MediaCtrl != nullptr) {
        return;
    }
    //
    //  Create and attach the sizer
    //
    wxFlexGridSizer* sizer = new wxFlexGridSizer(1);
    this->SetSizer(sizer);
    this->SetAutoLayout(true);
    sizer->AddGrowableRow(0);
    sizer->AddGrowableCol(0);
    
    //
    //  Create and attach the media control
    //
    MediaCtrl = new wxMediaCtrl();
    wxString MediaBackend;
    
#ifdef __WXMSW__
    // this causes Windows to use latest installed Windows Media Player version
    // On XP, users were getting WMP 6.4 without this
    MediaBackend = wxMEDIABACKEND_WMP10;
#endif
    
    playbackSpeed = 1.0;
    
    //  Make sure creation was successful
    bool bOK = MediaCtrl->Create(this, wxID_MEDIACTRL, wxEmptyString,
                                 wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, MediaBackend);
    
    wxASSERT_MSG(bOK, "Could not create media control!");
    wxUnusedVar(bOK);
    
    sizer->Add(MediaCtrl, 0, wxALL|wxEXPAND, 0);
    PlayAfterLoad=false;
    Connect(wxID_MEDIACTRL, wxEVT_MEDIA_LOADED,
            wxMediaEventHandler(PlayerFrame::OnMediaLoaded));
    Layout();
}