X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0326511329e2cdcd3005ab7c9c0709defe0bcc66..f5766910b6731eb03e82371416e9778203396ce7:/src/aui/auibook.cpp?ds=sidebyside diff --git a/src/aui/auibook.cpp b/src/aui/auibook.cpp index 2553b63f17..0b67e2e8f9 100644 --- a/src/aui/auibook.cpp +++ b/src/aui/auibook.cpp @@ -74,8 +74,8 @@ static wxBitmap BitmapFromBits(const unsigned char bits[], int w, int h, const wxColour& color) { wxImage img = wxBitmap((const char*)bits, w, h).ConvertToImage(); - img.Replace(255,255,255,123,123,123); - img.Replace(0,0,0,color.Red(),color.Green(),color.Blue()); + img.Replace(0,0,0,123,123,123); + img.Replace(255,255,255,color.Red(),color.Green(),color.Blue()); img.SetMaskColour(123,123,123); return wxBitmap(img); } @@ -313,7 +313,7 @@ void wxAuiTabContainer::AddButton(int id, const wxBitmap& bmp) void wxAuiTabContainer::DrawTab(wxDC* dc, const wxRect& in_rect, - const wxString& caption, + const wxString& caption_text, bool active, wxRect* out_rect, int* x_extent) @@ -324,6 +324,11 @@ void wxAuiTabContainer::DrawTab(wxDC* dc, wxCoord textx, texty; + // if the caption is empty, measure some temporary text + wxString caption = caption_text; + if (caption_text.empty()) + caption = wxT("Xj"); + // measure text dc->SetFont(m_measuring_font); dc->GetTextExtent(caption, &measured_textx, &measured_texty); @@ -334,6 +339,7 @@ void wxAuiTabContainer::DrawTab(wxDC* dc, dc->SetFont(m_normal_font); dc->GetTextExtent(caption, &normal_textx, &normal_texty); + caption = caption_text; wxCoord tab_height = measured_texty + 4; wxCoord tab_width = measured_textx + tab_height + 5; @@ -494,7 +500,7 @@ void wxAuiTabContainer::Render(wxDC* raw_dc) // true if a tab was hit, otherwise false bool wxAuiTabContainer::TabHitTest(int x, int y, wxWindow** hit) const { - if (!m_rect.Inside(x,y)) + if (!m_rect.Contains(x,y)) return false; size_t i, page_count = m_pages.GetCount(); @@ -502,7 +508,7 @@ bool wxAuiTabContainer::TabHitTest(int x, int y, wxWindow** hit) const for (i = 0; i < page_count; ++i) { wxAuiNotebookPage& page = m_pages.Item(i); - if (page.rect.Inside(x,y)) + if (page.rect.Contains(x,y)) { *hit = page.window; return true; @@ -517,7 +523,7 @@ bool wxAuiTabContainer::TabHitTest(int x, int y, wxWindow** hit) const bool wxAuiTabContainer::ButtonHitTest(int x, int y, wxAuiTabContainerButton** hit) const { - if (!m_rect.Inside(x,y)) + if (!m_rect.Contains(x,y)) return false; size_t i, button_count = m_buttons.GetCount(); @@ -525,7 +531,7 @@ bool wxAuiTabContainer::ButtonHitTest(int x, int y, for (i = 0; i < button_count; ++i) { wxAuiTabContainerButton& button = m_buttons.Item(i); - if (button.rect.Inside(x,y)) + if (button.rect.Contains(x,y)) { *hit = &button; return true; @@ -612,10 +618,22 @@ wxAuiTabCtrl::wxAuiTabCtrl(wxWindow* parent, m_hover_button = NULL; // FIXME: copied from dockart-- needs to put in a common place +#if defined( __WXMAC__ ) + static unsigned char close_bits[]={ + 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0xFE, 0x03, 0xF8, 0x01, 0xF0, 0x19, 0xF3, + 0xB8, 0xE3, 0xF0, 0xE1, 0xE0, 0xE0, 0xF0, 0xE1, 0xB8, 0xE3, 0x19, 0xF3, + 0x01, 0xF0, 0x03, 0xF8, 0x0F, 0xFE, 0xFF, 0xFF }; +#elif defined( __WXGTK__) + static unsigned char close_bits[]={ + 0xff, 0xff, 0xff, 0xff, 0x07, 0xf0, 0xfb, 0xef, 0xdb, 0xed, 0x8b, 0xe8, + 0x1b, 0xec, 0x3b, 0xee, 0x1b, 0xec, 0x8b, 0xe8, 0xdb, 0xed, 0xfb, 0xef, + 0x07, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; +#else static unsigned char close_bits[]={ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xef,0xfb,0xcf,0xf9, 0x9f,0xfc,0x3f,0xfe,0x3f,0xfe,0x9f,0xfc,0xcf,0xf9,0xef,0xfb, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}; +#endif AddButton(101, BitmapFromBits(close_bits, 16, 16, *wxBLACK)); } @@ -824,6 +842,7 @@ public: m_tabs->SetSize(m_rect.x, m_rect.y, m_rect.width, tab_height); m_tabs->SetRect(wxRect(0, 0, m_rect.width, tab_height)); m_tabs->Refresh(); + m_tabs->Update(); wxAuiNotebookPageArray& pages = m_tabs->GetPages(); size_t i, page_count = pages.GetCount(); @@ -1119,9 +1138,9 @@ bool wxAuiMultiNotebook::SetPageText(size_t page_idx, const wxString& text) wxAuiNotebookPage& info = ctrl->GetPage(ctrl_idx); info.caption = text; ctrl->Refresh(); + ctrl->Update(); } - return true; } @@ -1436,7 +1455,7 @@ wxAuiTabCtrl* wxAuiMultiNotebook::GetTabCtrlFromPoint(const wxPoint& pt) continue; wxTabFrame* tabframe = (wxTabFrame*)all_panes.Item(i).window; - if (tabframe->m_tab_rect.Inside(pt)) + if (tabframe->m_tab_rect.Contains(pt)) return tabframe->m_tabs; }