void VideoDisplay::UpdateSize() { auto provider = con->project->VideoProvider(); if (!provider || !IsShownOnScreen()) return; videoSize.Set(provider->GetWidth(), provider->GetHeight()); videoSize *= zoomValue; if (con->videoController->GetAspectRatioType() != AspectRatio::Default) videoSize.SetWidth(videoSize.GetHeight() * con->videoController->GetAspectRatioValue()); wxEventBlocker blocker(this); if (freeSize) { wxWindow *top = GetParent(); while (!top->IsTopLevel()) top = top->GetParent(); wxSize cs = GetClientSize(); wxSize oldSize = top->GetSize(); top->SetSize(top->GetSize() + videoSize / scale_factor - cs); SetClientSize(cs + top->GetSize() - oldSize); } else { SetMinClientSize(videoSize / scale_factor); SetMaxClientSize(videoSize / scale_factor); GetGrandParent()->Layout(); } PositionVideo(); }
void VideoDisplay::UpdateSize() { if (!con->videoController->IsLoaded() || !IsShownOnScreen()) return; videoSize.Set(con->videoController->GetWidth(), con->videoController->GetHeight()); videoSize *= zoomValue; if (con->videoController->GetAspectRatioType() != 0) videoSize.SetWidth(videoSize.GetHeight() * con->videoController->GetAspectRatioValue()); wxEventBlocker blocker(this); if (freeSize) { wxWindow *top = GetParent(); while (!top->IsTopLevel()) top = top->GetParent(); wxSize cs = GetClientSize(); wxSize oldSize = top->GetSize(); top->SetSize(top->GetSize() + videoSize - cs); SetClientSize(cs + top->GetSize() - oldSize); } else { SetMinClientSize(videoSize); SetMaxClientSize(videoSize); GetGrandParent()->Layout(); } PositionVideo(); }
void FrameNotification::create( wxString const& title, wxString const& message, wxBitmap const& bitmap, int maxWidth) { //SetMaxSize(wxSize(maxWidth, -1)); //Création du titre et du message. _staticTextTitle = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize); _staticTextTitle->SetLabelMarkup("<big><b>"+title+"</b></big>"); _staticTextMessage = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize); _staticTextMessage->SetLabelMarkup(message); //Création de la statice line. _staticLine = new wxStaticLine(this); //Créations du wxStaticBitmap _staticBitmap = nullptr; if(bitmap.IsOk()) { _staticBitmap = new wxStaticBitmap(this, wxID_ANY, bitmap); maxWidth -= _staticBitmap->GetSize().GetWidth()+SIZE_BORDER; } //Wrap le TextMessage //_staticTextMessage->Wrap(maxWidth-5*SIZE_BORDER); //Mise en forme titre et du message avec un sizer. wxSizer* sizerNotification = new wxBoxSizer(wxVERTICAL); sizerNotification->Add(_staticTextTitle, 0, wxEXPAND|wxLEFT, 2*SIZE_BORDER); sizerNotification->Add(_staticLine, 0, wxEXPAND|wxTOP|wxBOTTOM, SIZE_BORDER); sizerNotification->Add(_staticTextMessage, 0, wxEXPAND|wxLEFT, 4*SIZE_BORDER); //Mise en forme du GUI avec un sizer. wxSizer* sizerMain = new wxBoxSizer(wxHORIZONTAL); if(_staticBitmap != nullptr) sizerMain->Add(_staticBitmap, 0, wxALIGN_CENTER| wxLEFT|wxBOTTOM|wxTOP, SIZE_BORDER); sizerMain->Add(sizerNotification, 0, wxRIGHT|wxBOTTOM|wxTOP, SIZE_BORDER); SetSizerAndFit(sizerMain); SetMaxClientSize(GetSize()); //Modification de des couleurs SetBackgroundColour(ManNotification::get().getColourBackground()); SetForegroundColour(ManNotification::get().getColourText()); //Bind Bind(wxEVT_TIMER, &FrameNotification::onTimeout, this); _staticTextTitle->Bind(wxEVT_LEFT_DOWN, &FrameNotification::onLeftDown, this); _staticLine->Bind(wxEVT_LEFT_DOWN, &FrameNotification::onLeftDown, this); _staticTextMessage->Bind(wxEVT_LEFT_DOWN, &FrameNotification::onLeftDown, this); if(_staticBitmap) _staticBitmap->Bind(wxEVT_LEFT_DOWN, &FrameNotification::onLeftDown, this); Bind(wxEVT_LEFT_DOWN, &FrameNotification::onLeftDown, this); }