Added wxTreeLayout for wxWindows 2.0
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@232 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
BIN
utils/wxtree/docs/back.gif
Normal file
After Width: | Height: | Size: 225 B |
BIN
utils/wxtree/docs/books.gif
Normal file
After Width: | Height: | Size: 433 B |
304
utils/wxtree/docs/classes.tex
Normal file
@@ -0,0 +1,304 @@
|
||||
\chapter{wxTreeLayout Class Reference}
|
||||
\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}%
|
||||
\setfooter{\thepage}{}{}{}{}{\thepage}
|
||||
|
||||
\section{\class{wxTreeLayout}}\label{wxtreelayout}
|
||||
|
||||
This abstract class is used for drawing a tree. You must derive a new
|
||||
class from this, and define member functions to access the data that
|
||||
wxTreeLayout needs.
|
||||
|
||||
Nodes are identified by long integer identifiers. The derived class
|
||||
communicates the actual tree structure to wxTreeLayout by defining \helprefn{wxTreeLayout::GetChildren}{getchildren}\rtfsp
|
||||
and \helprefn{wxTreeLayout::GetNodeParent}{getnodeparent} functions.
|
||||
|
||||
The application should call \helprefn{DoLayout}{dolayout} to do the tree
|
||||
layout. Depending on how the derived class has been defined, either
|
||||
\rtfsp\helprefn{wxTreeLayout::Draw}{draw} must be called (for example by the OnPaint member
|
||||
of a wxScrolledWindow) or the application-defined drawing code should be called
|
||||
as normal.
|
||||
|
||||
For example, if you have an image drawing system already defined, you
|
||||
may want wxTreeLayout to position existing node images in that system. So you
|
||||
just need a way for wxTreeLayout to set the node image positions according to
|
||||
the layout algorithm, and the rest will be done by your own image drawing
|
||||
system.
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
wxObject
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
\membersection{wxTreeLayout::wxTreeLayout}
|
||||
|
||||
\func{}{wxTreeLayout}{\void}
|
||||
|
||||
Constructor.
|
||||
|
||||
\membersection{wxTreeLayout::ActivateNode}\label{activatenode}
|
||||
|
||||
\func{void}{ActivateNode}{\param{long}{ id}, \param{bool }{active}}
|
||||
|
||||
Define this so wxTreeLayout can turn nodes on and off for drawing purposes
|
||||
(not all nodes may be connected in the tree). See also \helprefn{NodeActive}{nodeactive}.
|
||||
|
||||
\membersection{wxTreeLayout::CalcLayout}
|
||||
|
||||
\func{void}{CalcLayout}{\param{long}{ id}, \param{int}{ level}}
|
||||
|
||||
Private function for laying out a branch.
|
||||
|
||||
\membersection{wxTreeLayout::DoLayout}\label{dolayout}
|
||||
|
||||
\func{void}{DoLayout}{\param{wxDC\&}{ dc}, \param{long}{ topNode = -1}}
|
||||
|
||||
Calculates the layout for the tree, optionally specifying the top node.
|
||||
|
||||
\membersection{wxTreeLayout::Draw}\label{draw}
|
||||
|
||||
\func{void}{Draw}{\param{wxDC\&}{ dc}}
|
||||
|
||||
Call this to let wxTreeLayout draw the tree itself, once the layout has been
|
||||
calculated with \helprefn{DoLayout}{dolayout}.
|
||||
|
||||
\membersection{wxTreeLayout::DrawBranch}
|
||||
|
||||
\func{void}{DrawBranch}{\param{long}{ from}, \param{long}{ to}, \param{wxDC\&}{ dc}}
|
||||
|
||||
Defined by wxTreeLayout to draw an arc between two nodes.
|
||||
|
||||
\membersection{wxTreeLayout::DrawBranches}
|
||||
|
||||
\func{void}{DrawBranches}{\param{wxDC\&}{ dc}}
|
||||
|
||||
Defined by wxTreeLayout to draw the arcs between nodes.
|
||||
|
||||
\membersection{wxTreeLayout::DrawNode}
|
||||
|
||||
\func{void}{DrawNode}{\param{long}{ id}, \param{wxDC\&}{ dc}}
|
||||
|
||||
Defined by wxTreeLayout to draw a node.
|
||||
|
||||
\membersection{wxTreeLayout::DrawNodes}
|
||||
|
||||
\func{void}{DrawNodes}{\param{wxDC\&}{ dc}}
|
||||
|
||||
Defined by wxTreeLayout to draw the nodes.
|
||||
|
||||
\membersection{wxTreeLayout::GetChildren}\label{getchildren}
|
||||
|
||||
\func{void}{GetChildren}{\param{long}{ id}, \param{wxList \&}{list}}
|
||||
|
||||
Must be defined to return the children of node {\it id} in the given list
|
||||
of integers.
|
||||
|
||||
\membersection{wxTreeLayout::GetNextNode}\label{getnextnode}
|
||||
|
||||
\func{long}{GetNextNode}{\param{long}{ id}}
|
||||
|
||||
Must be defined to return the next node after {\it id}, so that wxTreeLayout can
|
||||
iterate through all relevant nodes. The ordering is not important.
|
||||
The function should return -1 if there are no more nodes.
|
||||
|
||||
\membersection{wxTreeLayout::GetNodeName}
|
||||
|
||||
\constfunc{wxString}{GetNodeName}{\param{long}{ id}}
|
||||
|
||||
May optionally be defined to get a node's name (for example if leaving
|
||||
the drawing to wxTreeLayout).
|
||||
|
||||
\membersection{wxTreeLayout::GetNodeSize}
|
||||
|
||||
\constfunc{void}{GetNodeSize}{\param{long}{ id}, \param{long*}{ x}, \param{long*}{ y}}
|
||||
|
||||
Can be defined to indicate a node's size, or left to wxTreeLayout to use the
|
||||
name as an indication of size.
|
||||
|
||||
\membersection{wxTreeLayout::GetNodeParent}\label{getnodeparent}
|
||||
|
||||
\constfunc{long}{GetNodeParent}{\param{long}{ id}}
|
||||
|
||||
Must be defined to return the parent node of {\it id}.
|
||||
The function should return -1 if there is no parent.
|
||||
|
||||
\membersection{wxTreeLayout::GetNodeX}
|
||||
|
||||
\constfunc{long}{GetNodeX}{\param{long}{ id}}
|
||||
|
||||
Must be defined to return the current X position of the node. Note that
|
||||
coordinates are assumed to be at the top-left of the node so some conversion
|
||||
may be necessary for your application.
|
||||
|
||||
\membersection{wxTreeLayout::GetNodeY}
|
||||
|
||||
\constfunc{long}{GetNodeY}{\param{long}{ id}}
|
||||
|
||||
Must be defined to return the current Y position of the node. Note that
|
||||
coordinates are assumed to be at the top-left of the node so some conversion
|
||||
may be necessary for your application.
|
||||
|
||||
\membersection{wxTreeLayout::GetLeftMargin}
|
||||
|
||||
\constfunc{long}{GetLeftMargin}{\void}
|
||||
|
||||
Gets the left margin set with \helprefn{SetMargins}{setmargins}.
|
||||
|
||||
\membersection{wxTreeLayout::GetOrientation}
|
||||
|
||||
\constfunc{bool}{GetOrientation}{\void}
|
||||
|
||||
Gets the orientation: TRUE means top-to-bottom, FALSE means left-to-right (the default).
|
||||
|
||||
\membersection{wxTreeLayout::GetTopMargin}
|
||||
|
||||
\constfunc{long}{GetTopMargin}{\void}
|
||||
|
||||
Gets the top margin set with \helprefn{SetMargins}{setmargins}.
|
||||
|
||||
\membersection{wxTreeLayout::GetTopNode}
|
||||
|
||||
\constfunc{long}{GetTopNode}{\void}
|
||||
|
||||
wxTreeLayout calls this to get the top of the tree. Don't redefine this; call
|
||||
\rtfsp\helprefn{SetTopNode}{settopnode} instead before calling \helprefn{DoLayout}{dolayout}.
|
||||
|
||||
\membersection{wxTreeLayout::GetXSpacing}
|
||||
|
||||
\constfunc{long}{GetXSpacing}{\void}
|
||||
|
||||
Gets the horizontal spacing between nodes.
|
||||
|
||||
\membersection{wxTreeLayout::GetYSpacing}
|
||||
|
||||
\constfunc{long}{GetYSpacing}{\void}
|
||||
|
||||
Gets the vertical spacing between nodes.
|
||||
|
||||
\membersection{wxTreeLayout::Initialize}
|
||||
|
||||
\func{void}{Initialize}{\void}
|
||||
|
||||
Initializes wxTreeLayout. Call from application or overridden {\bf Initialize}
|
||||
or constructor.
|
||||
|
||||
\membersection{wxTreeLayout::NodeActive}\label{nodeactive}
|
||||
|
||||
\func{bool}{NodeActive}{\param{long}{ id}}
|
||||
|
||||
Define this so wxTreeLayout can know which nodes are to be drawn (not all
|
||||
nodes may be connected in the tree). See also \helprefn{ActivateNode}{activatenode}.
|
||||
|
||||
\membersection{wxTreeLayout::SetNodeName}
|
||||
|
||||
\func{void}{SetNodeName}{\param{long}{ id}, \param{const wxString\& }{ name}}
|
||||
|
||||
May optionally be defined to set a node's name.
|
||||
|
||||
\membersection{wxTreeLayout::SetNodeX}
|
||||
|
||||
\func{void}{SetNodeX}{\param{long}{ id}, \param{long}{ x}}
|
||||
|
||||
Must be defined to set the current X position of the node. Note that
|
||||
coordinates are assumed to be at the top-left of the node so some conversion
|
||||
may be necessary for your application.
|
||||
|
||||
\membersection{wxTreeLayout::SetNodeY}
|
||||
|
||||
\func{void}{SetNodeY}{\param{long}{ id}, \param{long}{ y}}
|
||||
|
||||
Must be defined to set the current Y position of the node. Note that
|
||||
coordinates are assumed to be at the top-left of the node so some conversion
|
||||
may be necessary for your application.
|
||||
|
||||
\membersection{wxTreeLayout::SetOrientation}
|
||||
|
||||
\func{void}{SetOrientation}{\param{bool}{ orientation}}
|
||||
|
||||
Sets the tree orientation: TRUE means top-to-bottom, FALSE means left-to-right (the default).
|
||||
|
||||
\membersection{wxTreeLayout::SetTopNode}\label{settopnode}
|
||||
|
||||
\func{void}{SetTopNode}{\param{long}{ id}}
|
||||
|
||||
Call this to identify the top of the tree to wxTreeLayout.
|
||||
|
||||
\membersection{wxTreeLayout::SetSpacing}
|
||||
|
||||
\func{void}{SetSpacing}{\param{long}{ x}, \param{long}{ y}}
|
||||
|
||||
Sets the horizontal and vertical spacing between nodes in the tree.
|
||||
|
||||
\membersection{wxTreeLayout::SetMargins}\label{setmargins}
|
||||
|
||||
\func{void}{SetMargins}{\param{long}{ x}, \param{long}{ y}}
|
||||
|
||||
Sets the left and top margins of the whole tree.
|
||||
|
||||
\section{\class{wxStoredTree}}\label{wxstoredtree}
|
||||
|
||||
wxStoredTree provides storage for node labels, position and client data. It also provides hit-testing
|
||||
(which node a mouse event occurred on). It is usually a more convenient class to use than wxTreeLayout.
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
\helpref{wxTreeLayout}{wxtreelayout}
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
\membersection{wxStoredTree::wxStoredTree}
|
||||
|
||||
\func{}{wxStoredTree}{\param{int }{noNodes = 200}}
|
||||
|
||||
Constructor. Specify the maximum number of nodes to be allocated.
|
||||
|
||||
\membersection{wxStoredTree::AddChild}\label{wxstoredtreeaddchild}
|
||||
|
||||
\func{long}{AddChild}{\param{const wxString\&}{ name}, \param{const wxString\&}{ parent = ""}}
|
||||
|
||||
Adds a child with a given parent, returning the node id.
|
||||
|
||||
\membersection{wxStoredTree::GetClientData}\label{wxstoredtreegetclientdata}
|
||||
|
||||
\constfunc{long}{GetClientData}{\param{long}{ id}}
|
||||
|
||||
Gets the client data for the given node.
|
||||
|
||||
\membersection{wxStoredTree::GetNode}\label{wxstoredtreegetnode}
|
||||
|
||||
\constfunc{wxStoredNode*}{GetNode}{\param{long}{ id}}
|
||||
|
||||
Returns the wxStoredNode object for the given node id.
|
||||
|
||||
\membersection{wxStoredTree::GetNodeCount}\label{wxstoredtreegetnodecount}
|
||||
|
||||
\constfunc{int}{GetNodeCount}{\void}
|
||||
|
||||
Returns the current number of nodes.
|
||||
|
||||
\membersection{wxStoredTree::GetNumNodes}\label{wxstoredtreegetnumnodes}
|
||||
|
||||
\constfunc{int}{GetNumNodes}{\void}
|
||||
|
||||
Returns the maximum number of nodes.
|
||||
|
||||
\membersection{wxStoredTree::HitTest}\label{wxstoredtreehittest}
|
||||
|
||||
\func{wxString}{HitTest}{\param{wxMouseEvent\&}{ event}, \param{wxDC\& }{dc}}
|
||||
|
||||
Returns a string with the node name corresponding to the position of the mouse event, or the empty string if no node
|
||||
was detected.
|
||||
|
||||
\membersection{wxStoredTree::NameToId}\label{wxstoredtreenametoid}
|
||||
|
||||
\func{long}{NameToId}{\param{const wxString\&}{ name}}
|
||||
|
||||
Returns the id for the given node name, or -1 if there was no such node.
|
||||
|
||||
\membersection{wxStoredTree::SetClientData}\label{wxstoredtreesetclientdata}
|
||||
|
||||
\func{void}{SetClientData}{\param{long}{ id}, \param{long}{ clientData}}
|
||||
|
||||
Sets client data for the given node.
|
||||
|
||||
|
BIN
utils/wxtree/docs/contents.gif
Normal file
After Width: | Height: | Size: 231 B |
BIN
utils/wxtree/docs/forward.gif
Normal file
After Width: | Height: | Size: 164 B |
28
utils/wxtree/docs/tex2rtf.ini
Normal file
@@ -0,0 +1,28 @@
|
||||
;;; Tex2RTF initialisation file
|
||||
runTwice = yes
|
||||
titleFontSize = 12
|
||||
authorFontSize = 10
|
||||
authorFontSize = 10
|
||||
chapterFontSize = 12
|
||||
sectionFontSize = 12
|
||||
subsectionFontSize = 12
|
||||
contentsDepth = 2
|
||||
headerRule = yes
|
||||
footerRule = yes
|
||||
useHeadingStyles = yes
|
||||
listItemIndent=40
|
||||
generateHPJ = no
|
||||
htmlBrowseButtons = bitmap
|
||||
winHelpContents = yes
|
||||
winHelpVersion = 3 ; 3 for Windows 3.x, 4 for Windows 95
|
||||
winHelpTitle = "wxTreeLayout Manual"
|
||||
truncateFilenames = yes
|
||||
combineSubSections = yes
|
||||
\overview [2] {\rtfonly{See also }\settransparency{on}\sethotspotcolour{off}\sethotspotunderline{on}\winhelponly{\image{}{books.bmp}\settransparency{off}}
|
||||
\htmlonly{\image{}{books.gif}}\helpref{#1}{#2}
|
||||
\sethotspotcolour{on}\sethotspotunderline{on}}
|
||||
\docparam [2]{\parskip{0}{\it #1}\htmlignore{\par}\parskip{10}\indented{1cm}{#2}}
|
||||
\wxheading [1]{{\bf \htmlignore{\fcol{blue}{#1}}\htmlonly{\fcol{red}{#1}}}}
|
||||
\const [0] {{\bf const}}
|
||||
\constfunc [3] {{\bf #1} {\bf #2}(#3) {\bf const}\index{#2}}
|
||||
\windowstyle [1] {{\bf #1}\index{#1}}
|
8
utils/wxtree/docs/tree.bib
Normal file
@@ -0,0 +1,8 @@
|
||||
@techreport{robins87,
|
||||
author = {Robins, Gabriel},
|
||||
title = {The {ISI} grapher: a portable tool for displaying graphs pictorially (ISI/RS-87-196)},
|
||||
institution = {University of South California},
|
||||
year = {1987},
|
||||
month = {September}
|
||||
}
|
||||
|
BIN
utils/wxtree/docs/treetst.bmp
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
utils/wxtree/docs/treetst.gif
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
utils/wxtree/docs/up.gif
Normal file
After Width: | Height: | Size: 137 B |
73
utils/wxtree/docs/wxtree.tex
Normal file
@@ -0,0 +1,73 @@
|
||||
\documentstyle[a4,makeidx,verbatim,texhelp,fancyhea,mysober,mytitle]{report}%
|
||||
\newcommand{\indexit}[1]{#1\index{#1}}%
|
||||
\newcommand{\pipe}[0]{$\|$\ }%
|
||||
\definecolour{black}{0}{0}{0}%
|
||||
\definecolour{cyan}{0}{255}{255}%
|
||||
\definecolour{green}{0}{255}{0}%
|
||||
\definecolour{magenta}{255}{0}{255}%
|
||||
\definecolour{red}{255}{0}{0}%
|
||||
\definecolour{blue}{0}{0}{200}%
|
||||
\definecolour{yellow}{255}{255}{0}%
|
||||
\definecolour{white}{255}{255}{255}%
|
||||
\input psbox.tex
|
||||
\parskip=10pt%
|
||||
\title{Manual for wxTreeLayout 2.0: a tree layout library for wxWindows}
|
||||
\author{Julian Smart\\Anthemion Software}
|
||||
\date{July 1998}%
|
||||
\makeindex%
|
||||
\begin{document}%
|
||||
\maketitle
|
||||
|
||||
\pagestyle{fancyplain}
|
||||
\bibliographystyle{plain}
|
||||
\pagenumbering{roman}
|
||||
\setheader{{\it CONTENTS}}{}{}{}{}{{\it CONTENTS}}
|
||||
\setfooter{\thepage}{}{}{}{}{\thepage}
|
||||
\tableofcontents%
|
||||
|
||||
\chapter{Introduction}
|
||||
\pagenumbering{arabic}%
|
||||
\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}%
|
||||
\setfooter{\thepage}{}{}{}{}{\thepage}
|
||||
|
||||
This manual describes a tree-drawing class library for wxWindows. It
|
||||
provides layout of simple trees with one root node, drawn left-to-right,
|
||||
with user-defined spacing between nodes.
|
||||
|
||||
wxTreeLayout is an abstract class that must be subclassed. The programmer
|
||||
defines various member functions which will access whatever data structures
|
||||
are appropriate for the application, and wxTreeLayout uses these when laying
|
||||
out the tree.
|
||||
|
||||
wxStoredTree is a class derived from wxTreeLayout that may be used directly to
|
||||
draw trees on a canvas. It supplies storage for the nodes, and draws
|
||||
to a device context.
|
||||
|
||||
\helponly{Below is the example tree generated by the program test.cc.
|
||||
|
||||
\begin{figure}
|
||||
$$\image{11cm;0cm}{treetst.ps}$$
|
||||
\caption{Example tree}\label{exampletree}
|
||||
\end{figure}
|
||||
}
|
||||
|
||||
\chapter{Implementation}
|
||||
\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}%
|
||||
\setfooter{\thepage}{}{}{}{}{\thepage}
|
||||
|
||||
The algorithm is due to Gabriel Robins \cite{robins87}, a linear-time
|
||||
algorithm originally implemented in LISP for AI applications.
|
||||
|
||||
The original algorithm has been modified so that both X and Y planes
|
||||
are calculated simultaneously, increasing efficiency slightly. The basic
|
||||
code is only a page or so long.
|
||||
|
||||
\input classes.tex
|
||||
%
|
||||
\bibliography{tree}
|
||||
|
||||
\addcontentsline{toc}{chapter}{Index}
|
||||
\setheader{{\it INDEX}}{}{}{}{}{{\it INDEX}}%
|
||||
\setfooter{\thepage}{}{}{}{}{\thepage}
|
||||
\printindex
|
||||
\end{document}
|