/usr/include/wx-2.6/wx/ogl/lines.h is in wx2.6-headers 2.6.3.2.2-5ubuntu4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | /////////////////////////////////////////////////////////////////////////////
// Name: lines.h
// Purpose: wxLineShape
// Author: Julian Smart
// Modified by:
// Created: 12/07/98
// RCS-ID: $Id: lines.h,v 1.7 2004/06/09 16:42:21 ABX Exp $
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _OGL_LINES_H_
#define _OGL_LINES_H_
#if defined(__GNUG__) && !defined(__APPLE__)
#pragma interface "lines.h"
#endif
class WXDLLIMPEXP_OGL wxLabelShape;
class WXDLLIMPEXP_OGL wxPseudoMetaFile;
class WXDLLIMPEXP_OGL wxLineControlPoint;
/*
* Arcs with multiple arrowheads
*
*/
// Types of arrowhead
// (i) Built-in
#define ARROW_HOLLOW_CIRCLE 1
#define ARROW_FILLED_CIRCLE 2
#define ARROW_ARROW 3
#define ARROW_SINGLE_OBLIQUE 4
#define ARROW_DOUBLE_OBLIQUE 5
// (ii) Custom
#define ARROW_METAFILE 20
// Position of arrow on line
#define ARROW_POSITION_START 0
#define ARROW_POSITION_END 1
#define ARROW_POSITION_MIDDLE 2
// Line alignment flags
// Vertical by default
#define LINE_ALIGNMENT_HORIZ 1
#define LINE_ALIGNMENT_VERT 0
#define LINE_ALIGNMENT_TO_NEXT_HANDLE 2
#define LINE_ALIGNMENT_NONE 0
class WXDLLIMPEXP_OGL wxArrowHead: public wxObject
{
DECLARE_DYNAMIC_CLASS(wxArrowHead)
public:
wxArrowHead(WXTYPE type = 0, int end = 0, double size = 0.0, double dist = 0.0, const wxString& name = wxEmptyString, wxPseudoMetaFile *mf = NULL,
long arrowId = -1);
~wxArrowHead();
wxArrowHead(wxArrowHead& toCopy);
inline WXTYPE _GetType() const { return m_arrowType; }
inline int GetPosition() const { return m_arrowEnd; }
inline void SetPosition(int pos) { m_arrowEnd = pos; }
inline double GetXOffset() const { return m_xOffset; }
inline double GetYOffset() const { return m_yOffset; }
inline double GetSpacing() const { return m_spacing; }
inline double GetSize() const { return m_arrowSize; }
inline wxString GetName() const { return m_arrowName; }
inline void SetXOffset(double x) { m_xOffset = x; }
inline void SetYOffset(double y) { m_yOffset = y; }
inline wxPseudoMetaFile *GetMetaFile() const { return m_metaFile; }
inline long GetId() const { return m_id; }
inline int GetArrowEnd() const { return m_arrowEnd; }
inline double GetArrowSize() const { return m_arrowSize; }
void SetSize(double size);
inline void SetSpacing(double sp) { m_spacing = sp; }
protected:
WXTYPE m_arrowType;
int m_arrowEnd; // Position on line
double m_xOffset; // Distance from arc start or end, w.r.t. point on arrowhead
// nearest start or end. If zero, use default spacing.
double m_yOffset; // vertical offset (w.r.t. a horizontal line). Normally zero.
double m_spacing; // Spacing from the last arrowhead
double m_arrowSize; // Length of arrowhead
wxString m_arrowName; // Name of arrow
bool m_saveToFile; // true if we want to save custom arrowheads to file.
wxPseudoMetaFile* m_metaFile; // Pseudo metafile if this is a custom arrowhead
long m_id; // identifier
};
// Line object
class WXDLLIMPEXP_OGL wxLabelShape;
class WXDLLIMPEXP_OGL wxLineShape: public wxShape
{
DECLARE_DYNAMIC_CLASS(wxLineShape)
public:
wxLineShape();
~wxLineShape();
// Called when a connected object has moved, to move the link to
// correct position
// moveControlPoints must be disabled when a control point is being
// dragged.
void OnMoveLink(wxDC& dc, bool moveControlPoints = true);
bool OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = true);
void OnDraw(wxDC& dc);
void OnDrawContents(wxDC& dc);
void OnDrawControlPoints(wxDC& dc);
void OnEraseControlPoints(wxDC& dc);
void OnErase(wxDC& dc);
virtual bool OnMoveControlPoint(int WXUNUSED(which), double WXUNUSED(x), double WXUNUSED(y)) { return false; }
virtual bool OnMoveMiddleControlPoint(wxDC& dc, wxLineControlPoint* lpt, const wxRealPoint& pt);
virtual bool OnLabelMovePre(wxDC& dc, wxLabelShape* labelShape, double x, double y, double old_x, double old_y, bool display);
void OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
void GetBoundingBoxMin(double *w, double *h);
void FormatText(wxDC& dc, const wxString& s, int regionId = 0);
virtual void SetEnds(double x1, double y1, double x2, double y2);
virtual void GetEnds(double *x1, double *y1, double *x2, double *y2);
inline virtual wxShape *GetFrom() { return m_from; }
inline virtual wxShape *GetTo() { return m_to; }
inline virtual int GetAttachmentFrom() { return m_attachmentFrom; }
inline virtual int GetAttachmentTo() { return m_attachmentTo; }
virtual void SetFrom(wxShape *object);
virtual void SetTo(wxShape *object);
virtual void DrawArrows(wxDC& dc);
// Finds the x, y points at the two ends of the line.
// This function can be used by e.g. line-routing routines to
// get the actual points on the two node images where the lines will be drawn
// to/from.
void FindLineEndPoints(double *fromX, double *fromY, double *toX, double *toY);
// Format one region at this position
void DrawRegion(wxDC& dc, wxShapeRegion *region, double x, double y);
// Erase one region at this position
void EraseRegion(wxDC& dc, wxShapeRegion *region, double x, double y);
// Get the reference point for a label. Region x and y
// are offsets from this.
// position is 0 (middle), 1 (start), 2 (end)
void GetLabelPosition(int position, double *x, double *y);
// Can override this to create a different class of label shape
virtual wxLabelShape* OnCreateLabelShape(wxLineShape *parent = NULL, wxShapeRegion *region = NULL, double w = 0.0, double h = 0.0);
// Straighten verticals and horizontals
virtual void Straighten(wxDC* dc = NULL);
// Not implemented
inline void SetMaintainStraightLines(bool flag) { m_maintainStraightLines = flag; }
inline bool GetMaintainStraightLines() const { return m_maintainStraightLines; }
// Make handle control points
void MakeControlPoints();
void ResetControlPoints();
// Make a given number of control points
virtual void MakeLineControlPoints(int n);
virtual wxNode *InsertLineControlPoint(wxDC* dc);
virtual bool DeleteLineControlPoint();
virtual void Initialise();
inline wxList *GetLineControlPoints() { return m_lineControlPoints; }
// Override dragging behaviour - don't want to be able to drag lines!
void OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
void OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
void OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
// Control points ('handles') redirect control to the actual shape, to make it easier
// to override sizing behaviour.
virtual void OnSizingDragLeft(wxControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
virtual void OnSizingBeginDragLeft(wxControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
virtual void OnSizingEndDragLeft(wxControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
// Override select, to create/delete temporary label-moving objects
void Select(bool select = true, wxDC* dc = NULL);
// Set to spline (true) or line (false)
inline void SetSpline(bool spl) { m_isSpline = spl; }
inline bool IsSpline() const { return m_isSpline; }
void Unlink();
void SetAttachments(int from_attach, int to_attach);
inline void SetAttachmentFrom(int attach) { m_attachmentFrom = attach; }
inline void SetAttachmentTo(int attach) { m_attachmentTo = attach; }
bool HitTest(double x, double y, int *attachment, double *distance);
#if wxUSE_PROLOGIO
// I/O
virtual void WriteAttributes(wxExpr *clause);
virtual void ReadAttributes(wxExpr *clause);
#endif
virtual void FindNth(wxShape *image, int *nth, int *no_arcs, bool incoming);
// Find which position we're talking about at this (x, y).
// Returns ARROW_POSITION_START, ARROW_POSITION_MIDDLE, ARROW_POSITION_END
int FindLinePosition(double x, double y);
// This is really to distinguish between lines and other images.
// For lines, want to pass drag to canvas, since lines tend to prevent
// dragging on a canvas (they get in the way.)
virtual bool Draggable() const { return false; }
// Does the copying for this object
void Copy(wxShape& copy);
// Add an arrowhead.
wxArrowHead *AddArrow(WXTYPE type, int end = ARROW_POSITION_END,
double arrowSize = 10.0, double xOffset = 0.0,
const wxString& name = wxEmptyString,
wxPseudoMetaFile *mf = NULL, long arrowId = -1);
// Add an arrowhead in the position indicated by the reference
// list of arrowheads, which contains all legal arrowheads for this
// line, in the correct order.
// E.g. reference list: a b c d e
// Current line list: a d
// Add c, then line list is: a c d
// If no legal arrowhead position, return false.
// Assume reference list is for one end only, since it potentially defines
// the ordering for any one of the 3 positions. So we don't check
// the reference list for arrowhead position.
bool AddArrowOrdered(wxArrowHead *arrow, wxList& referenceList, int end);
// Delete arrowhead(s)
void ClearArrowsAtPosition(int end = -1);
bool ClearArrow(const wxString& name);
wxArrowHead *FindArrowHead(int position, const wxString& name);
wxArrowHead *FindArrowHead(long arrowId);
bool DeleteArrowHead(int position, const wxString& name);
bool DeleteArrowHead(long arrowId);
void DrawArrow(wxDC& dc, wxArrowHead *arrow, double xOffset, bool proportionalOffset);
inline void SetIgnoreOffsets(bool ignore) { m_ignoreArrowOffsets = ignore; }
inline wxList& GetArrows() const { return (wxList&) m_arcArrows; }
// Find horizontal width for drawing a line with
// arrows in minimum space. Assume arrows at
// END only
double FindMinimumWidth();
// Set alignment flags. ALIGNMENT NOT IMPLEMENTED.
void SetAlignmentOrientation(bool isEnd, bool isHoriz);
void SetAlignmentType(bool isEnd, int alignType);
bool GetAlignmentOrientation(bool isEnd);
int GetAlignmentType(bool isEnd);
int GetAlignmentStart() const { return m_alignmentStart; }
int GetAlignmentEnd() const { return m_alignmentEnd; }
// Find next control point in line after the start/end point
// (depending on whether the node object is at start or end)
wxRealPoint *GetNextControlPoint(wxShape *nodeObject);
inline bool IsEnd(wxShape *nodeObject) const { return (m_to == nodeObject); }
private:
bool m_erasing; // flag to say whether we're erasing or drawing
// this line (really so metafiles can draw a
// blank rectangle)
bool m_ignoreArrowOffsets; // Don't always want to draw arrowhead offsets
// because they may not work on tool palettes (for example)
bool m_isSpline;
bool m_maintainStraightLines;
protected:
// Temporary list of line segment orientations
// so we know what direction the line is supposed to be dog-legging
// in. The values are integer: 0 for vertical, 1 for horizontal.
wxList m_lineOrientations;
// Temporary pointers for start, middle and end label editing objects
// (active only when the line is selected)
wxLabelShape* m_labelObjects[3];
// These define the segmented line - not to be confused with temporary control
// points which appear when object is selected (although in this case they'll
// probably be the same)
wxList* m_lineControlPoints;
double m_arrowSpacing; // Separation between adjacent arrows
wxShape* m_to;
wxShape* m_from;
int m_attachmentTo; // Attachment point at one end
int m_attachmentFrom; // Attachment point at other end
// Alignment flags
int m_alignmentStart;
int m_alignmentEnd;
wxList m_arcArrows;
};
#endif
// _OGL_LINES_H_
|