I just commited the new menu "system" in edelib trunk (actually, it
is not really new, but forked FLTK menu code).
FLTK menus are fine, fast and works well. But there are few
missing pieces, like custom icons in menu items. Actually, you can
set an icon, but menu item label will not be shown, since that icon
will be considered as label. Strange decision. Also, setting icons
with custom sizes is not possible.
On other hand, extending menu code in FLTK is pretty
impossible. One of the most important part of FLTK menus,
Fl_Menu_Item, can't be
inherited to allow custom item draws, so if do you even the
smallest change in this class, you'll have to pull all Fl_Menu_*
code and change it to use your
Fl_Menu_Item modification.
Pretty scary, isn't.
So, you know why it is forked :). Also, this is not the only
reason. With this comes greater flexibility in future extending,
adding custom drawing effects, improve scheming ability or similar
things. Besides, I planned to use them for
ede-panel, and these menus
has to be little bit "more" than plain FLTK menus.
Here is how it looks like:
I know, nothing fancy and looks like menus in any other
toolkit. And that is the point :). Also, icons with different sizes
can be used, aligning their labels nicely. It doesn't look pretty
and hardly anyone will use icons with non-uniform sizes, but
follows FLTK way where each menu item could have different label
size, font or color.
Contrary to Qt style (where you always have gap from the left
size, no matter was icon used or not in the menu item), I took Gtk
approach: if there is no icon, there will be no gap (like it is
shown in above submenu). This gives some kind of FLTK "compatible"
feeling.
Application code should not be changed considerably either.
Instead
Fl_Menu_Item or
Fl_Menu_Bar, putting
edelib::MenuItem or
edelib::MenuBar will do
the job allowing to use FLUID generated menus without much of the
trouble.
Menus with icons
July 3, 2009