1 |
/*************************************************************************** |
2 |
* Copyright (C) 2007 by Torben Nielsen * |
3 |
* torben@t-hoerup.dk * |
4 |
* * |
5 |
* This program is free software; you can redistribute it and/or modify * |
6 |
* it under the terms of the GNU General Public License as published by * |
7 |
* the Free Software Foundation; either version 2 of the License, or * |
8 |
* (at your option) any later version. * |
9 |
* * |
10 |
* This program is distributed in the hope that it will be useful, * |
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
13 |
* GNU General Public License for more details. * |
14 |
* * |
15 |
* You should have received a copy of the GNU General Public License * |
16 |
* along with this program; if not, write to the * |
17 |
* Free Software Foundation, Inc., * |
18 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
19 |
***************************************************************************/ |
20 |
|
21 |
#include "wxcputhrottleframe.h" |
22 |
|
23 |
#include "SysMetrix.xpm" |
24 |
|
25 |
BEGIN_EVENT_TABLE( wxCpuThrottleFrame, wxDialog ) |
26 |
EVT_CLOSE( wxCpuThrottleFrame::OnClose ) |
27 |
END_EVENT_TABLE() |
28 |
|
29 |
|
30 |
wxCpuThrottleFrame::wxCpuThrottleFrame( const wxString& title, const wxPoint& pos, const wxSize& size ) |
31 |
: wxDialog((wxDialog *)NULL, -1, title, pos, size), |
32 |
mIcon(SysMetrix_xpm) |
33 |
{ |
34 |
SetIcon(mIcon); |
35 |
mTrayIcon = new TrayIcon(this); |
36 |
mTrayIcon->SetIcon(mIcon,wxT("wxCpuThrottle") ); |
37 |
} |
38 |
|
39 |
void wxCpuThrottleFrame::OnQuit( wxCommandEvent& WXUNUSED( event ) ) |
40 |
{ |
41 |
delete mTrayIcon; |
42 |
mTrayIcon = 0; |
43 |
|
44 |
Close(TRUE); |
45 |
wxExit(); |
46 |
|
47 |
} |
48 |
|
49 |
void wxCpuThrottleFrame::OnClose( wxCloseEvent& WXUNUSED( event ) ) |
50 |
{ |
51 |
Show(false); |
52 |
} |
53 |
|
54 |
void wxCpuThrottleFrame::SetPosition() |
55 |
{ |
56 |
const int freeBorder = 20; |
57 |
wxSize screenSize = ::wxGetDisplaySize(); |
58 |
wxSize mySize = GetSize(); |
59 |
Move(screenSize.GetWidth()-mySize.GetWidth() - freeBorder, screenSize.GetHeight() - mySize.GetHeight() - freeBorder); |
60 |
} |