]> git.sesse.net Git - vlc/blob - modules/gui/wxwidgets/playlist_manager.hpp
Merge branch 'master' of git@git.videolan.org:vlc
[vlc] / modules / gui / wxwidgets / playlist_manager.hpp
1 /*****************************************************************************
2  * playlist_manager.hpp: Header for the playlist manager
3  *****************************************************************************
4  * Copyright (C) 1999-2005 the VideoLAN team
5  * $Id$
6  *
7  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
8  *          Gildas Bazin <gbazin@videolan.org>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25 #ifndef _WXVLC_PLAYLIST_MANAGER_H_
26 #define _WXVLC_PLAYLIST_MANAGER_H_
27
28 #include "wxwidgets.hpp"
29 #include <wx/treectrl.h>
30
31 namespace wxvlc
32 {
33 /* PlaylistManager */
34 class PlaylistManager: public wxPanel
35 {
36 public:
37     /* Constructor */
38     PlaylistManager( intf_thread_t *p_intf, wxWindow *p_parent );
39     virtual ~PlaylistManager();
40
41     void Update();
42
43     bool b_need_update;
44     int  i_items_to_append;
45
46 private:
47     DECLARE_EVENT_TABLE();
48
49     /* Update */
50     void Rebuild( bool );
51     void CreateNode( playlist_item_t*, wxTreeItemId );
52     void UpdateNode( playlist_item_t*, wxTreeItemId );
53     void UpdateNodeChildren( playlist_item_t*, wxTreeItemId );
54     void UpdateTreeItem( wxTreeItemId );
55
56     void UpdateItem( int );
57     void AppendItem( wxCommandEvent& );
58     void RemoveItem( int );
59
60     wxTreeItemId FindItem( wxTreeItemId, int );
61
62     /* Events */
63     void OnActivateItem( wxTreeEvent& event );
64     /* Custom events */
65     void OnPlaylistEvent( wxCommandEvent& event );
66
67     /* Simple cache for FindItem() */
68     int i_cached_item_id;
69     wxTreeItemId cached_item;
70
71     intf_thread_t *p_intf;
72     playlist_t *p_playlist;
73     wxTreeCtrl *treectrl;
74     wxSizer *sizer;
75
76     int i_update_counter;
77 };
78
79 } // end of wxvlc namespace
80
81 #endif