📄 jvqinspector.pas
字号:
icfSortOwners, icfKeepFirstOwnerAsFirst);
TInspectorComponentFlags = set of TInspectorComponentFlag;
TInspectorCompoundItemFlag = (icifSingleName, icifSingleNameUseFirstCol);
TInspectorCompoundItemFlags = set of TInspectorCompoundItemFlag;
TInspectorTMethodFlag = (imfShowInstanceNames, imfNoShowFirstInstanceName, imfSortMethods,
imfSortInstances, imfKeepFirstInstanceAsFirst);
TInspectorTMethodFlags = set of TInspectorTMethodFlag;
TInspectorPaintRect = (iprItem, iprButtonArea, iprBtnSrcRect, iprBtnDstRect,
iprNameArea, iprName, iprValueArea, iprValue, iprEditValue, iprEditButton,
iprUser1, iprUser2, iprUser3, iprUser4, iprUser5, iprUser6);
TItemRowSizing = type Integer;
TInspectorItemSortKind = (iskNone, iskName, iskManual, iskCustom);
TJvInspectorItemClass = class of TJvCustomInspectorItem;
TJvInspectorDataClass = class of TJvCustomInspectorData;
TJvInspectorPainterClass = class of TJvInspectorPainter;
TJvInspectorItemInstances = array of TJvCustomInspectorItem;
TJvInspectorDataInstances = array of TJvCustomInspectorData;
// Don't use the const qualifier on events when compiling for BCB
// because this would lead to the generation of a parameter that is
// a non const pointer to a const object.
// Then this would trigger warnings about using non const methods on
// a const object when we modify the properties of the object.
// We would have liked to be able to generate a const pointer to a
// non const object (which is what the Delphi declaration is) but the
// HPP Generator is compeletely flawed in this area
TInspectorItemEvent = procedure(Sender: TObject; Item: TJvCustomInspectorItem) of object;
TInspectorItemBeforeCreateEvent = procedure(Sender: TObject; Data: TJvCustomInspectorData;
var ItemClass: TJvInspectorItemClass) of object;
TInspectorItemBeforeSelectEvent = procedure(Sender: TObject; NewItem: TJvCustomInspectorItem;
var Allow: Boolean) of object;
TInspectorDataEvent = procedure(Sender: TObject; Data: TJvCustomInspectorData) of object;
TInspectorItemGetValueListEvent = procedure(Item: TJvCustomInspectorItem; Values: TStrings) of object;
TInspectorItemSortCompare = function(Item1, Item2: TJvCustomInspectorItem): Integer of object;
TJvInspAsFloat = procedure(Sender: TJvInspectorEventData; var Value: Extended) of object;
TJvInspAsInt64 = procedure(Sender: TJvInspectorEventData; var Value: Int64) of object;
TJvInspAsMethod = procedure(Sender: TJvInspectorEventData; var Value: TMethod) of object;
TJvInspAsString = procedure(Sender: TJvInspectorEventData; var Value: string) of object;
TJvInspAsSet = procedure(Sender: TJvInspectorEventData; var Value; var BufSize: Integer) of object;
TJvInspSupportsMethodPointers = procedure(Sender: TJvInspectorEventData; var SupportsTMethod: Boolean) of object;
TJvInspConfSectionEvent = procedure(var SectionName: string; var Parse: Boolean) of object;
TJvInspConfKeyEvent = procedure(const SectionName: string; var ItemName: string; var ATypeInfo: PTypeInfo;
var Allow: Boolean) of object;
TInspectorValueErrorEvent = procedure(Sender: TObject; Item: TJvCustomInspectorItem;
ExceptObject: Exception) of object;
// new event types (sept 2004) -wp
TInspectorBeforeEditEvent = procedure(Sender: TObject; Item: TJvCustomInspectorItem; Edit: TOpenEdit) of object;
EJvInspector = class(EJVCLException);
EJvInspectorItem = class(EJvInspector);
EJvInspectorData = class(EJvInspector);
EJvInspectorReg = class(EJvInspector);
TOnJvInspectorSetItemColors = procedure(Item: TJvCustomInspectorItem; Canvas: TCanvas) of object;
TOnJvInspectorMouseDown = procedure(Sender: TJvCustomInspector; Item: TJvCustomInspectorItem;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer) of object;
TOnJvInspectorItemEdit = procedure(Sender: TJvCustomInspector;
Item: TJvCustomInspectorItem; var DisplayStr: string) of object;
TJvCustomInspector = class(TJvExCustomPanel)
private
FAfterDataCreate: TInspectorDataEvent;
FAfterItemCreate: TInspectorItemEvent;
FBandSizing: Boolean;
FBandSizingBand: Integer;
FBandStartsSB: TList;
FBandStartsNoSB: TList;
FBandWidth: Integer;
FBeforeItemCreate: TInspectorItemBeforeCreateEvent;
FBeforeSelection: TInspectorItemBeforeSelectEvent;
FCollapseButton: TBitmap;
FDivider: Integer;
FDraggingDivider: Boolean;
FDividerDragBandX: Integer;
FExpandButton: TBitmap;
FImageHeight: Integer;
FItemHeight: Integer;
FLockCount: Integer;
FNeedRebuild: Boolean;
FNeedRedraw: Boolean;
FSortNotificationList: TList;
FOnDataValueChanged: TInspectorDataEvent;
FOnItemSelected: TNotifyEvent;
FOnItemValueChanged: TInspectorItemEvent;
FPainter: TJvInspectorPainter;
FPaintGen: Integer;
FReadOnly: Boolean;
FRelativeDivider: Boolean;
FRoot: TJvCustomInspectorItem;
FRowSizing: Boolean;
FRowSizingItem: TJvCustomInspectorItem;
FSelectedIndex: Integer;
FSelecting: Boolean;
FTopIndex: Integer;
FUseBands: Boolean;
FVisibleList: TStringList;
FAutoComplete: Boolean;
FAutoDropDown: Boolean; // depends on AutoComplete
FHorzScrollBar: TScrollBar;
FVertScrollBar: TScrollBar;
FOnEditorContextPopup: TContextPopupEvent;
FOnEditorKeyDown: TKeyEvent;
FOnEditorKeyPress: TKeyPressEvent;
FOnEditorKeyUp: TKeyEvent;
FOnEditorMouseDown: TOnJvInspectorMouseDown;
FOnItemEdit: TOnJvInspectorItemEdit; // User clicks Ellipsis button.
FOnItemValueError: TInspectorValueErrorEvent;
FInspectObject: TObject;
// BeforeEdit NOTE: - WAP
//
// This event fired is when creating TEdit or TMemo objects, and
// allows end users to customize the properties of the editor
// objects, or hook event handlers, which were
// otherwise invisible. This could be used to ill effect, so beware.
// We already expose some critical events in a nicer way,
// so only use BeforeEdit as a last-resort. Instead consider using:
// BeforeSelection if you want to prevent the editing from ocurring,
// or if you need to handle mouse and keyboard events in the editor
// use one of these:
// OnEditorKeyDown, OnEditorKeyUp,
// OnEditorKeyPress, OnEditorMouseDown,
// OnEditorContextPopup.etc.
// Also, If you want the event that occurs when the user clicks the ellipsis
// button, you want OnItemEdit, not BeforeEdit.
FBeforeEdit: TInspectorBeforeEditEvent;
procedure SetInspectObject(const Value: TObject);
// FOnMouseDown: TInspectorMouseDownEvent;
// ClientWidth and ClientHeight replaces the inherited properties by
// methods that adjusts the client width and height by AdjustClientRect
function ClientWidth: Integer;
function ClientHeight: Integer;
protected
function CalcImageHeight: Integer; virtual;
function CalcItemIndex(X, Y: Integer; var Rect: TRect): Integer; virtual;
function CalcItemRect(const Item: TJvCustomInspectorItem): TRect; virtual;
procedure CMActivate(var Msg: TCMActivate); message CM_ACTIVATE;
procedure CMDeactivate(var Msg: TCMActivate); message CM_DEACTIVATE;
procedure DoAfterDataCreate(const Data: TJvCustomInspectorData); virtual;
procedure DoAfterItemCreate(const Item: TJvCustomInspectorItem); virtual;
procedure DoBeforeItemCreate(const Data: TJvCustomInspectorData;
var ItemClass: TJvInspectorItemClass); virtual;
function DoBeforeItemSelect(const NewItem: TJvCustomInspectorItem): Boolean; virtual;
procedure DoDataValueChanged(const Data: TJvCustomInspectorData); virtual;
procedure DoItemSelected; virtual;
procedure DoItemValueChanged(const Item: TJvCustomInspectorItem); virtual;
function DoItemValueError(Item: TJvCustomInspectorItem): Boolean; virtual;
function GetAfterDataCreate: TInspectorDataEvent; virtual;
function GetAfterItemCreate: TInspectorItemEvent; virtual;
function GetBandFor(const ItemIdx: Integer): Integer; virtual;
function GetBandStarts: TList; virtual;
function GetBandWidth: Integer; virtual;
function GetBeforeItemCreate: TInspectorItemBeforeCreateEvent; virtual;
function GetBeforeSelection: TInspectorItemBeforeSelectEvent; virtual;
function GetButtonRect(const ItemIndex: Integer): TRect; virtual;
function GetCollapseButton: TBitmap; virtual;
function GetDivider: Integer; virtual;
function GetDividerAbs: Integer; virtual;
function GetExpandButton: TBitmap; virtual;
function GetImageHeight: Integer; virtual;
function GetItemHeight: Integer; virtual;
function GetLastFullVisible: Integer; virtual;
function GetLockCount: Integer; virtual;
function GetOnItemSelected: TNotifyEvent; virtual;
function GetPainter: TJvInspectorPainter; virtual;
function GetReadOnly: Boolean; virtual;
function GetRelativeDivider: Boolean; virtual;
function GetRoot: TJvCustomInspectorItem; virtual;
function GetSelected: TJvCustomInspectorItem; virtual;
function GetSelectedIndex: Integer; virtual;
function GetTopIndex: Integer; virtual;
function GetUseBands: Boolean; virtual;
function GetVisibleCount: Integer; virtual;
function GetVisibleItems(const I: Integer): TJvCustomInspectorItem; virtual;
function GetWantTabs: Boolean; virtual;
procedure HandleBandResize(X: Integer); virtual;
function IdxToY(const Index: Integer): Integer; virtual;
procedure IncPaintGeneration; virtual;
procedure InvalidateHeight; virtual;
procedure InvalidateItem; virtual;
procedure InvalidateList; virtual;
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
procedure KeyUp(var Key: Word; Shift: TShiftState); override;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure NotifySort(const Item: TJvCustomInspectorItem); virtual;
procedure Paint; override;
procedure RebuildVisible; virtual;
procedure RemoveNotifySort(const Item: TJvCustomInspectorItem); virtual;
procedure RemoveVisible(const Item: TJvCustomInspectorItem); virtual;
procedure BoundsChanged; override;
function ScrollFactorV: Extended; virtual;
procedure SetAfterDataCreate(const Value: TInspectorDataEvent); virtual;
procedure SetAfterItemCreate(const Value: TInspectorItemEvent); virtual;
procedure SetBandWidth(Value: Integer); virtual;
procedure SetBeforeItemCreate(const Value: TInspectorItemBeforeCreateEvent); virtual;
procedure SetBeforeSelection(const Value: TInspectorItemBeforeSelectEvent); virtual;
procedure SetCollapseButton(const Value: TBitmap); virtual;
procedure SetDivider(Value: Integer); virtual;
procedure SetDividerAbs(Value: Integer); virtual;
procedure SetExpandButton(const Value: TBitmap); virtual;
procedure SetItemHeight(Value: Integer); virtual;
procedure SetLockCount(const Value: Integer); virtual;
procedure SetOnItemSelected(const Value: TNotifyEvent); virtual;
procedure SetPainter(const Value: TJvInspectorPainter); virtual;
procedure SetReadOnly(const Value: Boolean); virtual;
procedure SetRelativeDivider(Value: Boolean); virtual;
procedure SetSelected(const Value: TJvCustomInspectorItem); virtual;
procedure SetSelectedIndex(Value: Integer); virtual;
procedure SetTopIndex(Value: Integer); virtual;
procedure SetUseBands(Value: Boolean); virtual;
procedure SetWantTabs(Value: Boolean); virtual;
procedure UpdateScrollBars; virtual;
function ViewHeight: Integer;
function ViewRect: TRect; virtual;
function ViewWidth: Integer;
procedure WMHScroll(var Msg: TWMScroll); message WM_HSCROLL;
procedure WMVScroll(var Msg: TWMScroll); message WM_VSCROLL;
procedure DoKillFocus(Focused: HWND); override;
procedure Scrolled(Sender: TObject; ScrollCode: TScrollCode;
var ScrollPos: Integer); dynamic;
procedure AdjustClientRect(var Rect: TRect); override;
function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; const MousePos: TPoint): Boolean; override;
procedure ShowScrollBars(Bar: Integer; Visible: Boolean); virtual;
function YToIdx(const Y: Integer): Integer; virtual;
property AutoComplete: Boolean read FAutoComplete write FAutoComplete;
property AutoDropDown: Boolean read FAutoDropDown write FAutoDropDown;
property BandSizing: Boolean read FBandSizing write FBandSizing;
property BandSizingBand: Integer read FBandSizingBand write FBandSizingBand;
property BandStarts: TList read GetBandStarts;
property BandWidth: Integer read GetBandWidth write SetBandWidth;
property CollapseButton: TBitmap read GetCollapseButton write SetCollapseButton;
property ExpandButton: TBitmap read GetExpandButton write SetExpandButton;
property Divider: Integer read GetDivider write SetDivider;
property DividerAbs: Integer read GetDividerAbs write SetDividerAbs;
property DraggingDivider: Boolean read FDraggingDivider write FDraggingDivider;
property DividerDragBandX: Integer read FDividerDragBandX write FDividerDragBandX;
property ItemHeight: Integer read GetItemHeight write SetItemHeight;
property ImageHeight: Integer read GetImageHeight;
property LockCount: Integer read GetLockCount;
property NeedRebuild: Boolean read FNeedRebuild write FNeedRebuild;
property NeedRedraw: Boolean read FNeedRedraw write FNeedRedraw;
property SortNotificationList: TList read FSortNotificationList;
property OnDataValueChanged: TInspectorDataEvent read FOnDataValueChanged write FOnDataValueChanged;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -