Commit 6e6164d0 authored by Gildas Bazin's avatar Gildas Bazin

* modules/gui/wxwidgets: use a wxSplitterWindow to display the embedded playlist.

parent 209591e0
......@@ -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();
......
......@@ -30,6 +30,7 @@
#include <wx/dnd.h>
#include <wx/accel.h>
#include <wx/taskbar.h>
#include <wx/splitter.h>
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;
......
......@@ -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 );
......
......@@ -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 )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment