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,
// 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
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;
}
}
}