From: Gildas Bazin Date: Fri, 2 Dec 2005 20:50:37 +0000 (+0000) Subject: * modules/gui/wxwidgets: use a wxSplitterWindow to display the embedded playlist. X-Git-Tag: 0.9.0-test0~13110 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=6e6164d05d34b353b4a1f67ffdab974b89a90ad9;p=vlc * modules/gui/wxwidgets: use a wxSplitterWindow to display the embedded playlist. --- diff --git a/modules/gui/wxwidgets/interface.cpp b/modules/gui/wxwidgets/interface.cpp index 699a121200..00b56927a0 100644 --- a/modules/gui/wxwidgets/interface.cpp +++ b/modules/gui/wxwidgets/interface.cpp @@ -225,12 +225,18 @@ Interface::Interface( intf_thread_t *_p_intf, long style ): /* Give our interface a nice little icon */ SetIcon( wxIcon( vlc_xpm ) ); - /* Create a main panel that will fill in the interface window */ + /* Create a splitter window that will fill in the interface window. + * We need a splitter bar in order to make the embedded playlist + * resizable. */ + splitter = new wxSplitterWindow( this, -1, wxDefaultPosition, wxSize(0,0), + wxCLIP_CHILDREN|wxSP_3DSASH ); main_sizer = new wxBoxSizer( wxVERTICAL ); + main_sizer->Add( splitter, 1, wxEXPAND ); SetSizer( main_sizer ); - main_panel = new wxPanel( this, -1, wxPoint(0,0), wxSize(0,0), + + /* Create a main panel that will fill in the interface window */ + main_panel = new wxPanel( splitter, -1, wxPoint(0,0), wxSize(0,0), wxCLIP_CHILDREN ); - main_sizer->Add( main_panel, 1, wxEXPAND ); main_panel->SetFocus(); #if defined(__WXGTK20__) && wxCHECK_VERSION(2,5,6) @@ -244,6 +250,12 @@ Interface::Interface( intf_thread_t *_p_intf, long style ): panel_sizer = new wxBoxSizer( wxVERTICAL ); main_panel->SetSizer( panel_sizer ); + /* Put this in the splitter */ + splitter->Initialize( main_panel ); +#if wxCHECK_VERSION(2,6,0) + splitter->SetSashGravity( 1.0 ); +#endif + #ifdef wxHAS_TASK_BAR_ICON /* Systray integration */ p_systray = NULL; @@ -262,17 +274,17 @@ Interface::Interface( intf_thread_t *_p_intf, long style ): /* Creation of the status bar * Helptext for menu items and toolbar tools will automatically get * displayed here. */ - int i_status_width[3] = {-6, -2, -9}; + int i_status_width[3] = {100, 40, -1}; statusbar = CreateStatusBar( 3 ); /* 2 fields */ statusbar->SetStatusWidths( 3, i_status_width ); statusbar->SetStatusText( wxString::Format(wxT("x%.2f"), 1.0), 1 ); /* Get minimum window size to prevent user from glitching it */ - main_panel->SetSizeHints( wxSize(-1,0) ); + splitter->SetSizeHints( wxSize(-1,0) ); panel_sizer->Layout(); panel_sizer->Fit( main_panel ); main_sizer->Layout(); main_sizer->Fit( this ); main_min_size = GetSize(); - main_panel->SetSizeHints( wxSize(-1,-1) ); + splitter->SetSizeHints( wxSize(-1,-1) ); /* Video window */ video_window = 0; @@ -287,10 +299,10 @@ Interface::Interface( intf_thread_t *_p_intf, long style ): panel_sizer->Add( input_manager, 0, wxEXPAND , 0 ); /* Layout everything */ - main_panel->SetSizeHints( wxSize(-1,0) ); + splitter->SetSizeHints( wxSize(-1,0) ); panel_sizer->Layout(); panel_sizer->Fit( main_panel ); main_sizer->Layout(); main_sizer->Fit( this ); - main_panel->SetSizeHints( wxSize(-1,-1) ); + splitter->SetSizeHints( wxSize(-1,-1) ); #if wxUSE_DRAG_AND_DROP /* Associate drop targets with the main interface */ @@ -860,13 +872,17 @@ void Interface::OnSmallPlaylist( wxCommandEvent& WXUNUSED(event) ) if( !playlist_manager ) { /* Create the extra panel */ - playlist_manager = new PlaylistManager( p_intf, main_panel ); - panel_sizer->Add( playlist_manager, 0, wxEXPAND , 0 ); + playlist_manager = new PlaylistManager( p_intf, splitter ); playlist_min_size = playlist_manager->GetBestSize(); } b_playlist_manager = !b_playlist_manager; - panel_sizer->Show( playlist_manager, b_playlist_manager ); + + if( b_playlist_manager ) + splitter->SplitHorizontally( main_panel, playlist_manager, + -playlist_min_size.GetHeight() ); + else + splitter->Unsplit( playlist_manager ); SetIntfMinSize(); main_sizer->Layout(); diff --git a/modules/gui/wxwidgets/interface.hpp b/modules/gui/wxwidgets/interface.hpp index 221d436839..8b392cfbef 100644 --- a/modules/gui/wxwidgets/interface.hpp +++ b/modules/gui/wxwidgets/interface.hpp @@ -30,6 +30,7 @@ #include #include #include +#include namespace wxvlc @@ -91,7 +92,8 @@ namespace wxvlc void PrevStream(); void NextStream(); - wxBoxSizer *main_sizer; + wxBoxSizer *main_sizer; + wxSplitterWindow *splitter; wxPanel *main_panel; wxBoxSizer *panel_sizer; diff --git a/modules/gui/wxwidgets/playlist_manager.cpp b/modules/gui/wxwidgets/playlist_manager.cpp index c920b1900a..0d02381982 100644 --- a/modules/gui/wxwidgets/playlist_manager.cpp +++ b/modules/gui/wxwidgets/playlist_manager.cpp @@ -94,7 +94,7 @@ public: * Constructor. *****************************************************************************/ PlaylistManager::PlaylistManager( intf_thread_t *_p_intf, wxWindow *p_parent ): - wxPanel( p_parent, -1, wxDefaultPosition, wxSize(500,300) ) + wxPanel( p_parent, -1, wxDefaultPosition, wxSize(0,0) ) { /* Initializations */ p_intf = _p_intf; @@ -123,6 +123,9 @@ PlaylistManager::PlaylistManager( intf_thread_t *_p_intf, wxWindow *p_parent ): sizer = new wxBoxSizer( wxHORIZONTAL ); SetSizer( sizer ); sizer->Add( treectrl, 1, wxEXPAND ); + treectrl->SetSizeHints( wxSize(500, 150) ); + sizer->Layout(); + sizer->Fit( this ); /* Create image list */ wxImageList *p_images = new wxImageList( 16 , 16, TRUE ); diff --git a/modules/gui/wxwidgets/video.cpp b/modules/gui/wxwidgets/video.cpp index 1b8c8b06cf..ea21dae3ff 100644 --- a/modules/gui/wxwidgets/video.cpp +++ b/modules/gui/wxwidgets/video.cpp @@ -70,7 +70,7 @@ wxWindow *CreateVideoWindow( intf_thread_t *p_intf, wxWindow *p_parent ) void UpdateVideoWindow( intf_thread_t *p_intf, wxWindow *p_window ) { -#if (wxCHECK_VERSION(2,5,3)) +#if wxCHECK_VERSION(2,5,3) if( !p_intf->p_sys->b_video_autosize ) return; if( p_window && mdate() - ((VideoWindow *)p_window)->i_creation_date < 2000000 )