TAppBar Class v.1.3 for Delphi 2.0 and 3.0 Copyright (c) 1997 Paolo Giacomuzzi e-mail: paolo.giacomuzzi@usa.net http://www.geocities.com/SiliconValley/9486 ------------------------------------------- PURPOSE The TAppBar class is a TForm derived class, that lets your form to behave like an Application Desktop Toolbar (i.e. to dock on the edges of the screen like the Windows 95/NT Taskbar). "An application desktop toolbar (or an appbar for short) is a window that attaches itself to an edge of your screen. (The shell’s taskbar window is a well-known example of an appbar). Though appbars are usually docked on an edge of the user's screen, they also can float. To make room for an appbar that's docked, the Windows 95/NT shell shrinks the size of the screen's workarea. The workarea is the portion of the screen that is not occupied by any appbars. Whenever the user maximizes a window, the system ensures that the window fills the workarea, not the full screen. If an appbar is docked on the edge of the screen, moved from one edge of the screen to another, or removed from an edge of the screen, the system automatically resizes and repositions any maximized windows so that they always fill the workarea completely. In addition, when the upper-left corner of the workarea changes, the system shifts all the application windows on the screen so that they always maintain their relative distance from that corner." (J. Richter, 'Extend the Windows 95 Shell with Application Desktop Toolbars', MSDN) USAGE To add appbar behavior to your application, just derive your main form from TAppBar, as shown in the DEMOAPP.DPR sample. Then, use the following properties and methods to customize the appbar appearance, position, size, and so on. PROPERTIES * AlwaysOnTop : Boolean Always-On-Top On/Off. If it is True, the Appbar is always on top of all other windows. Recommended if AutoHide is True. * AutoHide : Boolean Auto-hide On/Off. If it is True, the Appbar hides itself when focus is lost (just like the shell's taskbar). * Edge : TAppBarEdge Edge to dock on. It can assume one of the following values: abeLeft, abeTop, abeRight, abeBottom, abeUnknown, abeFloat. * Flags : TAppBarFlags Allowed dockable edges. It is a set of the following values: abfAllowLeft, abfAllowTop, abfAllowRight, abfAllowBottom, abfAllowFloat. * HorzSizeInc : LongInt Horizontal increment when window is resized. A value of zero prevents the appbar to resize. * VertSizeInc : LongInt Vertical increment when window is resized. A value of zero prevents the appbar to be resized. * DockDims : TRect AppBar dimensions when docked on left, top, right and bottom. DockDims.Left - width when docked on the left DockDims.Top - height when docked on the top DockDims.Right - width when docked on the right DockDims.Bottom - height when docked on the bottom * FloatRect : TRect Rectangle coordinates of the window when AppBar is floating. * MinWidth : LongInt Min allowed width when AppBar is floating. * MinHeight : LongInt Min allowed height when AppBar is floating. * MaxWidth : LongInt Max allowed width when AppBar is floating. * MaxHeight : LongInt Max allowed height when AppBar is floating. * TaskEntry : TAppBarTaskEntry AppBar behavior in the Windows Taskbar. It can assume one of the following values: abtShow - the Taskbar entry is always shown abtHide - the Taskbar entry is never shown abtFloatDependent - the Taskbar entry is shown only when the Appbar is floating METHODS * UpdateBar Forces the AppBar's visual appearance to match its internal state. Call this method after changing one or more properties. EVENTS (overridable functions) * procedure OnAppBarStateChange (bProposed : Boolean; abEdgeProposed : TAppBarEdge); virtual; Called when the AppBar's state changes. Using this notification, it is possible to be notified when the appbar is going to change its state. If bProposed is True, the AppBar is being repositioned on an edge but not yet docked. If bProposed is False, the AppBar is definitively docked on a new edge. The abEdgeProposed argument indicates the edge the AppBar is being docked. * procedure OnAppBarForcedToDocked; virtual; Called if the user attempts to dock an Autohide AppBar on an edge that already contains an Autohide AppBar. * procedure OnABNFullScreenApp (bOpen : Boolean); virtual; Called when a fullscreen application is opened or closed. The bOpen argument contains True if a fullscreen window is opening and False if one is closing. * procedure OnABNPosChanged; virtual; Called when any AppBar alters its size. This notification is also sent when an AppBar is removed, and when the shell's taskbar is in autohide mode and the user causes it to slide on or off the screen. * procedure OnABNWindowArrange (bBeginning : Boolean); virtual; Called when the user chooses either the cascade, tile horizontally, or tile vertically options from the shell's taskbar. This notification is sent to each AppBar twice: the first time when the system is about to reposition all the windows (the bBeginning argument contains True), and the second time after that all the windows have been moved (the bBeginning argument contains False). DISCLAIMER THIS SOFTWARE AND THE ACCOMPANYING FILES ARE DISTRIBUTED "AS IS" AND WITHOUT WARRANTIES AS TO PERFORMANCE OF MERCHANTABILITY OR ANY OTHER WARRANTIES WHETHER EXPRESSED OR IMPLIED. Because of the various software environments into which this class may be used, NO WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE IS OFFERED. Good data processing procedure dictates that any program based on this class be thoroughly tested with non-critical data before relying on it. THE USER MUST ASSUME THE ENTIRE RISK OF USING THE TAPPBAR CLASS. HISTORY * 1.0 - First implementation. * 1.1 - Added 'DemoApp.dpr' sample application and related files. Extended TAppBarFlags from [abfAllowLeftRight, abfAllowTopBottom, abfAllowFloat] to [abfAllowLeft, abfAllowTop, abfAllowRight, abfAllowBottom, abfAllowFloat]. * 1.2 - Fixed an incorrect window style modification if the AppBar was dragged near an edge of the screen. Fixed an incorrect resizing of the window when the AppBar was restored from a docked state to the floating state. * 1.3 - Added TaskEntry property. Fixed an occasional Access Violation, due to Boolean and LongBool different memory size. Removed the Maximize, Minimize and Restore items in the system menu. NOTES OF THE AUTHOR * The TAppBar class is largely based on the J.Richter's CAppBar MFC Class. * TAppBar is completely FREEWARE. * Comments, suggestions and improvements are welcome.