Mercurial > mercurial > hgweb_mpos.cgi
view myframe.cpp @ 0:6235b9a84d53
First Release.
author | pyon@macmini |
---|---|
date | Mon, 21 Apr 2014 20:44:57 +0900 |
parents | |
children |
line wrap: on
line source
#include "myframe.h" MyFrame::MyFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style ) { this->SetIcon( wxIcon( wxT("sample") ) ); this->SetSizeHints( wxDefaultSize, wxDefaultSize ); this->SetBackgroundColour( wxColour( 0, 0, 0 ) ); wxBoxSizer* bSizerTop = new wxBoxSizer( wxVERTICAL ); wxBoxSizer* bSizer = new wxBoxSizer( wxHORIZONTAL ); m_textCtrlPos = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); bSizer->Add( m_textCtrlPos, 0, wxALL, 5 ); m_buttonRec = new wxButton( this, ID_REC, wxT("Record"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); bSizer->Add( m_buttonRec, 1, wxALL, 5 ); bSizerTop->Add( bSizer, 0, wxEXPAND, 5 ); m_textCtrlRec = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE ); m_textCtrlRec->SetFocus(); bSizerTop->Add( m_textCtrlRec, 1, wxALL|wxEXPAND, 5 ); this->SetSizer( bSizerTop ); this->Layout(); this->Centre( wxBOTH ); } MyFrame::~MyFrame() { } // Event Table BEGIN_EVENT_TABLE( MyFrame, wxFrame ) EVT_MOVE( MyFrame::OnWinMove ) EVT_BUTTON( ID_REC, MyFrame::OnRec ) END_EVENT_TABLE() // Event Handlers & Functions /* ウィンドウ移動したら位置とサイズを表示 */ void MyFrame::OnWinMove( wxMoveEvent& WXUNUSED(event) ) { wxRect r = this->GetRect(); int x = r.GetX(); int y = r.GetY(); int w = r.GetWidth(); int h = r.GetHeight(); m_textCtrlPos->SetValue( wxString::Format(wxT( "%5d,%5d"), x, y ) ); } void MyFrame::OnRec( wxCommandEvent& WXUNUSED(event) ) { wxString pos; pos = m_textCtrlPos->GetValue(); m_textCtrlRec->AppendText( pos ); m_textCtrlRec->WriteText( wxT("\n") ); }