]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/tabg.cpp
Compilation fix.
[wxWidgets.git] / src / generic / tabg.cpp
index 5f66159f7e079f31a5113e4f63e43f58c70ef89b..1d913425cd8617cc4292f1c36ab4c386d812837b 100644 (file)
@@ -31,8 +31,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
-#include <math.h>
 
+#include "wx/math.h"
 #include "wx/tab.h"
 #include "wx/listimpl.cpp"
 
@@ -527,12 +527,11 @@ wxTabView::wxTabView(long style)
   m_tabViewRect.x = 300;
   m_highlightColour = *wxWHITE;
   m_shadowColour = wxColour(128, 128, 128);
-  m_backgroundColour = *wxLIGHT_GREY;
+  m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE);
   m_textColour = *wxBLACK;
   m_highlightPen = wxWHITE_PEN;
   m_shadowPen = wxGREY_PEN;
-  m_backgroundPen = wxLIGHT_GREY_PEN;
-  m_backgroundBrush = wxLIGHT_GREY_BRUSH;
+  SetBackgroundColour(m_backgroundColour);
   m_tabFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
   m_tabSelectedFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
   m_window = (wxWindow *) NULL;
@@ -1030,6 +1029,10 @@ void wxTabView::SetBackgroundColour(const wxColour& col)
   m_backgroundBrush = wxTheBrushList->FindOrCreateBrush(col, wxSOLID);
 }
 
+// this may be called with sel = zero (which doesn't match any page)
+// when wxMotif deletes a page
+// so return the first tab...
+
 void wxTabView::SetTabSelection(int sel, bool activateTool)
 {
   if ( sel==m_tabSelection )
@@ -1037,6 +1040,7 @@ void wxTabView::SetTabSelection(int sel, bool activateTool)
 
   int oldSel = m_tabSelection;
   wxTabControl *control = FindTabControlForId(sel);
+  if (sel == 0) sel=control->GetId();
   wxTabControl *oldControl = FindTabControlForId(m_tabSelection);
 
   if (!OnTabPreActivate(sel, oldSel))
@@ -1063,6 +1067,8 @@ void wxTabView::SetTabSelection(int sel, bool activateTool)
 }
 
 // Find tab control for id
+// this may be called with zero (which doesn't match any page)
+// so return the first control...
 wxTabControl *wxTabView::FindTabControlForId(int id) const
 {
   wxTabLayerList::compatibility_iterator node1 = m_layers.GetFirst();
@@ -1073,7 +1079,7 @@ wxTabControl *wxTabView::FindTabControlForId(int id) const
     while (node2)
     {
       wxTabControl *control = (wxTabControl *)node2->GetData();
-      if (control->GetId() == id)
+      if (control->GetId() == id || id == 0)
         return control;
       node2 = node2->GetNext();
     }