]> git.saurik.com Git - wxWidgets.git/blame - utils/ogl/src/misc.h
Added SetFont to most controls and controls sample
[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
42cfaf8c 21extern wxList oglObjectCopyMapping;
0fc1a713
JS
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.
42cfaf8c
JS
30void oglCentreText(wxDC& dc, wxList *text, double m_xpos, double m_ypos,
31 double width, double height,
0fc1a713
JS
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.
42cfaf8c 36wxStringList *oglFormatText(wxDC& dc, const wxString& text, double width, double height, int formatMode = 0);
0fc1a713
JS
37
38// Centres the list of wxShapeTextLine strings, doesn't clip.
39// Doesn't actually draw into the DC.
42cfaf8c
JS
40void oglCentreTextNoClipping(wxDC& dc, wxList *text_list,
41 double m_xpos, double m_ypos, double width, double height);
0fc1a713
JS
42
43// Gets the maximum width and height of the given list of wxShapeTextLines.
42cfaf8c
JS
44void oglGetCentredTextExtent(wxDC& dc, wxList *text_list,
45 double m_xpos, double m_ypos, double width, double height,
46 double *actual_width, double *actual_height);
0fc1a713
JS
47
48// Actually draw the preformatted list of wxShapeTextLines.
42cfaf8c
JS
49void oglDrawFormattedText(wxDC& context, wxList *text_list,
50 double m_xpos, double m_ypos, double width, double height,
0fc1a713
JS
51 int formatMode = FORMAT_CENTRE_HORIZ | FORMAT_CENTRE_VERT);
52
53// Give it a list of points, finds the centre.
42cfaf8c 54void oglFindPolylineCentroid(wxList *points, double *x, double *y);
0fc1a713 55
42cfaf8c
JS
56void oglCheckLineIntersection(double x1, double y1, double x2, double y2,
57 double x3, double y3, double x4, double y4,
58 double *ratio1, double *ratio2);
0fc1a713 59
42cfaf8c
JS
60void oglFindEndForPolyline(double n, double xvec[], double yvec[],
61 double x1, double y1, double x2, double y2, double *x3, double *y3);
0fc1a713
JS
62
63
42cfaf8c
JS
64void oglFindEndForBox(double width, double height,
65 double x1, double y1, // Centre of box (possibly)
66 double x2, double y2, // other end of line
67 double *x3, double *y3); // End on box edge
0fc1a713 68
42cfaf8c
JS
69void oglFindEndForCircle(double radius,
70 double x1, double y1, // Centre of circle
71 double x2, double y2, // Other end of line
72 double *x3, double *y3);
0fc1a713 73
42cfaf8c
JS
74void oglGetArrowPoints(double x1, double y1, double x2, double y2,
75 double length, double width,
76 double *tip_x, double *tip_y,
77 double *side1_x, double *side1_y,
78 double *side2_x, double *side2_y);
0fc1a713
JS
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
42cfaf8c
JS
91void oglDrawArcToEllipse(double x1, double y1, double a1, double b1, double x2, double y2, double x3, double y3,
92 double *x4, double *y4);
0fc1a713 93
42cfaf8c 94bool oglRoughlyEqual(double val1, double val2, double tol = 0.00001);
0fc1a713 95
42cfaf8c
JS
96extern wxFont* g_oglNormalFont;
97extern wxPen* g_oglBlackPen;
98extern wxPen* g_oglWhiteBackgroundPen;
99extern wxPen* g_oglTransparentPen;
100extern wxBrush* g_oglWhiteBackgroundBrush;
101extern wxPen* g_oglBlackForegroundPen;
102extern wxCursor* g_oglBullseyeCursor;
0fc1a713 103
42cfaf8c 104extern wxFont* oglMatchFont(int point_size);
0fc1a713 105
42cfaf8c
JS
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);
34138703
JS
110
111
0fc1a713
JS
112#endif
113 // _OGL_MISC_H_