📄 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_SETNEWSKIN : if (LongWord(Message.LParam) = LongWord(SkinData.SkinManager)) then begin
// BorderStyle := bsSingle;
CommonWndProc(Message, FCommonData);
exit
end; }
AC_REMOVESKIN : if LongWord(Message.LParam) = LongWord(SkinData.SkinManager) then begin
if ListSW <> nil then FreeAndNil(ListSW);
CommonWndProc(Message, FCommonData);
RecreateWnd;
exit
end;
{ AC_REFRESH : if (LongWord(Message.LParam) = LongWord(SkinData.SkinManager)) then begin
CommonWndProc(Message, FCommonData);
RefreshEditScrolls(SkinData, ListSW);
Perform(WM_ERASEBKGND, 0, 0);
Repaint;
SendMessage(Handle, WM_NCPAINT, 0, 0);
exit
end}
end;
if not ControlIsReady(Self) or not FCommonData.Skinned then inherited else begin
{ case Message.Msg of
WM_PAINT : begin
FCommonData.Updating := FCommonData.Updating;
if FCommonData.Updating then begin // Exit if parent is not ready yet
BeginPaint(Handle, PS);
EndPaint(Handle, PS);
Exit;
end;
if ControlIsActive(FCommonData) then begin
if not FCommonData.CustomColor and (Color <> FCommonData.SkinManager.gd[FCommonData.SkinIndex].HotColor) then Color := FCommonData.SkinManager.gd[FCommonData.SkinIndex].HotColor;
end
else if not FCommonData.CustomColor and (Color <> FCommonData.SkinManager.gd[FCommonData.SkinIndex].Color) then Color := FCommonData.SkinManager.gd[FCommonData.SkinIndex].Color;
inherited;
exit;
end;
end; }
CommonWndProc(Message, FCommonData);
inherited;
{ case Message.Msg of
CM_SHOWINGCHANGED : RefreshEditScrolls(SkinData, ListSW);
CM_VISIBLECHANGED, CM_ENABLEDCHANGED, WM_SETFONT : begin
FCommonData.Invalidate;
end;
CM_TEXTCHANGED, CM_CHANGED : if Assigned(ListSW) then UpdateScrolls(ListSW, True);
end; }
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 + -