Class TvRbwMostRecentlyUsed

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TvRbwMostRecentlyUsed = class(TComponent)

Description

TvRbwMostRecentlyUsed manages a list of the most recently used files in an application. It creates menu items for them that can be used to open those files.

Hierarchy

Overview

Fields

Private FCapacity: integer;
Private FFileNames: TStrings;
Private FFileToIgnore: string;
Private FMenuItemPosition: TMenuItemPosition;
Private FMenuItems: TObjectList;
Private FOnClick: TNotifyEvent;
Private FPreviousItem: TMenuItem;
Private FPublicFileNames: TStrings;
Private FShowHint: boolean;
Private FOnAdvancedDrawItem: TAdvancedMenuDrawItemEvent;
Private FOnDrawItem: TMenuDrawItemEvent;
Private FOnMeasureItem: TMenuMeasureItemEvent;

Methods

Private procedure CreateMenuItems(PriorPosition: integer);
Private function GetParentItem(out AddAsChild: boolean): TMenuItem;
Private function GetPublicFileNames: TStrings;
Private function GetMenuItemCount: integer;
Private procedure RestorePositionPreviousItem( const PositionOfPreviousItem: integer);
Private procedure SetCapacity(const Value: integer);
Private procedure SetFileToIgnore(const Value: string);
Private procedure SetMenuItemPosition(const Value: TMenuItemPosition);
Private procedure SetOnClick(const Value: TNotifyEvent);
Private procedure SetPreviousItem(const Value: TMenuItem);
Private procedure SetShowHint(const Value: boolean);
Private procedure UpdateCapacity;
Private procedure UpDateMenu;
Protected procedure Notification(AComponent: TComponent; Operation: TOperation); override;
Public procedure AddFileName(FileName: string);
Public constructor Create(Owner: TComponent); override;
Public destructor Destroy; override;
Public procedure RemoveFilename(FileName: string);

Properties

Public property FileNames: TStrings read GetPublicFileNames;
Public property MenuItemCount: integer read GetMenuItemCount;
Published property Capacity: integer read FCapacity write SetCapacity;
Published property FileToIgnore: string read FFileToIgnore write SetFileToIgnore;
Published property MenuItemPosition: TMenuItemPosition read FMenuItemPosition write SetMenuItemPosition;
Published property OnClick: TNotifyEvent read FOnClick write SetOnClick;
Published property OnAdvancedDrawItem: TAdvancedMenuDrawItemEvent read FOnAdvancedDrawItem write FOnAdvancedDrawItem;
Published property OnDrawItem: TMenuDrawItemEvent read FOnDrawItem write FOnDrawItem;
Published property OnMeasureItem: TMenuMeasureItemEvent read FOnMeasureItem write FOnMeasureItem;
Published property PreviousItem: TMenuItem read FPreviousItem write SetPreviousItem;
Published property ShowHint: boolean read FShowHint write SetShowHint;

Description

Fields

Private FCapacity: integer;

see Capacity.

Private FFileNames: TStrings;

FFileNames is the list of files names that is being stored.

See also
FileNames
FileNames is a copy of the list of files stored by TvRbwMostRecentlyUsed.
FPublicFileNames
FPublicFileNames is a copy of FFileNames.
Private FFileToIgnore: string;

See FileToIgnore.

Private FMenuItemPosition: TMenuItemPosition;

See MenuItemPosition.

Private FMenuItems: TObjectList;

FMenuItems stores the TMenuItems created by TvRbwMostRecentlyUsed.

Private FOnClick: TNotifyEvent;

See OnClick.

Private FPreviousItem: TMenuItem;

See PreviousItem.

Private FPublicFileNames: TStrings;

FPublicFileNames is a copy of FFileNames. It is made available through FileNames.

Private FShowHint: boolean;

See ShowHint.

Private FOnAdvancedDrawItem: TAdvancedMenuDrawItemEvent;
 
Private FOnDrawItem: TMenuDrawItemEvent;
 
Private FOnMeasureItem: TMenuMeasureItemEvent;
 

Methods

Private procedure CreateMenuItems(PriorPosition: integer);

CreateMenuItems is called by UpDateMenu to create menu items.

Private function GetParentItem(out AddAsChild: boolean): TMenuItem;

GetParentItem gets the TMenuItem that is the parent of PreviousItem and sets AddAsChild based on MenuItemPosition.

Private function GetPublicFileNames: TStrings;

The read accessor for FileNames. GetPublicFileNames copies FFileNames into FPublicFileNames and returns FPublicFileNames. (This prevents the user from making changes to FFileNames directly.

Private function GetMenuItemCount: integer;

See MenuItemCount.

Private procedure RestorePositionPreviousItem( const PositionOfPreviousItem: integer);

RestorePositionPreviousItem is called by UpDateMenu to put PreviousItem back where it belongs.

Private procedure SetCapacity(const Value: integer);

see Capacity.

Private procedure SetFileToIgnore(const Value: string);

See FileToIgnore.

Private procedure SetMenuItemPosition(const Value: TMenuItemPosition);

See MenuItemPosition.

Private procedure SetOnClick(const Value: TNotifyEvent);

See OnClick.

Private procedure SetPreviousItem(const Value: TMenuItem);

See PreviousItem.

Private procedure SetShowHint(const Value: boolean);

See ShowHint.

Private procedure UpdateCapacity;

UpdateCapacity gets rid of filenames in FFileNames when the capacity is exceeded.

Private procedure UpDateMenu;

UpDateMenu creates menu items for the recently opened files.

Protected procedure Notification(AComponent: TComponent; Operation: TOperation); override;

Notification is used to set PreviousItem to nil if PreviousItem is removed.

Public procedure AddFileName(FileName: string);

AddFileName adds a file name to the list of files stored by the TvRbwMostRecentlyUsed.

Public constructor Create(Owner: TComponent); override;

Create creates an instance of TvRbwMostRecentlyUsed.

Public destructor Destroy; override;

Destroy destroys the current instance of TvRbwMostRecentlyUsed. Don't call Destroy directly. Call Free instead.

Public procedure RemoveFilename(FileName: string);

RemoveFilename removes a file name from the list of files stored by the TvRbwMostRecentlyUsed.

Properties

Public property FileNames: TStrings read GetPublicFileNames;

FileNames is a copy of the list of files stored by TvRbwMostRecentlyUsed.

Public property MenuItemCount: integer read GetMenuItemCount;

MenuItemCount is the number of TMenuItems managed by TvRbwMostRecentlyUsed.

Published property Capacity: integer read FCapacity write SetCapacity;

Capacity is the maximum number of file names that will be stored in a TvRbwMostRecentlyUsed.

Published property FileToIgnore: string read FFileToIgnore write SetFileToIgnore;

no TMenuItem is created for FileToIgnore

Published property MenuItemPosition: TMenuItemPosition read FMenuItemPosition write SetMenuItemPosition;

MenuItemPosition is used to specify the relationship between the TRecentFileMenuItems generated by TvRbwMostRecentlyUsed and the one specified in PreviousItem.

See also
TMenuItemPosition
TMenuItemPosition is used to specify the relationship between the TRecentFileMenuItems generated by TvRbwMostRecentlyUsed and the one specified in TvRbwMostRecentlyUsed.PreviousItem.
Published property OnClick: TNotifyEvent read FOnClick write SetOnClick;

OnClick is the OnClick event handler for each of the menu items created by TvRbwMostRecentlyUsed.

Published property OnAdvancedDrawItem: TAdvancedMenuDrawItemEvent read FOnAdvancedDrawItem write FOnAdvancedDrawItem;

OnAdvancedDrawItem is the OnHighlighted event handler for each of the menu items created by TvRbwMostRecentlyUsed.

Published property OnDrawItem: TMenuDrawItemEvent read FOnDrawItem write FOnDrawItem;
 
Published property OnMeasureItem: TMenuMeasureItemEvent read FOnMeasureItem write FOnMeasureItem;
 
Published property PreviousItem: TMenuItem read FPreviousItem write SetPreviousItem;

PreviousItem is the TMenuItem just before the TMenuItems created by TvRbwMostRecentlyUsed.

Published property ShowHint: boolean read FShowHint write SetShowHint;

If ShowHint is true, the Hint property of the menu items will be set to the full file name.


Generated by PasDoc 0.12.1 on 2013-05-13 15:41:53