use UnsetToolTip() instead of SetToolTip(NULL) to fix wxX11 build broken on Buildbot since this file addition; fix some weird "else" indentation; use empty() instead of Length() > 0 tests

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55269 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-08-25 23:20:09 +00:00
parent 410201d988
commit 8b385bf892

View File

@@ -360,7 +360,7 @@ void wxAuiDefaultToolBarArt::DrawButton(
if (item.state & wxAUI_BUTTON_STATE_DISABLED) if (item.state & wxAUI_BUTTON_STATE_DISABLED)
dc.SetTextForeground(DISABLED_TEXT_COLOR); dc.SetTextForeground(DISABLED_TEXT_COLOR);
if ((m_flags & wxAUI_TB_TEXT) && item.label.Length() > 0) if ( (m_flags & wxAUI_TB_TEXT) && !item.label.empty() )
{ {
dc.DrawText(item.label, text_x, text_y); dc.DrawText(item.label, text_x, text_y);
} }
@@ -476,7 +476,7 @@ void wxAuiDefaultToolBarArt::DrawDropDownButton(
if (item.state & wxAUI_BUTTON_STATE_DISABLED) if (item.state & wxAUI_BUTTON_STATE_DISABLED)
dc.SetTextForeground(DISABLED_TEXT_COLOR); dc.SetTextForeground(DISABLED_TEXT_COLOR);
if ((m_flags & wxAUI_TB_TEXT) && item.label.Length() > 0) if ( (m_flags & wxAUI_TB_TEXT) && !item.label.empty() )
{ {
dc.DrawText(item.label, text_x, text_y); dc.DrawText(item.label, text_x, text_y);
} }
@@ -518,7 +518,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.label.Length() > 0) if ( (m_flags & wxAUI_TB_TEXT) && !item.label.empty() )
{ {
dc.DrawText(item.label, text_x, text_y); dc.DrawText(item.label, text_x, text_y);
} }
@@ -562,18 +562,19 @@ wxSize wxAuiDefaultToolBarArt::GetToolSize(
dc.GetTextExtent(wxT("ABCDHgj"), &tx, &ty); dc.GetTextExtent(wxT("ABCDHgj"), &tx, &ty);
height += ty; height += ty;
if (item.label.Length() > 0) if ( !item.label.empty() )
{ {
dc.GetTextExtent(item.label, &tx, &ty); dc.GetTextExtent(item.label, &tx, &ty);
width = wxMax(width, tx+6); width = wxMax(width, tx+6);
} }
} }
else if (m_text_orientation == wxAUI_TBTOOL_TEXT_RIGHT && item.label.Length() > 0) else if ( m_text_orientation == wxAUI_TBTOOL_TEXT_RIGHT &&
!item.label.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.label.Length() > 0) if ( !item.label.empty() )
{ {
dc.GetTextExtent(item.label, &tx, &ty); dc.GetTextExtent(item.label, &tx, &ty);
width += tx; width += tx;
@@ -1781,7 +1782,7 @@ 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) && item.label.Length() > 0) if ( (m_style & wxAUI_TB_TEXT) && !item.label.empty() )
{ {
wxSize s = GetLabelSize(item.label); wxSize s = GetLabelSize(item.label);
vert_sizer->Add(1, s.y); vert_sizer->Add(1, s.y);
@@ -2357,7 +2358,7 @@ void wxAuiToolBar::OnLeftUp(wxMouseEvent& evt)
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)
{ {
@@ -2531,7 +2532,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;
@@ -2566,15 +2567,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;
} }