]> git.saurik.com Git - wxWidgets.git/blobdiff - contrib/src/gizmos/splittree.cpp
added .chm support for Unix (Markus Sinner)
[wxWidgets.git] / contrib / src / gizmos / splittree.cpp
index ca4c7cf23f0d3c55bef80194f84dff1c18a5a110..8a16309acf5c21dd7755e47ca1cc6b3b3d88b6d1 100644 (file)
@@ -104,16 +104,25 @@ void wxRemotelyScrolledTreeCtrl::HideVScrollbar()
 // Number of pixels per user unit (0 or -1 for no scrollbar)
 // Length of virtual canvas in user units
 // Length of page in user units
-void wxRemotelyScrolledTreeCtrl::SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
+void wxRemotelyScrolledTreeCtrl::SetScrollbars(
+                                                #if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
+                                                  int pixelsPerUnitX, int pixelsPerUnitY,
                              int noUnitsX, int noUnitsY,
                              int xPos, int yPos,
-                             bool noRefresh)
+                                                  bool noRefresh
+                                                #else
+                                                  int WXUNUSED(pixelsPerUnitX), int WXUNUSED(pixelsPerUnitY),
+                                                  int WXUNUSED(noUnitsX), int WXUNUSED(noUnitsY),
+                                                  int WXUNUSED(xPos), int WXUNUSED(yPos),
+                                                  bool WXUNUSED(noRefresh)
+                                                #endif
+                                              )
 {
 #if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
     if (IsKindOf(CLASSINFO(wxGenericTreeCtrl)))
     {
         wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this;
-        win->wxGenericTreeCtrl::SetScrollbars(pixelsPerUnitX, 0, noUnitsX, 0, xPos, 0, noRefresh);
+        win->wxGenericTreeCtrl::SetScrollbars(pixelsPerUnitX, pixelsPerUnitY, noUnitsX, 0, xPos, 0, /* noRefresh */ TRUE);
 
         wxScrolledWindow* scrolledWindow = GetScrolledWindow();
         if (scrolledWindow)
@@ -125,9 +134,21 @@ void wxRemotelyScrolledTreeCtrl::SetScrollbars(int pixelsPerUnitX, int pixelsPer
 }
 
 // In case we're using the generic tree control.
-int wxRemotelyScrolledTreeCtrl::GetScrollPos(int orient) const
+int wxRemotelyScrolledTreeCtrl::GetScrollPos(
+                                             #if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
+                                                 int orient
+                                             #else
+                                                 int WXUNUSED(orient)
+                                             #endif
+                                             ) const
 {
-    wxScrolledWindow* scrolledWindow = GetScrolledWindow();
+
+#if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
+    // this condition fixes extsitence of warning but 
+    wxScrolledWindow* scrolledWindow = 
+    // but GetScrolledWindow is still executed in case internally does something
+#endif
+                                       GetScrolledWindow();
 
 #if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
     if (IsKindOf(CLASSINFO(wxGenericTreeCtrl)))
@@ -176,7 +197,13 @@ void wxRemotelyScrolledTreeCtrl::GetViewStart(int *x, int *y) const
 }
 
 // In case we're using the generic tree control.
-void wxRemotelyScrolledTreeCtrl::PrepareDC(wxDC& dc)
+void wxRemotelyScrolledTreeCtrl::PrepareDC( 
+                                            #if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
+                                                wxDC& dc
+                                            #else
+                                                wxDC& WXUNUSED(dc)
+                                            #endif
+                                           )
 {
 #if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
     if (IsKindOf(CLASSINFO(wxGenericTreeCtrl)))
@@ -200,7 +227,7 @@ void wxRemotelyScrolledTreeCtrl::PrepareDC(wxDC& dc)
 
 // Scroll to the given line (in scroll units where each unit is
 // the height of an item)
-void wxRemotelyScrolledTreeCtrl::ScrollToLine(int posHoriz, int posVert)
+void wxRemotelyScrolledTreeCtrl::ScrollToLine(int WXUNUSED(posHoriz), int posVert)
 {
 #ifdef __WXMSW__
 #if USE_GENERIC_TREECTRL
@@ -265,7 +292,7 @@ void wxRemotelyScrolledTreeCtrl::OnPaint(wxPaintEvent& event)
     // Reset the device origin since it may have been set
     dc.SetDeviceOrigin(0, 0);
 
-    wxPen pen(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DLIGHT), 1, wxSOLID);
+    wxPen pen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT), 1, wxSOLID);
     dc.SetPen(pen);
     dc.SetBrush(* wxTRANSPARENT_BRUSH);
 
@@ -282,7 +309,7 @@ void wxRemotelyScrolledTreeCtrl::OnPaint(wxPaintEvent& event)
             lastH = h;
         }
     }
-    if (GetBoundingRect(lastH, itemRect))
+    if (lastH.IsOk() && GetBoundingRect(lastH, itemRect))
     {
         cy = itemRect.GetBottom();
         dc.DrawLine(0, cy, clientSize.x, cy);
@@ -311,7 +338,7 @@ void wxRemotelyScrolledTreeCtrl::AdjustRemoteScrollbars()
         if (scrolledWindow)
         {
             wxRect itemRect;
-            if (GetBoundingRect(GetRootItem(), itemRect))
+            if (GetBoundingRect(GetFirstVisibleItem(), itemRect))
             {
                 // Actually, the real height seems to be 1 less than reported
                 // (e.g. 16 instead of 16)
@@ -381,9 +408,9 @@ void wxRemotelyScrolledTreeCtrl::CalcTreeSize(const wxTreeItemId& id, wxRect& re
         rect = CombineRectangles(rect, itemSize);
     }
 
-    long cookie;
+    wxTreeItemIdValue cookie;
     wxTreeItemId childId = GetFirstChild(id, cookie);
-    while (childId != 0)
+    while (childId)
     {
         CalcTreeSize(childId, rect);
         childId = GetNextChild(childId, cookie);
@@ -466,17 +493,17 @@ void wxTreeCompanionWindow::DrawItem(wxDC& dc, wxTreeItemId id, const wxRect& re
 #endif
 }
 
-void wxTreeCompanionWindow::OnPaint(wxPaintEvent& event)
+void wxTreeCompanionWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
 {
     wxPaintDC dc(this);
 
     if (!m_treeCtrl)
         return;
 
-        wxPen pen(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DLIGHT), 1, wxSOLID);
+        wxPen pen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT), 1, wxSOLID);
     dc.SetPen(pen);
     dc.SetBrush(* wxTRANSPARENT_BRUSH);
-    wxFont font(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
+    wxFont font(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
     dc.SetFont(font);
 
     wxSize clientSize = GetClientSize();
@@ -519,7 +546,7 @@ void wxTreeCompanionWindow::OnScroll(wxScrollWinEvent& event)
     Refresh(TRUE);
 }
 
-void wxTreeCompanionWindow::OnExpand(wxTreeEvent& event)
+void wxTreeCompanionWindow::OnExpand(wxTreeEvent& WXUNUSED(event))
 {
     // TODO: something more optimized than simply refresh the whole
     // window when the tree is expanded/collapsed. Tricky.
@@ -542,8 +569,18 @@ wxThinSplitterWindow::wxThinSplitterWindow(wxWindow* parent, wxWindowID id,
       long style):
       wxSplitterWindow(parent, id, pos, sz, style)
 {
+    wxColour faceColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
+    m_facePen = new wxPen(faceColour, 1, wxSOLID);
+    m_faceBrush = new wxBrush(faceColour, wxSOLID);
 }
 
+wxThinSplitterWindow::~wxThinSplitterWindow()
+{
+    delete m_facePen;
+    delete m_faceBrush;
+}
+
+
 void wxThinSplitterWindow::SizeWindows()
 {
     // The client size may have changed inbetween
@@ -554,7 +591,7 @@ void wxThinSplitterWindow::SizeWindows()
 }
 
 // Tests for x, y over sash
-bool wxThinSplitterWindow::SashHitTest(int x, int y, int tolerance)
+bool wxThinSplitterWindow::SashHitTest(int x, int y, int WXUNUSED(tolerance))
 {
     return wxSplitterWindow::SashHitTest(x, y, 4);
 }
@@ -581,7 +618,7 @@ void wxThinSplitterWindow::DrawSash(wxDC& dc)
         {
             y1 = 2; h1 -= 3;
         }
-        dc.DrawRectangle(m_sashPosition, y1, m_sashSize, h1);
+        dc.DrawRectangle(m_sashPosition, y1, GetSashSize(), h1);
     }
     else
     {
@@ -595,7 +632,7 @@ void wxThinSplitterWindow::DrawSash(wxDC& dc)
         {
             x1 = 2; w1 -= 3;
         }
-        dc.DrawRectangle(x1, m_sashPosition, w1, m_sashSize);
+        dc.DrawRectangle(x1, m_sashPosition, w1, GetSashSize());
     }
 
     dc.SetPen(wxNullPen);
@@ -626,12 +663,12 @@ wxSplitterScrolledWindow::wxSplitterScrolledWindow(wxWindow* parent, wxWindowID
 {
 }
 
-void wxSplitterScrolledWindow::OnSize(wxSizeEvent& event)
+void wxSplitterScrolledWindow::OnSize(wxSizeEvent& WXUNUSED(event))
 {
     wxSize sz = GetClientSize();
-    if (GetChildren().First())
+    if (GetChildren().GetFirst())
     {
-        ((wxWindow*) GetChildren().First()->Data())->SetSize(0, 0, sz.x, sz.y);
+        ((wxWindow*) GetChildren().GetFirst()->GetData())->SetSize(0, 0, sz.x, sz.y);
     }
 }
 
@@ -682,10 +719,10 @@ void wxSplitterScrolledWindow::OnScroll(wxScrollWinEvent& event)
     }
 
     // Find targets in splitter window and send the event to them
-    wxNode* node = GetChildren().First();
+    wxWindowListNode* node = GetChildren().GetFirst();
     while (node)
     {
-        wxWindow* child = (wxWindow*) node->Data();
+        wxWindow* child = (wxWindow*) node->GetData();
         if (child->IsKindOf(CLASSINFO(wxSplitterWindow)))
         {
             wxSplitterWindow* splitter = (wxSplitterWindow*) child;
@@ -695,7 +732,7 @@ void wxSplitterScrolledWindow::OnScroll(wxScrollWinEvent& event)
                 splitter->GetWindow2()->ProcessEvent(event);
             break;
         }
-        node = node->Next();
+        node = node->GetNext();
     }
 
 #ifdef __WXMAC__