--- wxCpuThrottle/src/wxcputhrottleframe.cpp 2007/08/08 21:00:34 20 +++ wxCpuThrottle/src/wxcputhrottleframe.cpp 2007/08/09 20:57:19 24 @@ -20,22 +20,45 @@ #include "wxcputhrottleframe.h" +#include "SysMetrix.xpm" + BEGIN_EVENT_TABLE( wxCpuThrottleFrame, wxDialog ) EVT_CLOSE( wxCpuThrottleFrame::OnClose ) END_EVENT_TABLE() -wxCpuThrottleFrame::wxCpuThrottleFrame( const wxString& title, const wxPoint& pos, const wxSize& size ) - : wxDialog((wxDialog *)NULL, -1, title, pos, size) - //mTrayIcon(this) -{ +enum +{ + ID_SLIDER = 2000 +}; + +wxCpuThrottleFrame::wxCpuThrottleFrame( ) + : wxDialog(NULL, -1, wxT("wxCpuThrottle"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER), + mIcon(SysMetrix_xpm) +{ + mParser.ReadAcpiFile(); + SetIcon(mIcon); + mTrayIcon = new TrayIcon(this); mTrayIcon->SetIcon(mIcon,wxT("wxCpuThrottle") ); + + wxBoxSizer* mainSizer = new wxBoxSizer( wxVERTICAL ); + + wxSlider* slider = new wxSlider(this, ID_SLIDER, mParser.GetCurrentState(), 0, mParser.GetStateCount()-1, wxDefaultPosition, wxSize(80,200), wxSL_VERTICAL|wxSL_AUTOTICKS|wxSL_LEFT|wxSL_LABELS); + mainSizer->Add(slider, 1, wxEXPAND,0); + + + SetSizer(mainSizer); + mainSizer->SetSizeHints(this ); + + } void wxCpuThrottleFrame::OnQuit( wxCommandEvent& WXUNUSED( event ) ) { delete mTrayIcon; + mTrayIcon = 0; + Close(TRUE); wxExit(); @@ -46,4 +69,10 @@ Show(false); } - +void wxCpuThrottleFrame::SetPosition() +{ + const int freeBorder = 20; + wxSize screenSize = ::wxGetDisplaySize(); + wxSize mySize = GetSize(); + Move(screenSize.GetWidth()-mySize.GetWidth() - freeBorder, screenSize.GetHeight() - mySize.GetHeight() - freeBorder); +}