]> git.saurik.com Git - wxWidgets.git/blob - src/mgl/utils.cpp
Include wx/string.h according to precompiled headers of wx/wx.h (with other minor...
[wxWidgets.git] / src / mgl / utils.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/mgl/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
19 #ifndef WX_PRECOMP
20 #include "wx/string.h"
21 #endif
22
23 #include "wx/intl.h"
24 #include "wx/apptrait.h"
25 #include "wx/log.h"
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
39 #include "wx/mgl/private.h"
40
41 //----------------------------------------------------------------------------
42 // misc.
43 //----------------------------------------------------------------------------
44
45 void wxBell()
46 {
47 // FIXME_MGL
48 }
49
50 // ----------------------------------------------------------------------------
51 // display characterstics
52 // ----------------------------------------------------------------------------
53
54 void wxDisplaySize(int *width, int *height)
55 {
56 wxASSERT_MSG( g_displayDC, wxT("You must call wxApp::SetDisplayMode before using this function") );
57 if (width) *width = g_displayDC->sizex()+1;
58 if (height) *height = g_displayDC->sizey()+1;
59 }
60
61 void wxDisplaySizeMM(int *width, int *height)
62 {
63 wxASSERT_MSG( g_displayDC, wxT("You must call wxApp::SetDisplayMode before using this function") );
64
65 int xDPI, yDPI;
66 MGL_getDotsPerInch(&xDPI, &yDPI);
67
68 if ( width )
69 *width = (int)((g_displayDC->sizex()+1) * 25.4 / xDPI);
70 if ( height )
71 *height = (int)((g_displayDC->sizey()+1) * 25.4 / yDPI);
72 }
73
74 void wxClientDisplayRect(int *x, int *y, int *width, int *height)
75 {
76 if ( x ) *x = 0;
77 if ( y ) *y = 0;
78 wxDisplaySize(width, height);
79 // FIXME_MGL - windowed version needs different handling
80 }
81
82 bool wxColourDisplay()
83 {
84 wxASSERT_MSG( g_displayDC, wxT("You must call wxApp::SetDisplayMode before using this function") );
85
86 return (wxDisplayDepth() > 1);
87 }
88
89 int wxDisplayDepth()
90 {
91 wxASSERT_MSG( g_displayDC, wxT("You must call wxApp::SetDisplayMode before using this function") );
92
93 return g_displayDC->getBitsPerPixel();
94 }
95
96 #if wxUSE_GUI
97
98 wxToolkitInfo& wxGUIAppTraits::GetToolkitInfo()
99 {
100 static wxToolkitInfo info;
101 info.shortName = _T("mgluniv");
102 info.name = _T("wxMGL");
103 info.versionMajor = MGL_RELEASE_MAJOR;
104 info.versionMinor = MGL_RELEASE_MINOR;
105 info.os = wxGTK;
106 #if defined(__UNIX__)
107 info.os = wxMGL_UNIX;
108 #elif defined(__OS2__)
109 info.os = wxMGL_OS2;
110 #elif defined(__WIN32__)
111 info.os = wxMGL_WIN32;
112 #elif defined(__DOS__)
113 info.os = wxMGL_DOS;
114 #else
115 #error Platform not supported by wxMGL!
116 #endif
117 return info;
118 }
119
120 #endif
121
122 #if 0
123 wxToolkitInfo& wxConsoleAppTraits::GetToolkitInfo()
124 {
125 static wxToolkitInfo info;
126 info.shortName = _T("mglbase");
127 info.versionMajor = MGL_RELEASE_MAJOR;
128 info.versionMinor = MGL_RELEASE_MINOR;
129 info.name = _T("wxBase");
130 info.os = wxGTK;
131 #if defined(__UNIX__)
132 info.os = wxMGL_UNIX;
133 #elif defined(__OS2__)
134 info.os = wxMGL_OS2;
135 #elif defined(__WIN32__)
136 info.os = wxMGL_WIN32;
137 #elif defined(__DOS__)
138 info.os = wxMGL_DOS;
139 #else
140 #error Platform not supported by wxMGL!
141 #endif
142 return info;
143 }
144 #endif
145
146 void wxGetMousePosition(int* x, int* y)
147 {
148 MS_getPos(x, y);
149 }
150
151 wxPoint wxGetMousePosition()
152 {
153 wxPoint pt;
154 wxGetMousePosition(&pt.x, &pt.y);
155 return pt;
156 }
157
158
159
160 #ifdef __UNIX__
161
162 int wxAddProcessCallback(wxEndProcessData *proc_data, int fd)
163 {
164 wxFAIL_MSG(wxT("wxAddProcessCallback not implemented in wxMGL!"));
165 return 0;
166 #if 0 // FIXME_MGL -do we need it at all?
167 int tag = gdk_input_add(fd,
168 GDK_INPUT_READ,
169 GTK_EndProcessDetector,
170 (gpointer)proc_data);
171
172 return tag;
173 #endif
174 }
175
176 #endif