Home Top Engage OWL Index What's New About

CheckLst ] Hyperlink ] [ BmpMenu ] TipOfDay ] CtxHelp ] DockingEx ] Buttons ] ColorHLS ]


Bitmap Menu

Screenshot Bitmap Menu No.1 Screenshot Bitmap Menu No.2
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
functions to map menu items to other bitmaps than the default
(so you can show different menu items with the same bitmap)

NOTE: TBmpMenu use the Win32 API and can't work with Windows 3.11

NOTE: Actually TBmpMenu class V1.5 is also included in the OWLExt3 package, that you can find in the download section of OWL NExt Home Page.

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 always gray. If you don't like the default Borland bitmaps, you can download a package (08/02/98, 67 KB) with 184 MS-Office style bitmaps.

By default all bitmaps in module that correspondent to a menuid will be shown. But you can exclude bitmaps or map a command to another bitmap.

This class works with OWL 6.0 patch #5 (and higher I hope). OWL 6.0 include default Borland bitmaps for some commands (e.g. File->New, Edit->Cut). If you don't like this, then you can insert some project defines to exclude the default Borland bitmaps:

OWL6.0 Project Define File Bitmaps
NO_BMP_EDITFILE editfile.rc new, open, save, save as
NO_BMP_EDITSEARCH editsear.rc find, finnext, undo, cut, copy, paste

Hint: If you have popup menus that reside popup menus, they aren't remapped correct. The reason for that is the following TBmpMenu function: void RemapMenu(HMENU hMenu, bool isPopup=false)
You see, that the member isPopup is set to false by default. I've added in the MDI example a "File" popup menu that reside a "File" popup menu. Look into the function InitInstance to see the implementation.

Hint: Tooltips are delimited to 50 characters by original OWL. TBmpMenu cut the tooltip, if a tooltip with accelerator key reach this limit.

Many thanks to Riho Ellermaa, Michael Morgensen, Jürgen Welzenbach, Rob Beckers, Jo Parrello, Mark Hatsell and Yura Bidus for their help in testing and fixing the TBmpMenu classes.

The code was tested using Microsoft Visual C++ 6.0 SR2 with OWL6 patch 5 and Borland C++ 5.02 with OWL 5.02. Both under Windows NT 4.0 SP4.

Please send me bug reports, bug fixes, enhancements, requests, etc., and I'll try to keep this in next versions:
EMail: dieter.windau@usa.net

Happy coding

Download

Ver File Description
1.7 bmpmenu.zip 04/24/99, 18 KB Only the source of TBmpMenu classes and this HTML-Document
- bmpmapp.zip 04/24/99, 109 KB This package contains the TBmpMenu soure and two examples. Add an Visual C++ 6 project file.
- The MDI sample shows:
   - how to use the TBmpMenu class in an MDI application
   - how to get a bitmap popup menu in editor windows
   - how you can insert a popup menu that reside popup menus.
   - 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

History

Ver Date Description
1.7 04/24/99 - Bugfix: Now user defined checkmark and radio dot bitmaps are mapped
  to the correct system colors and they use the also the mask color.
- More UNICODE support
- Make the member MapEntries protected
- Some other changes for better C++ design, but I don't change the functionality
- Add a actual version of helpfkt files to the project
1.6 04/05/99 - Now I use TColor for Old3dFaceColor member (same as in OWLExt3 library).
  It's is a better design, but with V1.5 code it works not correct. I've fixed the bug
- Test with OWL6 #5 and delete the source for older patches than #3
- Some changes with string handling (now it work with VC++ 6 compiler)
- Add new functions to get and set the color of pixels that will be mask to the
  correct system menu color. As example some MFC toolbar bitmaps have a
  green background color.
1.5 11/23/98 - Bugfix: Bitmaps aren't always shown in their default color, which is usually
  gray. Now I use again the TImageList (same as up to V1.3) and I will
  newer develop a 16-bit support in the future
- New functions: You can set a special bitmap for all simple checked menu
  items or for all radio dot checked menu items
1.4 10/23/98 - Bugfix: Show disabled menu items that reside on the menubar correct
- Make TBmpMenu compatible with OWL 6.0 patch #3
1.32 09/24/98 - Bugfix: Show menus with menu break (more than one column) correct
1.31 09/13/98 - Use shared helper functions (Also needed in my DockingEx classes)
- Use TCelArray instead of TImageList for more 16-bit support in future
- Add _OWLCLASS macros, to insert TBmpMenu classes in a DLL
1.3 08/22/98 - Add functions to map menu items to other bitmaps than the default
  - New public array member MapEntries where you can add TBmpMapEntry
- Bugfix: Show disabled checked menu items (checkbox and radio dot) correct
1.2 08/07/98 - 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 07/10/98 - Add support for Tooltips with accelerator keys. New Functions:
   - PreGetHintText()
   - IsWithAccel()
   - SetWithAccel()
- Add module in constructor to load bitmaps
- Bugfix: Delete search for '\a' character, because this is not necassary
1.0 06/17/98 Basic version
 

Back to top of Page CheckLst ] Hyperlink ] [ BmpMenu ] TipOfDay ] CtxHelp ] DockingEx ] Buttons ] ColorHLS ]

E-Mail: SoftEngage@aol.com
Copyright © 1998 M. Engelbert, D. Windau
Updated: 24.04.99