ksskinstatusbar.pas
来自「小区水费管理系统源代码水费收费管理系统 水费收费管理系统」· PAS 代码 · 共 246 行
PAS
246 行
{==============================================================================
SkinEngine's StatusBar
Copyright (C) 2000-2002 by Evgeny Kryukov
All rights reserved
All conTeThements of this file and all other files included in this archive
are Copyright (C) 2002 Evgeny Kryukov. Use and/or distribution of
them requires acceptance of the License Agreement.
See License.txt for licence information
$Id: ksskinstatusbar.pas,v 1.1.1.1 2002/08/05 12:12:14 Evgeny Exp $
===============================================================================}
unit ksskinstatusbar;
{$I se_define.inc}
{$T-,W-,X+,P+}
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
se_controls, KsSkinEngine, KsSkinObjects, KsSkinVersion;
type
{ TSeSkinStatusBar class }
TSeSkinStatusBar = class(TSeCustomStatusBar)
private
FSkinEngine: TSeSkinEngine;
FSkinStatus: TSeSkinObject;
FSkinObject: string;
function GetVersion: TSeSkinVersion;
procedure SetSkinEngine(const Value: TSeSkinEngine);
procedure SetVersion(const Value: TSeSkinVersion);
procedure SetSkinObject(const Value: string);
protected
procedure WMInvalidateSkinObject(var Msg: TMessage); message WM_INVALIDATESKINOBJECT;
procedure WMBeforeChange(var Msg: TMessage); message WM_BEFORECHANGE;
procedure WMSkinChange(var Msg: TMessage); message WM_SKINCHANGE;
function UseSkin: boolean;
{ overrides }
procedure DrawPanel(Panel: TSeStatusPanel; ARect: TRect; AGripper: boolean); override;
procedure PaintBackGround; override;
procedure PaintGripper; override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
property SkinEngine: TSeSkinEngine read FSkinEngine write SetSkinEngine;
property SkinObject: string read FSkinObject write SetSkinObject;
property Version: TSeSkinVersion read GetVersion write SetVersion
stored false;
end;
implementation {===============================================================}
{ TSeSkinStatusBar ===============================================================}
constructor TSeSkinStatusBar.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FSkinObject := 'StatusBar';
end;
destructor TSeSkinStatusBar.Destroy;
begin
if FSkinStatus <> nil then FSkinStatus.Free;
inherited Destroy;
end;
function TSeSkinStatusBar.UseSkin: boolean;
begin
if (csDestroying in ComponentState) or (csLoading in ComponentState) then
Result := false
else
if (FSkinEngine <> nil) and (FSkinEngine.SkinSource <> nil) and
(not FSkinEngine.SkinSource.IsChanging) and
(FSkinEngine.SkinSource.Count > 0) and
(FSkinEngine.SkinSource.GetObjectByName(FSkinObject) <> nil) and
(FSkinStatus <> nil)
then
Result := true
else
Result := false;
end;
procedure TSeSkinStatusBar.PaintBackGround;
var
SaveIndex: integer;
SkinObject: TSeSkinObject;
begin
if not UseSkin then
inherited
else
begin
SkinObject := FSkinStatus.FindObjectByName('Frame');
if SkinObject <> nil then
begin
SaveIndex := SaveDC(Canvas.Handle);
if Panels.Count > 0 then
with GetPanelsRect do
ExcludeClipRect(Canvas.Handle, Left, Top, Right, Bottom);
SkinObject.State := ssNormal;
SkinObject.BoundsRect := Rect(0, 0, Width, Height);
SkinObject.Draw(Canvas);
RestoreDC(Canvas.Handle, SaveIndex);
end
else
inherited ;
end;
end;
procedure TSeSkinStatusBar.PaintGripper;
var
SkinObject: TSeSkinObject;
begin
if not UseSkin then
inherited
else
begin
SkinObject := FSkinStatus.FindObjectByName('Gripper');
if SkinObject <> nil then
begin
SkinObject.State := ssNormal;
SkinObject.BoundsRect := GetGripperRect;
SkinObject.Draw(Canvas);
end
else
inherited ;
end;
end;
procedure TSeSkinStatusBar.DrawPanel(Panel: TSeStatusPanel; ARect: TRect; AGripper: boolean);
var
SkinObject: TSeSkinObject;
begin
if UseSkin then
begin
{ Draw background }
SkinObject := FSkinStatus.FindObjectByName('Frame');
if SkinObject <> nil then
begin
SkinObject.State := ssNormal;
SkinObject.BoundsRect := Rect(0, 0, Width, Height);
SkinObject.Draw(Canvas);
end;
{ Draw Panel }
SkinObject := FSkinStatus.FindObjectByName('Panel');
if SkinObject <> nil then
begin
SkinObject.State := ssNormal;
SkinObject.BoundsRect := ARect;
SkinObject.Draw(Canvas);
end;
{ Draw }
if Panel.Style = psOwnerDraw then
DoDrawPanel(Self, Panel, ARect)
else
begin
DrawPanelText(Panel, ARect);
if Panel.ShowImage then
DrawPanelImage(Panel, ARect);
end;
end
else
inherited;
end;
{ Properties }
function TSeSkinStatusBar.GetVersion: TSeSkinVersion;
begin
Result := sSeSkinVersion;
end;
procedure TSeSkinStatusBar.SetSkinEngine(const Value: TSeSkinEngine);
begin
FSkinEngine := Value;
if (FSkinEngine <> nil) and (FSkinEngine.SkinSource <> nil) and
(not FSkinEngine.SkinSource.IsChanging) and
(FSkinEngine.SkinSource.Count > 0) then
begin
if FSkinStatus <> nil then FSkinStatus.Free;
FSkinStatus := nil;
if FSkinEngine.SkinSource.GetObjectByName(FSkinObject) <> nil then
FSkinStatus := FSkinEngine.SkinSource.GetObjectByName(FSkinObject).CreateCopy(nil);
if FSkinStatus <> nil then
FSkinStatus.ParentControl := Self;
end
else
begin
if FSkinStatus <> nil then FSkinStatus.Free;
FSkinStatus := nil;
end;
Invalidate;
end;
procedure TSeSkinStatusBar.SetVersion(const Value: TSeSkinVersion);
begin
end;
procedure TSeSkinStatusBar.WMInvalidateSkinObject(var Msg: TMessage);
begin
Invalidate;
end;
procedure TSeSkinStatusBar.WMBeforeChange(var Msg: TMessage);
begin
if Pointer(Msg.LParam) = nil then Exit;
if TSeSkinEngine(Msg.LParam) <> FSkinEngine then Exit;
if FSkinStatus <> nil then FSkinStatus.Free;
FSkinStatus := nil;
end;
procedure TSeSkinStatusBar.WMSkinChange(var Msg: TMessage);
begin
if Pointer(Msg.LParam) = nil then Exit;
if TSeSkinEngine(Msg.LParam) <> FSkinEngine then Exit;
SkinEngine := FSkinEngine;
end;
procedure TSeSkinStatusBar.SetSkinObject(const Value: string);
begin
FSkinObject := Value;
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?