⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 teetree.pas

📁 TeeChart 7.0 With Source在Delphi 7.0中的安装
💻 PAS
📖 第 1 页 / 共 5 页
字号:
    Function YPosition(ANode:TTreeNodeShape; ABrotherIndex:Integer):Integer; virtual; abstract;
  end;

  // Default ChildManager.
  // Very similar to Windows Explorer tree style.
  TTreeExplorerAlignChild=class(TChildManager)
  private
    FCrossMargin : Integer;
    FHorizMargin : Integer;
    FTopPos      : Integer;
    FVertMargin  : Integer;
  protected
    ArrowToAngle: Integer;
    Function AnyRootShouldDrawCross(Tree:TCustomTree):Boolean;
  public
    Constructor Create;

    Function CalcXYCross(ANode,AParent:TTreeNodeShape):TPoint; override;
    Function DrawConnection(AConnection:TTreeConnection):Boolean; override;
    Function XPosition(ANode:TTreeNodeShape):Integer; override;
    Function YPosition(ANode:TTreeNodeShape; ABrotherIndex:Integer):Integer; override;

    property HorizMargin:Integer read FHorizMargin write FHorizMargin
                                 default TreeHorizMarginDefault;
    property TopPos:Integer read FTopPos write FTopPos default TeeTree_DefaultYPosition;
    property VertMargin:Integer read FVertMargin write FVertMargin
                                 default TreeVertMarginDefault;
    property CrossMargin:Integer read FCrossMargin write FCrossMargin
                                 default TeeCrossBoxHorizMargin;
  end;

  TTeeHotTrackFont=class(TTeeFont)
  published
    property Style default [fsUnderline];
  end;

  // TCustomTree HotTrack class.
  TTreeHotTrack=class(TPersistent)
  private
    FActive    : Boolean;
    FBorder    : TTreePen;
    FFont      : TTeeHotTrackFont;
    FHotLink   : Boolean;
    FUseBorder : Boolean;
    FUseFont   : Boolean;

    ITree   : TCustomTree;
    procedure SetActive(const Value: Boolean);
    procedure SetBorder(const Value: TTreePen);
    procedure SetFont(const Value: TTeeHotTrackFont);
  public
    Constructor Create(ATree:TCustomTree);
    Destructor Destroy; override;

    Procedure Assign(Source:TPersistent); override;
  published
    property Active:Boolean read FActive write SetActive default False;
    property Border:TTreePen read FBorder write SetBorder;
    property Font:TTeeHotTrackFont read FFont write SetFont;
    property HotLink:Boolean read FHotLink write FHotLink default True;
    property UseBorder:Boolean read FUseBorder write FUseBorder default False;
    property UseFont:Boolean read FUseFont write FUseFont default False;
  end;

  // Event signature for "OnStartEditing" Tree event
  TNotifyShapeEventStartEdit=procedure(Shape:TTreeNodeShape;
                                       Var AllowEditing:Boolean) of object;

  TDragDropShapeEvent=procedure(Sender:TCustomTree; Dragged,Parent:TTreeNodeShape)
                                               of object;

  // Global record with formatting objects global to all nodes of a Tree...
  TTreeGlobal=packed record
     Border       : TTreePen;           // default node Border
     Brush        : TTreeShapeBrush;    // default node Brush
     Connection   : TTreeConnection;    // default Connection
     Cursor       : TCursor;            // default node Cursor
     Font         : TTeeFont;           // default node Font
     ShowCross    : TTreeNodeShapeShowCross;  // default node ShowCross
     ImageIndex   : TTreeNodeImageIndex;      // default node ImageIndex
     Transparent  : Boolean;                  // default node Transparent
     ChildManager : TChildManager;            // default ChildManager class
     NodeClass    : TTreeNodeShapeClass;      // default node class.
     ConnectionClass: TTreeConnectionClass;   // default connection class.
  end;

  // Pen with default Silver color. Used in Tree1.Grid
  TGridPen=class(TChartHiddenPen)
  published
    property Color default clSilver;
  end;

  // Pen with default Gray color. Used in Tree1.Grid
  TGridBigPen=class(TChartHiddenPen)
  published
    property Color default clGray;
  end;

  // Displays a grid.
  TTreeGrid=class(TPersistent)
  private
    FBigPen    : TGridBigPen;  { hidden, clGray color }
    FBigStep   : Integer;  { 10 times FStep }
    FColor     : TColor;   { clGray }
    FPen       : TGridPen; { hidden, clSilver color }
    FHorizStep : Integer;  { 10 pixels }
    FVertStep  : Integer;  { 10 pixels }
    FVisible   : Boolean;

    ITree    : TCustomTree;
    procedure SetBigPen(const Value: TGridBigPen);
    procedure SetBigStep(const Value: Integer);
    procedure SetColor(const Value: TColor);
    procedure SetHorizStep(const Value: Integer);
    procedure SetPen(const Value: TGridPen);
    procedure SetStep(const Value: Integer);
    procedure SetVertStep(const Value: Integer);
    procedure SetVisible(const Value: Boolean);
  public
    Constructor Create(ATree:TCustomTree);
    Destructor Destroy; override;

    Procedure Assign(Source:TPersistent); override;
    property HorizStep:Integer read FHorizStep write SetHorizStep default TeeDefaultGridStep;
  published
    property BigPen:TGridBigPen read FBigPen write SetBigPen;
    property BigStep:Integer read FBigStep write SetBigStep default 10;
    property Color:TColor read FColor write SetColor default clGray;
    property Pen:TGridPen read FPen write SetPen;
    property Step:Integer read FHorizStep write SetStep default TeeDefaultGridStep;
    property VertStep:Integer read FVertStep write SetVertStep default TeeDefaultGridStep;
    property Visible:Boolean read FVisible write SetVisible default False;
  end;

  // Dark Gray pen used to display Tree Page boundaries.
  TTreePageBorder=class(TTreePen)
  private
    FPrint : Boolean;
  published
    property Color default clDkGray;
    property Print:Boolean read FPrint write FPrint default False;
  end;

  // Contains properties to determine the Tree Page size.
  TTreePage=class(TPersistent)
  private
    FBorder     : TTreePageBorder;
    FCount      : Integer;
    FHeight     : Integer;
    FPage       : Integer;
    FUsePrinter : Boolean;
    FWidth      : Integer;

    ITree   : TCustomTree;
    Function IsStored:Boolean;
    function InternalGetCount: Integer;
    function GetCount: Integer;
    function GetHeight: Integer;
    function GetWidth: Integer;
    procedure SetBorder(const Value: TTreePageBorder);
    procedure SetHeight(const Value: Integer);
    procedure SetPage(const Value: Integer);
    procedure SetUsePrinter(const Value: Boolean);
    procedure SetWidth(const Value: Integer);
  public
    Constructor Create(ATree:TCustomTree);
    Destructor Destroy; override;

    Procedure Assign(Source:TPersistent); override;
    procedure Refresh; //tom:24/09/2002
    property Count:Integer read GetCount;
    Procedure DrawBorder;
    property Page:Integer read FPage write SetPage default 1;
  published
    property Border:TTreePageBorder read FBorder write SetBorder;
    property Height:Integer read GetHeight write SetHeight stored IsStored;
    property Width:Integer read GetWidth write SetWidth stored IsStored;
    property UsePrinter:Boolean read FUsePrinter write SetUsePrinter default True;
  end;

  // Default base class for "custom" node shapes
  // See for example: TreeFlow.pas unit for examples of "custom" shapes.
  TCustomTreeShape=class(TTreeNodeShape)
  public
    Constructor Create(AOwner:TComponent); override;
  published
    property ImageIndex default tiNone;
    property Style default tssCustom;
  end;

  // Polygon shape.

  TPolygonShape=class;
  TPolygonShapeClass=class of TPolygonShape;

  // Collection item containing one point of a polygon shape.
  TPointItem=class(TCollectionItem)
  private
    FY: Integer;
    FX: Integer;
    procedure SetX(const Value: Integer);
    procedure SetY(const Value: Integer);
  public
    Procedure Assign(Source:TPersistent); override;

    function Shape:TPolygonShape;
  published
    property X:Integer read FX write SetX;
    property Y:Integer read FY write SetY;
  end;

  // Collection of Polygon shape points.
  TPointCollection=class(TOwnedCollection)
  private
    function GetPoint(Index:Integer): TPointItem;
    procedure SetPoint(Index:Integer; const Value: TPointItem);
  public
    Function Add:TPointItem;
    property Point[Index:Integer]:TPointItem read GetPoint write SetPoint; default;
  end;

  // Custom shape to create free drawing polygons
  TPolygonShape=class(TCustomTreeShape)
  private
    FPoints         : TPointCollection;
    FResizingHandle : Integer;

    IsPolyLine      : Boolean;
    Procedure InternalDraw(ACanvas:TCanvas3D; OffsetX,OffsetY:Integer);
    Procedure InternalDrawShadow( tmpR:TRect; ACanvas:TCanvas3D;
                                  tmpStyle:TTreeShapeStyle); override;
    procedure SetPoints(const Value: TPointCollection);
  protected
    Function GetHandleCursor(x,y:Integer):TCursor; override;
    Function GetShapePoints(Const R:TRect; Var P:TShapePoints):Integer; override;
    Procedure Loaded; override;
  public
    Constructor Create(AOwner: TComponent); override;
    Destructor Destroy; override;

    Procedure Assign(Source:TPersistent); override;

    Procedure Add(X,Y:Integer);
    Function ClickedPoint(x,y:Integer):Integer;
    Procedure DrawHandles; override;
    Procedure FillSample; { sample points to show at Editor toolbar }
    Function GetResizingHandle(x,y:Integer):TTreeShapeHandle; override;
    Procedure MoveRelative(OfsX,OfsY:Integer; MoveChilds:Boolean); override;
    Procedure RecalcSize(ACanvas:TCanvas3D); override;
    Procedure Resize(ACorner:TTreeShapeHandle; DeltaX,DeltaY:Integer); override;
  published
    property Points:TPointCollection read FPoints write SetPoints;
  end;

  // Custom shape to create free drawing poly-lines
  TPolyLineShape=class(TPolygonShape)
  public
    Constructor Create(AOwner: TComponent); override;
    Function Clicked(x,y:Integer):Boolean; override;
  end;

  // Custom shape that displays the node Image centered.
  TImageShape=class(TTreeNodeShape)
  public
    Constructor Create(AOwner: TComponent); override;
    Procedure RecalcSize(ACanvas:TCanvas3D); override;
  published
    property ImageIndex default tiMyPc;
    property ImageAlignment default iaCenter;
  end;

  // Simple shape to display Text only.
  // By default sets Transparent to True, Image to None and
  // hides Border.
  TTextShape=class(TTreeNodeShape)
  public
    Constructor Create(AOwner: TComponent); override;
  published
    property ImageIndex default tiNone;
    property Transparent default True;
  end;

  TNewPolygonEvent=procedure( Sender: TCustomTree;
                              APolygon:TPolygonShape) of object;

  TImageLevels=class;

  // Automatic Drag and drop options.
  TTreeDragDrop=class(TPersistent)
  private
    FAutomatic     : Boolean;
    FDragToRoot    : Boolean;
    FDragRoots     : Boolean;
    FFromOtherTree : Boolean;
    FRemove        : Boolean;
    FToOtherTree   : Boolean;
  public
    AutoScroll     : Boolean;

    Constructor Create;

    Procedure Assign(Source:TPersistent); override;
  published
    property Automatic:Boolean read FAutomatic write FAutomatic default False;
    property DragRoots:Boolean read FDragRoots write FDragRoots default True;
    property DragToRoot:Boolean read FDragToRoot write FDragToRoot default True;
    property FromOtherTree:Boolean read FFromOtherTree write FFromOtherTree default True;
    property RemoveNodes:Boolean read FRemove write FRemove default True;
    property ToOtherTree:Boolean read FToOtherTree write FToOtherTree default True;
  end;

  // Constants to determine when to show the Memo to edit a node's text.
  TTreeTextEditorMode=(
                        tteKey,   // when pressing the default key (F2)
  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -