wxFlatMenu & wxFlatMenuBar

If you have a cool piece of software to share, but you are not hosting it officially yet, please dump it in here. If you have code snippets that are useful, please donate!
ping203
In need of some credit
In need of some credit
Posts: 1
Joined: Sat Dec 30, 2006 2:14 pm

Post by ping203 »

I build in fedora 5, wx 8.0, some error with bitmap != wxNullBitmap,
I'm change to bitmap.OK() that OK :?:
In
int factor = ((menuItem->GetBitmap() != wxNullBitmap)
change to
wxBitmap menuItemBitmap = menuItem->GetBitmap();

int factor = (menuItemBitmap.OK()

Thanks for great lib.
eranif
Moderator
Moderator
Posts: 610
Joined: Tue Nov 29, 2005 7:10 pm
Location: Israel

Post by eranif »

'm change to bitmap.OK() that OK
thanks, i fixed it

Eran
IDE: CodeLite + wxCrafter
OS: All
https://wxcrafter.codelite.org
https://codelite.org
AlexCh
In need of some credit
In need of some credit
Posts: 2
Joined: Wed Mar 07, 2007 9:06 am

Shoot

Post by AlexCh »

Hi Eran!
You are was doing a great work! Thanks very murch for this job! Im changed a some things at this, for example adding grip and dockable style.
And doing two panel - panel Menu and Tools. Then i taken next problem:
1. The grip - is not repaint needed colour, and in general, looks disgustingly
2. When movable, the Bar consist size at all screen! and i doing all, but that not want resizing to needed size!
3. And Last, what reading this class from .xrc resource file?
Please help! say me please, what i doing that all?
best regards Shoot.

Code: Select all

void wxFlatMenuBar::PositionAUI(wxFrameManager *mgr, size_t pos)
{
	wxPaneInfo pn;
	int xx = wxSystemSettings::GetMetric(wxSYS_SCREEN_X);

	// We add our menu bar as a toolbar, with the following settings
	pn.ToolbarPane();
	pn.BestSize(wxSize(xx, this->GetSize().y));
	pn.FloatingSize(wxSize((xx>>1), this->GetSize().y));
	pn.LeftDockable(false);
	pn.RightDockable(false);
	pn.CaptionVisible(false);
	pn.PaneBorder(false);
	pn.MinSize(wxSize(xx, this->GetSize().y));
	pn.MaxSize(wxSize(xx, this->GetSize().y));
	pn.Top();
	pn.ToolbarPane().Top().Row(pos);
	pn.Name(GetName()+_T("_MenuBar"));
	pn.Caption(wxT("Menu Bar"));
	
	mgr->AddPane(this, pn);
}
Andreas Micheler
In need of some credit
In need of some credit
Posts: 4
Joined: Tue May 30, 2006 12:10 am
Contact:

How to make the menus smaller

Post by Andreas Micheler »

Hi Eran,

I'm experimenting with your wxFlatMenu classes for aUCBLogo,
since Bryan Petty told me about it, and I think they are great code! :-)

My question:
How can I reduce the size of the menubar,
so that it has the size of an old-style XP or 98 menubar?

I have found "SPACER",
but it does not change the horizontal space between the menubar items.

Thanks,
Andreas
Andreas Micheler
In need of some credit
In need of some credit
Posts: 4
Joined: Tue May 30, 2006 12:10 am
Contact:

How to "Check" a menu item?

Post by Andreas Micheler »

Hi Eran,

I hope I don't get on your nerves! ;-)

A second question:
I have lots of CheckItem's in my menus.
How can I "Check" it programmatically?
Or must I save the wxFlatMenuItem pointer, then access that?

Thanks,
Andreas
eranif
Moderator
Moderator
Posts: 610
Joined: Tue Nov 29, 2005 7:10 pm
Location: Israel

Post by eranif »

If I understood correctly what you want then you need to change this line:

flat_menu_bar.cpp, function OnPaint(), line: 201: (In SVN at least)

Code: Select all

if( padding == -1 ){
	dc.GetTextExtent(wxT("W"), &padding, &dummy);
}
and set padding to be whatever you want.

In addition, make sure you are using the sources from SVN, since they contains small bug fixes, and I recently added an option to popup a context menu for every menu item (wxFlatMenuItem::SetContextMenu(wxFlatMenu * context_menu))

Eran
IDE: CodeLite + wxCrafter
OS: All
https://wxcrafter.codelite.org
https://codelite.org
Andreas Micheler
In need of some credit
In need of some credit
Posts: 4
Joined: Tue May 30, 2006 12:10 am
Contact:

Post by Andreas Micheler »

dc.GetTextExtent(wxT("V"), &padding, &dummy);
(V instead of W) did the trick.

Thanks,
Andreas
framepointer
Super wx Problem Solver
Super wx Problem Solver
Posts: 264
Joined: Mon Aug 07, 2006 3:25 pm
Location: Baia Mare, Romania
Contact:

Post by framepointer »

Hey Eran,

There is a problem with the flatmenu when a submenu has alot of items.
I have a main menu with a submenu containing lots of children. What happens is that the submenu is positioned in the top left corner point(0,0) and no scroll buttons are shown.

I made a change to void wxFlatMenuBase::AdjustPosition(wxPoint& pos) and it seems to work.

Changed

Code: Select all

                               // we are a submenu
			       // try to decrese the y value of the menu position
                                int newy = pos.y;
				newy -= (size.y + pos.y) - scrHeight;
				if(newy + size.y > scrHeight)
				{
					// probably the menu size is too high to fit
					// the screen, we need scrollbuttons
					m_showScrollButtons = true;
				} 
				else 
				{
					pos.y = newy;
				}
to

Code: Select all

                        // we are a submenu
			// try to decrese the y value of the menu position
			if(size.y > scrHeight)
			{
				m_showScrollButtons = true;
				pos.y = 0;	
			}
			else
			{
				int newy = pos.y;
				newy -= (size.y + pos.y) - scrHeight;
				if(newy + size.y > scrHeight)
				{
					// probably the menu size is too high to fit
					// the screen, we need scrollbuttons
					m_showScrollButtons = true;
				} 
				else 
				{
					pos.y = newy;
				}
			}
and it seems to work.


Regards,
Robert
Software is like sex,
It's better when it's free.
~Linus Torvalds
almondega
Knows some wx things
Knows some wx things
Posts: 40
Joined: Wed May 09, 2007 3:54 am
Location: Joinville - SC - Brasil

Post by almondega »

anybody here?
i can add controls in this toolbar?
wxToolBar hate me
AlexCh
In need of some credit
In need of some credit
Posts: 2
Joined: Wed Mar 07, 2007 9:06 am

Re: Shoot

Post by AlexCh »

Hi Eran!
I have made all that is written in last my post. I wish to give you it. Can be it is useful. Tell as to forward you the advanced project?
Whether and still there is an opportunity of processing of your project thus that it was compiled if wxWidgets are collected and using as DLL?
Best Regards, Alex
syber
Experienced Solver
Experienced Solver
Posts: 53
Joined: Thu Apr 27, 2006 1:34 pm

Feature request

Post by syber »

Hi, eranif

There is no Alt handler for menu, like that:
- Press Alt button
- first menu must be highlighted (as mouse over menu)

It's standart behaviour. Could you implement it?
SIAS87
Earned a small fee
Earned a small fee
Posts: 23
Joined: Sun Jul 20, 2008 10:08 pm

Post by SIAS87 »

Hi
i know i firing up an ancient post but is there any where i can download wxFlatMenu as the links throughout this post are not hosted anymore
Thanks
Dan
priyank_bolia
wxWorld Domination!
wxWorld Domination!
Posts: 1339
Joined: Wed Aug 03, 2005 8:10 am
Location: BANGALORE, INDIA
Contact:

Post by priyank_bolia »

eranif
Moderator
Moderator
Posts: 610
Joined: Tue Nov 29, 2005 7:10 pm
Location: Israel

Post by eranif »

For the flat menu, you can download the sources directly from here:

svn co https://OpenSVN.csie.org/wxFlatMenu/ wxflatmenu

Eran
IDE: CodeLite + wxCrafter
OS: All
https://wxcrafter.codelite.org
https://codelite.org
Infinity_77
Experienced Solver
Experienced Solver
Posts: 89
Joined: Tue Oct 03, 2006 6:30 pm
Location: London, UK
Contact:

Post by Infinity_77 »

Hi Eran & All,

since I have switched to wxWidgets/wxPython version 2.8.8.1, I have noticed that the menu accelerators in FlatMenu do not work anymore (in wxPython). Is there someone who could test if they do work in wxWidgets (using C++) so that I can understand if it is a bug in my Python translation of FlatMenu (highly probable), a bug in wxPython or a bug in wxWidgets?
Using Eran's demo of FlatMenu is enough to test if accelerators work or not.

Thank you for your help.

Andrea.
"Imagination Is The Only Weapon In The War Against Reality."

http://xoomer.alice.it/infinity77/
Post Reply