-#ifdef __WXMSW__
- int width = 24;
-#else
- int width = 16;
-#endif
- int currentX = 5;
-
- toolBar->AddTool( MDI_NEW_WINDOW, *(bitmaps[0]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "New file");
- currentX += width + 5;
- toolBar->AddTool(1, *bitmaps[1], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Open file");
- currentX += width + 5;
- toolBar->AddTool(2, *bitmaps[2], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Save file");
- currentX += width + 5;
- toolBar->AddSeparator();
- toolBar->AddTool(3, *bitmaps[3], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Copy");
- currentX += width + 5;
- toolBar->AddTool(4, *bitmaps[4], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Cut");
- currentX += width + 5;
- toolBar->AddTool(5, *bitmaps[5], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Paste");
- currentX += width + 5;
- toolBar->AddSeparator();
- toolBar->AddTool(6, *bitmaps[6], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Print");
- currentX += width + 5;
- toolBar->AddSeparator();
- toolBar->AddTool(7, *bitmaps[7], wxNullBitmap, TRUE, currentX, -1, (wxObject *) NULL, "Help");
-
- toolBar->Realize();
-
- int i;
- for (i = 0; i < 8; i++)
- delete bitmaps[i];
+void MyChild::OnSize(wxSizeEvent& event)
+{
+ // VZ: under MSW the size event carries the client size (quite
+ // unexpectedly) *except* for the very first one which has the full
+ // size... what should it really be? TODO: check under wxGTK
+ wxSize size1 = event.GetSize(),
+ size2 = GetSize(),
+ size3 = GetClientSize();
+ wxLogStatus("size from event: %dx%d, from frame %dx%d, client %dx%d",
+ size1.x, size1.y, size2.x, size2.y, size3.x, size3.y);
+
+ event.Skip();
+}
+
+void MyChild::OnCloseWindow(wxCloseEvent& event)
+{
+ if ( m_canvas && m_canvas->IsDirty() )
+ {
+ if ( wxMessageBox("Really close?", "Please confirm",
+ wxICON_QUESTION | wxYES_NO) != wxYES )
+ {
+ event.Veto();
+
+ return;
+ }
+ }
+
+ event.Skip();
+}
+
+#if wxUSE_CLIPBOARD
+
+#include "wx/clipbrd.h"
+
+void MyChild::OnPaste(wxCommandEvent& WXUNUSED(event))
+{
+ wxClipboardLocker lock;
+ wxTextDataObject data;
+ m_canvas->SetText(wxTheClipboard->GetData(data)
+ ? data.GetText()
+ : wxString("No text on clipboard"));
+}
+
+void MyChild::OnUpdatePaste(wxUpdateUIEvent& event)
+{
+ wxClipboardLocker lock;
+ event.Enable( wxTheClipboard->IsSupported(wxDF_TEXT) );