]> git.sesse.net Git - vlc/blob - modules/gui/beos/ListViews.h
Attempt to port new BeOS features from the stable branch.
[vlc] / modules / gui / beos / ListViews.h
1 /*****************************************************************************
2  * ListViews.h: BeOS interface list view class prototype
3  *****************************************************************************
4  * Copyright (C) 1999, 2000, 2001 VideoLAN
5  * $Id: ListViews.h,v 1.1 2002/09/30 18:30:27 titer Exp $
6  *
7  * Authors: Stephan Aßmus <stippi@yellowbites.com>
8  *
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.
13  * 
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.
18  *
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., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22  *****************************************************************************/
23
24 #ifndef LIST_VIEWS_H
25 #define LIST_VIEWS_H
26
27 #include <ListItem.h>
28 #include <ListView.h>
29
30 class InterfaceWindow;
31
32 // PlaylistItem
33 class PlaylistItem : public BStringItem
34 {
35  public:
36                                                         PlaylistItem( const char* name );
37                 virtual                         ~PlaylistItem();
38
39                 virtual void            Draw( BView* owner, BRect frame,
40                                                                   bool tintedLine,
41                                                                   bool active = false,
42                                                                   bool playing = false );
43
44 };
45
46 // DragSortableListView
47 class DragSortableListView : public BListView
48 {
49  public:
50                                                         DragSortableListView( BRect frame,
51                                                                                                   const char* name,
52                                                                                                   list_view_type type
53                                                                                                                 = B_SINGLE_SELECTION_LIST,
54                                                                                                   uint32 resizingMode
55                                                                                                                 = B_FOLLOW_LEFT
56                                                                                                                   | B_FOLLOW_TOP,
57                                                                                                   uint32 flags
58                                                                                                                 = B_WILL_DRAW
59                                                                                                                   | B_NAVIGABLE
60                                                                                                                   | B_FRAME_EVENTS );
61         virtual                                 ~DragSortableListView();
62
63                                                         // BListView
64         virtual void                    Draw( BRect updateRect );
65         virtual bool                    InitiateDrag( BPoint point, int32 index,
66                                                                                   bool wasSelected );
67         virtual void                    MessageReceived( BMessage* message );
68         virtual void                    MouseMoved( BPoint where, uint32 transit,
69                                                                                 const BMessage* dragMessage );
70         virtual void                    MouseUp( BPoint where );
71         virtual void                    WindowActivated( bool active );
72         virtual void                    DrawItem( BListItem *item, BRect itemFrame,
73                                                                           bool complete = false);
74
75                                                         // DragSortableListView
76         virtual BListItem*              CloneItem( int32 atIndex ) const = 0;
77         virtual void                    DrawListItem( BView* owner, int32 index,
78                                                                                   BRect itemFrame ) const = 0;
79         virtual void                    MakeDragMessage( BMessage* message ) const = 0;
80
81  private:
82         int32                   fDropIndex;
83 };
84
85 // PlaylistView
86 class PlaylistView : public DragSortableListView
87 {
88  public:
89                                                         PlaylistView( BRect frame,
90                                                                                   InterfaceWindow* mainWindow );
91                                                         ~PlaylistView();
92
93                                                         // BListView
94         virtual void                    AttachedToWindow();
95         virtual void                    MouseDown( BPoint where );
96         virtual void                    KeyDown( const char* bytes, int32 numBytes );
97         virtual void                    Pulse();
98
99                                                         // DragSortableListView
100         virtual BListItem*              CloneItem( int32 atIndex ) const;
101         virtual void                    DrawListItem( BView* owner, int32 index,
102                                                                                   BRect itemFrame ) const;
103         virtual void                    MakeDragMessage( BMessage* message ) const;
104
105                                                         // PlaylistView
106                         void                    SetCurrent( int32 index );
107                         void                    SetPlaying( bool playing );
108
109  private:
110         int32                                   fCurrentIndex;
111         bool                                    fPlaying;
112         InterfaceWindow*                fMainWindow;
113 };
114
115 #endif // LIST_VIEWS_H