2002-04-26 14:28:30 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: styles.cpp
|
|
|
|
// Author: Robert Roebling
|
|
|
|
// Created: 04/07/02
|
2004-10-06 16:54:57 -04:00
|
|
|
// Copyright:
|
2002-04-26 14:28:30 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// For compilers that support precompilation
|
|
|
|
#include "wx/wxprec.h"
|
|
|
|
|
|
|
|
#ifdef __BORLANDC__
|
|
|
|
#pragma hdrstop
|
|
|
|
#endif
|
|
|
|
|
2002-09-03 15:17:56 -04:00
|
|
|
#include "wx/image.h"
|
|
|
|
|
2002-04-26 14:28:30 -04:00
|
|
|
// Include private headers
|
|
|
|
#include "styles.h"
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// MyFrame
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE(MyFrame,wxFrame)
|
|
|
|
EVT_MENU(ID_ABOUT, MyFrame::OnAbout)
|
|
|
|
EVT_MENU(ID_QUIT, MyFrame::OnQuit)
|
|
|
|
EVT_CLOSE(MyFrame::OnCloseWindow)
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
MyFrame::MyFrame( wxWindow *parent, wxWindowID id, const wxString &title,
|
|
|
|
const wxPoint &position, const wxSize& size, long style ) :
|
|
|
|
wxFrame( parent, id, title, position, size, style )
|
|
|
|
{
|
|
|
|
// Create menu and status bar.
|
|
|
|
CreateMyMenuBar();
|
2004-07-19 11:36:01 -04:00
|
|
|
#if wxUSE_STATUSBAR
|
2002-04-26 14:28:30 -04:00
|
|
|
CreateStatusBar(1);
|
2003-08-14 13:35:49 -04:00
|
|
|
SetStatusText( _T("Welcome to Styles!") );
|
2004-07-19 11:36:01 -04:00
|
|
|
#endif // wxUSE_STATUSBAR
|
2004-10-06 16:54:57 -04:00
|
|
|
|
2002-04-26 14:28:30 -04:00
|
|
|
wxImage image;
|
2003-08-14 13:35:49 -04:00
|
|
|
image.LoadFile( _T("marble.jpg"), wxBITMAP_TYPE_JPEG );
|
2004-10-06 16:54:57 -04:00
|
|
|
|
2002-04-26 14:28:30 -04:00
|
|
|
wxBitmap bitmap( image );
|
2002-09-04 07:14:55 -04:00
|
|
|
#ifdef __WXUNIVERSAL__
|
2002-04-26 14:28:30 -04:00
|
|
|
SetBackground( bitmap, 0, wxTILE );
|
2002-09-04 07:14:55 -04:00
|
|
|
#endif
|
2004-10-06 16:54:57 -04:00
|
|
|
|
2004-06-01 12:24:57 -04:00
|
|
|
new wxStaticText( this, wxID_ANY, _T("This is text"), wxPoint( 20,50 ) );
|
2004-10-06 16:54:57 -04:00
|
|
|
|
2004-06-01 12:24:57 -04:00
|
|
|
new wxCheckBox( this, wxID_ANY, _T("This is a checkbox"), wxPoint( 20,70 ) );
|
2002-04-26 14:28:30 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void MyFrame::CreateMyMenuBar()
|
|
|
|
{
|
|
|
|
wxMenu *file_menu = new wxMenu;
|
2003-08-14 13:35:49 -04:00
|
|
|
file_menu->Append( ID_ABOUT, _T("About..."), _T("Program info") );
|
2002-04-26 14:28:30 -04:00
|
|
|
file_menu->AppendSeparator();
|
2003-08-14 13:35:49 -04:00
|
|
|
file_menu->Append( ID_QUIT, _T("Quit..."), _T("Quit program") );
|
2002-04-26 14:28:30 -04:00
|
|
|
|
|
|
|
wxMenuBar *menu_bar = new wxMenuBar();
|
2003-08-14 13:35:49 -04:00
|
|
|
menu_bar->Append( file_menu, _T("&File") );
|
2004-10-06 16:54:57 -04:00
|
|
|
|
2002-04-26 14:28:30 -04:00
|
|
|
SetMenuBar( menu_bar );
|
|
|
|
}
|
|
|
|
|
2003-09-11 08:52:20 -04:00
|
|
|
void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) )
|
2002-04-26 14:28:30 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2003-09-11 08:52:20 -04:00
|
|
|
void MyFrame::OnQuit( wxCommandEvent &WXUNUSED(event) )
|
2002-04-26 14:28:30 -04:00
|
|
|
{
|
2004-06-01 12:24:57 -04:00
|
|
|
Close( true );
|
2002-04-26 14:28:30 -04:00
|
|
|
}
|
|
|
|
|
2003-09-11 08:52:20 -04:00
|
|
|
void MyFrame::OnCloseWindow( wxCloseEvent &WXUNUSED(event) )
|
2002-04-26 14:28:30 -04:00
|
|
|
{
|
|
|
|
Destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// MyApp
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
IMPLEMENT_APP(MyApp)
|
|
|
|
|
|
|
|
bool MyApp::OnInit()
|
|
|
|
{
|
2007-02-03 19:34:18 -05:00
|
|
|
if ( !wxApp::OnInit() )
|
|
|
|
return false;
|
|
|
|
|
2002-04-26 14:28:30 -04:00
|
|
|
wxInitAllImageHandlers();
|
|
|
|
|
2003-08-14 13:35:49 -04:00
|
|
|
SetVendorName(_T("Free world"));
|
|
|
|
SetAppName(_T("Styles"));
|
2004-10-06 16:54:57 -04:00
|
|
|
|
2004-06-01 12:24:57 -04:00
|
|
|
MyFrame *frame = new MyFrame( NULL, wxID_ANY, _T("Styles"), wxPoint(20,20), wxSize(500,340) );
|
|
|
|
frame->Show( true );
|
2004-10-06 16:54:57 -04:00
|
|
|
|
2004-06-01 12:24:57 -04:00
|
|
|
return true;
|
2002-04-26 14:28:30 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
int MyApp::OnExit()
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|