Unit Menus97

////////////////////////////////////////////////////////////////////////////// MENUS97 // ////////////////////////////////////////////////////////////////////////////// Menu Style 97 pour D3 (D2 ?) // ////////////////////////////////////////////////////////////////////////////// Version 1.59 Beta // Date de création : 02/07/1997 // Date dernière modification : 15/03/1998 // ////////////////////////////////////////////////////////////////////////////// Stéphane Chova stephane.chova@hol.fr // Jean-Luc Mattei jlucm@club-internet.fr / jlucm@mygale.org // TSystemMenus97 original idea from // * Sylvain Cresto // Portion of code from // * TSystemMenu - Sylvain Cresto // e-mail : sylvain.cresto@hol.fr // * TExplorerButton - Fabrice Deville // e-mail : fdev@tornado.be // WWW : http://www.tornado.be/~fdev/ // * TMSOfficeCaption - Warren F. Young // e-mail : wfy@ee.ed.ac.uk or Warren.Young@ee.ed.ac.uk // WWW : http://www.ee.ed.ac.uk/~wfy/components.html // Thanks to // * Richard Alimi // * Ian Delisle // * Tom Deprez // * Torben Falck // * Olivier Grosclaude // * Edwin Hagen // * Jérome Hersant // * Stefan Hoffmann // * Steven Kamradt // * Kevin Lu // * Arturo Monge // * Walter Nogueira Freire // * Alexander Obukhov // * Bart Pelgrims // * Larry Pierce // * Saverio Pieri // * Christian Poisson // * Glen Verran // * to be continued ... // ////////////////////////////////////////////////////////////////////////////// IMPORTANT NOTICE : // // This program is FreeWare // // Please do not release modified versions of this source code. // If you've made any changes that you think should have been there, // feel free to submit them to me at jlucm@club-internet.fr // ////////////////////////////////////////////////////////////////////////////// NOTES : // // * MENUS97 AND MSOFFICECAPTION (Warren F. Young) : // MSOFFICECAPTION MUST BE BEFORE MENUS97 IN CREATION ORDER // // * MENUS97 AND TOOLBARBUTTON97 (Jordan Russell) // - If you're using ToolbarButton97 Version 1.54 or greater you must // change Click code : // // Replace this code // // with DropdownMenu do begin // PopupComponent := Self; // { Starting with version 1.54, this avoids using the Popup method// of TPopupMenu because it uses the "track right button" flag // (which disallowed the "click and drag" selecting motion many // people are accustomed to). } // if Assigned(OnPopup) then // OnPopup (DropdownMenu); // TrackPopupMenu (Handle, AlignFlags[Alignment] or // ButtonFlags[NewStyleControls], // PopupPoint.X, PopupPoint.Y, 0, DropdownList.Window, nil); // end; // end // // by this one // // with DropdownMenu do // Popup(PopupPoint.x, PopupPoint.y); // end; // // ////////////////////////////////////////////////////////////////////////////// REVISIONS : // // - 1.20 : * CalcTextWidht Modified ( Accelerators (&) ) // * HOW TO USE Section // * OnDrawItem Event is called now // * ImageList can be changed at runtime without a GPF // * Menu can be changed at runtime without GPF // (thanks to Edwin Hagen) // * Accelerator Keys works fine now for all items // * OnDrawItemEvent is called now // - 1.30 : * CM_MENUCHANGED event added // * Added First Menu Banner // - 1.31 : * Shortcut drawing Bug corrected (thanks to Ian Delisle) // - 1.32 : * Shortcut drawing Bug (really) corrected (now) // * Correct HighLighted Text Color for MenuItems (with Bitmap) // * Shortcuts disableds for disabled items (thanks - again - // to Ian Delisle) // - 1.33 : * ItemHeight Bug Corrected // * Some minor bugs corrected // * HiLite Font Bug corrected // * (thanks to Christian Poisson and Kevin Lu) // - 1.34 : * Drawing Bug corrected // * Supports Break property // * Disabled items don't open submenus (arrow is still badly paint)// * (thanks to Kevin Lu - again ) // - 1.40 : * Added custom classes // * Many things changed // * TMainMenus97, TPopupMenus97 and TSystemMenus97 classes added // * DrawItem Method changed // * Component editor added to auto-fill tags (ContextMenu) // * TSystemMenus97 class added (Original idea and some portions of // code are from Sylvain CRESTO) // * WindowMenu items works now (Opened MDI Window Items) // * Works with MDI Child Menus (Main, Popup & System) // - 1.41 : * Added FontChange method to reflect changes on MenuBar // Reflects : Font, HiliteFont and Brush Changes // (Thanks to Kevin Lu) // - 1.42 : * DrawItem Modified now works with any size of image // (Thanks to Christian Poisson) // * DrawMenuBar is called only with TMainMenus97 component // * Some Methods visibility modification // * HideMenuBar property added to MainMenus for future use... // * ToolBar property added for future use... // * Banners are allowed on popups and system menus // (Thanks to Jérome Hersant) // * Menus97Look property added (Office97 or IE4) // (Thanks to Walter Nogueira Freire) // * TMenuBar97 & TMenuSpeedButton component added for future use ..// * MenuHook function added for future use... // * DON'T USE TOOLBAR PROPERTY IN THIS VERSION ... IT'S UNDER // CONSTRUCTION // - 1.43 : * Disabled item flickering have been minimized // (thanks to Arturo Monge) // - 1.44 : * (really) Stupid bug corrected with popup menus : FTPUHandle was// null after first popup (Member of TCustomPopupMenus97) // * now you can add dynamically items to a popup it works :-) // (thanks to bart pelgrims) // * Little drawing bug corrected (Office97Look) // - 1.45 : * Banner rect is calculated one time and works whith // "Multicolumns menus" (thanks to Bart Pelgrims) // * "abstract" error when changing font or brush on popups is // corrected (thanks to Kevin Lu and Saverio Pieri) // - 1.46 : * PopupMenu SubMenus don't have any more "banner space" // (thanks to Kevin Lu, Saverio Pieri and Torben Falck) // * BarBreak is correctly repaint when submenu is open/closed // - 1.47 : * BannerImage property default is now set to -1 // * No more "Access Violation" errors when an item caption is empty// * DT_EXPANDTABS added in DrawItem // * Some minor bugs corrected // (thanks to Olivier Grosclaude) // * Hints are correctly handled now // * new OnHint event added (thanks to Steven Kamradt) // - 1.48 : * Many little (but important) modifications in Measuring and // Drawing Functions (thanks to Olivier Grosclaude) // * Compiles under D2 without errors (csReflector and Flat) // (Thanks to Tom Deprez) // * No more errors when no popupmenu is selected in a TSystemMenu // and no unwanted separator drawn (thanks to Alexander Obukhov) // * DefaultFont property added // - 1.49 : * Submenu items with submenu have correct size now if no banner // is enabled // * MenuBarBreak is correctly drawn when there's no banner // - 1.50 : * DrawDisabledimages works now with NT 4&5 // (Thanks to Microsoft for their "unified API") // * Strange (and hard to find without NT 4) bug with PopupsMenus // and NT4 corrected (thanks to Torben Falk and Saverio Pieri for // their time and informations) // Never happends under Win95 Win98 or NT 5 // * dcr added for SystemMenus and MenuToolBar // (thanks to Arturo Monge) // - 1.51 : * AnsiString added for GetVerb (compiles with short strings // compiler options on) (thanks to Larry Pierce) // * IsNTPlatform flag used to draw correctly disbled image // (replace compiler directive introduced in V 1.50) // - 1.52 : * Gradient Fill for Banners // * Images allowed in MenuBar (Tag >= 256) // * HiliteFont Change & Font Change initialisation // * Banner is stored in a "BannerBmp" for speed // * A "Little bug" in IsNTPlatform initialization corrected // (NT was never detected !) // * If you plan to use Warren F. Young MSOffice Caption // MSOFFICECAPTION MUST BE BEFORE MENUS97 IN CREATION ORDER // - 1.53 : * Stupid debugging MessageBeep removed (for NT User only) // * MenusItems added dynamically in a OnClick Event are handled // correctly now (except under NT4) // * NT4 USERS : Never add items dynamically in OnClick event // or Menu drawing will hang (if someone know why ...) // If you want to add items add them in OnPopup event. // Win95, Win98 and NT5 users : all's working fine // - 1.54 : * DefaultMargin value modified to Handle Item Text Width when // No ImageList is assigned // * DefaultHeight value modified to Handle Item Text Height when // No ImageList is assigned // * Little corrections in CalcMenuWidth (usefull when no imagelist // are used // - 1.55 : * SystemMenus97 popup bug corrected // - 1.56 : * Toolbar property works with non mdiForms but V 1.42 warning is // still here... (thanks to Stefan Hoffmann) // - 1.57 : * TPUtilWindowsProc Hook chain is now correctly maintained // (Thanks to Saverio Pieri) // * Many unused messages removed for speed // * CalcMenuBarHeight function added // * ToolbarHeight is ok now (thanks to Stefan Hoffmann) // - 1.58 : * MenuBar items order bug corrected (with keyboard) // - 1.59 : * Now compile with or without {$T} compiler directive (thanks to // Richard Alimi) // - 1.60 : * ToolbarButton97 popup problem found (with version greater than // 1.53 (see NOTE section) // ////////////////////////////////////////////////////////////////////////////// HOW TO USE : // // - V 1.00 - V 1.3X : // * Use a standard Menu component : M // * Add a Menu97 component : M97 // * Link M to Menu property of M97 // * Add an image list L and Link L to Image Property of M97 // * Apparence of items is controlled by Tag Property // - Standard MenuBarItem : Tag = -1 (3D look) // - Standard PopupItem : Tag = -2 (Standard Look) // - PopupItem with Bitmap : Tag = n° of Bitmap in ImageList // // - V 1.4X : // + MAIN and POPUP Menus // * Use a standard Menu component (MainMenu or PopupMenu): M // * Add a Menu97 component (TMainMenu97 ot TPopupMenu97) : M97 // * Link M to Menu property of M97 // * Add an image list L and Link L to Image Property of M97 // * Apparence of items is controlled by Tag Property // - 3D Item : Tag = -1 (3D look) // - 3D Item With Bitmap : Tag = 256 + n° of Bitmap in ImageList // (3D Look + Bitmap) // - Standard PopupItem : Tag = -2 (Standard Look) // - PopupItem with Bitmap : Tag = n° of Bitmap in ImageList // // + SYSTEM Menus // * Use a standard Popup component : M // * Add a SystemMenus97 component : M97 // * Link M to PopupMenu property of M97 // * Add an image list L and Link L to Image Property of M97 // * Select ImageIndex for Standard Commands : SCxxxxx // * New Items are added before SC_CLOSE command (if exists) // * Apparence of items is controlled by Tag Property // - 3D Item : Tag = -1 (3D look) // - 3D Item With Bitmap : Tag = 256 + n° of Bitmap in ImageList // (3D Look + Bitmap) // - Standard PopupItem : Tag = -2 (Standard Look) // - PopupItem with Bitmap : Tag = n° of Bitmap in ImageList // //////////////////////////////////////////////////////////////////////////////

Classes

TCustomMainMenus97 -
TCustomMenuBar97 -
TCustomMenus97 -
TCustomPopupMenus97 -
TCustomSystemMenus97 -
TMainMenus97 -
TMenuBar97 -
TMenuSpeedButton -
TPopupMenus97 -
TSystemMenu97Options -
TSystemMenus97 -

Functions

Register - ;CreatePopupMenu

Types

TBannerJustification
TDrawMenuItemEvent
THintEvent
TMeasureMenuItemEvent
TMenus97Look
TMenuState
TSystemMenu97ItemState

Constants

Variables


Functions


procedure Register;

;CreatePopupMenu

Types


TBannerJustification = (bjCenter, bjTop, bjBottom);

TDrawMenuItemEvent = function(Control: TMenu; Item: TMenuItem; Rect: TRect; State: TOwnerDrawState): boolean of object
Remove this line if you have duplicate resources compiler error {$R MENUS97.DCR} Charge l'icône du composant. Component icon {$R *.RES} Charge la marque Check pour l'option Checked. Check Mark
THintEvent = function(Control: TMenu; Item: TMenuItem; Hint: String): String of object

TMeasureMenuItemEvent = procedure(Control: TMenu; Item: TMenuItem; var Height, Width: Integer) of object

TMenus97Look = (mlOffice97Look, mlIE4Look);

TMenuState = (msInactive, msActive, msActiveDrop);

TSystemMenu97ItemState = (smTrue, smFalse, smDefault);

Constants


Variables