TBmpMenu - A Bitmap Menu Class
Written by: Dieter Windau
Last updated: 15 August 1998
TBmpMenu is a freeware OWL class that shows bitmaps on the left side
of menus like MS Office 97.
Portions of code are based on MFC class CMenuSpawn written by Iuri
Apollonio and BCMenu written by Brent Corkum. Very special thanks.
Basically, menus with bitmaps was created to let the user see visually
the correspondence of a menu item and a toolbar button, so that he can
learn easily the meanings of sometime strange button drawing.
So I wrote the TBmpMenu class, which takes care with some help from
TDecoratedFrame (for SDI applications) or TDecoratedMDIFrame
(for MDI applications) of menu remapping and drawing.
Some of the features of TBmpMenu are:
- remap menus, popup menus and system menus
- draw simple and bitmapped checked/unchecked menu items
- draw radio dot checked menu items
- draw default menu items with bold text
- support the system wide menu fonts and menu colors
- change menu item text on the fly
- draw main menu items recessed (optional)
- support tooltips with accelerator keys (optional)
- support background bitmaps (optional)
- functions to exclude and include bitmaps
NOTE: TBmpMenu use the Win32 API and can't work with Windows 3.11
The default size of the loaded bitmaps are 19 x 18 pixel (Microsoft style).
If you use 20 x 20 pixel (default Borland size), change the constants in the
source. The bitmaps will be shown smaller in the menu. One pixel on the right
and bottom side is cut, because this is only gray.
By default all bitmaps in module that correspondent to a menuid will be shown.
Hint: Tooltips are delimited to 50 characters by original OWL. TBmpMenu
cut the tooltip, if a tooltip with accelerator key reach this limit.
This package contains the TBmpMenu source and two examples:
- The MDI sample shows:
- how to use the TBmpMenu class in an MDI application
- how to get a bitmap popup menu in editor windows
- support for the recent file list
- support for accelerators in tooltips and background bitmaps
- The SDI sample shows:
- how to use the TBmpMenu class in an SDI application
Tested with Borland C++ 5.02, OWL 5.02 with Windows NT 4.0 SP3 but
I think the class would work with Windows 95 too.
Please send me bug reports, bug fixes, enhancements, requests, etc., and
I'll try to keep this in next versions:
EMail: dieter dot windau at usa dot net
Web: http://www.members.aol.com/SoftEngage
Happy coding.
History
1.2 07.08.97
- Add support for background bitmaps. New Functions:
- IsBackBitmap()
- SetBackBitmap()
- Add functions to exclude and include bitmaps
- Change the default loaded bitmap size to 19x18 pixel
- Use TCHAR, LPTSTR,... to support UNICODE version later
- Add some TRACE macros for better diagnostic
- Make TBmpMenu compatible with OWL 6.0
1.1 10.07.98
- Add support for Tooltips with accelerator keys. New Functions:
- PreGetHintText()
- IsWithAccel()
- SetWithAccel()
- Add module in constructor to load bitmaps
- Bugfixes:
- Delete search for '\a' character, because is not necassary
1.0 17.06.98