X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4ae3fe39529688ffc016b2059321720d8bde7064..06fe46e2ffb5c9d54bab8509c68d2379370cb536:/src/aui/auibook.cpp?ds=inline diff --git a/src/aui/auibook.cpp b/src/aui/auibook.cpp index 048229f35f..dc5ce84949 100644 --- a/src/aui/auibook.cpp +++ b/src/aui/auibook.cpp @@ -34,7 +34,9 @@ #include "wx/renderer.h" #ifdef __WXMAC__ -#include "wx/mac/carbon/private.h" +#include "wx/osx/private.h" +// for themeing support +#include #endif #include "wx/arrimpl.cpp" @@ -193,7 +195,7 @@ wxAuiDefaultTabArt::wxAuiDefaultTabArt() m_fixed_tab_width = 100; m_tab_ctrl_height = 0; -#ifdef __WXMAC__ +#if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON wxColor base_colour = wxColour( wxMacCreateCGColorFromHITheme(kThemeBrushToolbarBackground)); #else wxColor base_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); @@ -1611,6 +1613,11 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd) return; wxMemoryDC dc; + + // use the same layout direction as the window DC uses to ensure that the + // text is rendered correctly + dc.SetLayoutDirection(raw_dc->GetLayoutDirection()); + wxBitmap bmp; size_t i; size_t page_count = m_pages.GetCount(); @@ -2186,6 +2193,7 @@ BEGIN_EVENT_TABLE(wxAuiTabCtrl, wxControl) EVT_SET_FOCUS(wxAuiTabCtrl::OnSetFocus) EVT_KILL_FOCUS(wxAuiTabCtrl::OnKillFocus) EVT_CHAR(wxAuiTabCtrl::OnChar) + EVT_MOUSE_CAPTURE_LOST(wxAuiTabCtrl::OnCaptureLost) END_EVENT_TABLE() @@ -2268,6 +2276,10 @@ void wxAuiTabCtrl::OnLeftDown(wxMouseEvent& evt) } } +void wxAuiTabCtrl::OnCaptureLost(wxMouseCaptureLostEvent& WXUNUSED(event)) +{ +} + void wxAuiTabCtrl::OnLeftUp(wxMouseEvent& evt) { if (GetCapture() == this) @@ -2576,7 +2588,19 @@ void wxAuiTabCtrl::OnChar(wxKeyEvent& event) int newPage = -1; - if (key == WXK_RIGHT) + int forwardKey, backwardKey; + if (GetLayoutDirection() == wxLayout_RightToLeft) + { + forwardKey = WXK_LEFT; + backwardKey = WXK_RIGHT; + } + else + { + forwardKey = WXK_RIGHT; + backwardKey = WXK_LEFT; + } + + if (key == forwardKey) { if (m_pages.GetCount() > 1) { @@ -2586,7 +2610,7 @@ void wxAuiTabCtrl::OnChar(wxKeyEvent& event) newPage = GetActivePage() + 1; } } - else if (key == WXK_LEFT) + else if (key == backwardKey) { if (m_pages.GetCount() > 1) { @@ -2695,16 +2719,23 @@ public: for (i = 0; i < page_count; ++i) { + int height = m_rect.height - m_tab_ctrl_height; + if ( height < 0 ) + { + // avoid passing negative height to wxWindow::SetSize(), this + // results in assert failures/GTK+ warnings + height = 0; + } + wxAuiNotebookPage& page = pages.Item(i); if (m_tabs->GetFlags() & wxAUI_NB_BOTTOM) { - page.window->SetSize(m_rect.x, m_rect.y, - m_rect.width, m_rect.height - m_tab_ctrl_height); + page.window->SetSize(m_rect.x, m_rect.y, m_rect.width, height); } else //TODO: if (GetFlags() & wxAUI_NB_TOP) { page.window->SetSize(m_rect.x, m_rect.y + m_tab_ctrl_height, - m_rect.width, m_rect.height - m_tab_ctrl_height); + m_rect.width, height); } // TODO: else if (GetFlags() & wxAUI_NB_LEFT){} // TODO: else if (GetFlags() & wxAUI_NB_RIGHT){} @@ -3065,7 +3096,7 @@ bool wxAuiNotebook::InsertPage(size_t page_idx, wxASSERT_MSG(page, wxT("page pointer must be non-NULL")); if (!page) return false; - + page->Reparent(this); wxAuiNotebookPage info; @@ -4233,7 +4264,7 @@ void wxAuiNotebook::OnTabButton(wxCommandEvent& command_evt) { // if the close button is to the right, use the active // page selection to determine which page to close - selection = GetSelection(); + selection = tabs->GetActivePage(); } if (selection != -1)