]> git.saurik.com Git - wxWidgets.git/blame - utils/ogl/src/misc.h
Added revamped Object Graphics Library (for node/arc diagrams).
[wxWidgets.git] / utils / ogl / src / misc.h
CommitLineData
0fc1a713
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: misc.h
3// Purpose: Miscellaneous utilities for OGL
4// Author: Julian Smart
5// Modified by:
6// Created: 12/07/98
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _OGL_MISC_H_
13#define _OGL_MISC_H_
14
15#ifdef __GNUG__
16#pragma interface "misc.h"
17#endif
18
19// List to use when copying objects; may need to associate elements of new objects
20// with elements of old objects, e.g. when copying constraint.s
21extern wxList wxObjectCopyMapping;
22
23/*
24 * TEXT FORMATTING FUNCTIONS
25 *
26 */
27
28// Centres the given list of wxShapeTextLine strings in the given box
29// (changing the positions in situ). Doesn't actually draw into the DC.
30void CentreText(wxDC& dc, wxList *text, float m_xpos, float m_ypos,
31 float width, float height,
32 int formatMode = FORMAT_CENTRE_HORIZ | FORMAT_CENTRE_VERT);
33
34// Given a string, returns a list of strings that fit within the given
35// width of box. Height is ignored.
36wxList *FormatText(wxDC& dc, const wxString& text, float width, float height, int formatMode = 0);
37
38// Centres the list of wxShapeTextLine strings, doesn't clip.
39// Doesn't actually draw into the DC.
40void CentreTextNoClipping(wxDC& dc, wxList *text_list,
41 float m_xpos, float m_ypos, float width, float height);
42
43// Gets the maximum width and height of the given list of wxShapeTextLines.
44void GetCentredTextExtent(wxDC& dc, wxList *text_list,
45 float m_xpos, float m_ypos, float width, float height,
46 float *actual_width, float *actual_height);
47
48// Actually draw the preformatted list of wxShapeTextLines.
49void DrawFormattedText(wxDC& context, wxList *text_list,
50 float m_xpos, float m_ypos, float width, float height,
51 int formatMode = FORMAT_CENTRE_HORIZ | FORMAT_CENTRE_VERT);
52
53// Give it a list of points, finds the centre.
54void find_polyline_centroid(wxList *points, float *x, float *y);
55
56void check_line_intersection(float x1, float y1, float x2, float y2,
57 float x3, float y3, float x4, float y4,
58 float *ratio1, float *ratio2);
59
60void find_end_for_polyline(float n, float xvec[], float yvec[],
61 float x1, float y1, float x2, float y2, float *x3, float *y3);
62
63
64void find_end_for_box(float width, float height,
65 float x1, float y1, // Centre of box (possibly)
66 float x2, float y2, // other end of line
67 float *x3, float *y3); // End on box edge
68
69void find_end_for_circle(float radius,
70 float x1, float y1, // Centre of circle
71 float x2, float y2, // Other end of line
72 float *x3, float *y3);
73
74void get_arrow_points(float x1, float y1, float x2, float y2,
75 float length, float width,
76 float *tip_x, float *tip_y,
77 float *side1_x, float *side1_y,
78 float *side2_x, float *side2_y);
79
80/*
81 * Given an ellipse and endpoints of a line, returns the point at which
82 * the line touches the ellipse in values x4, y4.
83 * This function assumes that the centre of the ellipse is at x1, y1, and the
84 * ellipse has a width of a1 and a height of b1. It also assumes you are
85 * wanting to draw an arc FROM point x2, y2 TOWARDS point x3, y3.
86 * This function calculates the x,y coordinates of the intersection point of
87 * the arc with the ellipse.
88 * Author: Ian Harrison
89 */
90
91void draw_arc_to_ellipse(float x1, float y1, float a1, float b1, float x2, float y2, float x3, float y3,
92 float *x4, float *y4);
93
94extern wxFont *g_oglNormalFont;
95extern wxPen *black_pen;
96
97extern wxPen *white_background_pen;
98extern wxPen *transparent_pen;
99extern wxBrush *white_background_brush;
100extern wxPen *black_foreground_pen;
101
102extern wxCursor *GraphicsBullseyeCursor;
103
104extern wxFont *MatchFont(int point_size);
105
106#endif
107 // _OGL_MISC_H_