📄 barpopupmenu.pas
字号:
{ Unit: Unit2
===========================================================================
Created: 2001-07-12 (yyyy-mm-dd)
===========================================================================
The contents of this file are subject to the Bluecave Public License V 1.0
(the "License"). You may not copy or use this file, in either source code
or executable form, except in compliance with the License. You may obtain
a copy of the License at http://www.bluecave.net/licenses/.
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
Copyright (C) 2001 Bluecave Software. All Rights Reserved.
http://www.bluecave.net/
Copyright (C) 2001 Jouni Airaksinen. All Rights Reserved.
http://Mintus.Codefield.com/ -- Mintus@Codefield.com
===========================================================================
History:
2001-07-12: Initial version.
=========================================================================== }
{$I DFS.inc}
{$I BcDirectives.inc}
unit BarPopupMenu;
interface
uses Classes, Graphics, BarMenus;
{$IFDEF OLDCLASS}
{ simple compatibility layer }
TBarPopupMenu = class(TBcCustomBarPopupMenu)
private
function GetBitmap: TBitmap;
function GetBitmapHorzAlignment: TBitmapHorzAlignment;
function GetBitmapOffset(const Index: Integer): Integer;
function GetBitmapVertAlignment: TBitmapVertAlignment;
function GetTransparent: Boolean;
function GetVerticalFont: TFont;
function GetVerticalText: string;
function GetVerticalTextOffset(const Index: Integer): Integer;
procedure SetBitmap(const Value: TBitmap);
procedure SetBitmapHorzAlignment(const Value: TBitmapHorzAlignment);
procedure SetBitmapOffset(const Index, Value: Integer);
procedure SetBitmapVertAlignment(const Value: TBitmapVertAlignment);
procedure SetTransparent(const Value: Boolean);
procedure SetVerticalFont(const Value: TFont);
procedure SetVerticalText(const Value: string);
procedure SetVerticalTextOffset(const Index, Value: Integer);
public
property BarBitmap;
property BarCaption;
published
{ no need for mapping }
property BarWidth;
property BarVisible;
property GradientEnd;
property GradientStart;
property ShortLines;
{ mapped properties }
property Bitmap: TBitmap read GetBitmap write SetBitmap;
property BitmapOffsetX: Integer index 0 read GetBitmapOffset write SetBitmapOffset default 0;
property BitmapOffsetY: Integer index 1 read GetBitmapOffset write SetBitmapOffset default 0;
property BitmapVertAlignment: TBitmapVertAlignment read GetBitmapVertAlignment
write SetBitmapVertAlignment default DefaultBarBitmapVertAlignment;
property BitmapHorzAlignment: TBitmapHorzAlignment read GetBitmapHorzAlignment
write SetBitmapHorzAlignment default DefaultBarBitmapHorzAlignment;
property Transparent: Boolean read GetTransparent write SetTransparent default DefaultBitmapTransparent;
property VerticalFont: TFont read GetVerticalFont write SetVerticalFont;
property VerticalText: string read GetVerticalText write SetVerticalText;
property VerticalTextOffsetY: Integer index 1 read GetVerticalTextOffset
write SetVerticalTextOffset default DefaultBarCaptionOffsetY;
end;
{$ENDIF}
implementation
{$IFDEF OLDCLASS}
{ TBarPopupMenu }
{ compatibility layer }
function TBarPopupMenu.GetBitmap: TBitmap;
begin
Result := BarBitmap.Bitmap;
end;
function TBarPopupMenu.GetBitmapHorzAlignment: TBitmapHorzAlignment;
begin
Result := BarBitmap.HorzAlignment;
end;
function TBarPopupMenu.GetBitmapOffset(const Index: Integer): Integer;
begin
case Index of
0: Result := BarBitmap.OffsetX;
1: Result := BarBitmap.OffsetY;
else
raise EInvalidPropertyIndex.CreateFmt(SInvalidPropertyIndex, [Index]);
end;
end;
function TBarPopupMenu.GetBitmapVertAlignment: TBitmapVertAlignment;
begin
Result := BarBitmap.VertAlignment;
end;
function TBarPopupMenu.GetTransparent: Boolean;
begin
Result := BarBitmap.Transparent;
end;
function TBarPopupMenu.GetVerticalFont: TFont;
begin
Result := BarCaption.Font;
end;
function TBarPopupMenu.GetVerticalText: string;
begin
Result := BarCaption.Caption;
end;
function TBarPopupMenu.GetVerticalTextOffset(const Index: Integer): Integer;
begin
case Index of
1: Result := BarCaption.OffsetY;
else
raise EInvalidPropertyIndex.CreateFmt(SInvalidPropertyIndex, [Index]);
end;
end;
procedure TBarPopupMenu.SetBitmap(const Value: TBitmap);
begin
BarBitmap.Bitmap := Value;
end;
procedure TBarPopupMenu.SetBitmapHorzAlignment(
const Value: TBitmapHorzAlignment);
begin
BarBitmap.HorzAlignment := Value;
end;
procedure TBarPopupMenu.SetBitmapOffset(const Index, Value: Integer);
begin
case Index of
0: BarBitmap.OffsetX := Value;
1: BarBitmap.OffsetY := Value;
else
raise EInvalidPropertyIndex.CreateFmt(SInvalidPropertyIndex, [Index]);
end;
end;
procedure TBarPopupMenu.SetBitmapVertAlignment(
const Value: TBitmapVertAlignment);
begin
BarBitmap.VertAlignment := Value;
end;
procedure TBarPopupMenu.SetTransparent(const Value: Boolean);
begin
BarBitmap.Transparent := Value;
end;
procedure TBarPopupMenu.SetVerticalFont(const Value: TFont);
begin
BarCaption.Font := Value;
end;
procedure TBarPopupMenu.SetVerticalText(const Value: string);
begin
BarCaption.Caption := Value;
end;
procedure TBarPopupMenu.SetVerticalTextOffset(const Index, Value: Integer);
begin
case Index of
1: BarCaption.OffsetY := Value;
else
raise EInvalidPropertyIndex.CreateFmt(SInvalidPropertyIndex, [Index]);
end;
end;
{$ENDIF}
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -