1 /* 2 * Copyright 2007, 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(BList& indices, int32 toIndex); 37 virtual void CopyItems(BList& indices, int32 toIndex); 38 virtual void RemoveItemList(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 private: 48 void _FullSync(); 49 void _AddItem(const entry_ref& ref, int32 index); 50 void _RemoveItem(int32 index); 51 52 void _SetCurrentPlaylistIndex(int32 index); 53 void _SetPlaybackState(uint32 state); 54 55 Playlist* fPlaylist; 56 PlaylistObserver* fPlaylistObserver; 57 58 Controller* fController; 59 ControllerObserver* fControllerObserver; 60 61 CommandStack* fCommandStack; 62 63 int32 fCurrentPlaylistIndex; 64 uint32 fPlaybackState; 65 66 font_height fFontHeight; 67 PlaylistItem* fLastClickedItem; 68 }; 69 70 #endif // PLAYLIST_LIST_VIEW_H 71