]> git.saurik.com Git - wxWidgets.git/blame - contrib/include/wx/ogl/misc.h
Array has pointers.
[wxWidgets.git] / contrib / include / wx / ogl / misc.h
CommitLineData
1fc25a89
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
2ba06d5a 9// Licence: wxWindows licence
1fc25a89
JS
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _OGL_MISC_H_
13#define _OGL_MISC_H_
14
ab7ce33c 15#if defined(__GNUG__) && !defined(__APPLE__)
1fc25a89
JS
16#pragma interface "misc.h"
17#endif
18
5f331691 19
1fc25a89
JS
20// List to use when copying objects; may need to associate elements of new objects
21// with elements of old objects, e.g. when copying constraint.s
22extern wxList oglObjectCopyMapping;
23
24/*
25 * TEXT FORMATTING FUNCTIONS
26 *
27 */
28
29// Centres the given list of wxShapeTextLine strings in the given box
30// (changing the positions in situ). Doesn't actually draw into the DC.
5f331691 31WXDLLIMPEXP_OGL void oglCentreText(wxDC& dc, wxList *text, double m_xpos, double m_ypos,
1fc25a89
JS
32 double width, double height,
33 int formatMode = FORMAT_CENTRE_HORIZ | FORMAT_CENTRE_VERT);
34
35// Given a string, returns a list of strings that fit within the given
36// width of box. Height is ignored.
5f331691 37WXDLLIMPEXP_OGL wxStringList* oglFormatText(wxDC& dc, const wxString& text, double width, double height, int formatMode = 0);
1fc25a89
JS
38
39// Centres the list of wxShapeTextLine strings, doesn't clip.
40// Doesn't actually draw into the DC.
5f331691 41WXDLLIMPEXP_OGL void oglCentreTextNoClipping(wxDC& dc, wxList *text_list,
1fc25a89
JS
42 double m_xpos, double m_ypos, double width, double height);
43
44// Gets the maximum width and height of the given list of wxShapeTextLines.
5f331691 45WXDLLIMPEXP_OGL void oglGetCentredTextExtent(wxDC& dc, wxList *text_list,
1fc25a89
JS
46 double m_xpos, double m_ypos, double width, double height,
47 double *actual_width, double *actual_height);
48
49// Actually draw the preformatted list of wxShapeTextLines.
5f331691 50WXDLLIMPEXP_OGL void oglDrawFormattedText(wxDC& context, wxList *text_list,
1fc25a89
JS
51 double m_xpos, double m_ypos, double width, double height,
52 int formatMode = FORMAT_CENTRE_HORIZ | FORMAT_CENTRE_VERT);
53
54// Give it a list of points, finds the centre.
5f331691 55WXDLLIMPEXP_OGL void oglFindPolylineCentroid(wxList *points, double *x, double *y);
1fc25a89 56
5f331691 57WXDLLIMPEXP_OGL void oglCheckLineIntersection(double x1, double y1, double x2, double y2,
1fc25a89
JS
58 double x3, double y3, double x4, double y4,
59 double *ratio1, double *ratio2);
60
5f331691 61WXDLLIMPEXP_OGL void oglFindEndForPolyline(double n, double xvec[], double yvec[],
1fc25a89
JS
62 double x1, double y1, double x2, double y2, double *x3, double *y3);
63
64
5f331691 65WXDLLIMPEXP_OGL void oglFindEndForBox(double width, double height,
1fc25a89
JS
66 double x1, double y1, // Centre of box (possibly)
67 double x2, double y2, // other end of line
68 double *x3, double *y3); // End on box edge
69
5f331691 70WXDLLIMPEXP_OGL void oglFindEndForCircle(double radius,
1fc25a89
JS
71 double x1, double y1, // Centre of circle
72 double x2, double y2, // Other end of line
73 double *x3, double *y3);
74
5f331691 75WXDLLIMPEXP_OGL void oglGetArrowPoints(double x1, double y1, double x2, double y2,
1fc25a89
JS
76 double length, double width,
77 double *tip_x, double *tip_y,
78 double *side1_x, double *side1_y,
79 double *side2_x, double *side2_y);
80
81/*
82 * Given an ellipse and endpoints of a line, returns the point at which
83 * the line touches the ellipse in values x4, y4.
84 * This function assumes that the centre of the ellipse is at x1, y1, and the
85 * ellipse has a width of a1 and a height of b1. It also assumes you are
86 * wanting to draw an arc FROM point x2, y2 TOWARDS point x3, y3.
67d54b58 87 * This function calculates the x,y coordinates of the intersection point of
1fc25a89
JS
88 * the arc with the ellipse.
89 * Author: Ian Harrison
90 */
91
5f331691 92WXDLLIMPEXP_OGL void oglDrawArcToEllipse(double x1, double y1, double a1, double b1, double x2, double y2, double x3, double y3,
1fc25a89
JS
93 double *x4, double *y4);
94
5f331691 95WXDLLIMPEXP_OGL bool oglRoughlyEqual(double val1, double val2, double tol = 0.00001);
1fc25a89
JS
96
97extern wxFont* g_oglNormalFont;
98extern wxPen* g_oglBlackPen;
99extern wxPen* g_oglWhiteBackgroundPen;
100extern wxPen* g_oglTransparentPen;
101extern wxBrush* g_oglWhiteBackgroundBrush;
102extern wxPen* g_oglBlackForegroundPen;
1fc25a89
JS
103
104extern wxFont* oglMatchFont(int point_size);
105
106extern wxString oglColourToHex(const wxColour& colour);
107extern wxColour oglHexToColour(const wxString& hex);
108extern void oglDecToHex(unsigned int dec, char *buf);
109extern unsigned int oglHexToDec(char* buf);
110
111
112#endif
113 // _OGL_MISC_H_