For this issue, I create a simple demo code to demonstrate.
#include <wx/wx.h>
#include <wx/frame.h>
#include <wx/artprov.h>
#include <wx/aui/aui.h>
/*---------------------------------------------------------------------------------------------------------*/
// HEADER
enum
{
ID_ShowNormal = wxID_HIGHEST,
ID_ShowBug,
ID_ShowWorkaround,
};
class MyApp : public wxApp
{
public:
bool OnInit();
};
class MyFrame : public wxFrame
{
public:
MyFrame(wxFrame *parent,
wxWindowID id = wxID_ANY,
const wxString& title = _T("wxToolBar Bug Demo"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE|wxCLIP_CHILDREN|wxNO_FULL_REPAINT_ON_RESIZE);
virtual ~MyFrame();
wxToolBar *m_tb;
wxToolBar *m_tb2;
wxToolBar *m_tb3;
wxAuiManager m_mngr;
DECLARE_EVENT_TABLE()
};
/*---------------------------------------------------------------------------------------------------------*/
// SOURCE
IMPLEMENT_APP(MyApp)
bool MyApp::OnInit()
{
MyFrame* frame = new MyFrame((wxFrame *) NULL, wxID_ANY,
_T("wxToolbar Bug Demo"),
wxPoint(100, 100), wxSize(550, 300));
frame->Show(true);
wxInitAllImageHandlers();
SetTopWindow(frame);
return true;
}
BEGIN_EVENT_TABLE(MyFrame,wxFrame)
END_EVENT_TABLE()
MyFrame::MyFrame(wxFrame* parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
long style)
: wxFrame(parent, id, title, pos, size, style)
,m_tb(0), m_tb2(0),m_tb3(0)
{
m_mngr.SetManagedWindow(this);
wxMenu *menuFile=new wxMenu;
menuFile->Append(ID_ShowNormal,wxT("Show Normal"));
menuFile->Append(ID_ShowBug,wxT("Show Bug"));
menuFile->Append(ID_ShowWorkaround,wxT("Show Workaround"));
wxMenuBar *menuBar = new wxMenuBar();
menuBar->Append(menuFile,wxT("Mode"));
SetMenuBar(menuBar);
//m_mngr.Update();
m_tb=new wxToolBar(this,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxTB_FLAT|wxTB_NODIVIDER);
//m_tb->AddTool(wxID_ANY,wxT("tool1"),wxArtProvider::GetBitmap(wxART_FILE_OPEN,wxART_TOOLBAR));
//m_tb->AddTool(wxID_ANY,wxT("tool2"),wxArtProvider::GetBitmap(wxART_FILE_SAVE,wxART_TOOLBAR));
m_tb->AddTool(wxID_ANY,wxT("tool1"),wxBitmap(16,15));
m_tb->AddTool(wxID_ANY,wxT("tool2"),wxBitmap(16,15));
m_tb->Realize();
wxAuiPaneInfo pi = wxAuiPaneInfo() .Name(wxT("toolbar"))
.Caption(wxT("toolbar"))
.ToolbarPane()
.Floatable()
.Direction(wxAUI_DOCK_TOP) // see also ticket #9722
.LeftDockable(false)
.RightDockable(false);
m_mngr.AddPane(m_tb,pi);
m_tb2=new wxToolBar(this,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxTB_FLAT|wxTB_NODIVIDER);
//m_tb2->AddTool(wxID_ANY,wxT("tool1"),wxArtProvider::GetBitmap(wxART_FILE_OPEN,wxART_TOOLBAR));
//m_tb2->AddTool(wxID_ANY,wxT("tool2"),wxArtProvider::GetBitmap(wxART_FILE_SAVE,wxART_TOOLBAR));
m_tb2->AddTool(wxID_ANY,wxT("tool1"),wxBitmap(16,15));
m_tb2->AddTool(wxID_ANY,wxT("tool2"),wxBitmap(16,15));
m_tb2->Realize();
wxAuiPaneInfo pi2 = wxAuiPaneInfo() .Name(wxT("toolbar2"))
.Caption(wxT("toolbar2"))
.ToolbarPane()
.Floatable()
.Direction(wxAUI_DOCK_TOP) // see also ticket #9722
.LeftDockable(false)
.RightDockable(false);
m_mngr.AddPane(m_tb2,pi2);
m_tb3=new wxToolBar(this,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxTB_FLAT|wxTB_NODIVIDER);
//m_tb3->AddTool(wxID_ANY,wxT("tool1"),wxArtProvider::GetBitmap(wxART_FILE_OPEN,wxART_TOOLBAR));
//m_tb3->AddTool(wxID_ANY,wxT("tool2"),wxArtProvider::GetBitmap(wxART_FILE_SAVE,wxART_TOOLBAR));
m_tb3->AddTool(wxID_ANY,wxT("tool1"),wxBitmap(16,15));
m_tb3->AddTool(wxID_ANY,wxT("tool2"),wxBitmap(16,15));
wxChoice* choice = new wxChoice(m_tb3, wxID_ANY);
choice->AppendString(wxT("One choice"));
choice->AppendString(wxT("Another choice"));
m_tb3->AddControl(choice);
m_tb3->Realize();
wxAuiPaneInfo pi3 = wxAuiPaneInfo() .Name(wxT("toolbar3"))
.Caption(wxT("toolbar3"))
.ToolbarPane()
.Floatable()
.Direction(wxAUI_DOCK_TOP) // see also ticket #9722
.LeftDockable(false)
.RightDockable(false);
m_mngr.AddPane(m_tb3,pi3);
m_mngr.Update();
}
MyFrame::~MyFrame()
{
m_mngr.UnInit();
}
When the toolbar button is small, such as "16*15", then you drag the toolbar to move horizontally, you see the screen shot as attachment.
If you use the standard toolbar size, such as the commented line, you don't have such issue.