1 /*****************************************************************************
2 * PlayListWindow.cpp: beos interface
3 *****************************************************************************
4 * Copyright (C) 1999, 2000, 2001 VideoLAN
5 * $Id: PlayListWindow.cpp,v 1.1 2001/06/15 09:07:10 tcastley Exp $
7 * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
8 * Samuel Hocevar <sam@zoy.org>
9 * Tony Castley <tony@castley.net>
10 * Richard Shepherd <richard@rshepherd.demon.co.uk>
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
25 *****************************************************************************/
29 #include <InterfaceKit.h>
30 #include <StorageKit.h>
41 #include "stream_control.h"
42 #include "input_ext-intf.h"
43 #include "interface.h"
45 #include "intf_playlist.h"
48 /* BeOS interface headers */
49 #include "InterfaceWindow.h"
50 #include "PlayListWindow.h"
53 /*****************************************************************************
55 *****************************************************************************/
57 PlayListWindow::PlayListWindow( BRect frame, const char *name,
59 : BWindow( frame, name, B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
60 B_WILL_ACCEPT_FIRST_CLICK | B_ASYNCHRONOUS_CONTROLS )
62 SetName( "playlist" );
66 /* set up the main menu */
68 menu_bar = new BMenuBar(BRect(0,0,0,0), "main menu");
72 /* Add the file Menu */
74 menu_bar->AddItem( mFile = new BMenu( "File" ) );
75 menu_bar->ResizeToPreferred();
76 mFile->AddItem( mItem = new BMenuItem( "Open File" B_UTF8_ELLIPSIS,
77 new BMessage(OPEN_FILE), 'O') );
79 CDMenu *cd_menu = new CDMenu( "Open Disc" );
80 mFile->AddItem( cd_menu );
82 BRect rect = Bounds();
83 rect.top += menu_bar->Bounds().IntegerHeight() + 1;
84 BView *p_view = new BView(rect, NULL, B_FOLLOW_ALL_SIDES, B_WILL_DRAW);
86 p_listview = new BListView(rect, "PlayList",
87 B_MULTIPLE_SELECTION_LIST);
88 for (int i=0; i < p_playlist->i_size; i++)
90 p_listview->AddItem(new BStringItem(p_playlist->p_item[i].psz_name));
92 p_view->AddChild(new BScrollView("scroll_playlist", p_listview,
93 B_FOLLOW_LEFT | B_FOLLOW_TOP, 0, false, true));
98 PlayListWindow::~PlayListWindow()
102 /*****************************************************************************
103 * PlayListWindow::MessageReceived
104 *****************************************************************************/
105 void PlayListWindow::MessageReceived( BMessage * p_message )
109 switch( p_message->what )
117 file_panel = new BFilePanel();
118 file_panel->SetTarget( this );
123 const char *psz_device;
124 char psz_source[ B_FILE_NAME_LENGTH + 4 ];
125 if( p_message->FindString("device", &psz_device) != B_ERROR )
127 snprintf( psz_source, B_FILE_NAME_LENGTH + 4,
128 "dvd:%s", psz_device );
129 psz_source[ strlen(psz_source) ] = '\0';
130 intf_PlaylistAdd( p_playlist, PLAYLIST_END, (char*)psz_source );
131 p_listview->AddItem(new BStringItem((char*)psz_source));
133 case B_REFS_RECEIVED:
137 if( p_message->FindRef( "refs", &ref ) == B_OK )
140 intf_PlaylistAdd( p_playlist,
141 PLAYLIST_END, (char*)path.Path() );
142 p_listview->AddItem(new BStringItem((char*)path.Path()));
147 BWindow::MessageReceived( p_message );