]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/mgl/utils.cpp
cleanup - reformatting
[wxWidgets.git] / src / mgl / utils.cpp
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: utils.cpp
3// Purpose:
4// Author: Vaclav Slavik
5// Id: $Id$
6// Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
7// Licence: wxWindows licence
8/////////////////////////////////////////////////////////////////////////////
9
10// For compilers that support precompilation, includes "wx.h".
11#include "wx/wxprec.h"
12
13#ifdef __BORLANDC__
14 #pragma hdrstop
15#endif
16
17#include "wx/utils.h"
18#include "wx/string.h"
19
20#include "wx/intl.h"
21#include "wx/apptrait.h"
22#include "wx/log.h"
23#include "wx/process.h"
24
25#include <stdarg.h>
26#include <string.h>
27#include <sys/stat.h>
28#include <sys/types.h>
29#include <unistd.h>
30#include <mgraph.hpp>
31
32#ifdef __UNIX__
33#include "wx/unix/execute.h"
34#endif
35
36#include "wx/mgl/private.h"
37
38//----------------------------------------------------------------------------
39// misc.
40//----------------------------------------------------------------------------
41
42void wxBell()
43{
44 // FIXME_MGL
45}
46
47// ----------------------------------------------------------------------------
48// display characterstics
49// ----------------------------------------------------------------------------
50
51void wxDisplaySize(int *width, int *height)
52{
53 wxASSERT_MSG( g_displayDC, wxT("You must call wxApp::SetDisplayMode before using this function") );
54 if (width) *width = g_displayDC->sizex()+1;
55 if (height) *height = g_displayDC->sizey()+1;
56}
57
58void wxDisplaySizeMM(int *width, int *height)
59{
60 wxASSERT_MSG( g_displayDC, wxT("You must call wxApp::SetDisplayMode before using this function") );
61
62 int xDPI, yDPI;
63 MGL_getDotsPerInch(&xDPI, &yDPI);
64
65 if ( width )
66 *width = (int)((g_displayDC->sizex()+1) * 25.4 / xDPI);
67 if ( height )
68 *height = (int)((g_displayDC->sizey()+1) * 25.4 / yDPI);
69}
70
71void wxClientDisplayRect(int *x, int *y, int *width, int *height)
72{
73 if ( x ) *x = 0;
74 if ( y ) *y = 0;
75 wxDisplaySize(width, height);
76 // FIXME_MGL - windowed version needs different handling
77}
78
79bool wxColourDisplay()
80{
81 wxASSERT_MSG( g_displayDC, wxT("You must call wxApp::SetDisplayMode before using this function") );
82
83 return (wxDisplayDepth() > 1);
84}
85
86int wxDisplayDepth()
87{
88 wxASSERT_MSG( g_displayDC, wxT("You must call wxApp::SetDisplayMode before using this function") );
89
90 return g_displayDC->getBitsPerPixel();
91}
92
93#if wxUSE_GUI
94
95wxToolkitInfo& wxGUIAppTraits::GetToolkitInfo()
96{
97 static wxToolkitInfo info;
98 info.shortName = _T("mgluniv");
99 info.name = _T("wxMGL");
100 info.versionMajor = MGL_RELEASE_MAJOR;
101 info.versionMinor = MGL_RELEASE_MINOR;
102 info.os = wxGTK;
103#if defined(__UNIX__)
104 info.os = wxMGL_UNIX;
105#elif defined(__OS2__)
106 info.os = wxMGL_OS2;
107#elif defined(__WIN32__)
108 info.os = wxMGL_WIN32;
109#elif defined(__DOS__)
110 info.os = wxMGL_DOS;
111#else
112 #error Platform not supported by wxMGL!
113#endif
114 return info;
115}
116
117#endif
118
119#if 0
120wxToolkitInfo& wxConsoleAppTraits::GetToolkitInfo()
121{
122 static wxToolkitInfo info;
123 info.shortName = _T("mglbase");
124 info.versionMajor = MGL_RELEASE_MAJOR;
125 info.versionMinor = MGL_RELEASE_MINOR;
126 info.name = _T("wxBase");
127 info.os = wxGTK;
128#if defined(__UNIX__)
129 info.os = wxMGL_UNIX;
130#elif defined(__OS2__)
131 info.os = wxMGL_OS2;
132#elif defined(__WIN32__)
133 info.os = wxMGL_WIN32;
134#elif defined(__DOS__)
135 info.os = wxMGL_DOS;
136#else
137 #error Platform not supported by wxMGL!
138#endif
139 return info;
140}
141#endif
142
143void wxGetMousePosition(int* x, int* y)
144{
145 MS_getPos(x, y);
146}
147
148wxPoint wxGetMousePosition()
149{
150 wxPoint pt;
151 wxGetMousePosition(&pt.x, &pt.y);
152 return pt;
153}
154
155
156
157#ifdef __UNIX__
158
159int wxAddProcessCallback(wxEndProcessData *proc_data, int fd)
160{
161 wxFAIL_MSG(wxT("wxAddProcessCallback not implemented in wxMGL!"));
162 return 0;
163#if 0 // FIXME_MGL -do we need it at all?
164 int tag = gdk_input_add(fd,
165 GDK_INPUT_READ,
166 GTK_EndProcessDetector,
167 (gpointer)proc_data);
168
169 return tag;
170#endif
171}
172
173#endif