Ticket #14795 (closed defect: fixed)
Wrong wxAuiToolBar dropdown tool button behaviour
| Reported by: | RedTide | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | |
| Component: | wxAui | Version: | 2.9-svn |
| Keywords: | wxAuiToolBar dropdown behaviour | Cc: | hanmac@… |
| Blocked By: | Patch: | yes | |
| Blocking: |
Description
It is not clear how dropdown buttons should work here, so I applied some changes in the auidemo to show the following issue:
In auibar.cpp:2419
else if (item.m_kind == wxITEM_NORMAL)
{
// draw a regular button or dropdown button
if (!item.m_dropDown)
m_art->DrawButton(dc, this, item, item_rect);
else
m_art->DrawDropDownButton(dc, this, item, item_rect);
}
else if (item.m_kind == wxITEM_CHECK)
{
// draw either a regular or dropdown toggle button
if (!item.m_dropDown)
m_art->DrawButton(dc, this, item, item_rect);
else
m_art->DrawDropDownButton(dc, this, item, item_rect);
}
else if (item.m_kind == wxITEM_RADIO)
{
// draw a toggle button
m_art->DrawButton(dc, this, item, item_rect);
}
It seems that dropdown buttons can be added/removed only on tools with wxITEM_NORMAL and wxITEM_CHECK flags.
But trying to do so to wxITEM_RADIO, it 'works' anyway. Though we don't see the dropdown button, it's possible to click on it to show the menu (i.e. the dropdown button is invisible).
It seems that, when the dropdown is set and an eventhandler attached, both wxITEM_CHECK and wxITEM_RADIO work like regular wxITEM_NORMAL buttons. When a handler is not attached, they work as standard check/radio buttons, though the radiobutton still has an invisible dropdown.
So what should be done here? Do we need wxITEM_RADIO to show a dropdown too? (It's a strange feature to have, but as the code is now I don't see why it shouldn't be done.)

