]> git.saurik.com Git - wxWidgets.git/blobdiff - contrib/samples/gizmos/dynsash_switch/dynsash_switch.cpp
Rework modal dialog code to not depend on now obsolete wxDIALOG_MODAL flag.
[wxWidgets.git] / contrib / samples / gizmos / dynsash_switch / dynsash_switch.cpp
index 9e52f704467d086608a65f516f21684a78bd349c..50db96f4aca8d8b7c7b6de74e555a526c07a54dd 100644 (file)
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+    #pragma hdrstop
+#endif
+
+// for all others, include the necessary headers (this file is usually all you
+// need because it includes almost all "standard" wxWindows headers)
+#ifndef WX_PRECOMP
+    #include "wx/wx.h"
+#endif
+
 #include <wx/app.h>
 #include <wx/frame.h>
 #include <wx/choice.h>
 #include <wx/app.h>
 #include <wx/frame.h>
 #include <wx/choice.h>
@@ -56,15 +69,15 @@ SwitchView::SwitchView(wxDynamicSashWindow *win) {
 
     m_dyn_sash = win;
 
 
     m_dyn_sash = win;
 
-    m_bar = new wxWindow(this, -1, wxDefaultPosition, wxDefaultSize, wxRAISED_BORDER, "bar");
+    m_bar = new wxWindow(this, -1, wxDefaultPosition, wxDefaultSize, wxRAISED_BORDER, wxT("bar"));
     m_choice = new wxChoice(m_bar, -1);
     m_choice->SetEventHandler(this);
     m_choice = new wxChoice(m_bar, -1);
     m_choice->SetEventHandler(this);
-    m_view = new wxWindow(this, -1, wxDefaultPosition, wxDefaultSize, 0, "view");
+    m_view = new wxWindow(this, -1, wxDefaultPosition, wxDefaultSize, 0, wxT("view"));
     m_view->SetBackgroundColour(*wxWHITE);
     m_view->SetEventHandler(this);
 
     m_view->SetBackgroundColour(*wxWHITE);
     m_view->SetEventHandler(this);
 
-    m_choice->Append("Triangle");
-    m_choice->Append("Square");
+    m_choice->Append(wxT("Triangle"));
+    m_choice->Append(wxT("Square"));
     m_choice->SetSelection(0);
 
     wxLayoutConstraints *layout;
     m_choice->SetSelection(0);
 
     wxLayoutConstraints *layout;
@@ -96,30 +109,60 @@ SwitchView::SwitchView(wxDynamicSashWindow *win) {
     hscroll->SetEventHandler(this);
     vscroll->SetEventHandler(this);
 
     hscroll->SetEventHandler(this);
     vscroll->SetEventHandler(this);
 
-    Connect(GetId(), wxEVT_SIZE, (wxObjectEventFunction)&SwitchView::OnSize);
-    Connect(m_choice->GetId(), wxEVT_COMMAND_CHOICE_SELECTED, (wxObjectEventFunction)&SwitchView::OnChoice);
-    Connect(m_view->GetId(), wxEVT_PAINT, (wxObjectEventFunction)&SwitchView::OnPaint);
-
-    Connect(-1, wxEVT_SET_FOCUS, (wxObjectEventFunction)&SwitchView::OnFocus);
-    Connect(-1, wxEVT_SCROLL_TOP, (wxObjectEventFunction)&SwitchView::OnScroll);
-    Connect(-1, wxEVT_SCROLL_BOTTOM, (wxObjectEventFunction)&SwitchView::OnScroll);
-    Connect(-1, wxEVT_SCROLL_LINEUP, (wxObjectEventFunction)&SwitchView::OnScroll);
-    Connect(-1, wxEVT_SCROLL_LINEDOWN, (wxObjectEventFunction)&SwitchView::OnScroll);
-    Connect(-1, wxEVT_SCROLL_PAGEUP, (wxObjectEventFunction)&SwitchView::OnScroll);
-    Connect(-1, wxEVT_SCROLL_PAGEDOWN, (wxObjectEventFunction)&SwitchView::OnScroll);
-    Connect(-1, wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction)&SwitchView::OnScroll);
-    Connect(-1, wxEVT_SCROLL_THUMBRELEASE, (wxObjectEventFunction)&SwitchView::OnScroll);
-    Connect(-1, wxEVT_ERASE_BACKGROUND, (wxObjectEventFunction)&SwitchView::OnErase);
-
-    Connect(-1, wxEVT_DYNAMIC_SASH_SPLIT, (wxObjectEventFunction)&SwitchView::OnSplit);
-    Connect(-1, wxEVT_DYNAMIC_SASH_UNIFY, (wxObjectEventFunction)&SwitchView::OnUnify);
+    Connect(GetId(), wxEVT_SIZE, (wxObjectEventFunction)
+                                 (wxEventFunction)
+                                 (wxSizeEventFunction)&SwitchView::OnSize);
+    Connect(m_choice->GetId(), wxEVT_COMMAND_CHOICE_SELECTED, (wxObjectEventFunction)
+                                                              (wxEventFunction)
+                                                              (wxCommandEventFunction)&SwitchView::OnChoice);
+    Connect(m_view->GetId(), wxEVT_PAINT, (wxObjectEventFunction)
+                                          (wxEventFunction)
+                                          (wxPaintEventFunction)&SwitchView::OnPaint);
+
+    Connect(-1, wxEVT_SET_FOCUS, (wxObjectEventFunction)
+                                 (wxEventFunction)
+                                 (wxFocusEventFunction)&SwitchView::OnFocus);
+    Connect(-1, wxEVT_SCROLL_TOP, (wxObjectEventFunction)
+                                  (wxEventFunction)
+                                  (wxScrollEventFunction)&SwitchView::OnScroll);
+    Connect(-1, wxEVT_SCROLL_BOTTOM, (wxObjectEventFunction)
+                                     (wxEventFunction)
+                                     (wxScrollEventFunction)&SwitchView::OnScroll);
+    Connect(-1, wxEVT_SCROLL_LINEUP, (wxObjectEventFunction)
+                                     (wxEventFunction)
+                                     (wxScrollEventFunction)&SwitchView::OnScroll);
+    Connect(-1, wxEVT_SCROLL_LINEDOWN, (wxObjectEventFunction)
+                                       (wxEventFunction)
+                                       (wxScrollEventFunction)&SwitchView::OnScroll);
+    Connect(-1, wxEVT_SCROLL_PAGEUP, (wxObjectEventFunction)
+                                     (wxEventFunction)
+                                     (wxScrollEventFunction)&SwitchView::OnScroll);
+    Connect(-1, wxEVT_SCROLL_PAGEDOWN, (wxObjectEventFunction)
+                                       (wxEventFunction)
+                                       (wxScrollEventFunction)&SwitchView::OnScroll);
+    Connect(-1, wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction)
+                                         (wxEventFunction)
+                                         (wxScrollEventFunction)&SwitchView::OnScroll);
+    Connect(-1, wxEVT_SCROLL_THUMBRELEASE, (wxObjectEventFunction)
+                                           (wxEventFunction)
+                                           (wxScrollEventFunction)&SwitchView::OnScroll);
+    Connect(-1, wxEVT_ERASE_BACKGROUND, (wxObjectEventFunction)
+                                        (wxEventFunction)
+                                        (wxEraseEventFunction)&SwitchView::OnErase);
+
+    Connect(-1, wxEVT_DYNAMIC_SASH_SPLIT, (wxObjectEventFunction)
+                                          (wxEventFunction)
+                                          (wxDynamicSashSplitEventFunction)&SwitchView::OnSplit);
+    Connect(-1, wxEVT_DYNAMIC_SASH_UNIFY, (wxObjectEventFunction)
+                                          (wxEventFunction)
+                                          (wxDynamicSashUnifyEventFunction)&SwitchView::OnUnify);
 }
 
 wxSize SwitchView::DoGetBestSize() const {
     return wxSize(64, 64);
 }
 
 }
 
 wxSize SwitchView::DoGetBestSize() const {
     return wxSize(64, 64);
 }
 
-void SwitchView::OnSize(wxSizeEvent& event) {
+void SwitchView::OnSize(wxSizeEvent& WXUNUSED(event)) {
     Layout();
 
     wxScrollBar *hscroll = m_dyn_sash->GetHScrollBar(this);
     Layout();
 
     wxScrollBar *hscroll = m_dyn_sash->GetHScrollBar(this);
@@ -140,7 +183,7 @@ void SwitchView::OnSize(wxSizeEvent& event) {
     }
 }
 
     }
 }
 
-void SwitchView::OnPaint(wxPaintEvent& event) {
+void SwitchView::OnPaint(wxPaintEvent& WXUNUSED(event)) {
     wxPaintDC dc(m_view);
 
     wxScrollBar *hscroll = m_dyn_sash->GetHScrollBar(this);
     wxPaintDC dc(m_view);
 
     wxScrollBar *hscroll = m_dyn_sash->GetHScrollBar(this);
@@ -161,11 +204,11 @@ void SwitchView::OnPaint(wxPaintEvent& event) {
     }
 }
 
     }
 }
 
-void SwitchView::OnErase(wxEraseEvent& event) {
+void SwitchView::OnErase(wxEraseEvent& WXUNUSED(event)) {
     // Do nothing
 }
 
     // Do nothing
 }
 
-void SwitchView::OnSplit(wxDynamicSashSplitEvent& event) {
+void SwitchView::OnSplit(wxDynamicSashSplitEvent& WXUNUSED(event)) {
     SwitchView *view = new SwitchView(m_dyn_sash);
     view->m_choice->SetSelection(m_choice->GetSelection());
 
     SwitchView *view = new SwitchView(m_dyn_sash);
     view->m_choice->SetSelection(m_choice->GetSelection());
 
@@ -176,7 +219,7 @@ void SwitchView::OnSplit(wxDynamicSashSplitEvent& event) {
     vscroll->SetEventHandler(this);
 }
 
     vscroll->SetEventHandler(this);
 }
 
-void SwitchView::OnUnify(wxDynamicSashUnifyEvent& event) {
+void SwitchView::OnUnify(wxDynamicSashUnifyEvent& WXUNUSED(event)) {
     wxScrollBar *hscroll = m_dyn_sash->GetHScrollBar(this);
     wxScrollBar *vscroll = m_dyn_sash->GetVScrollBar(this);
 
     wxScrollBar *hscroll = m_dyn_sash->GetHScrollBar(this);
     wxScrollBar *vscroll = m_dyn_sash->GetVScrollBar(this);
 
@@ -184,11 +227,11 @@ void SwitchView::OnUnify(wxDynamicSashUnifyEvent& event) {
     vscroll->SetEventHandler(this);
 }
 
     vscroll->SetEventHandler(this);
 }
 
-void SwitchView::OnChoice(wxCommandEvent& event) {
+void SwitchView::OnChoice(wxCommandEvent& WXUNUSED(event)) {
     m_view->Refresh();
 }
 
     m_view->Refresh();
 }
 
-void SwitchView::OnScroll(wxScrollEvent& event) {
+void SwitchView::OnScroll(wxScrollEvent& WXUNUSED(event)) {
     m_view->Refresh();
 }
 
     m_view->Refresh();
 }
 
@@ -209,7 +252,7 @@ bool SwitchDemo::OnInit() {
     wxFrame *frame;
     wxDynamicSashWindow *dyn;
 
     wxFrame *frame;
     wxDynamicSashWindow *dyn;
 
-    frame = new wxFrame(NULL, -1, "Dynamic Sash Window Switch Demo");
+    frame = new wxFrame(NULL, -1, wxT("Dynamic Sash Window Switch Demo"));
     dyn = new wxDynamicSashWindow(frame, -1, wxDefaultPosition, wxDefaultSize, wxCLIP_CHILDREN);
     new SwitchView(dyn);
 
     dyn = new wxDynamicSashWindow(frame, -1, wxDefaultPosition, wxDefaultSize, wxCLIP_CHILDREN);
     new SwitchView(dyn);