]> git.saurik.com Git - wxWidgets.git/blobdiff - contrib/samples/gizmos/dynsash_switch/dynsash_switch.cpp
Added support for toggle button on OS/2.
[wxWidgets.git] / contrib / samples / gizmos / dynsash_switch / dynsash_switch.cpp
index 0910f46caf3d6e756c37b22dc3a417807f041a53..239843942788025b7d367208ccdf0f7d34ae3052 100644 (file)
@@ -65,14 +65,14 @@ IMPLEMENT_APP(SwitchDemo)
 
 
 SwitchView::SwitchView(wxDynamicSashWindow *win) {
 
 
 SwitchView::SwitchView(wxDynamicSashWindow *win) {
-    Create(win, -1);
+    Create(win, wxID_ANY);
 
     m_dyn_sash = win;
 
 
     m_dyn_sash = win;
 
-    m_bar = new wxWindow(this, -1, wxDefaultPosition, wxDefaultSize, wxRAISED_BORDER, wxT("bar"));
-    m_choice = new wxChoice(m_bar, -1);
+    m_bar = new wxWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxRAISED_BORDER, wxT("bar"));
+    m_choice = new wxChoice(m_bar, wxID_ANY);
     m_choice->SetEventHandler(this);
     m_choice->SetEventHandler(this);
-    m_view = new wxWindow(this, -1, wxDefaultPosition, wxDefaultSize, 0, wxT("view"));
+    m_view = new wxWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, wxT("view"));
     m_view->SetBackgroundColour(*wxWHITE);
     m_view->SetEventHandler(this);
 
     m_view->SetBackgroundColour(*wxWHITE);
     m_view->SetEventHandler(this);
 
@@ -119,41 +119,41 @@ SwitchView::SwitchView(wxDynamicSashWindow *win) {
                                           (wxEventFunction)
                                           (wxPaintEventFunction)&SwitchView::OnPaint);
 
                                           (wxEventFunction)
                                           (wxPaintEventFunction)&SwitchView::OnPaint);
 
-    Connect(-1, wxEVT_SET_FOCUS, (wxObjectEventFunction)
+    Connect(wxID_ANY, wxEVT_SET_FOCUS, (wxObjectEventFunction)
                                  (wxEventFunction)
                                  (wxFocusEventFunction)&SwitchView::OnFocus);
                                  (wxEventFunction)
                                  (wxFocusEventFunction)&SwitchView::OnFocus);
-    Connect(-1, wxEVT_SCROLL_TOP, (wxObjectEventFunction)
+    Connect(wxID_ANY, wxEVT_SCROLL_TOP, (wxObjectEventFunction)
                                   (wxEventFunction)
                                   (wxScrollEventFunction)&SwitchView::OnScroll);
                                   (wxEventFunction)
                                   (wxScrollEventFunction)&SwitchView::OnScroll);
-    Connect(-1, wxEVT_SCROLL_BOTTOM, (wxObjectEventFunction)
+    Connect(wxID_ANY, wxEVT_SCROLL_BOTTOM, (wxObjectEventFunction)
                                      (wxEventFunction)
                                      (wxScrollEventFunction)&SwitchView::OnScroll);
                                      (wxEventFunction)
                                      (wxScrollEventFunction)&SwitchView::OnScroll);
-    Connect(-1, wxEVT_SCROLL_LINEUP, (wxObjectEventFunction)
+    Connect(wxID_ANY, wxEVT_SCROLL_LINEUP, (wxObjectEventFunction)
                                      (wxEventFunction)
                                      (wxScrollEventFunction)&SwitchView::OnScroll);
                                      (wxEventFunction)
                                      (wxScrollEventFunction)&SwitchView::OnScroll);
-    Connect(-1, wxEVT_SCROLL_LINEDOWN, (wxObjectEventFunction)
+    Connect(wxID_ANY, wxEVT_SCROLL_LINEDOWN, (wxObjectEventFunction)
                                        (wxEventFunction)
                                        (wxScrollEventFunction)&SwitchView::OnScroll);
                                        (wxEventFunction)
                                        (wxScrollEventFunction)&SwitchView::OnScroll);
-    Connect(-1, wxEVT_SCROLL_PAGEUP, (wxObjectEventFunction)
+    Connect(wxID_ANY, wxEVT_SCROLL_PAGEUP, (wxObjectEventFunction)
                                      (wxEventFunction)
                                      (wxScrollEventFunction)&SwitchView::OnScroll);
                                      (wxEventFunction)
                                      (wxScrollEventFunction)&SwitchView::OnScroll);
-    Connect(-1, wxEVT_SCROLL_PAGEDOWN, (wxObjectEventFunction)
+    Connect(wxID_ANY, wxEVT_SCROLL_PAGEDOWN, (wxObjectEventFunction)
                                        (wxEventFunction)
                                        (wxScrollEventFunction)&SwitchView::OnScroll);
                                        (wxEventFunction)
                                        (wxScrollEventFunction)&SwitchView::OnScroll);
-    Connect(-1, wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction)
+    Connect(wxID_ANY, wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction)
                                          (wxEventFunction)
                                          (wxScrollEventFunction)&SwitchView::OnScroll);
                                          (wxEventFunction)
                                          (wxScrollEventFunction)&SwitchView::OnScroll);
-    Connect(-1, wxEVT_SCROLL_THUMBRELEASE, (wxObjectEventFunction)
+    Connect(wxID_ANY, wxEVT_SCROLL_THUMBRELEASE, (wxObjectEventFunction)
                                            (wxEventFunction)
                                            (wxScrollEventFunction)&SwitchView::OnScroll);
                                            (wxEventFunction)
                                            (wxScrollEventFunction)&SwitchView::OnScroll);
-    Connect(-1, wxEVT_ERASE_BACKGROUND, (wxObjectEventFunction)
+    Connect(wxID_ANY, wxEVT_ERASE_BACKGROUND, (wxObjectEventFunction)
                                         (wxEventFunction)
                                         (wxEraseEventFunction)&SwitchView::OnErase);
 
                                         (wxEventFunction)
                                         (wxEraseEventFunction)&SwitchView::OnErase);
 
-    Connect(-1, wxEVT_DYNAMIC_SASH_SPLIT, (wxObjectEventFunction)
+    Connect(wxID_ANY, wxEVT_DYNAMIC_SASH_SPLIT, (wxObjectEventFunction)
                                           (wxEventFunction)
                                           (wxDynamicSashSplitEventFunction)&SwitchView::OnSplit);
                                           (wxEventFunction)
                                           (wxDynamicSashSplitEventFunction)&SwitchView::OnSplit);
-    Connect(-1, wxEVT_DYNAMIC_SASH_UNIFY, (wxObjectEventFunction)
+    Connect(wxID_ANY, wxEVT_DYNAMIC_SASH_UNIFY, (wxObjectEventFunction)
                                           (wxEventFunction)
                                           (wxDynamicSashUnifyEventFunction)&SwitchView::OnUnify);
 }
                                           (wxEventFunction)
                                           (wxDynamicSashUnifyEventFunction)&SwitchView::OnUnify);
 }
@@ -239,7 +239,7 @@ void SwitchView::OnFocus(wxFocusEvent& 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);
 
-    if (event.m_eventObject == hscroll || event.m_eventObject == vscroll) {
+    if (event.GetEventObject() == hscroll || event.GetEventObject() == vscroll) {
         m_view->SetFocus();
     } else {
         event.Skip();
         m_view->SetFocus();
     } else {
         event.Skip();
@@ -252,12 +252,12 @@ bool SwitchDemo::OnInit() {
     wxFrame *frame;
     wxDynamicSashWindow *dyn;
 
     wxFrame *frame;
     wxDynamicSashWindow *dyn;
 
-    frame = new wxFrame(NULL, -1, wxT("Dynamic Sash Window Switch Demo"));
-    dyn = new wxDynamicSashWindow(frame, -1, wxDefaultPosition, wxDefaultSize, wxCLIP_CHILDREN);
+    frame = new wxFrame(NULL, wxID_ANY, wxT("Dynamic Sash Window Switch Demo"));
+    dyn = new wxDynamicSashWindow(frame, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxCLIP_CHILDREN);
     new SwitchView(dyn);
 
     frame->SetSize(480, 480);
     frame->Show();
 
     new SwitchView(dyn);
 
     frame->SetSize(480, 480);
     frame->Show();
 
-    return TRUE;
+    return true;
 }
 }