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