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, 0xe7, 0xf3, 0xcf, 0xf9,
{
m_fixed_tab_width = 100;
- int tot_width = tab_ctrl_size.x;
+ int tot_width = (int)tab_ctrl_size.x - GetIndentSize() - 4;
if (tab_count > 0)
{
m_fixed_tab_width = tot_width/(int)tab_count;
// draw gradient background
if (active)
- {
+ {
wxColour c = m_bkbrush.GetColour();
dc.SetPen(wxPen(c));
{
wxColour c = m_bkbrush.GetColour();
dc.SetPen(wxPen(c));
- dc.DrawLine(points[0].x+1, points[0].y, points[5].x, points[5].y);
+ dc.DrawLine(points[0].x, points[0].y, points[5].x+1, points[5].y);
}
int text_offset;
dc.GetTextExtent(wxT("ABCDEFXj"), &tmp, &measured_texty);
- wxCoord tab_width = measured_textx + 5;
+ // add padding around the text
+ wxCoord tab_width = measured_textx + 16;
wxCoord tab_height = measured_texty + 10;
if (close_button_state != wxAUI_BUTTON_STATE_HIDDEN)
- tab_width += m_active_close_bmp.GetWidth() + 8;
+ tab_width += m_active_close_bmp.GetWidth() + 3;
if (m_flags & wxAUI_NB_TAB_FIXED_WIDTH)
{
m_fixed_tab_width = 100;
- int tot_width = tab_ctrl_size.x;
+ int tot_width = (int)tab_ctrl_size.x - GetIndentSize() - 4;
if (tab_count > 0)
{
m_fixed_tab_width = tot_width/(int)tab_count;
// provide custom drawing capabilities
void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd)
{
+ if (!raw_dc || !raw_dc->IsOk())
+ return;
+
wxMemoryDC dc;
wxBitmap bmp;
size_t i;
bmp.Create(m_rect.GetWidth(), m_rect.GetHeight());
dc.SelectObject(bmp);
+ if (!dc.IsOk())
+ return;
// find out if size of tabs is larger than can be
// afforded on screen
rect.x = offset;
rect.width = m_rect.width - right_buttons_width - offset - 2;
+ if (rect.width <= 0)
+ break;
+
+
m_art->DrawTab(dc,
for (i = 0; i < button_count; ++i)
{
wxAuiTabContainerButton& button = m_buttons.Item(i);
- if (button.rect.Contains(x,y))
+ if (button.rect.Contains(x,y) &&
+ !(button.cur_state & (wxAUI_BUTTON_STATE_HIDDEN |
+ wxAUI_BUTTON_STATE_DISABLED)))
{
if (hit)
*hit = &button;
for (i = 0; i < button_count; ++i)
{
wxAuiTabContainerButton& button = m_tab_close_buttons.Item(i);
- if (button.rect.Contains(x,y))
+ if (button.rect.Contains(x,y) &&
+ !(button.cur_state & (wxAUI_BUTTON_STATE_HIDDEN |
+ wxAUI_BUTTON_STATE_DISABLED)))
{
if (hit)
*hit = &button;
m_click_pt = wxDefaultPosition;
m_is_dragging = false;
m_hover_button = NULL;
+ m_pressed_button = NULL;
}
wxAuiTabCtrl::~wxAuiTabCtrl()
m_click_pt = wxDefaultPosition;
m_is_dragging = false;
m_click_tab = NULL;
+ m_pressed_button = NULL;
+
wxWindow* wnd;
if (TabHitTest(evt.m_x, evt.m_y, &wnd))
m_click_pt.y = evt.m_y;
m_click_tab = wnd;
}
-
+
if (m_hover_button)
{
- m_hover_button->cur_state = wxAUI_BUTTON_STATE_PRESSED;
+ m_pressed_button = m_hover_button;
+ m_pressed_button->cur_state = wxAUI_BUTTON_STATE_PRESSED;
Refresh();
Update();
}
}
-void wxAuiTabCtrl::OnLeftUp(wxMouseEvent&)
+void wxAuiTabCtrl::OnLeftUp(wxMouseEvent& evt)
{
if (GetCapture() == this)
ReleaseMouse();
return;
}
- if (m_hover_button)
+ if (m_pressed_button)
{
- m_hover_button->cur_state = wxAUI_BUTTON_STATE_HOVER;
+ // make sure we're still clicking the button
+ wxAuiTabContainerButton* button = NULL;
+ if (!ButtonHitTest(evt.m_x, evt.m_y, &button))
+ return;
+
+ if (button != m_pressed_button)
+ {
+ m_pressed_button = NULL;
+ return;
+ }
+
Refresh();
Update();
- if (!(m_hover_button->cur_state & wxAUI_BUTTON_STATE_DISABLED))
+ if (!(m_pressed_button->cur_state & wxAUI_BUTTON_STATE_DISABLED))
{
wxAuiNotebookEvent evt(wxEVT_COMMAND_AUINOTEBOOK_BUTTON, m_windowId);
- evt.SetInt(m_hover_button->id);
+ evt.SetInt(m_pressed_button->id);
evt.SetEventObject(this);
GetEventHandler()->ProcessEvent(evt);
}
+
+ m_pressed_button = NULL;
}
m_click_pt = wxDefaultPosition;
{
wxWindow* tab_ctrl = ::wxFindWindowAtPoint(screen_pt);
+ // if we aren't over any window, stop here
+ if (!tab_ctrl)
+ return;
+
// make sure we are not over the hint window
- if (tab_ctrl && !tab_ctrl->IsKindOf(CLASSINFO(wxFrame)))
+ if (!tab_ctrl->IsKindOf(CLASSINFO(wxFrame)))
{
while (tab_ctrl)
{
if (nb != this)
{
- wxRect hint_rect = tab_ctrl->GetRect();
+ wxRect hint_rect = tab_ctrl->GetClientRect();
tab_ctrl->ClientToScreen(&hint_rect.x, &hint_rect.y);
m_mgr.ShowHint(hint_rect);
return;
}
-
+ }
+ }
+ else
+ {
+ if (!dest_tabs)
+ {
+ // we are either over a hint window, or not over a tab
+ // window, and there is no where to drag to, so exit
+ return;
}
}
}
+ // if there are less than two panes, split can't happen, so leave
+ if (m_tabs.GetPageCount() < 2)
+ return;
+
// if tab moving is not allowed, leave
if (!(m_flags & wxAUI_NB_TAB_SPLIT))
- {
return;
- }
if (src_tabs)
// only perform a tab split if it's allowed
- if (m_flags & wxAUI_NB_TAB_SPLIT)
+ if ((m_flags & wxAUI_NB_TAB_SPLIT) && m_tabs.GetPageCount() >= 2)
{
// If the pointer is in an existing tab frame, do a tab insert
wxWindow* hit_wnd = ::wxFindWindowAtPoint(mouse_screen_pt);