📄 slistbox.pas
字号:
unit sListBox;
{$I sDefs.inc}
{.$DEFINE LOGGED}
interface
{$IFDEF TNTUNICODE}
uses StdCtrls, controls, classes, forms, graphics, messages, windows, sysutils, consts, sCommonData,
sConst, sDefaults, commctrl, acSBUtils, TntStdCtrls;
type
TsListBox = class(TTntListBox)
{$IFNDEF NOTFORHELP}
private
FCommonData: TsCommonData;
FDisabledKind: TsDisabledKind;
FBoundLabel: TsBoundLabel;
procedure SetDisabledKind(const Value: TsDisabledKind);
public
ListSW : TacScrollWnd;
procedure AfterConstruction; override;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Loaded; override;
procedure WndProc (var Message: TMessage); override;
published
{$ENDIF} // NOTFORHELP
property BoundLabel : TsBoundLabel read FBoundLabel write FBoundLabel;
property SkinData : TsCommonData read FCommonData write FCommonData;
property DisabledKind : TsDisabledKind read FDisabledKind write SetDisabledKind default DefDisabledKind;
end;
{$ENDIF}
implementation
{$IFDEF TNTUNICODE}
uses sVCLUtils, sMessages, sGraphUtils, sAlphaGraph, sSkinProps;
{ TsListBox }
procedure TsListBox.AfterConstruction;
begin
inherited AfterConstruction;
FCommonData.Loaded;
end;
constructor TsListBox.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
ControlStyle := ControlStyle - [csOpaque];
FCommonData := TsCommonData.Create(Self, {$IFDEF DYNAMICCACHE} False {$ELSE} True {$ENDIF});
FCommonData.COC := COC_TsListBox;
if FCommonData.SkinSection = '' then FCommonData.SkinSection := s_Edit;
FDisabledKind := DefDisabledKind;
FBoundLabel := TsBoundLabel.Create(Self, FCommonData);
end;
destructor TsListBox.Destroy;
begin
if ListSW <> nil then FreeAndNil(ListSW);
FreeAndNil(FBoundLabel);
if Assigned(FCommonData) then FreeAndNil(FCommonData);
inherited Destroy;
end;
procedure TsListBox.Loaded;
begin
inherited Loaded;
FCommonData.Loaded;
RefreshEditScrolls(SkinData, ListSW);
end;
procedure TsListBox.SetDisabledKind(const Value: TsDisabledKind);
begin
if FDisabledKind <> Value then begin
FDisabledKind := Value;
FCommonData.Invalidate;
end;
end;
procedure TsListBox.WndProc(var Message: TMessage);
begin
{$IFDEF LOGGED}
AddToLog(Message);
{$ENDIF}
if Message.Msg = SM_ALPHACMD then case Message.WParamHi of
AC_REMOVESKIN : if LongWord(Message.LParam) = LongWord(SkinData.SkinManager) then begin
if ListSW <> nil then FreeAndNil(ListSW);
CommonWndProc(Message, FCommonData);
RecreateWnd;
exit
end;
end;
if not ControlIsReady(Self) or not FCommonData.Skinned then inherited else begin
CommonWndProc(Message, FCommonData);
inherited;
end;
// Aligning of the bound label
if Assigned(BoundLabel) and Assigned(BoundLabel.FtheLabel) then case Message.Msg of
WM_SIZE, WM_WINDOWPOSCHANGED : begin BoundLabel.AlignLabel end;
CM_VISIBLECHANGED : begin BoundLabel.FtheLabel.Visible := Visible; BoundLabel.AlignLabel end;
CM_ENABLEDCHANGED : begin BoundLabel.FtheLabel.Enabled := Enabled; BoundLabel.AlignLabel end;
CM_BIDIMODECHANGED : begin BoundLabel.FtheLabel.BiDiMode := BiDiMode; BoundLabel.AlignLabel end;
end;
end;
{$ENDIF}
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -