1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*****************************************************************************
* popup.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: popup.cpp,v 1.1 2002/12/13 01:50:32 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <stdlib.h> /* malloc(), free() */
#include <errno.h> /* ENOMEM */
#include <string.h> /* strerror() */
#include <stdio.h>
#include <vlc/vlc.h>
#ifdef WIN32 /* mingw32 hack */
#undef Yield
#undef CreateDialog
#endif
/* Let vlc take care of the i18n stuff */
#define WXINTL_NO_GETTEXT_MACRO
#include <wx/wxprec.h>
#include <wx/wx.h>
#include <wx/listctrl.h>
#include <vlc/intf.h>
#include "wxwindows.h"
/*****************************************************************************
* Event Table.
*****************************************************************************/
/* IDs for the controls and the menu commands */
enum
{
/* menu items */
Close_Event = 1,
MenuEntry_Event,
MenuDummy_Event
};
BEGIN_EVENT_TABLE(PopupMenu, wxMenu)
/* Menu events */
EVT_MENU(Close_Event, PopupMenu::OnClose)
EVT_MENU(MenuEntry_Event, PopupMenu::OnEntrySelected)
END_EVENT_TABLE()
/*****************************************************************************
* Constructor.
*****************************************************************************/
PopupMenu::PopupMenu( intf_thread_t *_p_intf, Interface *_p_main_interface ):
wxMenu( "VideoLan" )
{
/* Initializations */
p_intf = _p_intf;
p_main_interface = _p_main_interface;
Append(MenuEntry_Event, "Dummy1");
Append(MenuEntry_Event, "Dummy2");
Append(MenuDummy_Event, "&Dummy sub menu",
CreateDummyMenu(), "Dummy sub menu help");
Append(MenuEntry_Event, "Dummy3", "", TRUE);
AppendSeparator();
Append( Close_Event, _("&Close") );
wxPoint mousepos = wxGetMousePosition();
p_main_interface->PopupMenu( this, mousepos.x, mousepos.y );
}
PopupMenu::~PopupMenu()
{
}
/*****************************************************************************
* Private methods.
*****************************************************************************/
void PopupMenu::OnClose( wxCommandEvent& WXUNUSED(event) )
{
p_intf->b_die = VLC_TRUE;
}
void PopupMenu::OnEntrySelected( wxCommandEvent& WXUNUSED(event) )
{
}
wxMenu *PopupMenu::CreateDummyMenu()
{
wxMenu *menu = new wxMenu;
menu->Append(MenuEntry_Event, "Sub Dummy1");
menu->AppendSeparator();
menu->Append(MenuEntry_Event, "Sub Dummy2", "", TRUE);
return menu;
}