]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/tabctrl.cpp
Clean up memory if have to exit early
[wxWidgets.git] / src / msw / tabctrl.cpp
index f4ffc5d16f7d83c73cee2424026009daabf71593..c2553f2f2fe4c70ca26fab3695a1c51c9e789957 100644 (file)
 
 #include <windows.h>
 
-#if !(defined(__GNUWIN32_OLD__) || defined(__TWIN32__))
+#if defined(__WIN95__) && !((defined(__GNUWIN32_OLD__) || defined(__TWIN32__)) && !defined(__CYGWIN10__))
     #include <commctrl.h>
 #else
     #include "wx/msw/gnuwin32/extra.h"
 #endif
 
 #include "wx/msw/dib.h"
-#include "wx/msw/tabctrl.h"
+#include "wx/tabctrl.h"
 #include "wx/app.h"
 #include "wx/msw/private.h"
 #include "wx/msw/imaglist.h"
 
 IMPLEMENT_DYNAMIC_CLASS(wxTabCtrl, wxControl)
+IMPLEMENT_DYNAMIC_CLASS(wxTabEvent, wxNotifyEvent)
 
 DEFINE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGED)
 DEFINE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGING)
@@ -76,15 +77,8 @@ bool wxTabCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
 
   m_windowStyle = style;
 
-  SetFont(* (wxTheFontList->FindOrCreateFont(11, wxSWISS, wxNORMAL, wxNORMAL)));
-
   SetParent(parent);
 
-  DWORD msflags = 0;
-  if (style & wxBORDER)
-    msflags |= WS_BORDER;
-  msflags |= WS_CHILD | WS_VISIBLE;
-  
   if (width <= 0)
     width = 100;
   if (height <= 0)
@@ -105,6 +99,8 @@ bool wxTabCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
     tabStyle |= TCS_FIXEDWIDTH;
   if (m_windowStyle & wxTC_OWNERDRAW)
     tabStyle |= TCS_OWNERDRAWFIXED;
+  if (m_windowStyle & wxBORDER)
+    tabStyle |= WS_BORDER;
 
   tabStyle |= TCS_TOOLTIPS;
 
@@ -112,7 +108,7 @@ bool wxTabCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
   HWND hWndTabCtrl = CreateWindowEx(0L,     // No extended styles.
     WC_TABCONTROL,                          // Class name for the tab control
     wxT(""),                                 // No default text.
-    WS_CHILD | WS_BORDER | WS_VISIBLE | tabStyle,    // Styles and defaults.
+    tabStyle,    // Styles and defaults.
     x, y, width, height,                    // Standard size and position.
     (HWND) parent->GetHWND(),               // Parent window
     (HMENU)m_windowId,                      // ID.
@@ -124,6 +120,8 @@ bool wxTabCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
   
   SubclassWin((WXHWND) hWndTabCtrl);
 
+  SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
+
   return TRUE;
 }
 
@@ -161,6 +159,7 @@ bool wxTabCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
     event.SetEventObject( this );
     event.SetEventType(eventType);
     event.SetInt(idCtrl) ;
+    event.SetSelection(idCtrl);
 
     return ProcessEvent(event);
 }
@@ -442,14 +441,5 @@ void wxMapBitmap(HBITMAP hBitmap, int width, int height)
 }
 #endif
 
-// Tab event
-IMPLEMENT_DYNAMIC_CLASS(wxTabEvent, wxCommandEvent)
-
-wxTabEvent::wxTabEvent(wxEventType commandType, int id):
-  wxCommandEvent(commandType, id)
-{
-}
-
-
 #endif
     // __WIN95__