All pastes #235042 Raw Edit

wxwidgets_sth

public text v1 · immutable
·published 2006-11-02 23:30 UTC
rendered paste body
#include <wx/wx.h>
#include "hello_wxwidgets.h"

BEGIN_EVENT_TABLE( hello_wxWidgetsFrame, wxFrame )
	EVT_MENU( Menu_File_Quit, hello_wxWidgetsFrame::OnQuit )
	EVT_MENU( Menu_File_About, hello_wxWidgetsFrame::OnAbout )
END_EVENT_TABLE()

IMPLEMENT_APP(hello_wxWidgetsapp)
	

bool 
hello_wxWidgetsapp::OnInit()
{
	hello_wxWidgetsFrame *frame = new hello_wxWidgetsFrame( wxT( "Hello World" ), wxPoint(50,50), wxSize(450,340) );

	frame->Show(TRUE);
	SetTopWindow(frame);
	return TRUE;
} 

hello_wxWidgetsFrame::hello_wxWidgetsFrame( const wxString& title, const wxPoint& pos, const wxSize& size )
	: wxFrame((wxFrame *)NULL, -1, title, pos, size)
{
	wxMenu *menuFile = new wxMenu;
	
	menuFile->Append( Menu_File_About, wxT( "&About..." ) );
	menuFile->AppendSeparator();
	menuFile->Append( Menu_File_Quit, wxT( "E&xit" ) );
	
	wxMenuBar *menuBar = new wxMenuBar;
	menuBar->Append( menuFile, wxT( "&File" ) );
	
	SetMenuBar( menuBar );
	
	CreateStatusBar();
	SetStatusText( wxT( "Welcome to Kdevelop wxWidgets app!" ) );
}

void 
hello_wxWidgetsFrame::OnQuit( wxCommandEvent& WXUNUSED( event ) )
{
	Close(TRUE);
}

void 
hello_wxWidgetsFrame::OnAbout( wxCommandEvent& WXUNUSED( event ) )
{
	wxMessageBox( wxT( "This is a wxWidgets Hello world sample" ),
			wxT( "About Hello World" ), wxOK | wxICON_INFORMATION, this );
}