]> git.sesse.net Git - vlc/blobdiff - modules/gui/wxwindows/playlist.cpp
* src/libvlc.c, src/libvlc.h: added a config option to disable the translation of...
[vlc] / modules / gui / wxwindows / playlist.cpp
index c68a3efb2448c120a766d3ed39e8ce317db177a7..f5bfbf67464c10aa4a93b0dc16a24a4a09cef0c4 100644 (file)
@@ -1,8 +1,8 @@
 /*****************************************************************************
- * interface.cpp : wxWindows plugin for vlc
+ * playlist.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $$
+ * $Id: playlist.cpp,v 1.6 2003/03/26 00:56:22 gbazin Exp $
  *
  * Authors: Olivier Teulière <ipkiss@via.ecp.fr>
  *
@@ -10,7 +10,7 @@
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- *-
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 #include <stdio.h>
 
 #include <vlc/vlc.h>
-#include <vlc/intf.h>
-
-/* Let wxWindows take care of the i18n stuff */
-#undef _
 
 #ifdef WIN32                                                 /* mingw32 hack */
-#undef Yield()
-#undef CreateDialog()
+#undef Yield
+#undef CreateDialog
 #endif
 
+/* Let vlc take care of the i18n stuff */
+#define WXINTL_NO_GETTEXT_MACRO
+
 #include <wx/wxprec.h>
 #include <wx/wx.h>
 #include <wx/listctrl.h>
 
+#include <vlc/intf.h>
+
 #include "wxwindows.h"
 
 /*****************************************************************************
@@ -119,30 +120,49 @@ Playlist::Playlist( intf_thread_t *_p_intf, Interface *_p_main_interface ):
     /* Attach the menu bar to the frame */
     SetMenuBar( menubar );
 
+    /* Create a panel to put everything in */
+    wxPanel *playlist_panel = new wxPanel( this, -1 );
+    playlist_panel->SetAutoLayout( TRUE );
+
     /* Create the listview */
     /* FIXME: the given size is arbitrary, and prevents us from resizing
      * the window to smaller dimensions. But the sizers don't seem to adjust
      * themselves to the size of a listview, and with a wxDefaultSize the
      * playlist window is ridiculously small */
-    listview = new wxListView( this, ListView_Event, wxDefaultPosition,
-                               wxSize( 350, 300 ), wxLC_REPORT );
+    listview = new wxListView( playlist_panel, ListView_Event,
+                               wxDefaultPosition, wxSize( 350, 300 ),
+                               wxLC_REPORT | wxSUNKEN_BORDER );
     listview->InsertColumn( 0, _("Url") );
     listview->InsertColumn( 1, _("Duration") );
     listview->SetColumnWidth( 0, 250 );
     listview->SetColumnWidth( 1, 100 );
 
     /* Create the OK button */
-    ok_button = new wxButton( this, wxID_OK, _("OK") );
+    ok_button = new wxButton( playlist_panel, wxID_OK, _("OK") );
     ok_button->SetDefault();
 
     /* Place everything in sizers */
     wxBoxSizer *ok_button_sizer = new wxBoxSizer( wxHORIZONTAL );
     ok_button_sizer->Add( ok_button, 0, wxALL, 5 );
+    ok_button_sizer->Layout();
     wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL );
-    main_sizer->Add( listview, 1, wxEXPAND | wxALL, 5 );
-    main_sizer->Add( ok_button_sizer, 0, wxALIGN_CENTRE );
-
+    wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL );
+    panel_sizer->Add( listview, 1, wxEXPAND | wxALL, 5 );
+    panel_sizer->Add( ok_button_sizer, 0, wxALIGN_CENTRE );
+    panel_sizer->Layout();
+    playlist_panel->SetSizerAndFit( panel_sizer );
+    main_sizer->Add( playlist_panel, 1, wxGROW, 0 );
+    main_sizer->Layout();
     SetSizerAndFit( main_sizer );
+
+#if !defined(__WXX11__)
+    /* Associate drop targets with the playlist */
+    SetDropTarget( new DragAndDrop( p_intf ) );
+#endif
+
+    /* Update the playlist */
+    Rebuild();
+
 }
 
 Playlist::~Playlist()
@@ -303,4 +323,3 @@ void Playlist::OnKeyDown( wxListEvent& event )
         OnDeleteSelection( event );
     }
 }
-