Erratic plugin toolbar
Posted: Mon Aug 29, 2011 11:37 pm
The toolbar created by my plugin is displaying some extremely erratic behavior. Here's my CreateToolBar method:
Inside Runtime/codelite-icons.zip, I have added generate.png in the toolbars/<size>/myplugin folder, and have added the appropriate line to manifest.ini, so the button I'm indicating shows up just fine. However, the toolbar extends itself far beyond the size of that button. When I try to move other toolbars around it, it doesn't work quite right. Here are some images to explain. They're pretty wide, but I added url tags so you can click through to the full image. My toolbar is the one with the icon.
Here is the overly large toolbar:
Here is what happens when I try to move the CodeFormatter toolbar (visible all the way at the right) to the location of the thin black rectangle:
I'm clueless as to why this is happening.
Code: Select all
clToolBar *MyPlugin::CreateToolBar(wxWindow *parent)
{
// Support both toolbars icon size
int size = m_mgr->GetToolbarIconSize();
clToolBar *tb(NULL);
if (m_mgr->AllowToolbar())
{
tb = new clToolBar(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, clTB_DEFAULT_STYLE);
tb->SetToolBitmapSize(wxSize(size, size));
BitmapLoader *bitmapLoader = m_mgr->GetStdIcons();
if (size == 24)
{
tb->AddTool(XRCID("generate_code"), wxT("Generate C code"), bitmapLoader->LoadBitmap(wxT("toolbars/24/myplugin/generate")), wxT("Generate C code"));
}
else
{
tb->AddTool(XRCID("generate_code"), wxT("Generate C code"), bitmapLoader->LoadBitmap(wxT("toolbars/16/myplugin/generate")), wxT("Generate C code"));
}
tb->Realize();
}
m_mgr->GetTheApp()->Connect(XRCID("generate_code"), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(MyPlugin::OnGenerate), NULL, (wxEvtHandler*)this);
return tb;
}
Here is the overly large toolbar:
Here is what happens when I try to move the CodeFormatter toolbar (visible all the way at the right) to the location of the thin black rectangle:
I'm clueless as to why this is happening.