1 /*****************************************************************************
2 * iteminfo.cpp : wxWindows plugin for vlc
3 *****************************************************************************
4 * Copyright (C) 2000-2004 the VideoLAN team
7 * Authors: Clément Stenac <zorglub@videolan.org>
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 *****************************************************************************/
24 #include "dialogs/iteminfo.hpp"
25 #include "dialogs/infopanels.hpp"
26 #include <wx/combobox.h>
27 #include <wx/statline.h>
30 # define wxRB_SINGLE 0
33 /*****************************************************************************
35 *****************************************************************************/
37 /* IDs for the controls and the menu commands */
45 BEGIN_EVENT_TABLE(ItemInfoDialog, wxDialog)
47 EVT_BUTTON(wxID_OK, ItemInfoDialog::OnOk)
48 EVT_BUTTON(wxID_CANCEL, ItemInfoDialog::OnCancel)
52 /*****************************************************************************
54 *****************************************************************************/
55 ItemInfoDialog::ItemInfoDialog( intf_thread_t *_p_intf,
56 playlist_item_t *_p_item,
57 wxWindow* _p_parent ):
58 wxDialog( _p_parent, -1, wxU(_("Playlist item info")),
59 wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE )
65 SetIcon( *p_intf->p_sys->p_icon );
67 /* Create a panel to put everything in */
68 wxPanel *panel = new wxPanel( this, -1 );
69 panel->SetAutoLayout( TRUE );
71 /* Create the standard info panel */
72 info_panel = new ItemInfoPanel(p_intf, panel, true );
73 info_panel->Update( &(p_item->input) );
75 wxStaticLine *static_line = new wxStaticLine( panel, wxID_OK );
77 /* Create the buttons */
78 wxButton *ok_button = new wxButton( panel, wxID_OK );
79 ok_button->SetDefault();
80 wxButton *cancel_button = new wxButton( panel, wxID_CANCEL );
82 /* Place everything in sizers */
83 wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL );
84 button_sizer->Add( ok_button, 0, wxALL, 5 );
85 button_sizer->Add( cancel_button, 0, wxALL, 5 );
86 button_sizer->Layout();
87 wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL );
88 wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL );
89 panel_sizer->Add( info_panel, 1, wxEXPAND | wxALL, 5 );
90 panel_sizer->Add( static_line, 0, wxEXPAND | wxALL, 5 );
91 panel_sizer->Add( button_sizer, 0, wxALIGN_LEFT | wxALIGN_BOTTOM |
93 panel_sizer->Layout();
94 panel->SetSizerAndFit( panel_sizer );
95 main_sizer->Add( panel, 1, wxGROW, 0 );
97 SetSizerAndFit( main_sizer );
100 ItemInfoDialog::~ItemInfoDialog()
105 /*****************************************************************************
107 *****************************************************************************/
108 void ItemInfoDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
110 vlc_mutex_lock( &p_item->input.lock );
111 p_item->input.psz_name = info_panel->GetName();
112 p_item->input.psz_uri = info_panel->GetURI();
113 vlc_mutex_unlock( &p_item->input.lock );
117 void ItemInfoDialog::OnCancel( wxCommandEvent& WXUNUSED(event) )
119 EndModal( wxID_CANCEL );