]> git.saurik.com Git - wxWidgets.git/commitdiff
wxAuiNotebook bitmaps working now
authorBenjamin Williams <bwilliams@kirix.com>
Wed, 8 Nov 2006 15:19:38 +0000 (15:19 +0000)
committerBenjamin Williams <bwilliams@kirix.com>
Wed, 8 Nov 2006 15:19:38 +0000 (15:19 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43198 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/aui/auibook.h
samples/aui/auidemo.cpp
src/aui/auibook.cpp

index 06afedaafb9d43833da90b402b3f5919e080d325..0d1dd76910ae2cb25829ec55242eaf153810cc36 100644 (file)
@@ -57,6 +57,79 @@ enum wxAuiNotebookOption
 
 
 
 
 
 
+// aui notebook event class
+
+class WXDLLIMPEXP_AUI wxAuiNotebookEvent : public wxNotifyEvent
+{
+public:
+    wxAuiNotebookEvent(wxEventType command_type = wxEVT_NULL,
+                       int win_id = 0)
+          : wxNotifyEvent(command_type, win_id)
+    {
+        old_selection = -1;
+        selection = -1;
+        drag_source = NULL;
+    }
+#ifndef SWIG
+    wxAuiNotebookEvent(const wxAuiNotebookEvent& c) : wxNotifyEvent(c)
+    {
+        old_selection = c.old_selection;
+        selection = c.selection;
+        drag_source = c.drag_source;
+    }
+#endif
+    wxEvent *Clone() const { return new wxAuiNotebookEvent(*this); }
+
+    void SetSelection(int s) { selection = s; m_commandInt = s; }
+    int GetSelection() const { return selection; }
+    
+    void SetOldSelection(int s) { old_selection = s; }
+    int GetOldSelection() const { return old_selection; }
+    
+    void SetDragSource(wxAuiNotebook* s) { drag_source = s; }
+    wxAuiNotebook* GetDragSource() const { return drag_source; }
+
+public:
+    int old_selection;
+    int selection;
+    wxAuiNotebook* drag_source;
+
+#ifndef SWIG
+private:
+    DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxAuiNotebookEvent)
+#endif
+};
+
+
+class WXDLLIMPEXP_AUI wxAuiNotebookPage
+{
+public:
+    wxWindow* window;     // page's associated window
+    wxString caption;     // caption displayed on the tab
+    wxBitmap bitmap;      // tab's bitmap
+    wxRect rect;          // tab's hit rectangle
+    bool active;          // true if the page is currently active
+};
+
+class WXDLLIMPEXP_AUI wxAuiTabContainerButton
+{
+public:
+
+    int id;               // button's id
+    int cur_state;        // current state (normal, hover, pressed, etc.)
+    int location;         // buttons location (wxLEFT, wxRIGHT, or wxCENTER)
+    wxBitmap bitmap;      // button's hover bitmap
+    wxBitmap dis_bitmap;  // button's disabled bitmap
+    wxRect rect;          // button's hit rectangle
+};
+
+
+#ifndef SWIG
+WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiNotebookPage, wxAuiNotebookPageArray, WXDLLIMPEXP_AUI);
+WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiTabContainerButton, wxAuiTabContainerButtonArray, WXDLLIMPEXP_AUI);
+#endif
+
+
 // tab art class
 
 class WXDLLIMPEXP_AUI wxAuiTabArt
 // tab art class
 
 class WXDLLIMPEXP_AUI wxAuiTabArt
@@ -85,6 +158,7 @@ public:
                          wxWindow* wnd,
                          const wxRect& in_rect,
                          const wxString& caption,
                          wxWindow* wnd,
                          const wxRect& in_rect,
                          const wxString& caption,
+                         const wxBitmap& bitmap,
                          bool active,
                          int close_button_state,
                          wxRect* out_tab_rect,
                          bool active,
                          int close_button_state,
                          wxRect* out_tab_rect,
@@ -107,6 +181,7 @@ public:
                          wxDC& dc,
                          wxWindow* wnd,
                          const wxString& caption,
                          wxDC& dc,
                          wxWindow* wnd,
                          const wxString& caption,
+                         const wxBitmap& bitmap,
                          bool active,
                          int close_button_state,
                          int* x_extent) = 0;
                          bool active,
                          int close_button_state,
                          int* x_extent) = 0;
@@ -116,21 +191,21 @@ public:
                          const wxArrayString& items,
                          int active_idx) = 0;
     
                          const wxArrayString& items,
                          int active_idx) = 0;
     
-    virtual int GetBestTabCtrlSize(wxWindow* wnd) = 0;    
+    virtual int GetBestTabCtrlSize(wxWindow* wnd,
+                                   wxAuiNotebookPageArray& pages) = 0;    
 };
 
 
 };
 
 
-class WXDLLIMPEXP_AUI wxAuiSimpleTabArt : public wxAuiTabArt
+class WXDLLIMPEXP_AUI wxAuiDefaultTabArt : public wxAuiTabArt
 {
 
 public:
 
 {
 
 public:
 
-    wxAuiSimpleTabArt();
-    virtual ~wxAuiSimpleTabArt();
+    wxAuiDefaultTabArt();
+    virtual ~wxAuiDefaultTabArt();
     
     wxAuiTabArt* Clone();
     void SetFlags(unsigned int flags);
     
     wxAuiTabArt* Clone();
     void SetFlags(unsigned int flags);
-
     void SetSizingInfo(const wxSize& tab_ctrl_size,
                        size_t tab_count);
 
     void SetSizingInfo(const wxSize& tab_ctrl_size,
                        size_t tab_count);
 
@@ -142,11 +217,12 @@ public:
                  wxDC& dc,
                  wxWindow* wnd,
                  const wxRect& rect);
                  wxDC& dc,
                  wxWindow* wnd,
                  const wxRect& rect);
-                                          
+                     
     void DrawTab(wxDC& dc,
                  wxWindow* wnd,
                  const wxRect& in_rect,
                  const wxString& caption,
     void DrawTab(wxDC& dc,
                  wxWindow* wnd,
                  const wxRect& in_rect,
                  const wxString& caption,
+                 const wxBitmap& bitmap,
                  bool active,
                  int close_button_state,
                  wxRect* out_tab_rect,
                  bool active,
                  int close_button_state,
                  wxRect* out_tab_rect,
@@ -162,13 +238,14 @@ public:
                  int orientation,
                  const wxBitmap& bitmap_override,
                  wxRect* out_rect);
                  int orientation,
                  const wxBitmap& bitmap_override,
                  wxRect* out_rect);
-             
-    int GetIndentSize();
     
     
+    int GetIndentSize();
+                 
     wxSize GetTabSize(
                  wxDC& dc,
                  wxWindow* wnd,
                  const wxString& caption,
     wxSize GetTabSize(
                  wxDC& dc,
                  wxWindow* wnd,
                  const wxString& caption,
+                 const wxBitmap& bitmap,
                  bool active,
                  int close_button_state,
                  int* x_extent);
                  bool active,
                  int close_button_state,
                  int* x_extent);
@@ -178,7 +255,8 @@ public:
                  const wxArrayString& items,
                  int active_idx);
 
                  const wxArrayString& items,
                  int active_idx);
 
-    int GetBestTabCtrlSize(wxWindow* wnd);    
+    int GetBestTabCtrlSize(wxWindow* wnd,
+                 wxAuiNotebookPageArray& pages);  
 
 protected:
 
 
 protected:
 
@@ -200,20 +278,22 @@ protected:
     wxBitmap m_disabled_windowlist_bmp;
     
     int m_fixed_tab_width;
     wxBitmap m_disabled_windowlist_bmp;
     
     int m_fixed_tab_width;
+    int m_tab_ctrl_height;
     unsigned int m_flags;
 };
 
 
     unsigned int m_flags;
 };
 
 
-class WXDLLIMPEXP_AUI wxAuiDefaultTabArt : public wxAuiTabArt
+class WXDLLIMPEXP_AUI wxAuiSimpleTabArt : public wxAuiTabArt
 {
 
 public:
 
 {
 
 public:
 
-    wxAuiDefaultTabArt();
-    virtual ~wxAuiDefaultTabArt();
+    wxAuiSimpleTabArt();
+    virtual ~wxAuiSimpleTabArt();
     
     wxAuiTabArt* Clone();
     void SetFlags(unsigned int flags);
     
     wxAuiTabArt* Clone();
     void SetFlags(unsigned int flags);
+
     void SetSizingInfo(const wxSize& tab_ctrl_size,
                        size_t tab_count);
 
     void SetSizingInfo(const wxSize& tab_ctrl_size,
                        size_t tab_count);
 
@@ -225,11 +305,12 @@ public:
                  wxDC& dc,
                  wxWindow* wnd,
                  const wxRect& rect);
                  wxDC& dc,
                  wxWindow* wnd,
                  const wxRect& rect);
-                     
+                                          
     void DrawTab(wxDC& dc,
                  wxWindow* wnd,
                  const wxRect& in_rect,
                  const wxString& caption,
     void DrawTab(wxDC& dc,
                  wxWindow* wnd,
                  const wxRect& in_rect,
                  const wxString& caption,
+                 const wxBitmap& bitmap,
                  bool active,
                  int close_button_state,
                  wxRect* out_tab_rect,
                  bool active,
                  int close_button_state,
                  wxRect* out_tab_rect,
@@ -245,13 +326,14 @@ public:
                  int orientation,
                  const wxBitmap& bitmap_override,
                  wxRect* out_rect);
                  int orientation,
                  const wxBitmap& bitmap_override,
                  wxRect* out_rect);
-    
+             
     int GetIndentSize();
     int GetIndentSize();
-                 
+    
     wxSize GetTabSize(
                  wxDC& dc,
                  wxWindow* wnd,
                  const wxString& caption,
     wxSize GetTabSize(
                  wxDC& dc,
                  wxWindow* wnd,
                  const wxString& caption,
+                 const wxBitmap& bitmap,
                  bool active,
                  int close_button_state,
                  int* x_extent);
                  bool active,
                  int close_button_state,
                  int* x_extent);
@@ -261,7 +343,8 @@ public:
                  const wxArrayString& items,
                  int active_idx);
 
                  const wxArrayString& items,
                  int active_idx);
 
-    int GetBestTabCtrlSize(wxWindow* wnd);    
+    int GetBestTabCtrlSize(wxWindow* wnd,
+                 wxAuiNotebookPageArray& pages);  
 
 protected:
 
 
 protected:
 
@@ -289,80 +372,9 @@ protected:
 
 
 
 
 
 
-// event declarations/classes
-
-class WXDLLIMPEXP_AUI wxAuiNotebookEvent : public wxNotifyEvent
-{
-public:
-    wxAuiNotebookEvent(wxEventType command_type = wxEVT_NULL,
-                       int win_id = 0)
-          : wxNotifyEvent(command_type, win_id)
-    {
-        old_selection = -1;
-        selection = -1;
-        drag_source = NULL;
-    }
-#ifndef SWIG
-    wxAuiNotebookEvent(const wxAuiNotebookEvent& c) : wxNotifyEvent(c)
-    {
-        old_selection = c.old_selection;
-        selection = c.selection;
-        drag_source = c.drag_source;
-    }
-#endif
-    wxEvent *Clone() const { return new wxAuiNotebookEvent(*this); }
-
-    void SetSelection(int s) { selection = s; m_commandInt = s; }
-    int GetSelection() const { return selection; }
-    
-    void SetOldSelection(int s) { old_selection = s; }
-    int GetOldSelection() const { return old_selection; }
-    
-    void SetDragSource(wxAuiNotebook* s) { drag_source = s; }
-    wxAuiNotebook* GetDragSource() const { return drag_source; }
-
-public:
-    int old_selection;
-    int selection;
-    wxAuiNotebook* drag_source;
-
-#ifndef SWIG
-private:
-    DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxAuiNotebookEvent)
-#endif
-};
-
-
-
-
-
-class WXDLLIMPEXP_AUI wxAuiNotebookPage
-{
-public:
-    wxWindow* window;     // page's associated window
-    wxString caption;     // caption displayed on the tab
-    wxBitmap bitmap;      // tab's bitmap
-    wxRect rect;          // tab's hit rectangle
-    bool active;          // true if the page is currently active
-};
-
-class WXDLLIMPEXP_AUI wxAuiTabContainerButton
-{
-public:
 
 
-    int id;               // button's id
-    int cur_state;        // current state (normal, hover, pressed, etc.)
-    int location;         // buttons location (wxLEFT, wxRIGHT, or wxCENTER)
-    wxBitmap bitmap;      // button's hover bitmap
-    wxBitmap dis_bitmap;  // button's disabled bitmap
-    wxRect rect;          // button's hit rectangle
-};
 
 
 
 
-#ifndef SWIG
-WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiNotebookPage, wxAuiNotebookPageArray, WXDLLIMPEXP_AUI);
-WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiTabContainerButton, wxAuiTabContainerButtonArray, WXDLLIMPEXP_AUI);
-#endif
 
 
 class WXDLLIMPEXP_AUI wxAuiTabContainer
 
 
 class WXDLLIMPEXP_AUI wxAuiTabContainer
@@ -510,12 +522,19 @@ public:
     size_t GetPageCount() const;
     wxWindow* GetPage(size_t page_idx) const;
 
     size_t GetPageCount() const;
     wxWindow* GetPage(size_t page_idx) const;
 
-
     void SetArtProvider(wxAuiTabArt* art);
     wxAuiTabArt* GetArtProvider();
 
 protected:
 
     void SetArtProvider(wxAuiTabArt* art);
     wxAuiTabArt* GetArtProvider();
 
 protected:
 
+    // these can be overridden
+    virtual void SetTabCtrlHeight(int height);
+    virtual int CalculateTabCtrlHeight();
+    
+protected:
+
+    void DoSizing();
+    void InitNotebook(long style);
     wxAuiTabCtrl* GetTabCtrlFromPoint(const wxPoint& pt);
     wxWindow* GetTabFrameFromTabCtrl(wxWindow* tab_ctrl);
     wxAuiTabCtrl* GetActiveTabCtrl();
     wxAuiTabCtrl* GetTabCtrlFromPoint(const wxPoint& pt);
     wxWindow* GetTabFrameFromTabCtrl(wxWindow* tab_ctrl);
     wxAuiTabCtrl* GetActiveTabCtrl();
@@ -524,8 +543,6 @@ protected:
 
 protected:
 
 
 protected:
 
-    void DoSizing();
-    void InitNotebook(long style);
 
     void OnChildFocus(wxChildFocusEvent& evt);
     void OnRender(wxAuiManagerEvent& evt);
 
     void OnChildFocus(wxChildFocusEvent& evt);
     void OnRender(wxAuiManagerEvent& evt);
index c9036eea9dc9c6edb3755f60f026408f2c7e677b..cb9cdd25096184c06ce09b641e214eeb9788636d 100644 (file)
@@ -1448,8 +1448,10 @@ wxAuiNotebook* MyFrame::CreateNotebook()
                                     wxPoint(client_size.x, client_size.y),
                                     wxSize(430,200),
                                     m_notebook_style);
                                     wxPoint(client_size.x, client_size.y),
                                     wxSize(430,200),
                                     m_notebook_style);
+   
+   wxBitmap page_bmp = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16));
                                     
                                     
-   ctrl->AddPage(CreateHTMLCtrl(ctrl), wxT("Welcome to wxAUI"));
+   ctrl->AddPage(CreateHTMLCtrl(ctrl), wxT("Welcome to wxAUI") , false, page_bmp);
                                     
    wxPanel *panel = new wxPanel( ctrl, wxID_ANY );
    wxFlexGridSizer *flex = new wxFlexGridSizer( 2 );
                                     
    wxPanel *panel = new wxPanel( ctrl, wxID_ANY );
    wxFlexGridSizer *flex = new wxFlexGridSizer( 2 );
@@ -1465,10 +1467,10 @@ wxAuiNotebook* MyFrame::CreateNotebook()
                 wxSP_ARROW_KEYS, 5, 50, 5 ), 0, wxALL|wxALIGN_CENTRE, 5 );
    flex->Add( 5,5 );   flex->Add( 5,5 );
    panel->SetSizer( flex );
                 wxSP_ARROW_KEYS, 5, 50, 5 ), 0, wxALL|wxALIGN_CENTRE, 5 );
    flex->Add( 5,5 );   flex->Add( 5,5 );
    panel->SetSizer( flex );
-   ctrl->AddPage( panel, wxT("wxPanel") );
+   ctrl->AddPage( panel, wxT("wxPanel"), false, page_bmp );
    
    ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some text"),
    
    ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some text"),
-                wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 1") );
+                wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 1"), false, page_bmp );
                 
    ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"),
                 wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 2") );
                 
    ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"),
                 wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 2") );
index c9dd3278738657b9c9ae5e75e6e184a2cb95d24e..bc62aaef78fffdd0566554d56d00b352c5354881 100644 (file)
@@ -221,6 +221,7 @@ wxAuiDefaultTabArt::wxAuiDefaultTabArt()
     m_measuring_font = m_selected_font;
     
     m_fixed_tab_width = 100;
     m_measuring_font = m_selected_font;
     
     m_fixed_tab_width = 100;
+    m_tab_ctrl_height = 0;
 
     wxColour base_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
 
 
     wxColour base_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
 
@@ -284,6 +285,8 @@ void wxAuiDefaultTabArt::SetSizingInfo(const wxSize& tab_ctrl_size,
         
     if (m_fixed_tab_width > 220)
         m_fixed_tab_width = 220;
         
     if (m_fixed_tab_width > 220)
         m_fixed_tab_width = 220;
+        
+    m_tab_ctrl_height = tab_ctrl_size.y;
 }
                        
                        
 }
                        
                        
@@ -316,6 +319,7 @@ void wxAuiDefaultTabArt::DrawTab(wxDC& dc,
                                  wxWindow* wnd,
                                  const wxRect& in_rect,
                                  const wxString& caption_text,
                                  wxWindow* wnd,
                                  const wxRect& in_rect,
                                  const wxString& caption_text,
+                                 const wxBitmap& bitmap,
                                  bool active,
                                  int close_button_state,
                                  wxRect* out_tab_rect,
                                  bool active,
                                  int close_button_state,
                                  wxRect* out_tab_rect,
@@ -338,9 +342,15 @@ void wxAuiDefaultTabArt::DrawTab(wxDC& dc,
     dc.GetTextExtent(caption, &normal_textx, &normal_texty);
         
     // figure out the size of the tab
     dc.GetTextExtent(caption, &normal_textx, &normal_texty);
         
     // figure out the size of the tab
-    wxSize tab_size = GetTabSize(dc, wnd, caption, active, close_button_state, x_extent);
-
-    wxCoord tab_height = tab_size.y;
+    wxSize tab_size = GetTabSize(dc,
+                                 wnd,
+                                 caption,
+                                 bitmap,
+                                 active,
+                                 close_button_state,
+                                 x_extent);
+
+    wxCoord tab_height = m_tab_ctrl_height - 3;
     wxCoord tab_width = tab_size.x;
     wxCoord tab_x = in_rect.x;
     wxCoord tab_y = in_rect.y + in_rect.height - tab_height;
     wxCoord tab_width = tab_size.x;
     wxCoord tab_x = in_rect.x;
     wxCoord tab_y = in_rect.y + in_rect.height - tab_height;
@@ -388,6 +398,9 @@ void wxAuiDefaultTabArt::DrawTab(wxDC& dc,
     points[5].x = tab_x + tab_width;
     points[5].y = tab_y + tab_height - 4;
 
     points[5].x = tab_x + tab_width;
     points[5].y = tab_y + tab_height - 4;
 
+    int drawn_tab_yoff = points[1].y;
+    int drawn_tab_height = points[0].y - points[1].y;
+
 
     // draw gradient background
     if (active)
 
     // draw gradient background
     if (active)
@@ -423,17 +436,33 @@ void wxAuiDefaultTabArt::DrawTab(wxDC& dc,
         dc.DrawLine(points[0].x, points[0].y, points[5].x+1, points[5].y);
     }
     
         dc.DrawLine(points[0].x, points[0].y, points[5].x+1, points[5].y);
     }
     
-    int text_offset;
 
 
+    int text_offset = tab_x + 8;
     int close_button_width = 0;
     int close_button_width = 0;
-    
     if (close_button_state != wxAUI_BUTTON_STATE_HIDDEN)
     {
         close_button_width = m_active_close_bmp.GetWidth();
     }
     
     if (close_button_state != wxAUI_BUTTON_STATE_HIDDEN)
     {
         close_button_width = m_active_close_bmp.GetWidth();
     }
     
-    text_offset = tab_x + 8;
     
     
+    if (bitmap.IsOk())
+    {
+        int bitmap_offset = tab_x + 8;
+        
+        // draw bitmap
+        dc.DrawBitmap(bitmap,
+                      bitmap_offset,
+                      drawn_tab_yoff + (drawn_tab_height/2) - (bitmap.GetHeight()/2) + 1,
+                      true);
+        
+        text_offset = bitmap_offset + bitmap.GetWidth();
+        text_offset += 3; // bitmap padding
+    }
+     else
+    {
+        text_offset = tab_x + 8;
+    }
+        
 
     wxString draw_text = ChopText(dc,
                           caption,
 
     wxString draw_text = ChopText(dc,
                           caption,
@@ -442,7 +471,7 @@ void wxAuiDefaultTabArt::DrawTab(wxDC& dc,
     // draw tab text
     dc.DrawText(draw_text,
                 text_offset,
     // draw tab text
     dc.DrawText(draw_text,
                 text_offset,
-                (tab_y + tab_height)/2 - (texty/2));
+                drawn_tab_yoff + (drawn_tab_height)/2 - (texty/2) - 1);
 
 
 
 
 
 
@@ -481,6 +510,7 @@ int wxAuiDefaultTabArt::GetIndentSize()
 wxSize wxAuiDefaultTabArt::GetTabSize(wxDC& dc,
                                       wxWindow* WXUNUSED(wnd),
                                       const wxString& caption,
 wxSize wxAuiDefaultTabArt::GetTabSize(wxDC& dc,
                                       wxWindow* WXUNUSED(wnd),
                                       const wxString& caption,
+                                      const wxBitmap& bitmap,
                                       bool WXUNUSED(active),
                                       int close_button_state,
                                       int* x_extent)
                                       bool WXUNUSED(active),
                                       int close_button_state,
                                       int* x_extent)
@@ -493,12 +523,24 @@ wxSize wxAuiDefaultTabArt::GetTabSize(wxDC& dc,
     dc.GetTextExtent(wxT("ABCDEFXj"), &tmp, &measured_texty);
     
     // add padding around the text
     dc.GetTextExtent(wxT("ABCDEFXj"), &tmp, &measured_texty);
     
     // add padding around the text
-    wxCoord tab_width = measured_textx + 16;
-    wxCoord tab_height = measured_texty + 10;
+    wxCoord tab_width = measured_textx;
+    wxCoord tab_height = measured_texty;
 
 
+    // if the close button is showing, add space for it
     if (close_button_state != wxAUI_BUTTON_STATE_HIDDEN)
         tab_width += m_active_close_bmp.GetWidth() + 3;
 
     if (close_button_state != wxAUI_BUTTON_STATE_HIDDEN)
         tab_width += m_active_close_bmp.GetWidth() + 3;
 
+    // if there's a bitmap, add space for it
+    if (bitmap.IsOk())
+    {
+        tab_width += bitmap.GetWidth();
+        tab_width += 3; // right side bitmap padding
+        tab_height = wxMax(tab_height, bitmap.GetHeight());
+    }
+
+    // add padding
+    tab_width += 16;
+    tab_height += 10;
 
     if (m_flags & wxAUI_NB_TAB_FIXED_WIDTH)
     {
 
     if (m_flags & wxAUI_NB_TAB_FIXED_WIDTH)
     {
@@ -627,18 +669,34 @@ int wxAuiDefaultTabArt::ShowWindowList(wxWindow* wnd,
     return -1;
 }
 
     return -1;
 }
 
-int wxAuiDefaultTabArt::GetBestTabCtrlSize(wxWindow* wnd)
+int wxAuiDefaultTabArt::GetBestTabCtrlSize(wxWindow* wnd,
+                                           wxAuiNotebookPageArray& pages)
 {
     wxClientDC dc(wnd);
     dc.SetFont(m_measuring_font);
 {
     wxClientDC dc(wnd);
     dc.SetFont(m_measuring_font);
-    int x_ext = 0;
-    wxSize s = GetTabSize(dc,
-                          wnd,
-                          wxT("ABCDEFGHIj"),
-                          true,
-                          wxAUI_BUTTON_STATE_HIDDEN,
-                          &x_ext);
-    return s.y+3;
+    
+    int max_y = 0;
+    size_t i, page_count = pages.GetCount();
+    for (i = 0; i < page_count; ++i)
+    {
+        wxAuiNotebookPage& page = pages.Item(i);
+
+        // we don't use the caption text because we don't
+        // want tab heights to be different in the case
+        // of a very short piece of text on one tab and a very
+        // tall piece of text on another tab
+        int x_ext = 0;
+        wxSize s = GetTabSize(dc,
+                              wnd,
+                              wxT("ABCDEFGHIj"),
+                              page.bitmap,
+                              true,
+                              wxAUI_BUTTON_STATE_HIDDEN,
+                              &x_ext);
+        max_y = wxMax(max_y, s.y);
+    }
+    
+    return max_y+2;
 }
 
 void wxAuiDefaultTabArt::SetNormalFont(const wxFont& font)
 }
 
 void wxAuiDefaultTabArt::SetNormalFont(const wxFont& font)
@@ -760,6 +818,7 @@ void wxAuiSimpleTabArt::DrawTab(wxDC& dc,
                                 wxWindow* wnd,
                                 const wxRect& in_rect,
                                 const wxString& caption_text,
                                 wxWindow* wnd,
                                 const wxRect& in_rect,
                                 const wxString& caption_text,
+                                const wxBitmap& bitmap,
                                 bool active,
                                 int close_button_state,
                                 wxRect* out_tab_rect,
                                 bool active,
                                 int close_button_state,
                                 wxRect* out_tab_rect,
@@ -782,7 +841,13 @@ void wxAuiSimpleTabArt::DrawTab(wxDC& dc,
     dc.GetTextExtent(caption, &normal_textx, &normal_texty);
         
     // figure out the size of the tab
     dc.GetTextExtent(caption, &normal_textx, &normal_texty);
         
     // figure out the size of the tab
-    wxSize tab_size = GetTabSize(dc, wnd, caption, active, close_button_state, x_extent);
+    wxSize tab_size = GetTabSize(dc,
+                                 wnd,
+                                 caption,
+                                 bitmap,
+                                 active,
+                                 close_button_state,
+                                 x_extent);
 
     wxCoord tab_height = tab_size.y;
     wxCoord tab_width = tab_size.x;
 
     wxCoord tab_height = tab_size.y;
     wxCoord tab_width = tab_size.x;
@@ -898,6 +963,7 @@ int wxAuiSimpleTabArt::GetIndentSize()
 wxSize wxAuiSimpleTabArt::GetTabSize(wxDC& dc,
                                      wxWindow* WXUNUSED(wnd),
                                      const wxString& caption,
 wxSize wxAuiSimpleTabArt::GetTabSize(wxDC& dc,
                                      wxWindow* WXUNUSED(wnd),
                                      const wxString& caption,
+                                     const wxBitmap& WXUNUSED(bitmap),
                                      bool WXUNUSED(active),
                                      int close_button_state,
                                      int* x_extent)
                                      bool WXUNUSED(active),
                                      int close_button_state,
                                      int* x_extent)
@@ -1040,7 +1106,8 @@ int wxAuiSimpleTabArt::ShowWindowList(wxWindow* wnd,
     return -1;
 }
 
     return -1;
 }
 
-int wxAuiSimpleTabArt::GetBestTabCtrlSize(wxWindow* wnd)
+int wxAuiSimpleTabArt::GetBestTabCtrlSize(wxWindow* wnd,
+                                          wxAuiNotebookPageArray& WXUNUSED(pages))
 {
     wxClientDC dc(wnd);
     dc.SetFont(m_measuring_font);
 {
     wxClientDC dc(wnd);
     dc.SetFont(m_measuring_font);
@@ -1048,6 +1115,7 @@ int wxAuiSimpleTabArt::GetBestTabCtrlSize(wxWindow* wnd)
     wxSize s = GetTabSize(dc,
                           wnd,
                           wxT("ABCDEFGHIj"),
     wxSize s = GetTabSize(dc,
                           wnd,
                           wxT("ABCDEFGHIj"),
+                          wxNullBitmap,
                           true,
                           wxAUI_BUTTON_STATE_HIDDEN,
                           &x_ext);
                           true,
                           wxAUI_BUTTON_STATE_HIDDEN,
                           &x_ext);
@@ -1440,6 +1508,7 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd)
         wxSize size = m_art->GetTabSize(dc,
                             wnd,
                             page.caption,
         wxSize size = m_art->GetTabSize(dc,
                             wnd,
                             page.caption,
+                            page.bitmap,
                             page.active,
                             close_button ?
                               wxAUI_BUTTON_STATE_NORMAL :
                             page.active,
                             close_button ?
                               wxAUI_BUTTON_STATE_NORMAL :
@@ -1645,6 +1714,7 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd)
                        wnd,
                        rect,
                        page.caption,
                        wnd,
                        rect,
                        page.caption,
+                       page.bitmap,
                        page.active,
                        tab_button.cur_state,
                        &page.rect,
                        page.active,
                        tab_button.cur_state,
                        &page.rect,
@@ -1681,6 +1751,7 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd)
                        wnd,
                        active_rect,
                        page.caption,
                        wnd,
                        active_rect,
                        page.caption,
+                       page.bitmap,
                        page.active,
                        tab_button.cur_state,
                        &page.rect,
                        page.active,
                        tab_button.cur_state,
                        &page.rect,
@@ -2263,25 +2334,44 @@ void wxAuiNotebook::SetArtProvider(wxAuiTabArt* art)
 {
     m_tabs.SetArtProvider(art);
     
 {
     m_tabs.SetArtProvider(art);
     
-    // choose a default for the tab height
-    m_tab_ctrl_height = art->GetBestTabCtrlSize(this);
-    
-    wxAuiPaneInfoArray& all_panes = m_mgr.GetAllPanes();
-    size_t i, pane_count = all_panes.GetCount();
-    for (i = 0; i < pane_count; ++i)
+    SetTabCtrlHeight(CalculateTabCtrlHeight());
+}
+
+void wxAuiNotebook::SetTabCtrlHeight(int height)
+{
+    // if the tab control height needs to change, update
+    // all of our tab controls with the new height
+    if (m_tab_ctrl_height != height)
     {
     {
-        wxAuiPaneInfo& pane = all_panes.Item(i);
-        if (pane.name == wxT("dummy"))
-            continue;
-        wxTabFrame* tab_frame = (wxTabFrame*)pane.window;
-        wxAuiTabCtrl* tabctrl = tab_frame->m_tabs;
-        tab_frame->SetTabCtrlHeight(m_tab_ctrl_height);
-        tabctrl->SetArtProvider(art->Clone());
-        tab_frame->DoSizing();
+        wxAuiTabArt* art = m_tabs.GetArtProvider();
+        
+        m_tab_ctrl_height = height;
+        
+        wxAuiPaneInfoArray& all_panes = m_mgr.GetAllPanes();
+        size_t i, pane_count = all_panes.GetCount();
+        for (i = 0; i < pane_count; ++i)
+        {
+            wxAuiPaneInfo& pane = all_panes.Item(i);
+            if (pane.name == wxT("dummy"))
+                continue;
+            wxTabFrame* tab_frame = (wxTabFrame*)pane.window;
+            wxAuiTabCtrl* tabctrl = tab_frame->m_tabs;
+            tab_frame->SetTabCtrlHeight(m_tab_ctrl_height);
+            tabctrl->SetArtProvider(art->Clone());
+            tab_frame->DoSizing();
+        }
     }
     }
-    
 }
 
 }
 
+int wxAuiNotebook::CalculateTabCtrlHeight()
+{
+    // find out new best tab height
+    wxAuiTabArt* art = m_tabs.GetArtProvider();
+  
+    return art->GetBestTabCtrlSize(this, m_tabs.GetPages());
+}
+
+
 wxAuiTabArt* wxAuiNotebook::GetArtProvider()
 {
     return m_tabs.GetArtProvider();
 wxAuiTabArt* wxAuiNotebook::GetArtProvider()
 {
     return m_tabs.GetArtProvider();
@@ -2347,6 +2437,7 @@ bool wxAuiNotebook::InsertPage(size_t page_idx,
          else
         active_tabctrl->InsertPage(page, info, page_idx);
 
          else
         active_tabctrl->InsertPage(page, info, page_idx);
 
+    SetTabCtrlHeight(CalculateTabCtrlHeight());
     DoSizing();
     active_tabctrl->DoShowHide();
 
     DoSizing();
     active_tabctrl->DoShowHide();