66 lines
1.4 KiB
C++
66 lines
1.4 KiB
C++
#include "wxUI.h"
|
|
|
|
BEGIN_EVENT_TABLE(wxUI, wxFrame)
|
|
EVT_MENU(ID_Quit, wxUI::OnQuit)
|
|
EVT_MENU(ID_About, wxUI::OnAbout)
|
|
END_EVENT_TABLE()
|
|
|
|
wxUI::wxUI(KissCount* kiss, const wxString& title, const wxPoint& pos, const wxSize& size)
|
|
: wxFrame(NULL, -1, title, pos, size), _kiss(kiss)
|
|
{
|
|
_hbox = new wxBoxSizer(wxVERTICAL);
|
|
ButtonPanel* buttons = new ButtonPanel(_kiss, this);
|
|
wxMenu *menuFile = new wxMenu;
|
|
|
|
menuFile->Append( ID_About, _("&About...") );
|
|
menuFile->AppendSeparator();
|
|
menuFile->Append( ID_Quit, _("E&xit") );
|
|
|
|
wxMenuBar *menuBar = new wxMenuBar;
|
|
menuBar->Append( menuFile, _("&File") );
|
|
|
|
SetMenuBar( menuBar );
|
|
|
|
CreateStatusBar();
|
|
SetStatusText( _("Welcome to wxWidgets!") );
|
|
|
|
SetSizer(_hbox);
|
|
|
|
_hbox->Add(buttons);
|
|
}
|
|
|
|
wxUI::~wxUI()
|
|
{
|
|
if (_accountPanel) delete _accountPanel;
|
|
}
|
|
|
|
void wxUI::OnQuit(wxCommandEvent& WXUNUSED(event))
|
|
{
|
|
Close(true);
|
|
}
|
|
|
|
void wxUI::OnAbout(wxCommandEvent& WXUNUSED(event))
|
|
{
|
|
wxMessageBox( _("This is a wxWidgets Hello world sample"),
|
|
_("About Hello World"),
|
|
wxOK | wxICON_INFORMATION, this );
|
|
}
|
|
|
|
void wxUI::ChangeUser()
|
|
{
|
|
UsersDialog u(_kiss, this);
|
|
u.ShowModal();
|
|
}
|
|
|
|
void wxUI::LoadUser()
|
|
{
|
|
if (_accountPanel)
|
|
{
|
|
_hbox->Detach(_accountPanel);
|
|
delete _accountPanel;
|
|
}
|
|
_accountPanel = new AccountPanel(_kiss, this);
|
|
_hbox->Add(_accountPanel);
|
|
Layout();
|
|
}
|