1 /*****************************************************************************
2 * playlist.hpp: Header for the playlist
3 *****************************************************************************
4 * Copyright (C) 1999-2005 the VideoLAN team
7 * Authors: Clément Stenac <zorglub@videolan.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 #ifndef _WXVLC_PLAYLIST_H_
25 #define _WXVLC_PLAYLIST_H_
27 #include "wxwidgets.hpp"
29 #include <wx/treectrl.h>
47 class Playlist: public wxFrame
51 Playlist( intf_thread_t *p_intf, wxWindow *p_parent );
54 void UpdatePlaylist();
55 void ShowPlaylist( bool show );
56 void UpdateItem( int );
57 void AppendItem( wxCommandEvent& );
60 int i_items_to_append;
62 int GetCurrentView( ){ return i_current_view; };
65 void RemoveItem( int );
66 void DeleteTreeItem( wxTreeItemId );
67 void DeleteItem( int item );
68 void DeleteNode( playlist_item_t *node );
70 void RecursiveDeleteSelection( wxTreeItemId );
72 /* Event handlers (these functions should _not_ be virtual) */
75 void OnAddFile( wxCommandEvent& event );
76 void OnAddDir( wxCommandEvent& event );
77 void OnAddMRL( wxCommandEvent& event );
78 void OnMenuClose( wxCommandEvent& event );
79 void OnClose( wxCloseEvent& WXUNUSED(event) );
81 void OnDeleteSelection( wxCommandEvent& event );
83 void OnOpen( wxCommandEvent& event );
84 void OnSave( wxCommandEvent& event );
87 void OnSearch( wxCommandEvent& event );
88 /*void OnSearchTextChange( wxCommandEvent& event );*/
89 wxTextCtrl *search_text;
90 wxButton *search_button;
91 wxTreeItemId search_current;
93 void OnEnDis( wxCommandEvent& event );
97 void OnSort( wxCommandEvent& event );
100 int i_duration_sorted;
103 void OnMenuEvent( wxCommandEvent& event );
104 void OnMenuOpen( wxMenuEvent& event );
110 void OnUp( wxCommandEvent& event);
111 void OnDown( wxCommandEvent& event);
113 void OnRandom( wxCommandEvent& event );
114 void OnRepeat( wxCommandEvent& event );
115 void OnLoop ( wxCommandEvent& event );
117 void OnActivateItem( wxTreeEvent& event );
118 void OnKeyDown( wxTreeEvent& event );
119 void OnNewGroup( wxCommandEvent& event );
121 void OnDragItemBegin( wxTreeEvent& event );
122 void OnDragItemEnd( wxTreeEvent& event );
123 wxTreeItemId draged_tree_item;
128 wxTreeItemId i_wx_popup_item;
131 void OnPopup( wxContextMenuEvent& event );
132 void OnPopupPlay( wxCommandEvent& event );
133 void OnPopupPreparse( wxCommandEvent& event );
134 void OnPopupSort( wxCommandEvent& event );
135 void OnPopupDel( wxCommandEvent& event );
136 void OnPopupEna( wxCommandEvent& event );
137 void OnPopupInfo( wxCommandEvent& event );
138 void OnPopupAddNode( wxCommandEvent& event );
140 void Rebuild( vlc_bool_t );
146 void UpdateNode( playlist_item_t*, wxTreeItemId );
147 void UpdateNodeChildren( playlist_item_t*, wxTreeItemId );
148 void CreateNode( playlist_item_t*, wxTreeItemId );
149 void UpdateTreeItem( wxTreeItemId );
151 /* Search (internal) */
152 int CountItems( wxTreeItemId);
153 wxTreeItemId FindItem( wxTreeItemId, int );
154 wxTreeItemId FindItemByName( wxTreeItemId, wxString,
155 wxTreeItemId, vlc_bool_t *);
157 wxTreeItemId saved_tree_item;
161 playlist_t *p_playlist;
165 void OnPlaylistEvent( wxCommandEvent& event );
167 DECLARE_EVENT_TABLE();
171 wxStatusBar *statusbar;
172 ItemInfoDialog *iteminfo_dialog;
174 int i_update_counter;
176 vlc_bool_t b_changed_view;
180 intf_thread_t *p_intf;
181 wxTreeCtrl *treectrl;
184 friend class PlaylistFileDropTarget;
187 #if wxUSE_DRAG_AND_DROP
188 /* Playlist file drop target */
189 class PlaylistFileDropTarget: public wxFileDropTarget
192 PlaylistFileDropTarget( Playlist * );
193 virtual bool OnDropFiles( wxCoord x, wxCoord y,
194 const wxArrayString& filenames );
200 } // end of wxvlc namespace