Owner Drawn Menus...

Hello NG,

      this may be an impossible question, but I am just curious about one
thing: using wxWidgets source code of wxMenu (in the wxUniversal port or
using the "common" cpp/h files), converting it to wxPython/Python, is it
possible to build a custom wxMenu that is independent from the platform and
uses only wxPython calls/method? I mean, is there a way I can avoid
platform dependency of wxMenu? Something like building a new class that is
pure wxPython code, similar to other things we have in wx.lib.*
If this is possible, do you have any suggestion about the source code to be
converted? I see, in the "common" folder of wxWidgets, the menucmn.cpp file
that should be common to all ports, menu.cpp and menu.h from wxUniversal
folder... am I missing something else? The strange thing, is that I can't
find any wx.EVT_PAINT in those files... who is actually painting the menu?

Sorry for the (probable) stupid question.

Thanks in advance for every hint.

Andrea.

···

_______________________________________________
Andrea Gavana
Reservoir Engineer
MOGI ? Reservoir Characterization and Modeling Dept.
ENI S.p.A. ? Exploration & Production Division
Via Emilia, 1 ? 20097 San Donato Milanese (MI) ? Italy
Phone: +39 02 520 62972
Fax: +39 02 520 61824
E-mail: andrea.gavana@agip.it
Restyled Internet Site: http://xoomer.virgilio.it/infinity77/
____________________________________________________

Eni S.p.A.
Sede legale in Roma,
Piazzale Enrico Mattei 1, 00144 Roma
Tel. centralino: +39 06598.21
www.eni.it
Capitale sociale € 4.002.934.326 i.v.
Registro Imprese di Roma,
Codice Fiscale 00484960588
Part. IVA 00905811006
R.E.A. Roma n. 756453

------------------------------------------------------------------------------------------------------------------------------------------
Message for the recipient only, if received in error, please notify the
sender and read http://www.eni.it/disclaimer/

I don't know who is painting it, but it seems like you could probably
simulate a menu and its functionality via a popupwindow (or borderless
frame on mac) and some static text controls (remembering to change the
background color of the window/frame via PAINT events), or wxChoice (if
you could change the background color of the choice list) along with
some EVT_SELECTED events for submenus...

Out of curiosity: why do you want to build "owner drawn menus"?

- Josiah

···

andrea.gavana@agip.it wrote:

      this may be an impossible question, but I am just curious about one
thing: using wxWidgets source code of wxMenu (in the wxUniversal port or
using the "common" cpp/h files), converting it to wxPython/Python, is it
possible to build a custom wxMenu that is independent from the platform and
uses only wxPython calls/method? I mean, is there a way I can avoid
platform dependency of wxMenu? Something like building a new class that is
pure wxPython code, similar to other things we have in wx.lib.*
If this is possible, do you have any suggestion about the source code to be
converted? I see, in the "common" folder of wxWidgets, the menucmn.cpp file
that should be common to all ports, menu.cpp and menu.h from wxUniversal
folder... am I missing something else? The strange thing, is that I can't
find any wx.EVT_PAINT in those files... who is actually painting the menu?

Sorry for the (probable) stupid question.

Hello Josiah & NG,

I don't know who is painting it, but it seems like you could probably
simulate a menu and its functionality via a popupwindow (or borderless
frame on mac) and some static text controls (remembering to change the
background color of the window/frame via PAINT events), or wxChoice (if
you could change the background color of the choice list) along with
some EVT_SELECTED events for submenus...

Out of curiosity: why do you want to build "owner drawn menus"?

Ah, this is the right question :wink:
I was thinking about a "new" control, nothing more... by now, I have run out
of new ideas about "new" controls, so I was thinking (dreaming?) about new
wxMenu styles such as XP/Office 2003 menu. They don't have any new
functionality, they are just simple menus, but they are graphically
impressive and, mostly, I like them very much :slight_smile:
However, I have very few hopes to be able to implement a pure wxPython
wxMenu... I'm just waiting for a definitive answer from Robin before killing
forever this idea. No new child this time :frowning:

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77

Ah. If you really want to try do it, try putting a panel on a
frame/window and doing all of the drawing, highlighting, etc., yourself.

- Josiah

···

"Andrea Gavana" <andrea_gavana@tin.it> wrote:

Hello Josiah & NG,

> I don't know who is painting it, but it seems like you could probably
> simulate a menu and its functionality via a popupwindow (or borderless
> frame on mac) and some static text controls (remembering to change the
> background color of the window/frame via PAINT events), or wxChoice (if
> you could change the background color of the choice list) along with
> some EVT_SELECTED events for submenus...
>
> Out of curiosity: why do you want to build "owner drawn menus"?
>

Ah, this is the right question :wink:
I was thinking about a "new" control, nothing more... by now, I have run out
of new ideas about "new" controls, so I was thinking (dreaming?) about new
wxMenu styles such as XP/Office 2003 menu. They don't have any new
functionality, they are just simple menus, but they are graphically
impressive and, mostly, I like them very much :slight_smile:
However, I have very few hopes to be able to implement a pure wxPython
wxMenu... I'm just waiting for a definitive answer from Robin before killing
forever this idea. No new child this time :frowning:

Hello NG,

      this may be an impossible question, but I am just curious about one
thing: using wxWidgets source code of wxMenu (in the wxUniversal port or
using the "common" cpp/h files), converting it to wxPython/Python, is it
possible to build a custom wxMenu that is independent from the platform and
uses only wxPython calls/method? I mean, is there a way I can avoid
platform dependency of wxMenu? Something like building a new class that is
pure wxPython code, similar to other things we have in wx.lib.*
If this is possible, do you have any suggestion about the source code to be
converted? I see, in the "common" folder of wxWidgets, the menucmn.cpp file
that should be common to all ports,

Right. The classes in the common folder are base classes that all of the platform specific versions derive from.

menu.cpp and menu.h from wxUniversal
folder... am I missing something else? The strange thing, is that I can't
find any wx.EVT_PAINT in those files... who is actually painting the menu?

I haven't checked to be sure, but the painting in the wxUniv port is probably being delegated to a Renderer class. However they are probably implemented using a wx.PopupTransient window, so you should be able to get some ideas at least that would carry over.

···

andrea.gavana@agip.it wrote:

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!