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!
tiwag
Earned some good credits
Earned some good credits
Posts: 123
Joined: Tue Dec 21, 2004 8:51 pm
Location: Austria

Post by tiwag » Tue Oct 17, 2006 9:14 am

bug when using dual monitor desktop:
there is a problem when running on a secondary monitor,
all the menus are shown on the primary monitor (as usual)
brgds, tiwag
-tiwag

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

Post by eranif » Tue Oct 17, 2006 10:10 am

I have a question on dual monitor:

Does the menu always appear on primary monitor (in my implementation, menu is a child of the desktop)?

If the answer is yes, does the following is a valid solution:
- Query a system about number of monitors
- Query the main window on which monitor it is shown (is this feasible??)
- if appliocation main frame is on secondary screen, add to the menu popup position an offset of the primary monitor size

Am I going the right way, or I am wrong?

Please assume that I am a complete newbi when it comes to dual monitors :D

PS:

Are you the one who opened me same bug on wxFlatNotebook, dual monitoring & CodeBlocks?

With regards,
Eran
IDE: CodeLite + wxCrafter
OS: All
https://wxcrafter.codelite.org
https://codelite.org

tiwag
Earned some good credits
Earned some good credits
Posts: 123
Joined: Tue Dec 21, 2004 8:51 pm
Location: Austria

Post by tiwag » Tue Oct 17, 2006 11:21 am

eranif wrote:Does the menu always appear on primary monitor (in my implementation, menu is a child of the desktop)?

YES
eranif wrote:If the answer is yes, does the following is a valid solution:
- Query a system about number of monitors
- Query the main window on which monitor it is shown (is this feasible??)
- if appliocation main frame is on secondary screen, add to the menu popup position an offset of the primary monitor size
don't know exactly, but on my dual monitor setup the desktop has continous coordinates of both screens.
example

primary: 1280 x 1024 = (Xp x Yp , left monitor )
secondary: 1024 x 768 = (Xs x Ys , right monitor )

virtual desktop : X ( Xp + Xs ) , Y ( Yp) = 2304 x 1024
X range: 0 ... 2303
Y range: 0 ... 1023

Image

because the setup of the two monitors is choosen so,
that the bottom line of screen matches the two monitors,
the area on top of the right side (1279, 0 ... 2303,255)
cannot be shown.
eranif wrote: Are you the one who opened me same bug on wxFlatNotebook, dual monitoring & CodeBlocks?
no, but i noticed it too.

brgds, tiwag
-tiwag

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

Post by eranif » Tue Oct 17, 2006 7:51 pm

Hi all,

I just updated the source files of wxFlatMenu,


The only change I did, is that it now compiles and run on Linux (makefile is provided).

to compile it on Linux, untar the zip and simply run the makefile
make type=release [clean] (or debug, debug_unicode, release_unicode)

Here is a screenshot from my ubuntu machine:

Image

@Infinity_77 - start converting :wink:

Eran
IDE: CodeLite + wxCrafter
OS: All
https://wxcrafter.codelite.org
https://codelite.org

User avatar
T-Rex
Moderator
Moderator
Posts: 1198
Joined: Sat Oct 23, 2004 9:58 am
Location: Zaporizhzhya, Ukraine
Contact:

Post by T-Rex » Tue Oct 17, 2006 8:53 pm

Excellent!
Looks very nice and promissing.
Thanks for your great efforts, Eran

Infinity_77
Experienced Solver
Experienced Solver
Posts: 89
Joined: Tue Oct 03, 2006 6:30 pm
Location: London, UK
Contact:

Post by Infinity_77 » Tue Oct 17, 2006 9:42 pm

@Infinity_77 - start converting
I'll do my best Eran ;-)

But at the moment I believe that those nice and eye-capturing shadows behind the menus (in MSW) will be a prerogative of wxWidgets... unless some magic thing appears with low-level modules in Python.

Very nice also on Linux! Congratulations!

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

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

Infinity_77
Experienced Solver
Experienced Solver
Posts: 89
Joined: Tue Oct 03, 2006 6:30 pm
Location: London, UK
Contact:

Post by Infinity_77 » Wed Oct 18, 2006 4:48 pm

Hi Eran,

sorry for my immense ignorance in C++, but I have a couple of questions about FlatMenu.

1) Looking at the 2 following declarations:

flat_menu.cpp:

Code: Select all

BEGIN_EVENT_TABLE(wxMenuDecoration, wxPopupWindow)
flat_menu.h

Code: Select all

class WXMAKINGDLL_FLATMENU_EXPIMP wxMenuDecoration :
	public wxShadowPopupWindow
wxMenuDeclaration is a subclass of what? wxPopupWindow or wxShadowPopupWindow?

2) wxMenuDecoration initialization (flat_menu.cpp):

Code: Select all

wxMenuDecoration::wxMenuDecoration(wxMenuDecType type, const wxString& text, bool dropDownArrow)
: m_type(type)
, m_text(text)
, m_bDropDownArrow(dropDownArrow)
, m_bmp(wxNullBitmap)
{
#ifndef __WXMSW__
	wxWindow* parent = wxTheApp->GetTopWindow();
	wxASSERT_MSG(parent, wxT("Can't create menu without parent!"));
	wxPopupWindow::Create(parent, wxBORDER_NONE );
#endif
}

Uhm... why wxPopupWindow is created only on MSW? Don't the other platforms need an initialization too?

I am surely missing something, sorry for my ingnorance :oops:

Thanks for any explanation.

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

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

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

Post by eranif » Wed Oct 18, 2006 7:00 pm

Ok,

I will draw the class structure:

On windows:

wxPopupWindow
-wxShadowPopupWindow
---wxFlatMenuBase
-------wxFlatMenu

On GTK:
wxPopupWindow
- wxFlatMenuBase
----wxFlatMenu

On GTK and other platforms, the class wxShadowPopupWindow is a define for wxPopupWindow (acronym)

On all platforms, the initialisation take place in wxFlatMenuBase constructor, On windows, I needed to override it to call my own CreateMSW() function.
wxMenuDeclaration is a subclass of what? wxPopupWindow or wxShadowPopupWindow?
wxMenuDecration, on windows is subclass of wxShadowPopupWindow ( which is a subclass of wxPopupWindow)
On GTK, wxShadowPopupWindow *is* wxPopupWindow.

The class wxShadowPopupWindow, was needed so I could register it to windows with window style flag set, so we can get this nice shadows around the custom menus.

On GTK, I am currently implemeting a shadow using a technique that will work in 95% of the cases, using placing the background image behind the menu and using PNG images for the shadow, I willl post a screenshot once it is done.

Hope it cleared it for you,

Eran
IDE: CodeLite + wxCrafter
OS: All
https://wxcrafter.codelite.org
https://codelite.org

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

Post by eranif » Sat Oct 21, 2006 11:43 pm

Hi,

Here is an update of my new little project menu & menu bar:

- The menu bar got some face lift ...
- New drop down arrow button was added to the right of the menu, it always contains the "Customize" option, which will popup an options dialog, the dialog functionality is not completed, but it will have:
- Ability to add/remove menus (done)
- Select different colour schems for the menu bar
- Control various options, such as: colour for highlight menu item, draw border around menu (classic look only), display decorations for popup menus (menus which are not related to menu bar)
- Ability to change accelerators for menu items (maybe after first release)

- To complete the set, I will provide also a toolbar to keep look and feel consistency

The source files are now under SVN, and can be found here:
https://opensvn.csie.org/wxFlatMenu

Compiled demo with AUI:
http://www.eistware.com/flatmenu/22_oct ... th_AUI.zip

Here are some (6) screenshots for the updated menu:

classic look (AKA XP):
Image Image

customize dialog (with new wxLabelBook :wink:)


Hidden menus are shown in the 'more' button:
ImageImage

Dark colour scheme for the menu bar.

I hope that sometime next week or the week after I will release the first version (announcement will be posted in 'Announcment and discoveries' section)

Btw, all are running on Linux as well (too lazy to post screenshot from my Llinux)

With regards,
Eran
IDE: CodeLite + wxCrafter
OS: All
https://wxcrafter.codelite.org
https://codelite.org

Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg » Sun Oct 22, 2006 7:58 am

Good work Eran!

What are your plans, create a second alternative to wxAUI ? I guess your approach is very cool, skinning a lot of controls to a flat family on wxWidgets, but I can't help noticing you and the wxAUI guys are sharing a lot of common code. Maybe you should team up and making it an even cooler library?

It's just a thought. I did follow the thread on wx-users where you Vadim and Robert are pondering about integrating custom drawing in wxWidgets. That would be very cool ..

Regards,
- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb

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

Post by eranif » Sun Oct 22, 2006 8:26 am

Jorg wrote:Good work Eran!
Thanks
Jorg wrote: What are your plans, create a second alternative to wxAUI ?
No, I think wxAUI is great, If I didnt think so, I would not have bother supplying a support for it with my new menu bar alternative.

In fact, I am working on integrating wxFlatNotebook inside wxAUI (with bwilliams, wxAUI author), becuase I think wxFlatNotebook tabs, can offer alot to wxAUI.
Jorg wrote:What are your plans
I plan to achieve a proper alternative for wxMenu* family.

My ultimate goal is to complete a wxRibbonBar


http://www.codejock.com/downloads/sampl ... bbonsample

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 » Sun Oct 22, 2006 3:12 pm

Hi Eran,

excellent work, really! If I may show you something, that uses your custom controls, I would like to present my latest creature, called Symphony. This is a screenshot of Symphony (with luna blue theme) using FlatNotebook in the middle (I can't show the real plot 'cause I am not allowed to, but it is something VTK-based) and an improved version of FancyButtonPanel that handles also separators, controls, buttons with text and much more:

http://xoomer.alice.it/infinity77/Symphony_lunablue.png

And another screenshot that implements FlatMenu in wxPython (I just finished it), with luna grey theme:

http://xoomer.alice.it/infinity77/Symph ... atMenu.png

Unfortunately, shadows behind menus still baffles me, but I think it is nice anyway and I will write to Robin to see if there is something we can do to obtain those nice shadows.

I hope you like it, and thanks so much for your great efforts!


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

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

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

Post by eranif » Sun Oct 22, 2006 3:34 pm

Very nice and impressive,
this kind of replies encourage me to improve the control!

I am now working on completing the menu bar.

BTW, by looking at your screenshot, I remembered a small bug that I intended to fix and forgot about it: when poping up a menu, the menu caption, is drawn 4 pixels too low :)

Beside that, Once I will complete it, you will be able to choose colours scheme for the menu bar using the right side button (user will be able to save/load its settings to/from a wxString)

I am also planing to add toolbar as part of the menu bar, very similar to the FancyButtonPanel, but will integrate with the menu bar (disabling, receive the UpdateUI events, etc)

You should really convince Robbin to accept the shadow code, even if it windows only, it adds *alot* to the menus

With regards,
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 » Sun Oct 22, 2006 3:43 pm

Hi Eran,

I am glad you liked it! However, as for convince Robin, it is not really an issue. The problem I am having is related to the code itself, not to Robin acceptance of it. If I have understood correctly, in your code you have:

ShadowPopupWindow inherits from wx.PopupWindow

BUT:

In the initialization code of ShadowPopupWindow, you have:

Code: Select all

long style = wxBORDER_NONE | wxWANTS_CHARS | wxPOPUP_WINDOW;
wxWindow::Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, style, wxT("flat_menu"));

So it does not inherit anymore from wx.PopupWindow, but from wx.Window (?!?!?).

In wxPython, if ShadowPopupWindow inherits from wx.PopupWindow, I have to do either this:

class ShadowPopupWindow(wx.PopupWindow):
def __init__(self, parent):
wx.PopupWindow.__init__(self, parent)

OR:

class ShadowPopupWindow(wx.PopupWindow):
def __init__(self, parent):
pre = wx.PrePopupWindow()
pre.Create(parent, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, style, "flat_menu")

I still haven't found a way to Create() a wx.Window even if I inherit from wx.PopupWindow... maybe someone from the C++ side can share some suggestion on this issue.

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

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

Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg » Sun Oct 22, 2006 5:18 pm

In fact, I am working on integrating wxFlatNotebook inside wxAUI (with bwilliams, wxAUI author), becuase I think wxFlatNotebook tabs, can offer alot to wxAUI.
Cool! It would be great to combine those two greatnesses, wxAUI for the docking, and your great libs for the eye candy... :-)
My ultimate goal is to complete a wxRibbonBar
That looks really nice and can be a new revolutioonary way of designing menus in the GUI. I hope you succeed in this, it will greatly add value to wxWidgets!

Regards,
- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb

Post Reply