]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/mgl/utils.cpp
Fix for [1250089] 'wxHtmlHelpFrame uses constants instead of variables'.
[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
93wxString wxGetOsDescription()
94{
95 wxString osname(
96
97#if defined(__UNIX__)
98 _T("Unix")
99#elif defined(__OS2__)
100 _T("OS/2")
101#elif defined(__WIN32__)
102 _T("Windows")
103#elif defined(__DOS__)
104 _T("DOS")
105#else
106 _T("unknown")
107#endif
108
109 );
110
111 return osname;
112}
113
114#if wxUSE_GUI
115
116wxToolkitInfo& wxGUIAppTraits::GetToolkitInfo()
117{
118 static wxToolkitInfo info;
119 info.shortName = _T("mgluniv");
120 info.name = _T("wxMGL");
121 info.versionMajor = MGL_RELEASE_MAJOR;
122 info.versionMinor = MGL_RELEASE_MINOR;
123 info.os = wxGTK;
124#if defined(__UNIX__)
125 info.os = wxMGL_UNIX;
126#elif defined(__OS2__)
127 info.os = wxMGL_OS2;
128#elif defined(__WIN32__)
129 info.os = wxMGL_WIN32;
130#elif defined(__DOS__)
131 info.os = wxMGL_DOS;
132#else
133 #error Platform not supported by wxMGL!
134#endif
135 return info;
136}
137
138#endif
139
140#if 0
141wxToolkitInfo& wxConsoleAppTraits::GetToolkitInfo()
142{
143 static wxToolkitInfo info;
144 info.shortName = _T("mglbase");
145 info.versionMajor = MGL_RELEASE_MAJOR;
146 info.versionMinor = MGL_RELEASE_MINOR;
147 info.name = _T("wxBase");
148 info.os = wxGTK;
149#if defined(__UNIX__)
150 info.os = wxMGL_UNIX;
151#elif defined(__OS2__)
152 info.os = wxMGL_OS2;
153#elif defined(__WIN32__)
154 info.os = wxMGL_WIN32;
155#elif defined(__DOS__)
156 info.os = wxMGL_DOS;
157#else
158 #error Platform not supported by wxMGL!
159#endif
160 return info;
161}
162#endif
163
164void wxGetMousePosition(int* x, int* y)
165{
166 MS_getPos(x, y);
167}
168
169wxPoint wxGetMousePosition()
170{
171 wxPoint pt;
172 wxGetMousePosition(&pt.x, &pt.y);
173 return pt;
174}
175
176
177
178#ifdef __UNIX__
179
180int wxAddProcessCallback(wxEndProcessData *proc_data, int fd)
181{
182 wxFAIL_MSG(wxT("wxAddProcessCallback not implemented in wxMGL!"));
183 return 0;
184#if 0 // FIXME_MGL -do we need it at all?
185 int tag = gdk_input_add(fd,
186 GDK_INPUT_READ,
187 GTK_EndProcessDetector,
188 (gpointer)proc_data);
189
190 return tag;
191#endif
192}
193
194#endif