forked from dimbor-ru/opennx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathForeignFrame.cpp
240 lines (192 loc) · 5.09 KB
/
ForeignFrame.cpp
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
// $Id: ForeignFrame.cpp 591 2010-10-24 23:58:47Z felfert $
//
// Copyright (C) 2006 The OpenNX team
// Author: Fritz Elfert
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU Library 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 Library General Public
// License along with this program; if not, write to the
// Free Software Foundation, Inc.,
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "ForeignFrame.h"
#endif
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
/*
* Defines canonicalized platform names (e.g. __LINUX__)
*/
#include <wx/platform.h>
#ifndef __WXMSW__
////@begin includes
////@end includes
#include "ForeignFrame.h"
#include "osdep.h"
////@begin XPM images
////@end XPM images
/*!
* ForeignFrame type definition
*/
#define ID_TIMER 5999
IMPLEMENT_CLASS( ForeignFrame, wxFrame )
/*!
* ForeignFrame event table definition
*/
BEGIN_EVENT_TABLE( ForeignFrame, wxFrame )
////@begin ForeignFrame event table entries
EVT_WINDOW_CREATE( ForeignFrame::OnCreate )
EVT_MENU( XRCID("ID_FOREIGN_SUSPEND"), ForeignFrame::OnForeignSuspendClick )
EVT_MENU( XRCID("ID_FOREIGN_TERMINATE"), ForeignFrame::OnForeignTerminateClick )
EVT_MENU( XRCID("ID_FOREIGN_CLOSE"), ForeignFrame::OnForeignCloseClick )
////@end ForeignFrame event table entries
EVT_TIMER(ID_TIMER, ForeignFrame::OnTimer)
END_EVENT_TABLE()
/*!
* ForeignFrame constructors
*/
ForeignFrame::ForeignFrame( )
: m_cTimer(this, ID_TIMER)
{
Init();
}
ForeignFrame::ForeignFrame( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
: m_cTimer(this, ID_TIMER)
{
Init();
Create( parent, id, caption, pos, size, style );
}
/*!
* ForeignFrame creator
*/
bool ForeignFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
////@begin ForeignFrame creation
SetParent(parent);
CreateControls();
////@end ForeignFrame creation
wxUnusedVar(style);
wxUnusedVar(size);
wxUnusedVar(pos);
wxUnusedVar(caption);
wxUnusedVar(id);
return true;
}
/*!
* Member initialisation
*/
void ForeignFrame::Init()
{
////@begin ForeignFrame member initialisation
////@end ForeignFrame member initialisation
}
/*!
* Control creation for ForeignFrame
*/
void ForeignFrame::CreateControls()
{
////@begin ForeignFrame content construction
if (!wxXmlResource::Get()->LoadFrame(this, GetParent(), wxT("ID_FOREIGNFRAME")))
wxLogError(wxT("Missing wxXmlResource::Get()->Load() in OnInit()?"));
////@end ForeignFrame content construction
// Create custom windows not generated automatically here.
////@begin ForeignFrame content initialisation
////@end ForeignFrame content initialisation
wxToolBar *tb = GetToolBar();
tb->Fit();
wxSize sz = tb->GetBestSize();
SetMinSize(sz);
SetMaxSize(sz);
SetSize(sz);
}
/*!
* Should we show tooltips?
*/
bool ForeignFrame::ShowToolTips()
{
return true;
}
/*!
* Get bitmap resources
*/
wxBitmap ForeignFrame::GetBitmapResource( const wxString& name )
{
// Bitmap retrieval
////@begin ForeignFrame bitmap retrieval
wxUnusedVar(name);
return wxNullBitmap;
////@end ForeignFrame bitmap retrieval
}
/*!
* Get icon resources
*/
wxIcon ForeignFrame::GetIconResource( const wxString& name )
{
// Icon retrieval
////@begin ForeignFrame icon retrieval
wxUnusedVar(name);
return wxNullIcon;
////@end ForeignFrame icon retrieval
}
void ForeignFrame::OnTimer( wxTimerEvent& event )
{
Hide();
Close();
event.Skip();
}
/*!
* wxEVT_COMMAND_MENU_SELECTED event handler for ID_FOREIGN_SUSPEND
*/
void ForeignFrame::OnForeignSuspendClick( wxCommandEvent& event )
{
Close();
event.Skip();
::wxKill(getppid(), wxSIGHUP);
}
/*!
* wxEVT_COMMAND_MENU_SELECTED event handler for ID_FOREIGN_TERMINATE
*/
void ForeignFrame::OnForeignTerminateClick( wxCommandEvent& event )
{
Close();
event.Skip();
::wxKill(m_nOtherPID, wxSIGTERM);
}
/*!
* wxEVT_COMMAND_MENU_SELECTED event handler for ID_FOREIGN_CLOSE
*/
void ForeignFrame::OnForeignCloseClick( wxCommandEvent& event )
{
Close();
event.Skip();
close_foreign(m_nForeignWindowID);
}
/*!
* wxEVT_CREATE event handler for ID_FOREIGNFRAME
*/
void ForeignFrame::OnCreate( wxWindowCreateEvent& event )
{
reparent_pulldown(m_nForeignWindowID);
m_cTimer.Start(6000, wxTIMER_ONE_SHOT);
event.Skip();
}
#endif
// !__WXMSW__