]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/splitter.cpp
removed rpmfiles.lst
[wxWidgets.git] / src / generic / splitter.cpp
index c018dc781d64dcc61d76c7906fc7f8dcec807f51..dc50eb3590c1893f55157e472b0b811deba95712 100644 (file)
 #include "wx/settings.h"
 #include "wx/log.h"
 
 #include "wx/settings.h"
 #include "wx/log.h"
 
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_DOUBLECLICKED)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_UNSPLIT)
+
 IMPLEMENT_DYNAMIC_CLASS(wxSplitterWindow, wxWindow)
 IMPLEMENT_DYNAMIC_CLASS(wxSplitterEvent, wxCommandEvent)
 
 IMPLEMENT_DYNAMIC_CLASS(wxSplitterWindow, wxWindow)
 IMPLEMENT_DYNAMIC_CLASS(wxSplitterEvent, wxCommandEvent)
 
@@ -51,14 +56,21 @@ BEGIN_EVENT_TABLE(wxSplitterWindow, wxWindow)
     EVT_SPLITTER_SASH_POS_CHANGING(-1, wxSplitterWindow::OnSashPosChanged)
     EVT_SPLITTER_DCLICK(-1,           wxSplitterWindow::OnDoubleClick)
     EVT_SPLITTER_UNSPLIT(-1,          wxSplitterWindow::OnUnsplitEvent)
     EVT_SPLITTER_SASH_POS_CHANGING(-1, wxSplitterWindow::OnSashPosChanged)
     EVT_SPLITTER_DCLICK(-1,           wxSplitterWindow::OnDoubleClick)
     EVT_SPLITTER_UNSPLIT(-1,          wxSplitterWindow::OnUnsplitEvent)
+
+    WX_EVENT_TABLE_CONTROL_CONTAINER(wxSplitterWindow)
 END_EVENT_TABLE()
 
 END_EVENT_TABLE()
 
+WX_DELEGATE_TO_CONTROL_CONTAINER(wxSplitterWindow);
+
 bool wxSplitterWindow::Create(wxWindow *parent, wxWindowID id,
                                    const wxPoint& pos,
                                    const wxSize& size,
                                    long style,
                                    const wxString& name)
 {
 bool wxSplitterWindow::Create(wxWindow *parent, wxWindowID id,
                                    const wxPoint& pos,
                                    const wxSize& size,
                                    long style,
                                    const wxString& name)
 {
+    // allow TABbing from one window to the other
+    style |= wxTAB_TRAVERSAL;
+
     if (!wxWindow::Create(parent, id, pos, size, style, name))
         return FALSE;
 
     if (!wxWindow::Create(parent, id, pos, size, style, name))
         return FALSE;
 
@@ -81,6 +93,8 @@ bool wxSplitterWindow::Create(wxWindow *parent, wxWindowID id,
 
 void wxSplitterWindow::Init()
 {
 
 void wxSplitterWindow::Init()
 {
+    m_container.SetContainerWindow(this);
+
     m_splitMode = wxSPLIT_VERTICAL;
     m_permitUnsplitAlways = TRUE;
     m_windowOne = (wxWindow *) NULL;
     m_splitMode = wxSPLIT_VERTICAL;
     m_permitUnsplitAlways = TRUE;
     m_windowOne = (wxWindow *) NULL;
@@ -309,7 +323,7 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
                 return;
             }
         }
                 return;
             }
         }
-        
+
         if (new_sash_position == m_sashPosition)
             return;
 
         if (new_sash_position == m_sashPosition)
             return;
 
@@ -693,7 +707,7 @@ void wxSplitterWindow::SizeWindows()
     if ( GetBorderSize() > 0 )
         DrawBorders(dc);
     DrawSash(dc);
     if ( GetBorderSize() > 0 )
         DrawBorders(dc);
     DrawSash(dc);
-    
+
     SetNeedUpdating(FALSE);
 }
 
     SetNeedUpdating(FALSE);
 }
 
@@ -722,7 +736,7 @@ bool wxSplitterWindow::SplitVertically(wxWindow *window1, wxWindow *window2, int
     if ( sashPosition > 0 )
         m_sashPosition = sashPosition;
     else if ( sashPosition < 0 )
     if ( sashPosition > 0 )
         m_sashPosition = sashPosition;
     else if ( sashPosition < 0 )
-        m_sashPosition = w - sashPosition;
+        m_sashPosition = w + sashPosition;   // It's negative so adding is subtracting
     else    // default
         m_sashPosition = w/2;
 
     else    // default
         m_sashPosition = w/2;
 
@@ -745,7 +759,7 @@ bool wxSplitterWindow::SplitHorizontally(wxWindow *window1, wxWindow *window2, i
     if ( sashPosition > 0 )
         m_sashPosition = sashPosition;
     else if ( sashPosition < 0 )
     if ( sashPosition > 0 )
         m_sashPosition = sashPosition;
     else if ( sashPosition < 0 )
-        m_sashPosition = h - sashPosition;
+        m_sashPosition = h + sashPosition; // It's negative so adding is subtracting
     else    // default
         m_sashPosition = h/2;
 
     else    // default
         m_sashPosition = h/2;