📄 jvgcommclasses.pas
字号:
{-----------------------------------------------------------------------------
The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/MPL-1.1.html
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for
the specific language governing Rights and limitations under the License.
The Original Code is: JvgCommClasses.PAS, released on 2003-01-15.
The Initial Developer of the Original Code is Andrey V. Chudin, [chudin att yandex dott ru]
Portions created by Andrey V. Chudin are CopyRight (C) 2003 Andrey V. Chudin.
All Rights Reserved.
Contributor(s):
Michael Beck [mbeck att bigfoot dott com].
Rob den Braasem [rbraasem att xs4all dott nl]
Burov Dmitry, translation of russian text.
You may retrieve the latest version of this file at the Project JEDI's JVCL home page,
located at http://jvcl.sourceforge.net
Known Issues:
-----------------------------------------------------------------------------}
// $Id: JvgCommClasses.pas,v 1.26 2005/02/17 10:21:20 marquardt Exp $
unit JvgCommClasses;
{$I jvcl.inc}
interface
uses
{$IFDEF USEJVCL}
{$IFDEF UNITVERSIONING}
JclUnitVersioning,
{$ENDIF UNITVERSIONING}
{$ENDIF USEJVCL}
Windows, Graphics, Controls, Classes, ExtCtrls,
JvgTypes;
type
TJvgTwainColors = class;
TJvgCustomGradient = class;
TJvgGradient = class;
TJvg3DGradient = class;
TJvg2DAlign = class;
TJvgPointClass = class;
TJvgBevelOptions = class;
TJvgExtBevelOptions = class;
TJvgIllumination = class;
TJvgLabelTextStyles = class;
TJvgCustomTextColors = class;
TJvgSimleLabelColors = class;
TJvgCustomLabelColors = class;
TJvgLabelColors = class;
TJvgGroupBoxColors = class;
TJvgListBoxItemStyle = class;
TJvgAskListBoxItemStyle = class;
TJvgCustomBoxStyle = class;
TJvgCustomTextBoxStyle = class;
TJvgTextBoxStyle = class;
TJvgBevelLines = class;
TJvgTwainColors = class(TPersistent)
private
FFromColor: TColor;
FToColor: TColor;
FRGBFromColor: Longint;
FRGBToColor: Longint;
FOnChanged: TNotifyEvent;
procedure SetFromColor(Value: TColor);
procedure SetToColor(Value: TColor);
protected
procedure Changed; virtual;
public
constructor Create; virtual;
procedure Assign(Source: TPersistent); override;
property RGBFromColor: Longint read FRGBFromColor write FRGBFromColor;
property RGBToColor: Longint read FRGBToColor write FRGBToColor;
property OnChanged: TNotifyEvent read FOnChanged write FOnChanged;
published
property FromColor: TColor read FFromColor write SetFromColor default clGray;
property ToColor: TColor read FToColor write SetToColor default 0;
end;
TJvgCustomGradient = class(TJvgTwainColors)
private
FBufferedDraw: Boolean;
FSteps: Integer;
FPercentFilling: TPercentRange;
FBrushStyle: TBrushStyle;
FOrientation: TglGradientDir; //...public!
FActive: Boolean;
FReverse: Boolean;
procedure SetActive(Value: Boolean);
procedure SetOrientation(Value: TglGradientDir);
procedure SetSteps(Value: Integer);
procedure SetPercentFilling(Value: TPercentRange);
procedure SetBrushStyle(Value: TBrushStyle);
protected
property Active: Boolean read FActive write SetActive;
property BufferedDraw: Boolean read FBufferedDraw write FBufferedDraw default False;
property Orientation: TglGradientDir read FOrientation write SetOrientation;
property Steps: Integer read FSteps write SetSteps default 255;
property PercentFilling: TPercentRange read FPercentFilling write SetPercentFilling default 100;
property BrushStyle: TBrushStyle read FBrushStyle write SetBrushStyle default bsSolid;
public
constructor Create; override;
procedure Assign(Source: TPersistent); override;
procedure TextOut(DC: HDC; const Str: string; TextR: TRect; X, Y: Integer);
function GetColorFromGradientLine(GradientLineWidth, Position: Word): COLORREF;
end;
TJvgGradient = class(TJvgCustomGradient)
public
procedure Draw(DC: HDC; r: TRect; PenStyle, PenWidth: Integer);
published
property Active;
property BufferedDraw;
property Orientation;
property Steps;
property PercentFilling;
property BrushStyle;
end;
TJvg3DGradient = class(TJvgCustomGradient)
private
FDepth: Word;
FGType: TThreeDGradientType;
procedure SetDepth(Value: Word);
procedure SetGType(Value: TThreeDGradientType);
public
constructor Create; override;
procedure Assign(Source: TPersistent); override;
published
property Depth: Word read FDepth write SetDepth default 16;
property GType: TThreeDGradientType read FGType write SetGType default fgtFlat;
end;
TJvg2DAlign = class(TPersistent)
private
FHorizontal: TglHorAlign;
FVertical: TglVertAlign;
FOnChanged: TNotifyEvent;
procedure SetHorizontal(Value: TglHorAlign);
procedure SetVertical(Value: TglVertAlign);
protected
procedure Changed; virtual;
public
constructor Create;
procedure Assign(Source: TPersistent); override;
property OnChanged: TNotifyEvent read FOnChanged write FOnChanged;
published
property Horizontal: TglHorAlign read FHorizontal write SetHorizontal
default fhaLeft;
property Vertical: TglVertAlign read FVertical write SetVertical
default fvaTop;
end;
TJvgPointClass = class(TPersistent)
private
FX: Integer;
FY: Integer;
FOnChanged: TNotifyEvent;
procedure SetX(Value: Integer);
procedure SetY(Value: Integer);
protected
procedure Changed; virtual;
public
procedure Assign(Source: TPersistent); override;
property OnChanged: TNotifyEvent read FOnChanged write FOnChanged;
published
property X: Integer read FX write SetX;
property Y: Integer read FY write SetY;
end;
TJvgBevelOptions = class(TPersistent)
private
FInner: TPanelBevel;
FOuter: TPanelBevel;
FSides: TglSides;
FBold: Boolean;
FOnChanged: TNotifyEvent;
procedure SetInner(Value: TPanelBevel);
procedure SetOuter(Value: TPanelBevel);
procedure SetSides(Value: TglSides);
procedure SetBold(Value: Boolean);
protected
procedure Changed; virtual;
public
constructor Create; virtual;
procedure Assign(Source: TPersistent); override;
function BordersHeight: Integer;
function BordersWidth: Integer;
property OnChanged: TNotifyEvent read FOnChanged write FOnChanged;
published
property Inner: TPanelBevel read FInner write SetInner stored True; // default bvLowered;
property Outer: TPanelBevel read FOuter write SetOuter stored True; // default bvNone;
property Sides: TglSides read FSides write SetSides stored True default ALLGLSIDES;
property Bold: Boolean read FBold write SetBold stored True; // default False;
end;
TJvgExtBevelOptions = class(TJvgBevelOptions)
private
FActive: Boolean;
FBevelPenStyle: TPenStyle;
FBevelPenWidth: Word;
FInteriorOffset: Word;
procedure SetActive(Value: Boolean);
procedure SetBevelPenStyle(Value: TPenStyle);
procedure SetBevelPenWidth(Value: Word);
procedure SetInteriorOffset(Value: Word);
public
constructor Create; override;
procedure Assign(Source: TPersistent); override;
published
property Active: Boolean read FActive write SetActive default True;
property BevelPenStyle: TPenStyle read FBevelPenStyle write SetBevelPenStyle default psSolid;
property BevelPenWidth: Word read FBevelPenWidth write SetBevelPenWidth default 1;
property InteriorOffset: Word read FInteriorOffset write SetInteriorOffset default 0;
end;
TJvgIllumination = class(TJvg2DAlign)
private
FShadowDepth: Integer;
procedure SetShadowDepth(Value: Integer);
public
constructor Create;
procedure Assign(Source: TPersistent); override;
published
property ShadowDepth: Integer read FShadowDepth write SetShadowDepth default 2;
end;
TJvgLabelTextStyles = class(TPersistent)
private
FPassive: TglTextStyle;
FActive: TglTextStyle;
FDisabled: TglTextStyle;
FOnChanged: TNotifyEvent;
procedure SetPassive(Value: TglTextStyle);
procedure SetActive(Value: TglTextStyle);
procedure SetDisabled(Value: TglTextStyle);
protected
procedure Changed; virtual;
public
constructor Create;
procedure Assign(Source: TPersistent); override;
property OnChanged: TNotifyEvent read FOnChanged write FOnChanged;
published
property Passive: TglTextStyle read FPassive write SetPassive default fstRaised;
property Active: TglTextStyle read FActive write SetActive default fstRaised;
property Disabled: TglTextStyle read FDisabled write SetDisabled default fstPushed;
end;
TJvgCustomTextColors = class(TPersistent)
private
FOnChanged: TNotifyEvent;
FText: TColor;
FTextDisabled: TColor;
FDelineate: TColor;
FBackground: TColor;
FHighlight: TColor;
FShadow: TColor;
private
procedure SetText(Value: TColor);
procedure SetTextDisabled(Value: TColor);
procedure SetDelineate(Value: TColor);
procedure SetBackground(Value: TColor);
procedure SetHighlight(Value: TColor);
procedure SetShadow(Value: TColor);
protected
procedure Changed; virtual;
public
constructor Create; virtual;
procedure Assign(Source: TPersistent); override;
property OnChanged: TNotifyEvent read FOnChanged write FOnChanged;
protected
property Text: TColor read FText write SetText default clBlack;
property TextDisabled: TColor read FTextDisabled write SetTextDisabled default clGray;
property Delineate: TColor read FDelineate write SetDelineate default clWhite;
property Shadow: TColor read FShadow write SetShadow default clBtnShadow;
property Highlight: TColor read FHighlight write SetHighlight default clBtnHighlight;
property Background: TColor read FBackground write SetBackground default clBtnFace;
end;
TJvgSimleLabelColors = class(TJvgCustomTextColors)
published
// property Text stored True;
property Delineate stored True;
property Shadow stored True;
property Highlight;
property Background stored True;
end;
TJvgCustomLabelColors = class(TJvgCustomTextColors)
private
FTextActive: TColor;
FDelineateActive: TColor;
FAutoHighlight: Boolean;
FAutoShadow: Boolean;
FBackgroundActive: TColor;
FColorHighlightShift: Integer;
FColorShadowShift: Integer;
private
procedure SetTextActive(Value: TColor);
procedure SetDelineateActive(Value: TColor);
procedure SetBackgroundActive(Value: TColor);
procedure SetAutoHighlight(Value: Boolean);
procedure SetAutoShadow(Value: Boolean);
procedure SetColorHighlightShift(Value: Integer);
procedure SetColorShadowShift(Value: Integer);
public
constructor Create; override;
procedure Assign(Source: TPersistent); override;
protected
property TextActive: TColor read FTextActive write SetTextActive default clBlack;
property DelineateActive: TColor read FDelineateActive write SetDelineateActive default clWhite;
property AutoHighlight: Boolean read FAutoHighlight write SetAutoHighlight default False;
property AutoShadow: Boolean read FAutoShadow write SetAutoShadow default False;
property ColorHighlightShift: Integer read FColorHighlightShift write SetColorHighlightShift default 40;
property ColorShadowShift: Integer read FColorShadowShift write SetColorShadowShift default 60;
property BackgroundActive: TColor read FBackgroundActive write SetBackgroundActive default clBtnFace;
end;
TJvgLabelColors = class(TJvgCustomLabelColors)
published
property Text;
property TextDisabled;
property Delineate;
property Shadow;
property Highlight;
property Background;
property TextActive;
property DelineateActive;
property AutoHighlight;
property AutoShadow;
property ColorHighlightShift;
property ColorShadowShift;
property BackgroundActive;
end;
TJvgGroupBoxColors = class(TJvgCustomLabelColors)
private
FCaption: TColor;
FCaptionActive: TColor;
FClient: TColor;
FClientActive: TColor;
procedure SetCaption(Value: TColor);
procedure SetCaptionActive(Value: TColor);
procedure SetClient(Value: TColor);
procedure SetClientActive(Value: TColor);
public
constructor Create; override;
procedure Assign(Source: TPersistent); override;
published
property Text;
property Delineate;
property Shadow;
property Highlight;
// property Background;
property TextActive;
property DelineateActive;
// property AutoHighlight;
// property AutoShadow;
// property ColorHighlightShift;
// property ColorShadowShift;
// property BackgroundActive;
property Caption: TColor read FCaption write SetCaption;
property CaptionActive: TColor read FCaptionActive write SetCaptionActive;
property Client: TColor read FClient write SetClient;
property ClientActive: TColor read FClientActive write SetClientActive;
end;
TJvgCustomListBoxItemStyle = class(TPersistent)
private
FColor: TColor;
FDelineateColor: TColor;
FFont: TFont;
FBevel: TJvgBevelOptions;
FTextStyle: TglTextStyle;
FOnChanged: TNotifyEvent;
procedure SetColor(Value: TColor);
procedure SetDelineateColor(Value: TColor);
procedure SetFont(Value: TFont);
procedure SetBevel(Value: TJvgBevelOptions);
procedure SetTextStyle(Value: TglTextStyle);
protected
procedure SetOnChanged(Value: TNotifyEvent); virtual;
procedure Changed;
public
constructor Create; virtual;
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
function HighlightColor: TColor;
function ShadowColor: TColor;
property OnChanged: TNotifyEvent read FOnChanged write SetOnChanged;
property Color: TColor read FColor write SetColor;
property DelineateColor: TColor read FDelineateColor write SetDelineateColor;
property Font: TFont read FFont write SetFont;
property Bevel: TJvgBevelOptions read FBevel write SetBevel;
property TextStyle: TglTextStyle read FTextStyle write SetTextStyle;
end;
TJvgListBoxItemStyle = class(TJvgCustomListBoxItemStyle)
private
FGradient: TJvgGradient;
FTextGradient: TJvgGradient;
procedure SetGradient(Value: TJvgGradient);
procedure SetTextGradient(Value: TJvgGradient);
protected
property TextGradient: TJvgGradient read FTextGradient write SetTextGradient;
procedure SetOnChanged(Value: TNotifyEvent); override;
public
constructor Create; override;
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
published
property Gradient: TJvgGradient read FGradient write SetGradient;
property Color;
property DelineateColor;
property Font;
property Bevel;
property TextStyle;
end;
TJvgHintStyle = class(TJvgListBoxItemStyle);
TJvgSpeedButtonStyle = class(TJvgListBoxItemStyle)
published
property TextGradient;
end;
TJvgAskListBoxItemStyle = class(TJvgCustomListBoxItemStyle)
private
FBtnColor: TColor;
FBtnFont: TFont;
FBtnTextStyle: TglTextStyle;
procedure SetBtnColor(Value: TColor);
procedure SetBtnFont(Value: TFont);
procedure SetBtnTextStyle(Value: TglTextStyle);
public
constructor Create; override;
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
published
property BtnColor: TColor read FBtnColor write SetBtnColor;
property BtnFont: TFont read FBtnFont write SetBtnFont;
property BtnTextStyle: TglTextStyle read FBtnTextStyle write SetBtnTextStyle;
property Color;
property DelineateColor;
property Font;
property Bevel;
property TextStyle;
end;
TJvgCustomBoxStyle = class(TJvgBevelOptions)
private
FPenStyle: TPenStyle;
FHighlightColor: TColor;
FShadowColor: TColor;
procedure SetPenStyle(Value: TPenStyle);
procedure SetHighlightColor(Value: TColor);
procedure SetShadowColor(Value: TColor);
protected
property PenStyle: TPenStyle read FPenStyle write SetPenStyle default psSolid;
property HighlightColor: TColor read FHighlightColor write SetHighlightColor default clBtnHighlight;
property ShadowColor: TColor read FShadowColor write SetShadowColor default clBtnShadow;
public
constructor Create; override;
procedure Assign(Source: TPersistent); override;
end;
TJvgCustomTextBoxStyle = class(TJvgCustomBoxStyle)
private
FTextColor: TColor;
FBackgroundColor: TColor;
procedure SetTextColor(Value: TColor);
procedure SetBackgroundColor(Value: TColor);
protected
property TextColor: TColor read FTextColor write SetTextColor default clBlack;
property BackgroundColor: TColor read FBackgroundColor write SetBackgroundColor default clWindow;
public
constructor Create; override;
procedure Assign(Source: TPersistent); override;
end;
TJvgTextBoxStyle = class(TJvgCustomTextBoxStyle)
published
property Inner;
property Outer;
property Sides;
property Bold;
property PenStyle;
property TextColor;
property BackgroundColor;
property HighlightColor;
property ShadowColor;
end;
TJvgBevelLines = class(TPersistent)
private
FCount: Cardinal;
FStep: Cardinal;
FOrigin: TglOrigin;
FStyle: TPanelBevel;
FBold: Boolean;
FThickness: Byte;
FIgnoreBorder: Boolean;
FOnChanged: TNotifyEvent;
procedure SetCount(Value: Cardinal);
procedure SetStep(Value: Cardinal);
procedure SetOrigin(Value: TglOrigin);
procedure SetStyle(Value: TPanelBevel);
procedure SetBold(Value: Boolean);
procedure SetThickness(Value: Byte);
procedure SetIgnoreBorder(Value: Boolean);
protected
procedure Changed; virtual;
public
constructor Create;
procedure Assign(Source: TPersistent); override;
property OnChanged: TNotifyEvent read FOnChanged write FOnChanged;
published
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -