#include "folder.xpm"
#include "list.xpm"
+#include "test.xpm"
//-----------------------------------------------------------------------------
// main program
// MyDialog
//-----------------------------------------------------------------------------
-const ID_RETURN = 100;
-const ID_HELLO = 101;
+const int ID_RETURN = 100;
+const int ID_HELLO = 101;
-const ID_CHECKBOX = 110;
-const ID_CHECKBOX_CHECK = 110;
-const ID_CHECKBOX_UNCHECK = 112;
+const int ID_CHECKBOX = 110;
+const int ID_CHECKBOX_CHECK = 110;
+const int ID_CHECKBOX_UNCHECK = 112;
-const ID_TEXTCTRL = 115;
-const ID_TEXTCTRL_SET = 116;
-const ID_TEXTCTRL_DEL = 117;
+const int ID_TEXTCTRL = 115;
+const int ID_TEXTCTRL_SET = 116;
+const int ID_TEXTCTRL_DEL = 117;
-const ID_CHOICE = 120;
-const ID_CHOICE_SEL_NUM = 121;
-const ID_CHOICE_SEL_STR = 122;
-const ID_CHOICE_CLEAR = 123;
-const ID_CHOICE_APPEND = 124;
+const int ID_CHOICE = 120;
+const int ID_CHOICE_SEL_NUM = 121;
+const int ID_CHOICE_SEL_STR = 122;
+const int ID_CHOICE_CLEAR = 123;
+const int ID_CHOICE_APPEND = 124;
-const ID_LISTBOX = 130;
-const ID_LISTBOX_SEL_NUM = 131;
-const ID_LISTBOX_SEL_STR = 132;
-const ID_LISTBOX_CLEAR = 133;
-const ID_LISTBOX_APPEND = 134;
+const int ID_LISTBOX = 130;
+const int ID_LISTBOX_SEL_NUM = 131;
+const int ID_LISTBOX_SEL_STR = 132;
+const int ID_LISTBOX_CLEAR = 133;
+const int ID_LISTBOX_APPEND = 134;
-const ID_RADIOBOX = 130;
-const ID_RADIOBOX_SEL_NUM = 131;
-const ID_RADIOBOX_SEL_STR = 132;
+const int ID_RADIOBOX = 130;
+const int ID_RADIOBOX_SEL_NUM = 131;
+const int ID_RADIOBOX_SEL_STR = 132;
BEGIN_EVENT_TABLE(MyDialog,wxDialog)
EVT_BUTTON (ID_RETURN, MyDialog::OnReturnButton)
MyDialog::MyDialog( wxWindow *parent ) :
wxDialog( parent, -1, "TestDialog", wxPoint(20,100), wxSize(700,400), wxDIALOG_MODAL )
{
- m_text1 = NULL;
- m_text2 = NULL;
+ m_text1 = (wxStaticText *) NULL;
+ m_text2 = (wxStaticText *) NULL;
(void)new wxStaticBox( this, -1, "CheckBox group", wxPoint(20,10), wxSize(140,180) );
m_checkbox = new wxCheckBox( this, ID_CHECKBOX, "CheckBox", wxPoint(40,35), wxSize(100,30) );
};
case ID_TEXTCTRL_DEL:
{
- m_textctrl->Delete();
+ m_textctrl->Clear();
break;
};
};
{
wxMessageDialog *dialog;
dialog = new wxMessageDialog( this, "Now, I will paint on Screen.", "wxGTK" );
- dialog->ShowModal();
+ dialog->ShowModal();
delete dialog;
wxScreenDC dc;
: wxScrolledWindow( parent, id, pos, size, wxSUNKEN_BORDER )
{
my_bitmap = new wxBitmap( folder_xpm );
- my_horse = new wxBitmap();
- my_horse->LoadFile( "horse.png", 0 );
+ my_horse = new wxBitmap( test_xpm);
my_backstore = new wxBitmap( 150, 150 );
my_font = new wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL );
m_isCreated = FALSE;
IMPLEMENT_DYNAMIC_CLASS( MyFrame, wxFrame )
BEGIN_EVENT_TABLE(MyFrame,wxFrame)
- EVT_SIZE (MyFrame::OnSize)
EVT_MENU (ID_OPEN, MyFrame::OnOpenDialog)
EVT_MENU (ID_FONT, MyFrame::OnFontDialog)
EVT_MENU (ID_MSG, MyFrame::OnMsg)
END_EVENT_TABLE()
MyFrame::MyFrame(void) :
- wxFrame( NULL, -1, "Robert's Test application", wxPoint(20,20), wxSize(470,360) )
+ wxFrame( (wxFrame *) NULL, -1, (char *) "Robert's Test application", wxPoint(20,20), wxSize(470,360) )
{
+/*
wxMenu *file_menu = new wxMenu( "Test" );
file_menu->Append( ID_OPEN, "Open..");
file_menu->Append( ID_MSG, "MessageBox..");
menu_bar->Show( TRUE );
SetMenuBar( menu_bar );
+*/
CreateStatusBar( 2 );
m_canvas = new MyCanvas( this, -1, wxPoint(2,62), wxSize(300-4,120-4) );
m_canvas->SetScrollbars( 10, 10, 50, 50 );
- m_tb = new wxToolBarGTK( this, -1, wxPoint(2,60), wxSize(300-4,26) );
- m_tb->SetMargins( 2, 2 );
-
- wxBitmap *bm = new wxBitmap( list_xpm );
- m_tb->AddTool( 0, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "This is a button" );
- bm = new wxBitmap( folder_xpm );
- m_tb->AddTool( 0, *bm, wxNullBitmap, TRUE, -1, -1, NULL, "This is a toggle" );
-
- m_tb->Layout();
- m_tb->Show( TRUE );
+ m_tb = CreateToolBar();
+ m_tb->AddTool( 0, wxBitmap( list_xpm ), wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, "This is a button" );
+ m_tb->AddTool( 0, wxBitmap( folder_xpm ), wxNullBitmap, TRUE, -1, -1, (wxObject *) NULL, "This is a toggle" );
+ m_tb->Realize();
// m_timer.Start( 1000, TRUE );
};
-void MyFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
-{
- int x = 0;
- int y = 0;
- GetClientSize( &x, &y );
-
- m_tb->SetSize( 1, 0, x-2, 42 );
- m_canvas-> SetSize( 0, 42, x, y-42 );
-};
-
void MyFrame::OnDialog( wxCommandEvent &WXUNUSED(event) )
{
- MyDialog dialog( this );
- dialog.ShowModal();
+ MyDialog *dialog = new MyDialog( this );
+ dialog->ShowModal();
+ dialog->Close( TRUE );
};
void MyFrame::OnFontDialog( wxCommandEvent &WXUNUSED(event) )