]>
Commit | Line | Data |
---|---|---|
32b8ec41 VZ |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: utils.cpp | |
3 | // Purpose: | |
4 | // Author: Vaclav Slavik | |
5 | // Id: $Id$ | |
8f7b34a8 | 6 | // Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) |
32b8ec41 VZ |
7 | // Licence: wxWindows licence |
8 | ///////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | #include "wx/utils.h" | |
11 | #include "wx/string.h" | |
12 | ||
13 | #include "wx/intl.h" | |
14 | #include "wx/log.h" | |
32b8ec41 VZ |
15 | #include "wx/process.h" |
16 | ||
17 | #include <stdarg.h> | |
18 | #include <string.h> | |
19 | #include <sys/stat.h> | |
20 | #include <sys/types.h> | |
21 | #include <unistd.h> | |
22 | #include <mgraph.hpp> | |
23 | ||
24 | #ifdef __UNIX__ | |
25 | #include "wx/unix/execute.h" | |
26 | #endif | |
27 | ||
a4bbc9f7 VS |
28 | #include "wx/mgl/private.h" |
29 | ||
32b8ec41 VZ |
30 | //---------------------------------------------------------------------------- |
31 | // misc. | |
32 | //---------------------------------------------------------------------------- | |
33 | ||
34 | void wxBell() | |
35 | { | |
36 | // FIXME_MGL | |
37 | } | |
38 | ||
39 | // ---------------------------------------------------------------------------- | |
40 | // display characterstics | |
41 | // ---------------------------------------------------------------------------- | |
42 | ||
a4bbc9f7 | 43 | void wxDisplaySize(int *width, int *height) |
32b8ec41 VZ |
44 | { |
45 | wxASSERT_MSG( g_displayDC, wxT("MGL display DC not created yet.") ); | |
46 | if (width) *width = g_displayDC->sizex(); | |
47 | if (height) *height = g_displayDC->sizey(); | |
48 | } | |
49 | ||
7bdc1879 | 50 | void wxDisplaySizeMM(int *width, int *height) |
32b8ec41 | 51 | { |
7bdc1879 | 52 | wxASSERT_MSG( g_displayDC, wxT("MGL display DC not created yet.") ); |
2343d81b VS |
53 | if ( width ) |
54 | *width = g_displayDC->sizex() * 25/72; | |
55 | if ( height ) | |
56 | *height = g_displayDC->sizey() * 25/72; | |
7bdc1879 | 57 | // FIXME_MGL -- what about returning *real* monitor dimensions? |
a4bbc9f7 VS |
58 | } |
59 | ||
7bdc1879 | 60 | void wxClientDisplayRect(int *x, int *y, int *width, int *height) |
a4bbc9f7 | 61 | { |
7bdc1879 VS |
62 | // This is supposed to return desktop dimensions minus any window |
63 | // manager panels, menus, taskbars, etc. If there is a way to do that | |
64 | // for this platform please fix this function, otherwise it defaults | |
65 | // to the entire desktop. | |
66 | if (x) *x = 0; | |
67 | if (y) *y = 0; | |
68 | wxDisplaySize(width, height); | |
2343d81b | 69 | // FIXME_MGL -- make it use wxDesktop class when there's one |
32b8ec41 VZ |
70 | } |
71 | ||
72 | bool wxColourDisplay() | |
73 | { | |
74 | wxASSERT_MSG( g_displayDC, wxT("MGL display DC not created yet.") ); | |
75 | ||
76 | return (wxDisplayDepth() > 1); | |
77 | } | |
78 | ||
79 | int wxDisplayDepth() | |
80 | { | |
81 | wxASSERT_MSG( g_displayDC, wxT("MGL display DC not created yet.") ); | |
82 | ||
83 | return g_displayDC->getBitsPerPixel(); | |
84 | } | |
85 | ||
86 | int wxGetOsVersion(int *majorVsn, int *minorVsn) | |
87 | { | |
2343d81b VS |
88 | if ( majorVsn ) |
89 | *majorVsn = MGL_RELEASE_MAJOR; | |
90 | if ( minorVsn ) | |
91 | *minorVsn = MGL_RELEASE_MINOR; | |
92 | ||
93 | #if defined(__UNIX__) | |
94 | return wxMGL_UNIX; | |
95 | #elif defined(__OS2__) | |
96 | return wxMGL_OS2; | |
97 | #elif defined(__WIN32__) | |
98 | return wxMGL_WIN32; | |
32b8ec41 VZ |
99 | #endif |
100 | } | |
101 | ||
102 | ||
7bdc1879 VS |
103 | void wxGetMousePosition(int* x, int* y) |
104 | { | |
105 | MS_getPos(x, y); | |
106 | } | |
107 | ||
108 | wxPoint wxGetMousePosition() | |
109 | { | |
110 | wxPoint pt; | |
111 | wxGetMousePosition(&pt.x, &pt.y); | |
112 | return pt; | |
113 | } | |
114 | ||
115 | ||
116 | ||
32b8ec41 VZ |
117 | #ifdef __UNIX__ |
118 | ||
119 | int wxAddProcessCallback(wxEndProcessData *proc_data, int fd) | |
120 | { | |
2343d81b VS |
121 | wxFAIL_MSG(wxT("wxAddProcessCallback not implemented in wxMGL!")); |
122 | return 0; | |
32b8ec41 VZ |
123 | #if 0 // FIXME_MGL -do we need it at all? |
124 | int tag = gdk_input_add(fd, | |
125 | GDK_INPUT_READ, | |
126 | GTK_EndProcessDetector, | |
127 | (gpointer)proc_data); | |
128 | ||
129 | return tag; | |
130 | #endif | |
131 | } | |
132 | ||
133 | #endif |