xref: /haiku/src/apps/mediaplayer/playlist/PlaylistListView.h (revision b08627f310bb2e80bca50176e7a758182384735a)
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				ItemsReceived(const 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 	virtual	void				SkipBackward();
53 	virtual	void				SkipForward();
54 
55 private:
56 	class Item;
57 
58 			void				_Wind(bigtime_t howMuch, int64 frames);
59 			void				_FullSync();
60 			void				_AddItem(PlaylistItem* item, int32 index);
61 			void				_RemoveItem(int32 index);
62 
63 			void				_SetCurrentPlaylistIndex(int32 index);
64 			void				_SetPlaybackState(uint32 state);
65 
66 			Playlist*			fPlaylist;
67 			PlaylistObserver*	fPlaylistObserver;
68 
69 			Controller*			fController;
70 			ControllerObserver*	fControllerObserver;
71 
72 			CommandStack*		fCommandStack;
73 
74 			int32				fCurrentPlaylistIndex;
75 			uint32				fPlaybackState;
76 
77 			font_height			fFontHeight;
78 			Item*				fLastClickedItem;
79 };
80 
81 #endif // PLAYLIST_LIST_VIEW_H
82