]>
Commit | Line | Data |
---|---|---|
32b8ec41 VZ |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: utils.cpp | |
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 VZ |
17 | #include "wx/utils.h" |
18 | #include "wx/string.h" | |
19 | ||
20 | #include "wx/intl.h" | |
cd478a95 | 21 | #include "wx/apptrait.h" |
32b8ec41 | 22 | #include "wx/log.h" |
32b8ec41 VZ |
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 | ||
a4bbc9f7 VS |
36 | #include "wx/mgl/private.h" |
37 | ||
32b8ec41 VZ |
38 | //---------------------------------------------------------------------------- |
39 | // misc. | |
40 | //---------------------------------------------------------------------------- | |
41 | ||
42 | void wxBell() | |
43 | { | |
44 | // FIXME_MGL | |
45 | } | |
46 | ||
47 | // ---------------------------------------------------------------------------- | |
48 | // display characterstics | |
49 | // ---------------------------------------------------------------------------- | |
50 | ||
a4bbc9f7 | 51 | void wxDisplaySize(int *width, int *height) |
32b8ec41 | 52 | { |
9210a48a | 53 | wxASSERT_MSG( g_displayDC, wxT("You must call wxApp::SetDisplayMode before using this function") ); |
b8c0528d VS |
54 | if (width) *width = g_displayDC->sizex()+1; |
55 | if (height) *height = g_displayDC->sizey()+1; | |
32b8ec41 VZ |
56 | } |
57 | ||
7bdc1879 | 58 | void wxDisplaySizeMM(int *width, int *height) |
32b8ec41 | 59 | { |
1f43b5c9 | 60 | wxASSERT_MSG( g_displayDC, wxT("You must call wxApp::SetDisplayMode before using this function") ); |
39578f9c VS |
61 | |
62 | int xDPI, yDPI; | |
99f0cdf2 WS |
63 | MGL_getDotsPerInch(&xDPI, &yDPI); |
64 | ||
65 | if ( width ) | |
39578f9c | 66 | *width = (int)((g_displayDC->sizex()+1) * 25.4 / xDPI); |
99f0cdf2 | 67 | if ( height ) |
39578f9c | 68 | *height = (int)((g_displayDC->sizey()+1) * 25.4 / yDPI); |
a4bbc9f7 VS |
69 | } |
70 | ||
7bdc1879 | 71 | void wxClientDisplayRect(int *x, int *y, int *width, int *height) |
a4bbc9f7 | 72 | { |
58061670 VS |
73 | if ( x ) *x = 0; |
74 | if ( y ) *y = 0; | |
7bdc1879 | 75 | wxDisplaySize(width, height); |
58061670 | 76 | // FIXME_MGL - windowed version needs different handling |
32b8ec41 VZ |
77 | } |
78 | ||
79 | bool wxColourDisplay() | |
80 | { | |
1f43b5c9 | 81 | wxASSERT_MSG( g_displayDC, wxT("You must call wxApp::SetDisplayMode before using this function") ); |
99f0cdf2 | 82 | |
32b8ec41 VZ |
83 | return (wxDisplayDepth() > 1); |
84 | } | |
85 | ||
86 | int wxDisplayDepth() | |
87 | { | |
1f43b5c9 | 88 | wxASSERT_MSG( g_displayDC, wxT("You must call wxApp::SetDisplayMode before using this function") ); |
32b8ec41 VZ |
89 | |
90 | return g_displayDC->getBitsPerPixel(); | |
91 | } | |
92 | ||
1c53456f VS |
93 | #if wxUSE_GUI |
94 | ||
752464f9 | 95 | wxToolkitInfo& wxGUIAppTraits::GetToolkitInfo() |
32b8ec41 | 96 | { |
752464f9 VS |
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; | |
2343d81b | 103 | #if defined(__UNIX__) |
752464f9 | 104 | info.os = wxMGL_UNIX; |
2343d81b | 105 | #elif defined(__OS2__) |
752464f9 | 106 | info.os = wxMGL_OS2; |
2343d81b | 107 | #elif defined(__WIN32__) |
752464f9 | 108 | info.os = wxMGL_WIN32; |
a246f95e | 109 | #elif defined(__DOS__) |
752464f9 | 110 | info.os = wxMGL_DOS; |
a246f95e VS |
111 | #else |
112 | #error Platform not supported by wxMGL! | |
32b8ec41 | 113 | #endif |
752464f9 | 114 | return info; |
32b8ec41 VZ |
115 | } |
116 | ||
1c53456f VS |
117 | #endif |
118 | ||
83d8eb47 | 119 | #if 0 |
1c53456f VS |
120 | wxToolkitInfo& 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 | } | |
83d8eb47 | 141 | #endif |
32b8ec41 | 142 | |
7bdc1879 VS |
143 | void wxGetMousePosition(int* x, int* y) |
144 | { | |
145 | MS_getPos(x, y); | |
146 | } | |
147 | ||
148 | wxPoint wxGetMousePosition() | |
149 | { | |
150 | wxPoint pt; | |
151 | wxGetMousePosition(&pt.x, &pt.y); | |
152 | return pt; | |
153 | } | |
154 | ||
155 | ||
156 | ||
32b8ec41 VZ |
157 | #ifdef __UNIX__ |
158 | ||
159 | int wxAddProcessCallback(wxEndProcessData *proc_data, int fd) | |
160 | { | |
2343d81b VS |
161 | wxFAIL_MSG(wxT("wxAddProcessCallback not implemented in wxMGL!")); |
162 | return 0; | |
32b8ec41 VZ |
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 |