]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/splitter.cpp
rtti api mods added
[wxWidgets.git] / src / generic / splitter.cpp
index 70fbed666eb3c190e05c50513a34f47839e0b1d1..078cdb7f7b266e05ae1b0fe8dc68cddf13452a62 100644 (file)
@@ -9,7 +9,7 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
     #pragma implementation "splitter.h"
 #endif
 
     #pragma implementation "splitter.h"
 #endif
 
@@ -48,6 +48,16 @@ DEFINE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_DOUBLECLICKED)
 DEFINE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_UNSPLIT)
 
 IMPLEMENT_DYNAMIC_CLASS(wxSplitterWindow, wxWindow)
 DEFINE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_UNSPLIT)
 
 IMPLEMENT_DYNAMIC_CLASS(wxSplitterWindow, wxWindow)
+
+/*
+       TODO PROPERTIES
+               style wxSP_3D
+               sashpos (long , 0 )
+               minsize (long -1 )
+               object, object_ref
+               orientation
+*/
+
 IMPLEMENT_DYNAMIC_CLASS(wxSplitterEvent, wxNotifyEvent)
 
 BEGIN_EVENT_TABLE(wxSplitterWindow, wxWindow)
 IMPLEMENT_DYNAMIC_CLASS(wxSplitterEvent, wxNotifyEvent)
 
 BEGIN_EVENT_TABLE(wxSplitterWindow, wxWindow)
@@ -109,6 +119,7 @@ void wxSplitterWindow::Init()
     m_sashTrackerPen = new wxPen(*wxBLACK, 2, wxSOLID);
 
     m_needUpdating = FALSE;
     m_sashTrackerPen = new wxPen(*wxBLACK, 2, wxSOLID);
 
     m_needUpdating = FALSE;
+    m_isHot = false;
 }
 
 wxSplitterWindow::~wxSplitterWindow()
 }
 
 wxSplitterWindow::~wxSplitterWindow()
@@ -116,12 +127,46 @@ wxSplitterWindow::~wxSplitterWindow()
     delete m_sashTrackerPen;
 }
 
     delete m_sashTrackerPen;
 }
 
+// ----------------------------------------------------------------------------
+// entering/leaving sash
+// ----------------------------------------------------------------------------
+
+void wxSplitterWindow::RedrawIfHotSensitive(bool isHot)
+{
+    if ( wxRendererNative::Get().GetSplitterParams(this).isHotSensitive )
+    {
+        m_isHot = isHot;
+
+        wxClientDC dc(this);
+        DrawSash(dc);
+    }
+    //else: we don't change our appearance, don't redraw to avoid flicker
+}
+
+void wxSplitterWindow::OnEnterSash()
+{
+    SetResizeCursor();
+
+    RedrawIfHotSensitive(true);
+}
+
+void wxSplitterWindow::OnLeaveSash()
+{
+    SetCursor(*wxSTANDARD_CURSOR);
+
+    RedrawIfHotSensitive(false);
+}
+
 void wxSplitterWindow::SetResizeCursor()
 {
     SetCursor(m_splitMode == wxSPLIT_VERTICAL ? m_sashCursorWE
                                               : m_sashCursorNS);
 }
 
 void wxSplitterWindow::SetResizeCursor()
 {
     SetCursor(m_splitMode == wxSPLIT_VERTICAL ? m_sashCursorWE
                                               : m_sashCursorNS);
 }
 
+// ----------------------------------------------------------------------------
+// other event handlers
+// ----------------------------------------------------------------------------
+
 void wxSplitterWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
 {
     wxPaintDC dc(this);
 void wxSplitterWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
 {
     wxPaintDC dc(this);
@@ -252,15 +297,10 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
     }  // left up && dragging
     else if ((event.Moving() || event.Leaving() || event.Entering()) && (m_dragMode == wxSPLIT_DRAG_NONE))
     {
     }  // left up && dragging
     else if ((event.Moving() || event.Leaving() || event.Entering()) && (m_dragMode == wxSPLIT_DRAG_NONE))
     {
-        // Just change the cursor as required
-        if ( !event.Leaving() && SashHitTest(x, y) )
-        {
-            SetResizeCursor();
-        }
+        if ( event.Leaving() || !SashHitTest(x, y) )
+            OnLeaveSash();
         else
         else
-        {
-            SetCursor(* wxSTANDARD_CURSOR);
-        }
+            OnEnterSash();
     }
     else if (event.Dragging() && (m_dragMode == wxSPLIT_DRAG_DRAGGING))
     {
     }
     else if (event.Dragging() && (m_dragMode == wxSPLIT_DRAG_DRAGGING))
     {
@@ -387,18 +427,19 @@ bool wxSplitterWindow::SashHitTest(int x, int y, int tolerance)
 
 int wxSplitterWindow::GetSashSize() const
 {
 
 int wxSplitterWindow::GetSashSize() const
 {
-    return wxRendererNative::Get().GetSplitterSashAndBorder(this).x;
+    return wxRendererNative::Get().GetSplitterParams(this).widthSash;
 }
 
 int wxSplitterWindow::GetBorderSize() const
 {
 }
 
 int wxSplitterWindow::GetBorderSize() const
 {
-    return wxRendererNative::Get().GetSplitterSashAndBorder(this).y;
+    return wxRendererNative::Get().GetSplitterParams(this).border;
 }
 
 // Draw the sash
 void wxSplitterWindow::DrawSash(wxDC& dc)
 {
 }
 
 // Draw the sash
 void wxSplitterWindow::DrawSash(wxDC& dc)
 {
-    wxRendererNative::Get().DrawSplitterBorder
+    if (HasFlag(wxSP_3DBORDER))
+        wxRendererNative::Get().DrawSplitterBorder
                             (
                                 this,
                                 dc,
                             (
                                 this,
                                 dc,
@@ -419,9 +460,9 @@ void wxSplitterWindow::DrawSash(wxDC& dc)
                                 dc,
                                 GetClientSize(),
                                 m_sashPosition,
                                 dc,
                                 GetClientSize(),
                                 m_sashPosition,
-                                m_splitMode == wxSPLIT_VERTICAL
-                                    ? wxVERTICAL
-                                    : wxHORIZONTAL
+                                m_splitMode == wxSPLIT_VERTICAL ? wxVERTICAL
+                                                                : wxHORIZONTAL,
+                                m_isHot ? wxCONTROL_CURRENT : 0
                             );
 }
 
                             );
 }