added UnsetToolTip() and use it in wxAUI code to fix wxX11 compilation [backport of r55269 from trunk

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@55514 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-09-07 17:09:38 +00:00
parent b8e40fb308
commit 3ba967c80b
3 changed files with 94 additions and 86 deletions

View File

@@ -1004,14 +1004,21 @@ public:
void SetToolTip( const wxString &tip ); void SetToolTip( const wxString &tip );
// attach a tooltip to the window // attach a tooltip to the window
void SetToolTip( wxToolTip *tip ) { DoSetToolTip(tip); } void SetToolTip( wxToolTip *tip ) { DoSetToolTip(tip); }
#if wxABI_VERSION >= 20809
// more readable synonym for SetToolTip(NULL)
void UnsetToolTip() { SetToolTip(NULL); }
#endif // wxABI_VERSION >= 2.8.9
// get the associated tooltip or NULL if none // get the associated tooltip or NULL if none
wxToolTip* GetToolTip() const { return m_tooltip; } wxToolTip* GetToolTip() const { return m_tooltip; }
wxString GetToolTipText() const ; wxString GetToolTipText() const ;
#else #else // !wxUSE_TOOLTIPS
// make it much easier to compile apps in an environment // make it much easier to compile apps in an environment
// that doesn't support tooltips, such as PocketPC // that doesn't support tooltips, such as PocketPC
inline void SetToolTip( const wxString & WXUNUSED(tip) ) {} void SetToolTip( const wxString & WXUNUSED(tip) ) {}
#endif // wxUSE_TOOLTIPS #if wxABI_VERSION >= 20809
void UnsetToolTip() { }
#endif // wxABI_VERSION >= 2.8.9
#endif // wxUSE_TOOLTIPS/!wxUSE_TOOLTIPS
// drag and drop // drag and drop
// ------------- // -------------

View File

@@ -37,7 +37,9 @@
#include "wx/aui/framemanager.h" #include "wx/aui/framemanager.h"
#ifdef __WXMAC__ #ifdef __WXMAC__
#include "wx/mac/carbon/private.h" #include "wx/osx/private.h"
// for themeing support
#include <Carbon/Carbon.h>
#endif #endif
#include "wx/arrimpl.cpp" #include "wx/arrimpl.cpp"
@@ -110,24 +112,22 @@ static wxBitmap MakeDisabledBitmap(wxBitmap& bmp)
static wxColor GetBaseColor() static wxColor GetBaseColor()
{ {
#ifdef __WXMAC__ #if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON
wxBrush toolbarbrush; wxColor base_colour = wxColour( wxMacCreateCGColorFromHITheme(kThemeBrushToolbarBackground));
toolbarbrush.MacSetTheme( kThemeBrushToolbarBackground );
wxColor base_color = toolbarbrush.GetColour();
#else #else
wxColor base_color = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); wxColor base_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
#endif #endif
// the base_colour is too pale to use as our base colour, // the base_colour is too pale to use as our base colour,
// so darken it a bit -- // so darken it a bit --
if ((255-base_color.Red()) + if ((255-base_colour.Red()) +
(255-base_color.Green()) + (255-base_colour.Green()) +
(255-base_color.Blue()) < 60) (255-base_colour.Blue()) < 60)
{ {
base_color = wxAuiStepColour(base_color, 92); base_colour = wxAuiStepColour(base_colour, 92);
} }
return base_color; return base_colour;
} }
@@ -165,7 +165,6 @@ const wxColour DISABLED_TEXT_COLOR(DISABLED_TEXT_GREY_HUE,
DISABLED_TEXT_GREY_HUE, DISABLED_TEXT_GREY_HUE,
DISABLED_TEXT_GREY_HUE); DISABLED_TEXT_GREY_HUE);
wxAuiDefaultToolBarArt::wxAuiDefaultToolBarArt() wxAuiDefaultToolBarArt::wxAuiDefaultToolBarArt()
{ {
m_base_colour = GetBaseColor(); m_base_colour = GetBaseColor();
@@ -210,7 +209,7 @@ wxAuiDefaultToolBarArt::~wxAuiDefaultToolBarArt()
wxAuiToolBarArt* wxAuiDefaultToolBarArt::Clone() wxAuiToolBarArt* wxAuiDefaultToolBarArt::Clone()
{ {
return wx_static_cast(wxAuiToolBarArt*, new wxAuiDefaultToolBarArt); return static_cast<wxAuiToolBarArt*>(new wxAuiDefaultToolBarArt);
} }
void wxAuiDefaultToolBarArt::SetFlags(unsigned int flags) void wxAuiDefaultToolBarArt::SetFlags(unsigned int flags)
@@ -302,7 +301,7 @@ void wxAuiDefaultToolBarArt::DrawButton(
text_x = rect.x + (rect.width/2) - (text_width/2) + 1; text_x = rect.x + (rect.width/2) - (text_width/2) + 1;
text_y = rect.y + rect.height - text_height - 1; text_y = rect.y + rect.height - text_height - 1;
} }
else if (m_text_orientation == wxAUI_TBTOOL_TEXT_RIGHT) else if (m_text_orientation == wxAUI_TBTOOL_TEXT_RIGHT)
{ {
bmp_x = rect.x + 3; bmp_x = rect.x + 3;
@@ -325,7 +324,7 @@ void wxAuiDefaultToolBarArt::DrawButton(
dc.SetBrush(wxBrush(wxAuiStepColour(m_highlight_colour, 150))); dc.SetBrush(wxBrush(wxAuiStepColour(m_highlight_colour, 150)));
dc.DrawRectangle(rect); dc.DrawRectangle(rect);
} }
else if ((item.GetState() & wxAUI_BUTTON_STATE_HOVER) || item.IsSticky()) else if ((item.GetState() & wxAUI_BUTTON_STATE_HOVER) || item.IsSticky())
{ {
dc.SetPen(wxPen(m_highlight_colour)); dc.SetPen(wxPen(m_highlight_colour));
dc.SetBrush(wxBrush(wxAuiStepColour(m_highlight_colour, 170))); dc.SetBrush(wxBrush(wxAuiStepColour(m_highlight_colour, 170)));
@@ -337,7 +336,7 @@ void wxAuiDefaultToolBarArt::DrawButton(
dc.DrawRectangle(rect); dc.DrawRectangle(rect);
} }
else if (item.GetState() & wxAUI_BUTTON_STATE_CHECKED) else if (item.GetState() & wxAUI_BUTTON_STATE_CHECKED)
{ {
// it's important to put this code in an else statment after the // it's important to put this code in an else statment after the
// hover, otherwise hovers won't draw properly for checked items // hover, otherwise hovers won't draw properly for checked items
@@ -350,7 +349,7 @@ void wxAuiDefaultToolBarArt::DrawButton(
wxBitmap bmp; wxBitmap bmp;
if (item.GetState() & wxAUI_BUTTON_STATE_DISABLED) if (item.GetState() & wxAUI_BUTTON_STATE_DISABLED)
bmp = item.GetDisabledBitmap(); bmp = item.GetDisabledBitmap();
else else
bmp = item.GetBitmap(); bmp = item.GetBitmap();
if (!bmp.IsOk()) if (!bmp.IsOk())
@@ -363,7 +362,7 @@ void wxAuiDefaultToolBarArt::DrawButton(
if (item.GetState() & wxAUI_BUTTON_STATE_DISABLED) if (item.GetState() & wxAUI_BUTTON_STATE_DISABLED)
dc.SetTextForeground(DISABLED_TEXT_COLOR); dc.SetTextForeground(DISABLED_TEXT_COLOR);
if ((m_flags & wxAUI_TB_TEXT) && item.GetLabel().Length() > 0) if ( (m_flags & wxAUI_TB_TEXT) && !item.GetLabel().empty() )
{ {
dc.DrawText(item.GetLabel(), text_x, text_y); dc.DrawText(item.GetLabel(), text_x, text_y);
} }
@@ -424,7 +423,7 @@ void wxAuiDefaultToolBarArt::DrawDropDownButton(
text_x = rect.x + (rect.width/2) - (text_width/2) + 1; text_x = rect.x + (rect.width/2) - (text_width/2) + 1;
text_y = rect.y + rect.height - text_height - 1; text_y = rect.y + rect.height - text_height - 1;
} }
else if (m_text_orientation == wxAUI_TBTOOL_TEXT_RIGHT) else if (m_text_orientation == wxAUI_TBTOOL_TEXT_RIGHT)
{ {
bmp_x = rect.x + 3; bmp_x = rect.x + 3;
@@ -446,8 +445,8 @@ void wxAuiDefaultToolBarArt::DrawDropDownButton(
dc.DrawRectangle(button_rect); dc.DrawRectangle(button_rect);
dc.DrawRectangle(dropdown_rect); dc.DrawRectangle(dropdown_rect);
} }
else if (item.GetState() & wxAUI_BUTTON_STATE_HOVER || else if (item.GetState() & wxAUI_BUTTON_STATE_HOVER ||
item.IsSticky()) item.IsSticky())
{ {
dc.SetPen(wxPen(m_highlight_colour)); dc.SetPen(wxPen(m_highlight_colour));
dc.SetBrush(wxBrush(wxAuiStepColour(m_highlight_colour, 170))); dc.SetBrush(wxBrush(wxAuiStepColour(m_highlight_colour, 170)));
@@ -462,7 +461,7 @@ void wxAuiDefaultToolBarArt::DrawDropDownButton(
bmp = item.GetDisabledBitmap(); bmp = item.GetDisabledBitmap();
dropbmp = m_disabled_button_dropdown_bmp; dropbmp = m_disabled_button_dropdown_bmp;
} }
else else
{ {
bmp = item.GetBitmap(); bmp = item.GetBitmap();
dropbmp = m_button_dropdown_bmp; dropbmp = m_button_dropdown_bmp;
@@ -479,7 +478,7 @@ void wxAuiDefaultToolBarArt::DrawDropDownButton(
if (item.GetState() & wxAUI_BUTTON_STATE_DISABLED) if (item.GetState() & wxAUI_BUTTON_STATE_DISABLED)
dc.SetTextForeground(DISABLED_TEXT_COLOR); dc.SetTextForeground(DISABLED_TEXT_COLOR);
if ((m_flags & wxAUI_TB_TEXT) && item.GetLabel().Length() > 0) if ( (m_flags & wxAUI_TB_TEXT) && !item.GetLabel().empty() )
{ {
dc.DrawText(item.GetLabel(), text_x, text_y); dc.DrawText(item.GetLabel(), text_x, text_y);
} }
@@ -521,7 +520,7 @@ void wxAuiDefaultToolBarArt::DrawControlLabel(
text_x = rect.x + (rect.width/2) - (text_width/2) + 1; text_x = rect.x + (rect.width/2) - (text_width/2) + 1;
text_y = rect.y + rect.height - text_height - 1; text_y = rect.y + rect.height - text_height - 1;
if ((m_flags & wxAUI_TB_TEXT) && item.GetLabel().Length() > 0) if ( (m_flags & wxAUI_TB_TEXT) && !item.GetLabel().empty() )
{ {
dc.DrawText(item.GetLabel(), text_x, text_y); dc.DrawText(item.GetLabel(), text_x, text_y);
} }
@@ -565,18 +564,19 @@ wxSize wxAuiDefaultToolBarArt::GetToolSize(
dc.GetTextExtent(wxT("ABCDHgj"), &tx, &ty); dc.GetTextExtent(wxT("ABCDHgj"), &tx, &ty);
height += ty; height += ty;
if (item.GetLabel().Length() > 0) if ( !item.GetLabel().empty() )
{ {
dc.GetTextExtent(item.GetLabel(), &tx, &ty); dc.GetTextExtent(item.GetLabel(), &tx, &ty);
width = wxMax(width, tx+6); width = wxMax(width, tx+6);
} }
} }
else if (m_text_orientation == wxAUI_TBTOOL_TEXT_RIGHT && item.GetLabel().Length() > 0) else if ( m_text_orientation == wxAUI_TBTOOL_TEXT_RIGHT &&
!item.GetLabel().empty() )
{ {
width += 3; // space between left border and bitmap width += 3; // space between left border and bitmap
width += 3; // space between bitmap and text width += 3; // space between bitmap and text
if (item.GetLabel().Length() > 0) if ( !item.GetLabel().empty() )
{ {
dc.GetTextExtent(item.GetLabel(), &tx, &ty); dc.GetTextExtent(item.GetLabel(), &tx, &ty);
width += tx; width += tx;
@@ -611,7 +611,7 @@ void wxAuiDefaultToolBarArt::DrawSeparator(
rect.y += (rect.height/2) - (new_height/2); rect.y += (rect.height/2) - (new_height/2);
rect.height = new_height; rect.height = new_height;
} }
else else
{ {
rect.y += (rect.height/2); rect.y += (rect.height/2);
rect.height = 1; rect.height = 1;
@@ -641,7 +641,7 @@ void wxAuiDefaultToolBarArt::DrawGripper(wxDC& dc,
if (x > rect.GetWidth()-5) if (x > rect.GetWidth()-5)
break; break;
} }
else else
{ {
x = rect.x + 3; x = rect.x + 3;
y = rect.y + (i*4) + 5; y = rect.y + (i*4) + 5;
@@ -746,7 +746,7 @@ int wxAuiDefaultToolBarArt::ShowDropDown(wxWindow* wnd,
menuPopup.Append(m); menuPopup.Append(m);
items_added++; items_added++;
} }
else if (item.GetKind() == wxITEM_SEPARATOR) else if (item.GetKind() == wxITEM_SEPARATOR)
{ {
if (items_added > 0) if (items_added > 0)
menuPopup.AppendSeparator(); menuPopup.AppendSeparator();
@@ -850,18 +850,18 @@ void wxAuiToolBar::SetWindowStyleFlag(long style)
if (m_style & wxAUI_TB_GRIPPER) if (m_style & wxAUI_TB_GRIPPER)
m_gripper_visible = true; m_gripper_visible = true;
else else
m_gripper_visible = false; m_gripper_visible = false;
if (m_style & wxAUI_TB_OVERFLOW) if (m_style & wxAUI_TB_OVERFLOW)
m_overflow_visible = true; m_overflow_visible = true;
else else
m_overflow_visible = false; m_overflow_visible = false;
if (style & wxAUI_TB_HORZ_LAYOUT) if (style & wxAUI_TB_HORZ_LAYOUT)
SetToolTextOrientation(wxAUI_TBTOOL_TEXT_RIGHT); SetToolTextOrientation(wxAUI_TBTOOL_TEXT_RIGHT);
else else
SetToolTextOrientation(wxAUI_TBTOOL_TEXT_BOTTOM); SetToolTextOrientation(wxAUI_TBTOOL_TEXT_BOTTOM);
} }
@@ -1217,7 +1217,7 @@ int wxAuiToolBar::GetToolSeparation() const
{ {
if (m_art) if (m_art)
return m_art->GetElementSize(wxAUI_TBART_SEPARATOR_SIZE); return m_art->GetElementSize(wxAUI_TBART_SEPARATOR_SIZE);
else else
return 5; return 5;
} }
@@ -1437,7 +1437,7 @@ void wxAuiToolBar::RefreshOverflowState()
{ {
if (::wxGetMouseState().LeftDown()) if (::wxGetMouseState().LeftDown())
overflow_state = wxAUI_BUTTON_STATE_PRESSED; overflow_state = wxAUI_BUTTON_STATE_PRESSED;
else else
overflow_state = wxAUI_BUTTON_STATE_HOVER; overflow_state = wxAUI_BUTTON_STATE_HOVER;
} }
@@ -1462,7 +1462,7 @@ void wxAuiToolBar::ToggleTool(int tool_id, bool state)
if (state == true) if (state == true)
tool->state |= wxAUI_BUTTON_STATE_CHECKED; tool->state |= wxAUI_BUTTON_STATE_CHECKED;
else else
tool->state &= ~wxAUI_BUTTON_STATE_CHECKED; tool->state &= ~wxAUI_BUTTON_STATE_CHECKED;
} }
} }
@@ -1490,7 +1490,7 @@ void wxAuiToolBar::EnableTool(int tool_id, bool state)
{ {
if (state == true) if (state == true)
tool->state &= ~wxAUI_BUTTON_STATE_DISABLED; tool->state &= ~wxAUI_BUTTON_STATE_DISABLED;
else else
tool->state |= wxAUI_BUTTON_STATE_DISABLED; tool->state |= wxAUI_BUTTON_STATE_DISABLED;
} }
} }
@@ -1634,7 +1634,7 @@ bool wxAuiToolBar::GetToolFitsByIndex(int tool_idx) const
if (rect.y+rect.height < cli_h) if (rect.y+rect.height < cli_h)
return true; return true;
} }
else else
{ {
// take the dropdown size into account // take the dropdown size into account
if (m_overflow_visible) if (m_overflow_visible)
@@ -1697,10 +1697,10 @@ bool wxAuiToolBar::Realize()
{ {
if (horizontal) if (horizontal)
m_gripper_sizer_item = sizer->Add(gripper_size, 1, 0, wxEXPAND); m_gripper_sizer_item = sizer->Add(gripper_size, 1, 0, wxEXPAND);
else else
m_gripper_sizer_item = sizer->Add(1, gripper_size, 0, wxEXPAND); m_gripper_sizer_item = sizer->Add(1, gripper_size, 0, wxEXPAND);
} }
else else
{ {
m_gripper_sizer_item = NULL; m_gripper_sizer_item = NULL;
} }
@@ -1710,7 +1710,7 @@ bool wxAuiToolBar::Realize()
{ {
if (horizontal) if (horizontal)
sizer->Add(m_left_padding, 1); sizer->Add(m_left_padding, 1);
else else
sizer->Add(1, m_left_padding); sizer->Add(1, m_left_padding);
} }
@@ -1758,7 +1758,7 @@ bool wxAuiToolBar::Realize()
{ {
if (horizontal) if (horizontal)
sizer_item = sizer->Add(separator_size, 1, 0, wxEXPAND); sizer_item = sizer->Add(separator_size, 1, 0, wxEXPAND);
else else
sizer_item = sizer->Add(1, separator_size, 0, wxEXPAND); sizer_item = sizer->Add(1, separator_size, 0, wxEXPAND);
// add tool packing // add tool packing
@@ -1773,7 +1773,7 @@ bool wxAuiToolBar::Realize()
case wxITEM_SPACER: case wxITEM_SPACER:
if (item.proportion > 0) if (item.proportion > 0)
sizer_item = sizer->AddStretchSpacer(item.proportion); sizer_item = sizer->AddStretchSpacer(item.proportion);
else else
sizer_item = sizer->Add(item.spacer_pixels, 1); sizer_item = sizer->Add(item.spacer_pixels, 1);
break; break;
@@ -1786,11 +1786,11 @@ bool wxAuiToolBar::Realize()
vert_sizer->AddStretchSpacer(1); vert_sizer->AddStretchSpacer(1);
ctrl_sizer_item = vert_sizer->Add(item.window, 0, wxEXPAND); ctrl_sizer_item = vert_sizer->Add(item.window, 0, wxEXPAND);
vert_sizer->AddStretchSpacer(1); vert_sizer->AddStretchSpacer(1);
if ((m_style & wxAUI_TB_TEXT) && if ( (m_style & wxAUI_TB_TEXT) &&
m_tool_text_orientation == wxAUI_TBTOOL_TEXT_BOTTOM && m_tool_text_orientation == wxAUI_TBTOOL_TEXT_BOTTOM &&
item.label.Length() > 0) !item.GetLabel().empty() )
{ {
wxSize s = GetLabelSize(item.label); wxSize s = GetLabelSize(item.GetLabel());
vert_sizer->Add(1, s.y); vert_sizer->Add(1, s.y);
} }
@@ -1829,7 +1829,7 @@ bool wxAuiToolBar::Realize()
{ {
if (horizontal) if (horizontal)
sizer->Add(m_right_padding, 1); sizer->Add(m_right_padding, 1);
else else
sizer->Add(1, m_right_padding); sizer->Add(1, m_right_padding);
} }
@@ -1843,10 +1843,10 @@ bool wxAuiToolBar::Realize()
{ {
if (horizontal) if (horizontal)
m_overflow_sizer_item = sizer->Add(overflow_size, 1, 0, wxEXPAND); m_overflow_sizer_item = sizer->Add(overflow_size, 1, 0, wxEXPAND);
else else
m_overflow_sizer_item = sizer->Add(1, overflow_size, 0, wxEXPAND); m_overflow_sizer_item = sizer->Add(1, overflow_size, 0, wxEXPAND);
} }
else else
{ {
m_overflow_sizer_item = NULL; m_overflow_sizer_item = NULL;
} }
@@ -1861,7 +1861,7 @@ bool wxAuiToolBar::Realize()
{ {
if (horizontal) if (horizontal)
outside_sizer->Add(1, m_top_padding); outside_sizer->Add(1, m_top_padding);
else else
outside_sizer->Add(m_top_padding, 1); outside_sizer->Add(m_top_padding, 1);
} }
@@ -1873,7 +1873,7 @@ bool wxAuiToolBar::Realize()
{ {
if (horizontal) if (horizontal)
outside_sizer->Add(1, m_bottom_padding); outside_sizer->Add(1, m_bottom_padding);
else else
outside_sizer->Add(m_bottom_padding, 1); outside_sizer->Add(m_bottom_padding, 1);
} }
@@ -1911,12 +1911,12 @@ bool wxAuiToolBar::Realize()
{ {
SetClientSize(new_size); SetClientSize(new_size);
} }
else else
{ {
m_sizer->SetDimension(0, 0, cur_size.x, cur_size.y); m_sizer->SetDimension(0, 0, cur_size.x, cur_size.y);
} }
} }
else else
{ {
wxSize cur_size = GetClientSize(); wxSize cur_size = GetClientSize();
m_sizer->SetDimension(0, 0, cur_size.x, cur_size.y); m_sizer->SetDimension(0, 0, cur_size.x, cur_size.y);
@@ -1944,7 +1944,7 @@ wxRect wxAuiToolBar::GetOverflowRect() const
overflow_rect.width = cli_rect.width; overflow_rect.width = cli_rect.width;
overflow_rect.height = overflow_size; overflow_rect.height = overflow_size;
} }
else else
{ {
overflow_rect.x = cli_rect.width - overflow_size; overflow_rect.x = cli_rect.width - overflow_size;
overflow_rect.y = 0; overflow_rect.y = 0;
@@ -1998,7 +1998,7 @@ void wxAuiToolBar::DoIdleUpdate()
bool is_enabled; bool is_enabled;
if (item.window) if (item.window)
is_enabled = item.window->IsEnabled(); is_enabled = item.window->IsEnabled();
else else
is_enabled = (item.state & wxAUI_BUTTON_STATE_DISABLED) ? false : true; is_enabled = (item.state & wxAUI_BUTTON_STATE_DISABLED) ? false : true;
bool new_enabled = evt.GetEnabled(); bool new_enabled = evt.GetEnabled();
@@ -2008,11 +2008,11 @@ void wxAuiToolBar::DoIdleUpdate()
{ {
item.window->Enable(new_enabled); item.window->Enable(new_enabled);
} }
else else
{ {
if (new_enabled) if (new_enabled)
item.state &= ~wxAUI_BUTTON_STATE_DISABLED; item.state &= ~wxAUI_BUTTON_STATE_DISABLED;
else else
item.state |= wxAUI_BUTTON_STATE_DISABLED; item.state |= wxAUI_BUTTON_STATE_DISABLED;
} }
need_refresh = true; need_refresh = true;
@@ -2032,7 +2032,7 @@ void wxAuiToolBar::DoIdleUpdate()
{ {
if (new_checked) if (new_checked)
item.state |= wxAUI_BUTTON_STATE_CHECKED; item.state |= wxAUI_BUTTON_STATE_CHECKED;
else else
item.state &= ~wxAUI_BUTTON_STATE_CHECKED; item.state &= ~wxAUI_BUTTON_STATE_CHECKED;
need_refresh = true; need_refresh = true;
@@ -2057,7 +2057,7 @@ void wxAuiToolBar::OnSize(wxSizeEvent& WXUNUSED(evt))
if (x > y) if (x > y)
SetOrientation(wxHORIZONTAL); SetOrientation(wxHORIZONTAL);
else else
SetOrientation(wxVERTICAL); SetOrientation(wxVERTICAL);
if (((x >= y) && m_absolute_min_size.x > x) || if (((x >= y) && m_absolute_min_size.x > x) ||
@@ -2075,7 +2075,7 @@ void wxAuiToolBar::OnSize(wxSizeEvent& WXUNUSED(evt))
} }
} }
} }
else else
{ {
// show all flexible items // show all flexible items
size_t i, count; size_t i, count;
@@ -2142,7 +2142,7 @@ void wxAuiToolBar::OnPaint(wxPaintEvent& WXUNUSED(evt))
wxRect gripper_rect = m_gripper_sizer_item->GetRect(); wxRect gripper_rect = m_gripper_sizer_item->GetRect();
if (horizontal) if (horizontal)
gripper_rect.width = gripper_size; gripper_rect.width = gripper_size;
else else
gripper_rect.height = gripper_size; gripper_rect.height = gripper_size;
m_art->DrawGripper(dc, this, gripper_rect); m_art->DrawGripper(dc, this, gripper_rect);
} }
@@ -2151,7 +2151,7 @@ void wxAuiToolBar::OnPaint(wxPaintEvent& WXUNUSED(evt))
int last_extent; int last_extent;
if (horizontal) if (horizontal)
last_extent = cli_rect.width; last_extent = cli_rect.width;
else else
last_extent = cli_rect.height; last_extent = cli_rect.height;
if (m_overflow_visible) if (m_overflow_visible)
last_extent -= dropdown_size; last_extent -= dropdown_size;
@@ -2179,25 +2179,25 @@ void wxAuiToolBar::OnPaint(wxPaintEvent& WXUNUSED(evt))
// draw a separator // draw a separator
m_art->DrawSeparator(dc, this, item_rect); m_art->DrawSeparator(dc, this, item_rect);
} }
else if (item.kind == wxITEM_LABEL) else if (item.kind == wxITEM_LABEL)
{ {
// draw a text label only // draw a text label only
m_art->DrawLabel(dc, this, item, item_rect); m_art->DrawLabel(dc, this, item, item_rect);
} }
else if (item.kind == wxITEM_NORMAL) else if (item.kind == wxITEM_NORMAL)
{ {
// draw a regular button or dropdown button // draw a regular button or dropdown button
if (!item.dropdown) if (!item.dropdown)
m_art->DrawButton(dc, this, item, item_rect); m_art->DrawButton(dc, this, item, item_rect);
else else
m_art->DrawDropDownButton(dc, this, item, item_rect); m_art->DrawDropDownButton(dc, this, item, item_rect);
} }
else if (item.kind == wxITEM_CHECK) else if (item.kind == wxITEM_CHECK)
{ {
// draw a toggle button // draw a toggle button
m_art->DrawButton(dc, this, item, item_rect); m_art->DrawButton(dc, this, item, item_rect);
} }
else if (item.kind == wxITEM_CONTROL) else if (item.kind == wxITEM_CONTROL)
{ {
// draw the control's label // draw the control's label
m_art->DrawControlLabel(dc, this, item, item_rect); m_art->DrawControlLabel(dc, this, item, item_rect);
@@ -2261,7 +2261,7 @@ void wxAuiToolBar::OnLeftDown(wxMouseEvent& evt)
{ {
DoIdleUpdate(); DoIdleUpdate();
} }
else else
{ {
size_t i, count; size_t i, count;
wxAuiToolBarItemArray overflow_items; wxAuiToolBarItemArray overflow_items;
@@ -2357,14 +2357,14 @@ void wxAuiToolBar::OnLeftUp(wxMouseEvent& evt)
m_action_item = NULL; m_action_item = NULL;
return; return;
} }
else else
{ {
wxAuiToolBarItem* hit_item; wxAuiToolBarItem* hit_item;
hit_item = FindToolByPosition(evt.GetX(), evt.GetY()); hit_item = FindToolByPosition(evt.GetX(), evt.GetY());
if (m_action_item && hit_item == m_action_item) if (m_action_item && hit_item == m_action_item)
{ {
SetToolTip(NULL); UnsetToolTip();
if (hit_item->kind == wxITEM_CHECK) if (hit_item->kind == wxITEM_CHECK)
{ {
@@ -2372,7 +2372,7 @@ void wxAuiToolBar::OnLeftUp(wxMouseEvent& evt)
if (m_action_item->state & wxAUI_BUTTON_STATE_CHECKED) if (m_action_item->state & wxAUI_BUTTON_STATE_CHECKED)
toggle = false; toggle = false;
else else
toggle = true; toggle = true;
ToggleTool(m_action_item->id, toggle); ToggleTool(m_action_item->id, toggle);
@@ -2382,7 +2382,7 @@ void wxAuiToolBar::OnLeftUp(wxMouseEvent& evt)
ProcessEvent(e); ProcessEvent(e);
DoIdleUpdate(); DoIdleUpdate();
} }
else else
{ {
wxCommandEvent e(wxEVT_COMMAND_MENU_SELECTED, m_action_item->id); wxCommandEvent e(wxEVT_COMMAND_MENU_SELECTED, m_action_item->id);
e.SetEventObject(this); e.SetEventObject(this);
@@ -2453,7 +2453,7 @@ void wxAuiToolBar::OnRightUp(wxMouseEvent& evt)
DoIdleUpdate(); DoIdleUpdate();
} }
} }
else else
{ {
// right-clicked on the invalid area of the toolbar // right-clicked on the invalid area of the toolbar
wxAuiToolBarEvent e(wxEVT_COMMAND_AUITOOLBAR_RIGHT_CLICK, -1); wxAuiToolBarEvent e(wxEVT_COMMAND_AUITOOLBAR_RIGHT_CLICK, -1);
@@ -2538,7 +2538,7 @@ void wxAuiToolBar::OnMotion(wxMouseEvent& evt)
m_action_pos != wxPoint(-1,-1) && m_action_pos != wxPoint(-1,-1) &&
abs(evt.m_x - m_action_pos.x) + abs(evt.m_y - m_action_pos.y) > 5) abs(evt.m_x - m_action_pos.x) + abs(evt.m_y - m_action_pos.y) > 5)
{ {
SetToolTip(NULL); UnsetToolTip();
m_dragging = true; m_dragging = true;
@@ -2555,10 +2555,10 @@ void wxAuiToolBar::OnMotion(wxMouseEvent& evt)
{ {
if (!(hit_item->state & wxAUI_BUTTON_STATE_DISABLED)) if (!(hit_item->state & wxAUI_BUTTON_STATE_DISABLED))
SetHoverItem(hit_item); SetHoverItem(hit_item);
else else
SetHoverItem(NULL); SetHoverItem(NULL);
} }
else else
{ {
// no hit item, remove any hit item // no hit item, remove any hit item
SetHoverItem(hit_item); SetHoverItem(hit_item);
@@ -2573,15 +2573,15 @@ void wxAuiToolBar::OnMotion(wxMouseEvent& evt)
{ {
m_tip_item = packing_hit_item; m_tip_item = packing_hit_item;
if (packing_hit_item->short_help.Length() > 0) if ( !packing_hit_item->short_help.empty() )
SetToolTip(packing_hit_item->short_help); SetToolTip(packing_hit_item->short_help);
else else
SetToolTip(NULL); UnsetToolTip();
} }
} }
else else
{ {
SetToolTip(NULL); UnsetToolTip();
m_tip_item = NULL; m_tip_item = NULL;
} }
@@ -2591,7 +2591,7 @@ void wxAuiToolBar::OnMotion(wxMouseEvent& evt)
{ {
if (m_action_item == hit_item) if (m_action_item == hit_item)
SetPressedItem(m_action_item); SetPressedItem(m_action_item);
else else
SetPressedItem(NULL); SetPressedItem(NULL);
} }

View File

@@ -29,6 +29,7 @@
@WX_VERSION_TAG@.9 { @WX_VERSION_TAG@.9 {
*wxAuiTabCtrl*OnCaptureLost*; *wxAuiTabCtrl*OnCaptureLost*;
*wxAuiToolBar*; *wxAuiToolBar*;
*wxWindow*UnsetToolTip*;
}; };
@WX_VERSION_TAG@.8 { @WX_VERSION_TAG@.8 {