Erratic plugin toolbar

CodeLite installation/troubleshooting forum
GlenboLake
CodeLite Enthusiast
Posts: 10
Joined: Tue Aug 23, 2011 6:59 pm
Genuine User: Yes
IDE Question: C++
Contact:

Erratic plugin toolbar

Post by GlenboLake »

The toolbar created by my plugin is displaying some extremely erratic behavior. Here's my CreateToolBar method:

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;
}
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 Image icon.

Here is the overly large toolbar:
Image

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:
Image

I'm clueless as to why this is happening.
CodeLite Revision 5011, compiled on my machine
64-bit Ubuntu 11.04
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Erratic plugin toolbar

Post by eranif »

I don't see anything problematic with your code. My guess is that there is a glitch with wxAUI layout code.
To "force" reset the layout: "View -> Restore default layout"

See if it helps
Eran
Make sure you have read the HOW TO POST thread
GlenboLake
CodeLite Enthusiast
Posts: 10
Joined: Tue Aug 23, 2011 6:59 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Erratic plugin toolbar

Post by GlenboLake »

That did the trick! Many thanks.
CodeLite Revision 5011, compiled on my machine
64-bit Ubuntu 11.04
Post Reply