📄 iplotobjects.pas
字号:
{*******************************************************}
{ }
{ iPlotObjects }
{ }
{ Copyright (c) 1997,2003 Iocomp Software }
{ }
{*******************************************************}
{$I iInclude.inc}
{$ifdef iVCL}unit iPlotObjects;{$endif}
{$ifdef iCLX}unit QiPlotObjects;{$endif}
interface
uses
{$I iIncludeUses.inc}
{$IFDEF iVCL} Menus, iTypes;{$ENDIF}
{$IFDEF iCLX} QMenus, QiTypes;{$ENDIF}
type
TiPlotMouseData = record
X : Integer;
Y : Integer;
ScreenX : Integer;
ScreenY : Integer;
XAxisPixels : Integer;
YAxisPixels : Integer;
Shift : TShiftState;
Button : TMouseButton;
DblClickActive : Boolean;
end;
TiMenuItem = class(TMenuItem)
public
AString : String;
end;
TiHintData = record
Text : String;
Top : Integer;
Left : Integer;
Visible : Boolean;
end;
TiPlotRectObject = class(TObject)
public
ARect : TRect;
end;
TPlotMousePointerEvent = procedure(ACursor : TCursor) of object;
TiPlotTranslationObject = class(TPersistent)
private
FOriginalString : String;
FReplacementString : String;
public
property OriginalString : String read FOriginalString write FOriginalString;
property ReplacementString : String read FReplacementString write FReplacementString;
end;
TiPlotObject = class(TPersistent)
private
FName : String;
FNameOld : String;
FOwner : TObject;
FShiftState : TShiftState;
FOnChange : TNotifyEvent;
FOnLayoutChange : TNotifyEvent;
FOnRemove : TNotifyEvent;
FOnInsert : TNotifyEvent;
FOnRename : TNotifyEvent;
FOnSetFocus : TNotifyEvent;
FOnEdit : TNotifyEvent;
FOnInvalidateNow : TNotifyEvent;
FVisible : Boolean;
FEnabled : Boolean;
FLayer : Integer;
FPopupEnabled : Boolean;
FUserSelected : Boolean;
FUserCanEdit : Boolean;
FXYAxesReversed : Boolean;
FCanDraw : Boolean;
FMouseOverObject : TiPlotObject;
FMouseDown : Boolean;
protected
function GetLayerString: String;
procedure SetVisible (const Value: Boolean); virtual;
procedure SetLayer (const Value: Integer);
procedure SetEnabled (const Value: Boolean); virtual;
procedure SetXYAxesReversed(const Value: Boolean); virtual;
procedure SetUserSelected (const Value: Boolean);
procedure SetName (const Value: String);
procedure SetUserCanEdit (const Value: Boolean);
procedure SetShiftState (const Value: TShiftState);
procedure SetPopupEnabled (const Value: Boolean);
procedure TriggerChange (Sender : TObject); virtual;
procedure TriggerRename (Sender : TObject);
procedure TriggerLayoutChange (Sender : TObject); virtual;
procedure TriggerInvalidateNow(Sender : TObject);
procedure TriggerSetFocus (Sender : TObject);
procedure SetBooleanProperty(Value : Boolean; var FVariable : Boolean; EventHandler : TNotifyEvent);
procedure SetIntegerProperty(Value : Integer; var FVariable : Integer; EventHandler : TNotifyEvent);
procedure SetDoubleProperty (Value : Double; var FVariable : Double; EventHandler : TNotifyEvent);
procedure SetStringProperty (Value : String; var FVariable : String; EventHandler : TNotifyEvent);
procedure SetColorProperty (Value : TColor; var FVariable : TColor; EventHandler : TNotifyEvent);
procedure NotificationRemove (Sender : TObject); virtual;
procedure NotificationRename (Sender : TObject); virtual;
procedure NotificationSetFocus(Sender : TObject); virtual;
procedure DrawSetup(const Canvas: TCanvas); virtual;
procedure Draw(const Canvas: TCanvas; const BackGroundColor: TColor); virtual;
procedure iMouseDown (Button: TMouseButton; Shift: TShiftState; X, Y, ScreenX, ScreenY: Integer; PopupMenu : TPopupMenu); virtual;
procedure iMouseMove (var HintData: TiHintData; Shift: TShiftState; X, Y, ScreenX, ScreenY: Integer; DblClickActive: Boolean);virtual;
procedure iMouseUp (Button: TMouseButton; Shift: TShiftState; X, Y, ScreenX, ScreenY: Integer; DblClickActive: Boolean);virtual;
function iMouseHitTest(MouseData: TiPlotMouseData): Boolean; virtual;
function iMouseWheel (WheelDelta: Integer; Shift: TShiftState; const MousePos: TPoint): Boolean; virtual;
procedure CalcAxisPixels(X, Y: Integer; var XAxisPixels, YAxisPixels: Integer);
procedure DoMouseHint (MouseData: TiPlotMouseData; var HintData: TiHintData); virtual;
procedure DoMouseLeft (MouseData: TiPlotMouseData); virtual;
procedure DoMouseMove (MouseData: TiPlotMouseData); virtual;
procedure DoMouseUp (MouseData: TiPlotMouseData); virtual;
procedure DoMouseDoubleClick(MouseData: TiPlotMouseData); virtual;
procedure DoSetFocus; virtual;
procedure DoLostFocus; virtual;
procedure DoMouseNotOver; virtual;
function GetMouseObject(X, Y: Integer): TiPlotObject; virtual;
function GetMousePointer(APoint: TPoint) : TCursor; virtual;
function GetTranslation(Value: String): String;
procedure iKeyDown (var CharCode: Word; Shift: TShiftState); virtual;
procedure Loaded; virtual;
procedure EditMenuItemClick(Sender : TObject);
procedure AddMenuItems (PopupMenu: TPopUpMenu); virtual;
procedure AddEditMenuItems(PopupMenu: TPopUpMenu);
property Owner : TObject read FOwner;
property MouseOverObject : TiPlotObject read FMouseOverObject write FMouseOverObject;
property NameOld : String read FNameOld;
property OnEdit : TNotifyEvent read FOnEdit write FOnEdit;
property OnLayoutChange : TNotifyEvent read FOnLayoutChange write FOnLayoutChange;
property OnInvalidateNow : TNotifyEvent read FOnInvalidateNow write FOnInvalidateNow;
property OnSetFocus : TNotifyEvent read FOnSetFocus write FOnSetFocus;
property OnRemove : TNotifyEvent read FOnRemove write FOnRemove;
property OnChange : TNotifyEvent read FOnChange write FOnChange;
property XYAxesReversed : Boolean read FXYAxesReversed write SetXYAxesReversed;
property MouseDown : Boolean read FMouseDown;
property Shift : TShiftState read FShiftState;
property CanDraw : Boolean read FCanDraw write FCanDraw;
property LayerString : String read GetLayerString;
public
constructor Create(AOwner: TObject; AOnChange, AOnInsert, AOnRemove, AOnRename: TNotifyEvent); virtual;
destructor Destroy; override;
function HitTest(X, Y: Integer): Boolean;
property UserSelected : Boolean read FUserSelected write SetUserSelected;
property UserCanEdit : Boolean read FUserCanEdit write SetUserCanEdit;
published
property Name : String read FName write SetName;
property Visible : Boolean read FVisible write SetVisible default True;
property Enabled : Boolean read FEnabled write SetEnabled default True;
property Layer : Integer read FLayer write SetLayer default 100;
property PopupEnabled : Boolean read FPopupEnabled write SetPopupEnabled default True;
end;
TiPlotManagerObject = class(TiPlotObject)
public
constructor Create(AOwner: TObject; AOnChange, AOnInsert, AOnRemove, AOnRename: TNotifyEvent); override;
end;
TiPlotLayoutObject = class(TiPlotManagerObject)
private
FStopPercent : Double;
FStartPercent : Double;
FZOrder : Integer;
FHorizontal : Boolean;
FReverseSide : Boolean;
FBottom : Integer;
FLeft : Integer;
FTop : Integer;
FRight : Integer;
FStartStacked : Boolean;
FStopStacked : Boolean;
FLayoutBottom : Integer;
FLayoutLeft : Integer;
FLayoutTop : Integer;
FLayoutRight : Integer;
FForceStacking : Boolean;
protected
procedure SetHorizontal (const Value: Boolean);
procedure SetReverseSide (const Value: Boolean);
procedure SetStartPercent (const Value: Double);
procedure SetStopPercent (const Value: Double);
procedure SetZOrder (const Value: Integer);
procedure SetBottom (const Value: Integer);
procedure SetLeft (const Value: Integer);
procedure SetRight (const Value: Integer);
procedure SetTop (const Value: Integer);
procedure SetDrawRect (const Value: TRect);
procedure SetLayoutRect (const Value: TRect);
procedure SetStartStacked (const Value: Boolean);
procedure SetStopStacked (const Value: Boolean);
procedure SetForceStacking(const Value: Boolean);
function GetDrawRect : TRect;
function GetLayoutRect : TRect;
function GetIsHorz : Boolean; virtual;
function GetIsVert : Boolean; virtual;
function GetHeight : Integer;
function GetWidth : Integer;
function GetLayoutHeight : Integer;
function GetLayoutWidth : Integer;
function GetZOrderString : String;
function GetStartPercentString : String;
function GetRequiredWidth (const Canvas : TCanvas): Integer; virtual;
function GetRequiredLengthGaurd(const Canvas : TCanvas): Integer; virtual;
function iMouseHitTest(MouseData: TiPlotMouseData): Boolean; override;
procedure Loaded; override;
procedure SetStartStopPercent(const Start : Double; const Stop : Double);
property Left : Integer read FLeft write SetLeft;
property Top : Integer read FTop write SetTop;
property Right : Integer read FRight write SetRight;
property Bottom : Integer read FBottom write SetBottom;
property LayoutLeft : Integer read FLayoutLeft write FLayoutLeft;
property LayoutTop : Integer read FLayoutTop write FLayoutTop;
property LayoutRight : Integer read FLayoutRight write FLayoutRight;
property LayoutBottom : Integer read FLayoutBottom write FLayoutBottom;
property StartStacked : Boolean read FStartStacked write SetStartStacked;
property StopStacked : Boolean read FStopStacked write SetStopStacked;
property ReverseSide : Boolean read FReverseSide write SetReverseSide;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -