1 /* 2 * Copyright 2007-2010 Stephan Aßmus <superstippi@gmx.de>. 3 * All rights reserved. Distributed under the terms of the MIT License. 4 */ 5 6 #include "PlaylistObserver.h" 7 8 #include <stdio.h> 9 10 #include <Message.h> 11 12 13 PlaylistObserver::PlaylistObserver(BHandler* target) 14 : Playlist::Listener() 15 , AbstractLOAdapter(target) 16 { 17 } 18 19 20 PlaylistObserver::~PlaylistObserver() 21 { 22 } 23 24 25 void 26 PlaylistObserver::ItemAdded(PlaylistItem* item, int32 index) 27 { 28 BMessage message(MSG_PLAYLIST_ITEM_ADDED); 29 message.AddPointer("item", item); 30 message.AddInt32("index", index); 31 32 DeliverMessage(message); 33 } 34 35 36 void 37 PlaylistObserver::ItemRemoved(int32 index) 38 { 39 BMessage message(MSG_PLAYLIST_ITEM_REMOVED); 40 message.AddInt32("index", index); 41 42 DeliverMessage(message); 43 } 44 45 46 void 47 PlaylistObserver::ItemsSorted() 48 { 49 BMessage message(MSG_PLAYLIST_ITEMS_SORTED); 50 51 DeliverMessage(message); 52 } 53 54 55 void 56 PlaylistObserver::CurrentItemChanged(int32 newIndex) 57 { 58 BMessage message(MSG_PLAYLIST_CURRENT_ITEM_CHANGED); 59 message.AddInt32("index", newIndex); 60 61 DeliverMessage(message); 62 } 63 64 65 void 66 PlaylistObserver::ImportFailed() 67 { 68 BMessage message(MSG_PLAYLIST_IMPORT_FAILED); 69 70 DeliverMessage(message); 71 } 72 73 74