xref: /haiku/src/apps/mediaplayer/playlist/PlaylistListView.h (revision 03187b607b2b5eec7ee059f1ead09bdba14991fb)
1 /*
2  * Copyright 2007-2009, Haiku. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Stephan Aßmus <superstippi@gmx.de>
7  */
8 #ifndef PLAYLIST_LIST_VIEW_H
9 #define PLAYLIST_LIST_VIEW_H
10 
11 #include "ListViews.h"
12 
13 class CommandStack;
14 class Controller;
15 class ControllerObserver;
16 class Playlist;
17 class PlaylistItem;
18 class PlaylistObserver;
19 
20 class PlaylistListView : public SimpleListView {
21 public:
22 								PlaylistListView(BRect frame,
23 									Playlist* playlist,
24 									Controller* controller,
25 									CommandStack* stack);
26 	virtual						~PlaylistListView();
27 
28 	// BView interface
29 	virtual	void				AttachedToWindow();
30 	virtual	void				MessageReceived(BMessage* message);
31 
32 	virtual	void				MouseDown(BPoint where);
33 	virtual	void				KeyDown(const char* bytes, int32 numBytes);
34 
35 	// SimpleListView interface
36 	virtual	void				MoveItems(const BList& indices, int32 toIndex);
37 	virtual	void				CopyItems(const BList& indices, int32 toIndex);
38 	virtual	void				RemoveItemList(const BList& indices);
39 
40 	virtual	void				DrawListItem(BView* owner, int32 index,
41 									BRect frame) const;
42 
43 	// PlaylistListView
44 			void				RefsReceived(BMessage* message,
45 									int32 appendIndex);
46 
47 			void				Randomize();
48 			void				RemoveSelectionToTrash();
49 			void				RemoveToTrash(int32 index);
50 			void				RemoveItemList(const BList& indices,
51 									bool intoTrash);
52 
53 private:
54 	class Item;
55 
56 			void				_FullSync();
57 			void				_AddItem(PlaylistItem* item, int32 index);
58 			void				_RemoveItem(int32 index);
59 
60 			void				_SetCurrentPlaylistIndex(int32 index);
61 			void				_SetPlaybackState(uint32 state);
62 
63 			Playlist*			fPlaylist;
64 			PlaylistObserver*	fPlaylistObserver;
65 
66 			Controller*			fController;
67 			ControllerObserver*	fControllerObserver;
68 
69 			CommandStack*		fCommandStack;
70 
71 			int32				fCurrentPlaylistIndex;
72 			uint32				fPlaybackState;
73 
74 			font_height			fFontHeight;
75 			Item*				fLastClickedItem;
76 };
77 
78 #endif // PLAYLIST_LIST_VIEW_H
79