text_x = rect.x + (rect.width/2) - (text_width/2) + 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;
dc.SetBrush(wxBrush(wxAuiStepColour(m_highlight_colour, 150)));
dc.DrawRectangle(rect);
}
- else if ((item.state & wxAUI_BUTTON_STATE_HOVER) || item.sticky == true)
+ else if ((item.state & wxAUI_BUTTON_STATE_HOVER) || item.sticky == true)
{
dc.SetPen(wxPen(m_highlight_colour));
dc.SetBrush(wxBrush(wxAuiStepColour(m_highlight_colour, 170)));
dc.DrawRectangle(rect);
}
- else if (item.state & wxAUI_BUTTON_STATE_CHECKED)
+ else if (item.state & wxAUI_BUTTON_STATE_CHECKED)
{
// it's important to put this code in an else statment after the
// hover, otherwise hovers won't draw properly for checked items
wxBitmap bmp;
if (item.state & wxAUI_BUTTON_STATE_DISABLED)
bmp = item.disabled_bitmap;
- else
+ else
bmp = item.bitmap;
if (!bmp.IsOk())
if (item.state & wxAUI_BUTTON_STATE_DISABLED)
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);
}
text_x = rect.x + (rect.width/2) - (text_width/2) + 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;
dc.DrawRectangle(button_rect);
dc.DrawRectangle(dropdown_rect);
}
- else if (item.state & wxAUI_BUTTON_STATE_HOVER ||
+ else if (item.state & wxAUI_BUTTON_STATE_HOVER ||
item.sticky == true)
{
dc.SetPen(wxPen(m_highlight_colour));
bmp = item.disabled_bitmap;
dropbmp = m_disabled_button_dropdown_bmp;
}
- else
+ else
{
bmp = item.bitmap;
dropbmp = m_button_dropdown_bmp;
if (item.state & wxAUI_BUTTON_STATE_DISABLED)
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);
}
text_x = rect.x + (rect.width/2) - (text_width/2) + 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.GetTextExtent(wxT("ABCDHgj"), &tx, &ty);
height += ty;
- if (item.label.Length() > 0)
+ if ( !item.label.empty() )
{
dc.GetTextExtent(item.label, &tx, &ty);
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 bitmap and text
- if (item.label.Length() > 0)
+ if ( !item.label.empty() )
{
dc.GetTextExtent(item.label, &tx, &ty);
width += tx;
rect.y += (rect.height/2) - (new_height/2);
rect.height = new_height;
}
- else
+ else
{
rect.y += (rect.height/2);
rect.height = 1;
if (x > rect.GetWidth()-5)
break;
}
- else
+ else
{
x = rect.x + 3;
y = rect.y + (i*4) + 5;
menuPopup.Append(m);
items_added++;
}
- else if (item.kind == wxITEM_SEPARATOR)
+ else if (item.kind == wxITEM_SEPARATOR)
{
if (items_added > 0)
menuPopup.AppendSeparator();
if (m_style & wxAUI_TB_GRIPPER)
m_gripper_visible = true;
- else
+ else
m_gripper_visible = false;
if (m_style & wxAUI_TB_OVERFLOW)
m_overflow_visible = true;
- else
+ else
m_overflow_visible = false;
if (style & wxAUI_TB_HORZ_TEXT)
SetToolTextOrientation(wxAUI_TBTOOL_TEXT_RIGHT);
- else
+ else
SetToolTextOrientation(wxAUI_TBTOOL_TEXT_BOTTOM);
}
{
if (m_art)
return m_art->GetElementSize(wxAUI_TBART_SEPARATOR_SIZE);
- else
+ else
return 5;
}
{
if (::wxGetMouseState().LeftDown())
overflow_state = wxAUI_BUTTON_STATE_PRESSED;
- else
+ else
overflow_state = wxAUI_BUTTON_STATE_HOVER;
}
if (state == true)
tool->state |= wxAUI_BUTTON_STATE_CHECKED;
- else
+ else
tool->state &= ~wxAUI_BUTTON_STATE_CHECKED;
}
}
{
if (state == true)
tool->state &= ~wxAUI_BUTTON_STATE_DISABLED;
- else
+ else
tool->state |= wxAUI_BUTTON_STATE_DISABLED;
}
}
if (rect.y+rect.height < cli_h)
return true;
}
- else
+ else
{
// take the dropdown size into account
if (m_overflow_visible)
{
if (horizontal)
m_gripper_sizer_item = sizer->Add(gripper_size, 1, 0, wxEXPAND);
- else
+ else
m_gripper_sizer_item = sizer->Add(1, gripper_size, 0, wxEXPAND);
}
- else
+ else
{
m_gripper_sizer_item = NULL;
}
{
if (horizontal)
sizer->Add(m_left_padding, 1);
- else
+ else
sizer->Add(1, m_left_padding);
}
{
if (horizontal)
sizer_item = sizer->Add(separator_size, 1, 0, wxEXPAND);
- else
+ else
sizer_item = sizer->Add(1, separator_size, 0, wxEXPAND);
// add tool packing
case wxITEM_SPACER:
if (item.proportion > 0)
sizer_item = sizer->AddStretchSpacer(item.proportion);
- else
+ else
sizer_item = sizer->Add(item.space_pixels, 1);
break;
vert_sizer->AddStretchSpacer(1);
ctrl_sizer_item = vert_sizer->Add(item.window, 0, wxEXPAND);
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);
vert_sizer->Add(1, s.y);
{
if (horizontal)
sizer->Add(m_right_padding, 1);
- else
+ else
sizer->Add(1, m_right_padding);
}
{
if (horizontal)
m_overflow_sizer_item = sizer->Add(overflow_size, 1, 0, wxEXPAND);
- else
+ else
m_overflow_sizer_item = sizer->Add(1, overflow_size, 0, wxEXPAND);
}
- else
+ else
{
m_overflow_sizer_item = NULL;
}
{
if (horizontal)
outside_sizer->Add(1, m_top_padding);
- else
+ else
outside_sizer->Add(m_top_padding, 1);
}
{
if (horizontal)
outside_sizer->Add(1, m_bottom_padding);
- else
+ else
outside_sizer->Add(m_bottom_padding, 1);
}
{
SetClientSize(new_size);
}
- else
+ else
{
m_sizer->SetDimension(0, 0, cur_size.x, cur_size.y);
}
}
- else
+ else
{
wxSize cur_size = GetClientSize();
m_sizer->SetDimension(0, 0, cur_size.x, cur_size.y);
overflow_rect.width = cli_rect.width;
overflow_rect.height = overflow_size;
}
- else
+ else
{
overflow_rect.x = cli_rect.width - overflow_size;
overflow_rect.y = 0;
bool is_enabled;
if (item.window)
is_enabled = item.window->IsEnabled();
- else
+ else
is_enabled = (item.state & wxAUI_BUTTON_STATE_DISABLED) ? false : true;
bool new_enabled = evt.GetEnabled();
{
item.window->Enable(new_enabled);
}
- else
+ else
{
if (new_enabled)
item.state &= ~wxAUI_BUTTON_STATE_DISABLED;
- else
+ else
item.state |= wxAUI_BUTTON_STATE_DISABLED;
}
need_refresh = true;
{
if (new_checked)
item.state |= wxAUI_BUTTON_STATE_CHECKED;
- else
+ else
item.state &= ~wxAUI_BUTTON_STATE_CHECKED;
need_refresh = true;
if (x > y)
SetOrientation(wxHORIZONTAL);
- else
+ else
SetOrientation(wxVERTICAL);
if (((x >= y) && m_absolute_min_size.x > x) ||
}
}
}
- else
+ else
{
// show all flexible items
size_t i, count;
wxRect gripper_rect = m_gripper_sizer_item->GetRect();
if (horizontal)
gripper_rect.width = gripper_size;
- else
+ else
gripper_rect.height = gripper_size;
m_art->DrawGripper(dc, this, gripper_rect);
}
int last_extent;
if (horizontal)
last_extent = cli_rect.width;
- else
+ else
last_extent = cli_rect.height;
if (m_overflow_visible)
last_extent -= dropdown_size;
// draw a separator
m_art->DrawSeparator(dc, this, item_rect);
}
- else if (item.kind == wxITEM_LABEL)
+ else if (item.kind == wxITEM_LABEL)
{
// draw a text label only
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
if (!item.dropdown)
m_art->DrawButton(dc, this, item, item_rect);
- else
+ else
m_art->DrawDropDownButton(dc, this, item, item_rect);
}
- else if (item.kind == wxITEM_CHECK)
+ else if (item.kind == wxITEM_CHECK)
{
// draw a toggle button
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
m_art->DrawControlLabel(dc, this, item, item_rect);
{
DoIdleUpdate();
}
- else
+ else
{
size_t i, count;
wxAuiToolBarItemArray overflow_items;
m_action_item = NULL;
return;
}
- else
+ else
{
wxAuiToolBarItem* hit_item;
hit_item = FindToolByPosition(evt.GetX(), evt.GetY());
if (m_action_item && hit_item == m_action_item)
{
- SetToolTip(NULL);
+ UnsetToolTip();
if (hit_item->kind == wxITEM_CHECK)
{
if (m_action_item->state & wxAUI_BUTTON_STATE_CHECKED)
toggle = false;
- else
+ else
toggle = true;
ToggleTool(m_action_item->id, toggle);
ProcessEvent(e);
DoIdleUpdate();
}
- else
+ else
{
wxCommandEvent e(wxEVT_COMMAND_MENU_SELECTED, m_action_item->id);
e.SetEventObject(this);
DoIdleUpdate();
}
}
- else
+ else
{
// right-clicked on the invalid area of the toolbar
wxAuiToolBarEvent e(wxEVT_COMMAND_AUITOOLBAR_RIGHT_CLICK, -1);
m_action_pos != wxPoint(-1,-1) &&
abs(evt.m_x - m_action_pos.x) + abs(evt.m_y - m_action_pos.y) > 5)
{
- SetToolTip(NULL);
+ UnsetToolTip();
m_dragging = true;
{
if (!(hit_item->state & wxAUI_BUTTON_STATE_DISABLED))
SetHoverItem(hit_item);
- else
+ else
SetHoverItem(NULL);
}
- else
+ else
{
// no hit item, remove any hit item
SetHoverItem(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);
- else
- SetToolTip(NULL);
+ else
+ UnsetToolTip();
}
}
- else
+ else
{
- SetToolTip(NULL);
+ UnsetToolTip();
m_tip_item = NULL;
}
{
if (m_action_item == hit_item)
SetPressedItem(m_action_item);
- else
+ else
SetPressedItem(NULL);
}