📄 dcoutbar.pas
字号:
Property FlatGroups ;
Property HotTrack ;
Property ButtonSpace ;
Property HotColor ;
Property Frequency ;
Property ButtonSpaceColor ;
Property OnChange;
Property OnChanging;
Property OnGroupCaptionChanged;
Property OnGroupCaptionChanging;
Property OnGroupDraw;
Property Align ;
Property Color;
Property Ctl3D;
property Enabled;
Property PopupMenu ;
Property Visible ;
Property Font ;
Property ParentFont ;
Property ShowHint ;
Property ParentColor;
Property ParentShowHint;
Property ParentCtl3D;
Property OnMouseDown;
Property OnMouseMove;
Property OnMouseUp;
Property OnExit ;
Property OnEnter ;
Property OnDragDrop ;
Property OnDragOver ;
End ;
TDCOutBarVertListView=Class;
TDCOutBar = Class (TDCGroupBar)
Private
FBackground:TBitmap;
FBackgroundMode:TBackgroundMode;
FDragEnabled:Boolean;
FDragPlaceColor:TColor;
FGradientBeginColor:TColor;
FGradientEndColor:TColor;
FHighlightColor:TColor;
FHighlightFontColor:TColor;
FHighlightSelection:Boolean;
FLargeImages:TImageList;
FOnButtonClick:TListItemEvent;
FOnExecuteItem:TExecuteItemEvent;
FOnHotTrackItem:TListItemEvent;
FOneSelected:Boolean;
FOnPopupMenu:TPopupMenuEvent;
FScrollButtonsPos:TScrollButtonsPos;
FSelectionType:TSelectionType;
FSmallImages:TImageList;
FSunkSelected:Boolean;
FUseDblClick:Boolean;
FWrapLineCount:Integer;
Procedure ClearAllSelected(ExcludeGroup:TDCOutbarGroup);
Function GetActiveListView:TDCVertListView;
Procedure OnBkChange(Sender:TObject);
Procedure SetBackground(Value:TBitmap);
Procedure SetBackgroundMode(Value:TBackgroundMode);
Procedure SetDragEnabled(Value:Boolean);
Procedure SetDragPlaceColor(Value:TColor);
Procedure SetGradientBeginColor(Value:TColor);
Procedure SetGradientEndColor(Value:TColor);
Procedure SetHighlightColor(Value:TColor);
Procedure SetHighlightFontColor(Value:TColor);
Procedure SetHighlightSelection(Value:Boolean);
Procedure SetLargeImagesList(Value:TImageList);
Procedure SetOneSelected(Value:Boolean);
Procedure SetScrollButtonsPos(Value:TScrollButtonsPos);
Procedure SetSelectionType(Value:TSelectionType);
Procedure SetSmallImagesList(Value:TImageList);
Procedure SetSunkSelected(Value:Boolean);
Procedure SetUseDblClick(Value:Boolean);
Procedure SetWrapLineCount(Value:Integer);
Protected
Function CreateListView:TDCOutBarVertListView;virtual;
Procedure Notification (AComponent:TComponent;Operation:TOperation);override ;
public
Constructor Create(AOwner:TComponent);override;
Destructor Destroy;override;
Property ActiveListView:TDCVertListView Read GetActiveListView;
Function NewGroup:TDCOutBarGroup;override;
Published
Property Background:TBitmap read FBackground write SetBackground;
Property BackgroundMode:TBackgroundMode read FBackgroundMode write SetBackgroundMode default bkmNone;
Property DragEnabled:Boolean read FDragEnabled write SetDragEnabled default True;
Property DragPlaceColor:TColor read FDRagPlaceColor write SetDragPlaceColor default clBlack;
Property GradientBeginColor:TColor read FGradientBeginColor write SetGradientBeginColor default clBlue;
Property GradientEndColor:TColor read FGradientEndColor write SetGradientEndColor default clBlack;
Property HighlightColor:TColor read FHighlightColor write SetHighlightColor default clBtnFace;
Property HighlightFontColor:TColor read FHighlightFontColor write SetHighlightFontColor default clBlack;
Property HighlightSelection:Boolean read FHighlightSelection write SetHighlightSelection default False;
Property LargeImages:TImageList read FLargeImages write SetLargeImagesList ;
Property OnButtonClick:TListItemEvent read FOnButtonClick write FOnButtonClick;
Property OnExecuteItem:TExecuteItemEvent read FOnExecuteItem write FOnExecuteItem;
Property OneSelected:Boolean read FOneSelected write SetOneSelected default False;
Property OnHotTrackItem:TListItemEvent read FOnHotTrackItem write FOnHotTrackItem;
Property OnPopupMenu:TPopupMenuEvent read FOnPopupMenu write FOnPopupMenu;
Property ScrollButtonsPos:TScrollButtonsPos read FScrollButtonsPos write SetScrollButtonsPos default spTopAndBottom;
Property SelectionType:TSelectionType read FSelectionType write SetSelectionType default stStandard;
Property SmallImages:TImageList read FSmallImages write SetSmallImagesList ;
Property SunkSelected:Boolean read FSunkSelected write SetSunkSelected default False;
Property UseDblClick:Boolean read FUseDblClick write SetUseDblClick default False;
Property WrapLineCount:Integer read FWrapLineCount write SetWrapLineCount default 1;
End;
TDCOutBarVertListView=Class(TDCVertListView)
Private
FLargeImages:TImageList;
FParentBackgroundMode:Boolean;
FParentBackground:Boolean;
FParentDragEnabled:Boolean;
FParentDragPlaceColor:Boolean;
FParentGradientBeginColor:Boolean;
FParentGradientEndColor:Boolean;
FParentHighlightColor:Boolean;
FParentHighlightFontColor:Boolean;
FParentHighlightSelection:Boolean;
FParentScrollButtonsPos:Boolean;
FParentSelectionType:Boolean;
FParentSunkSelected:Boolean;
FParentUseDblClick:Boolean;
FParentWrapLineCount:Boolean;
FSmallImages:TImageList;
Function GetOutBar:TDCOutBar;
Procedure InitImages;
Procedure SetLargeImagesList(Value:TImageList);
Procedure SetParentBkgnd(Value:Boolean);
Procedure SetParentBackgroundMode(Value:Boolean);
Procedure SetParentDragEnabled(Value:Boolean);
Procedure SetParentDragPlaceColor(Value:Boolean);
Procedure SetParentGradientBeginColor(Value:Boolean);
Procedure SetParentGradientEndColor(Value:Boolean);
Procedure SetParentHighlightColor(Value:Boolean);
Procedure SetParentHighlightFontColor(Value:Boolean);
Procedure SetParentHighlightSelection(Value:Boolean);
Procedure SetParentScrollButtonsPos(Value:Boolean);
Procedure SetParentSelectionType(Value:Boolean);
Procedure SetParentSunkSelected(Value:Boolean);
Procedure SetParentUseDblClick(Value:Boolean);
Procedure SetParentWrapLineCount(Value:Boolean);
Procedure SetSmallImagesList(Value:TImageList);
Protected
Procedure DoButtonClick(Item:TListItem);override;
Function DoExecuteItem(Item:TDCVertListItem):Boolean;override;
Procedure DoHotTrackItem(Item:TListItem);override;
Function DoPopupMenu(Item:TListItem):TPopupMenu;override;
Procedure Notification(AComponent:TComponent;Operation:TOperation);override;
Procedure SelectedItemChanged;override;
Procedure SetBackground(Value:TBitmap);override;
Procedure SetBackgroundMode(Value:TBackgroundMode);override;
Procedure SetDragEnabled(Value:Boolean);override;
Procedure SetDragPlaceColor(Value:TColor);override;
Procedure SetGradientBeginColor(Value:TColor);override;
Procedure SetGradientEndColor(Value:TColor);override;
Procedure SetHighlightColor(Value:TColor);override;
Procedure SetHighlightFontColor(Value:TColor);override;
Procedure SetHighlightSelection(Value:Boolean);override;
Procedure SetScrollButtonsPos(Value:TScrollButtonsPos);override;
Procedure SetSelectionType(Value:TSelectionType);override;
Procedure SetSunkSelected(Value:Boolean);override;
Procedure SetUseDblClick(Value:Boolean);override;
Procedure SetWrapLineCount(Value:Integer);override;
Procedure UpdateBackground(Value:TBitmap);
Procedure UpdateBackgroundMode(Value:TBackgroundMode);
Procedure UpdateDragEnabled(Value:Boolean);
Procedure UpdateDragPlaceColor(Value:TColor);
Procedure UpdateGradientBeginColor(Value:TColor);
Procedure UpdateGradientEndColor(Value:TColor);
Procedure UpdateHighlightColor(Value:TColor);
Procedure UpdateHighlightFontColor(Value:TColor);
Procedure UpdateHighlightSelection(Value:Boolean);
Procedure UpdateScrollButtonsPos(Value:TScrollButtonsPos);
Procedure UpdateSelectionType(Value:TSelectionType);
Procedure UpdateSunkSelected(Value:Boolean);
Procedure UpdateUseDblClick(Value:Boolean);
Procedure UpdateWrapLineCount(Value:Integer);
Procedure WMRButtonDown(Var Message:TWMMouse);message WM_RBUTTONDOWN;
Public
Constructor Create(AOwner:TComponent);override;
Property OutBar:TDCOutBar read GetOutBar;
Published
Property LargeImages:TImageList read FLargeImages write SetLargeImagesList;
Property ParentBackground:Boolean read FParentBackground write SetParentBkgnd default True;
Property ParentBackgroundMode:Boolean read FParentBackgroundMode write SetParentBackgroundMode default True;
Property ParentDragEnabled:Boolean read FParentDragEnabled write SetParentDragEnabled default True;
Property ParentDragPlaceColor:Boolean read FParentDragPlaceColor write SetParentDragPlaceColor default True;
Property ParentGradientBeginColor:Boolean read FParentGradientBeginColor write SetParentGradientBeginColor default True;
Property ParentGradientEndColor:Boolean read FParentGradientEndColor write SetParentGradientEndColor default True;
Property ParentHighlightColor:Boolean read FParentHighlightColor write SetParentHighlightColor default True;
Property ParentHighlightFontColor:Boolean read FParentHighlightFontColor write SetParentHighlightFontColor default True;
Property ParentHighlightSelection:Boolean read FParentHighlightSelection write SetParentHighlightSelection default True;
Property ParentScrollButtonsPos:Boolean read FParentScrollButtonsPos write SetParentScrollButtonsPos default True;
Property ParentSelectionType:Boolean read FParentSelectionType write SetParentSelectionType default True;
Property ParentSunkSelected:Boolean read FParentSunkSelected write SetParentSunkSelected default True;
Property ParentUseDblClick:Boolean read FParentUseDblClick write SetParentUseDblClick default True;
Property ParentWrapLineCount:Boolean read FParentWrapLineCount write SetParentWrapLineCount default True;
Property SmallImages:TImageList read FSmallImages write SetSmallImagesList;
End ;
procedure JumpToURL(const s : string);
Implementation
//{$DEFINE FASTPAINT}
{$IFNDEF D3}
{$R dcHandPT.Res}
{$ENDIF}
{$R DCOutBar.Res}
Const
HorzSpace=7;
TriangleVertSpace=5;
HorzButtonSpace=5;
VertButtonSpace=5;
DragHorzSpace=5;
DragVertSpace=5;
DragPlaceHorzSpace=2;
crDragMove=100;
crDragCopy=101;
EditorLeftMargin=10;
EditorRightMargin=10;
HotSpace=10;
SmallIconTextSpace=3;
IncSmallIconSpace=4;
FocusSpace=2;
LargeTextIconSpace=2;
Type
TPublicWinControl=Class(TWinControl);
Var
KeyboardHook:Integer;
HookedListView:TDCVertListView;
procedure JumpToURL(const s : string);
begin
ShellExecute(Application.Handle, nil, PChar(s), nil, nil, SW_SHOW);
end;
{-----------------------------------------------------------}
Procedure Error(const Message:String);
Begin
Raise Exception.Create(Message);
End;
{---------------------------------------------------------}
Procedure ErrorFmt(const Message:String;const Data:Array Of Const);
Begin
Error(Format(Message,Data));
End;
{---------------------------------------------------------}
Function KeyboardProc(Code:Integer;wParam,lParam:Integer):Integer;stdcall;
Begin
With HookedListView Do
If FIsDrag Then
Case wParam Of
VK_ESCAPE:
ProcessCancelDrag;
VK_CONTROL:
UpdateDragCursor;
End;
Result:=1;
If HookedListView<>Nil Then
Result:=CallNextHookEx(KeyboardHook,Code,wParam,lParam);
End;
{***********************************************************}
Constructor TCustomDCTranspScrollBar.Create (AOwner : TComponent) ;
Begin
Inherited ;
FTimer := TTimer.Create (Self) ;
FTimer.OnTimer := OnTimer ;
FTimer.Enabled := FALSE ;
Frequency := 100 ;
FAutoSize := TRUE ;
FKind := sbVertical ;
FMax := 100 ;
Height := 100 ;
Width := 100 ;
Color := clSilver ;
Transparent := FALSE ;
InitAutoSize ;
End ;
{-----------------------------------------------------------}
Destructor TCustomDCTranspScrollBar.Destroy ;
Begin
FTimer.Free ;
Inherited ;
End ;
{-----------------------------------------------------------}
Procedure TCustomDCTranspScrollBar.WMSize (Var Message : TWMSize) ;
Begin
Inherited ;
InitAutoSize ;
End ;
{-----------------------------------------------------------}
Procedure TCustomDCTranspScrollBar.InitAutoSize ;
Begin
If AutoSize Then
Begin
If Kind=sbHorizontal Then
Begin
FAddSize:=GetSystemMetrics(SM_CXHSCROLL);
Height:=GetSystemMetrics(SM_CYHSCROLL);
End
Else
Begin
Width:=GetSystemMetrics(SM_CXVSCROLL);
FAddSize:=GetSystemMetrics(SM_CYVSCROLL);
End;
End;
End;
{-----------------------------------------------------------}
Procedure TCustomDCTranspScrollBar.InternalSetAutoSize (Value : Boolean) ;
Begin
If csLoading in ComponentState Then
Begin
FAutoSize := Value ;
Exit ;
End ;
If FAutoSize <> Value Then
Begin
FAutoSize := Value ;
InitAutoSize ;
Invalidate ;
End ;
End ;
{-----------------------------------------------------------}
Procedure TCustomDCTranspScrollBar.SetMax (Value : Integer) ;
Begin
If FMax <> Value Then
Begin
FMax := Value ;
If Min > Max Then
Min := Max ;
If Position > Max Then
Position := Max ;
Invalidate ;
End ;
End ;
{-----------------------------------------------------------}
Procedure TCustomDCTranspScrollBar.SetMin (Value : Integer) ;
Begin
If FMin <> Value Then
Begin
FMin := Value ;
If Min > Max Then
Min := Max ;
If Position < Min Then
Position := Min ;
Invalidate ;
End ;
End ;
{-----------------------------------------------------------}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -