1 /*****************************************************************************
2 * ListViews.h: BeOS interface list view class prototype
3 *****************************************************************************
4 * Copyright (C) 1999, 2000, 2001 the VideoLAN team
7 * Authors: Stephan Aßmus <stippi@yellowbites.com>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
37 class InterfaceWindow;
40 class PlaylistItem : public BStringItem
43 PlaylistItem( const char* name );
44 virtual ~PlaylistItem();
46 virtual void Draw( BView* owner, BRect frame,
50 bool playing = false );
53 BString fName; // additional to BStringItem::Text()
57 // DragSortableListView
58 class DragSortableListView : public BListView
61 DragSortableListView( BRect frame,
64 = B_SINGLE_SELECTION_LIST,
72 virtual ~DragSortableListView();
75 virtual void Draw( BRect updateRect );
76 virtual bool InitiateDrag( BPoint point, int32 index,
78 virtual void MessageReceived( BMessage* message );
79 virtual void MouseMoved( BPoint where, uint32 transit,
80 const BMessage* dragMessage );
81 virtual void MouseUp( BPoint where );
82 virtual void WindowActivated( bool active );
83 virtual void DrawItem( BListItem *item, BRect itemFrame,
84 bool complete = false);
86 // DragSortableListView
87 virtual void ModifiersChanged(); // called by window
89 virtual void MoveItems( BList& items, int32 toIndex );
90 virtual void CopyItems( BList& items, int32 toIndex );
91 virtual void RemoveItemList( BList& indices );
92 void RemoveSelected(); // uses RemoveItemList()
93 int32 CountSelectedItems() const;
95 virtual BListItem* CloneItem( int32 atIndex ) const = 0;
96 virtual void DrawListItem( BView* owner, int32 index,
97 BRect itemFrame ) const = 0;
98 virtual void MakeDragMessage( BMessage* message ) const = 0;
101 void _SetDropAnticipationRect( BRect r );
102 void _SetDropIndex( int32 index );
103 void _RemoveDropAnticipationRect();
106 BMessage fDragMessageCopy;
113 class PlaylistView : public DragSortableListView
116 PlaylistView( intf_thread_t * p_intf,
118 InterfaceWindow* mainWindow,
119 BMessage* selectionChangeMessage = NULL );
123 virtual void AttachedToWindow();
124 virtual void MessageReceived( BMessage* message );
125 virtual void MouseDown( BPoint where );
126 virtual void KeyDown( const char* bytes, int32 numBytes );
127 virtual void Pulse();
128 virtual void SelectionChanged();
130 // DragSortableListView
131 virtual void MoveItems( BList& items, int32 toIndex );
132 virtual void CopyItems( BList& items, int32 toIndex );
133 virtual void RemoveItemList( BList& indices );
135 virtual BListItem* CloneItem( int32 atIndex ) const;
136 virtual void DrawListItem( BView* owner, int32 index,
137 BRect itemFrame ) const;
138 virtual void MakeDragMessage( BMessage* message ) const;
141 void SetCurrent( int32 index );
142 void SetPlaying( bool playing );
149 void SetDisplayMode( uint32 mode );
150 uint32 DisplayMode() const
151 { return fDisplayMode; }
154 BListItem* _PlayingItem() const;
155 void _SetPlayingIndex( BListItem* item );
157 intf_thread_t * p_intf;
162 InterfaceWindow* fMainWindow;
163 BMessage* fSelectionChangeMessage;
164 PlaylistItem* fLastClickedItem;
167 #endif // LIST_VIEWS_H