?? hwextjvinspdata.pas
字號:
unit hwExtJvInspData;
{ 本單元擴展JvInspector,用于顯示公式對象和用戶表達式對象等 }
interface
uses
SysUtils, Classes, TypInfo, Messages, JvInspector, Dialogs,
hwExpr, hwExprExt;
type
TJvStringData = class(TJvCustomInspectorData)
private
FValue: string;
Protected
procedure CreateChild(const AParent : TJvCustomInspectorItem); override;
function GetAsFloat: extended; override;
function GetAsInt64: int64; override;
function GetAsMethod: TMethod; override;
function GetAsOrdinal: int64; override;
function GetAsString: string; override;
procedure SetAsFloat(const Value : extended); override;
procedure SetAsInt64(const Value : int64); override;
procedure SetAsMethod(const Value : TMethod); override;
procedure SetAsOrdinal(const Value : int64); override;
procedure SetAsString(const Value : string); override;
Public
constructor Create(const AParent: TJvCustomInspectorItem;
const AName: string;
const AValue: String);
function HasValue: boolean; override;
function IsAssigned: boolean; override;
function IsInitialized: boolean; override;
procedure GetAsSet(var Buf); override;
procedure SetAsSet(const Buf); override;
end;
{ ExtFunctionDeclare data }
TJvDataForExtFuncDeclare = class(TJvCustomInspectorData)
Private
FEFD: TExtFunctionDeclare;
Protected
procedure CreateChild(const AParent : TJvCustomInspectorItem); override;
function GetAsFloat: extended; override;
function GetAsInt64: int64; override;
function GetAsMethod: TMethod; override;
function GetAsOrdinal: int64; override;
function GetAsString: string; override;
procedure SetAsFloat(const Value : extended); override;
procedure SetAsInt64(const Value : int64); override;
procedure SetAsMethod(const Value : TMethod); override;
procedure SetAsOrdinal(const Value : int64); override;
procedure SetAsString(const Value : string); override;
Public
class procedure Create(const ExtFuncDeclare: TExtFunctionDeclare;
const AParent: TJvCustomInspectorItem); overload;
constructor Create(const AParent: TJvCustomInspectorItem;
const ExtFuncDeclare: TExtFunctionDeclare;
const PropName: string;
const ATypeInfo: PTypeInfo); overload;
procedure GetAsSet(var Buf); override;
function HasValue: boolean; override;
function IsAssigned: boolean; override;
function IsInitialized: boolean; override;
procedure SetAsSet(const Buf); override;
end;
TJvDataForExprFunc = class(TJvCustomInspectorData)
end;
TJvDataForIValue = class(TJvCustomInspectorData)
end;
implementation
{ ============================================================================
>>>> Class Implementation Begin <<<<
>>>> Class Name : TJvStringData
>>>> Description :
>>>> Create Date :
---------------------------------------------------------------------------- }
constructor TJvStringData.Create(const AParent: TJvCustomInspectorItem;
const AName: string; const AValue: string);
begin
inherited Create(AName, system.TypeInfo(String), AParent);
FValue := AValue;
Init(AName, System.TypeInfo(String));
CreateChild(AParent);
end;
function TJvStringData.HasValue: Boolean;
begin
Result := True;
end;
function TJvStringData.IsAssigned: Boolean;
begin
Result := HasValue;
end;
function TJvStringData.IsInitialized: Boolean;
begin
Result := HasValue;
end;
procedure TJvStringData.CreateChild(const AParent: TJvCustomInspectorItem);
begin
SetItem(TJvInspectorStringItem.Create(AParent, Self));
end;
function TJvStringData.GetAsFloat: Extended;
begin
end;
function TJvStringData.GetAsInt64: Int64;
begin
end;
function TJvStringData.GetAsMethod: TMethod;
begin
end;
function TJvStringData.GetAsOrdinal: Int64;
begin
end;
function TJvStringData.GetAsString: string;
begin
Result := FValue;
end;
procedure TJvStringData.SetAsString(const Value: String);
begin
FValue := Value;
end;
procedure TJvStringData.SetAsFloat(const Value: Extended);
begin
end;
procedure TJvStringData.SetAsInt64(const Value: Int64);
begin
end;
procedure TJvStringData.SetAsMethod(const Value: TMethod);
begin
end;
procedure TJvStringData.SetAsOrdinal(const Value: Int64);
begin
end;
procedure TJvStringData.GetAsSet(var Buf);
begin
end;
procedure TJvStringData.SetAsSet(const Buf);
begin
end;
{ ============================================================================
>>>> Class Implementation Begin <<<<
>>>> Class Name : TJvDataForExtFuncDeclare
>>>> Description :
>>>> Create Date :
---------------------------------------------------------------------------- }
constructor TJvDataForExtFuncDeclare.Create
(const AParent: TJvCustomInspectorItem;
const ExtFuncDeclare: TExtFunctionDeclare;
const PropName: string;
const ATypeInfo: PTypeInfo);
begin
Inherited Create;
FEFD := ExtFuncDeclare;
Init(PropName, ATypeInfo);
CreateChild(Aparent);
end;
class procedure TJvDataForExtFuncDeclare.Create
(const ExtFuncDeclare: TExtFunctionDeclare;
const AParent: TJvCustomInspectorItem);
var inspCat: TJvInspectorCustomCategoryItem;
i : Integer;
paramData: TJvStringData;
begin
if ExtFuncDeclare = nil then
raise EJvInspectorData.Create('沒有公式定義對象。笨蛋,你的程序是怎么寫的?');
{ 根據公式定義對象逐一顯示其屬性 }
{ 函數名 }
Create(AParent, ExtFuncDeclare, '函數名', System.TypeInfo(string));
Create(AParent, ExtFuncDeclare, '返回值類型', System.TypeInfo(String));
inspCat := TJvInspectorCustomCategoryItem.Create(AParent, nil);
inspCat.DisplayName := '參數表(' + IntToStr(ExtFuncDeclare.ParamsCount) + ')';
if ExtFuncDeclare.ParamsCount > 0 then
for i := 0 to ExtFuncDeclare.ParamsCount -1 do
begin
TJvInspectorVarData.Create(ExtFuncDeclare.ParamsName[i], system.TypeInfo(String),
InspCat, ExprTypeName[ExtFuncDeclare.ParamsType[i]]);
end;
end;
function TJvDataForExtFuncDeclare.HasValue: Boolean;
begin
if FEFD <> nil then Result := True;
end;
function TJvDataForExtFuncDeclare.IsAssigned: Boolean;
begin
Result := HasValue;
end;
function TJvDataForExtFuncDeclare.IsInitialized: Boolean;
begin
result := HasValue;
end;
procedure TJvDataForExtFuncDeclare.CreateChild(const AParent: TJvCustomInspectorItem);
begin
if Name = '函數名' then
SetItem(TJvInspectorStringItem.Create(AParent, Self))
else if Name = '返回值類型' then
SetItem(TJvInspectorStringItem.Create(AParent, Self));
end;
function TJvDataForExtFuncDeclare.GetAsFloat: Extended;
begin
end;
procedure TJvDataForExtFuncDeclare.SetAsFloat(const Value: Extended);
begin
end;
function TJvDataForExtFuncDeclare.GetAsInt64: Int64;
begin
end;
procedure TJvDataForExtFuncDeclare.SetAsInt64(const Value: Int64);
begin
end; //
function TJvDataForExtFuncDeclare.GetAsMethod: TMethod;
begin
end; //
procedure TJvDataForExtFuncDeclare.SetAsMethod(const Value: TMethod);
begin
end; //
function TJvDataForExtFuncDeclare.GetAsOrdinal: Int64;
begin
end;
procedure TJvDataForExtFuncDeclare.SetAsOrdinal(const Value: Int64);
begin
end; //
function TJvDataForExtFuncDeclare.GetAsString: string;
begin
if Name = '函數名' then Result := FEFD.FunctionName
else if Name = '返回值類型' then Result := ExprTypeName[FEFD.ResultType];
end;
procedure TJvDataForExtFuncDeclare.SetAsString(const Value: string);
begin
end;
procedure TJvDataForExtFuncDeclare.GetAsSet(var Buf);
begin
end;
procedure TJvDataForExtFuncDeclare.SetAsSet(const Buf);
begin
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -