]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: utils.cpp | |
3 | // Purpose: | |
4 | // Author: Vaclav Slavik | |
5 | // Id: $Id$ | |
6 | // Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) | |
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" | |
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 | ||
28 | #include "wx/mgl/private.h" | |
29 | ||
30 | //---------------------------------------------------------------------------- | |
31 | // misc. | |
32 | //---------------------------------------------------------------------------- | |
33 | ||
34 | void wxBell() | |
35 | { | |
36 | // FIXME_MGL | |
37 | } | |
38 | ||
39 | // ---------------------------------------------------------------------------- | |
40 | // display characterstics | |
41 | // ---------------------------------------------------------------------------- | |
42 | ||
43 | void wxDisplaySize(int *width, int *height) | |
44 | { | |
45 | wxASSERT_MSG( g_displayDC, wxT("MGL display DC not created yet.") ); | |
46 | if (width) *width = g_displayDC->sizex()+1; | |
47 | if (height) *height = g_displayDC->sizey()+1; | |
48 | } | |
49 | ||
50 | void wxDisplaySizeMM(int *width, int *height) | |
51 | { | |
52 | wxASSERT_MSG( g_displayDC, wxT("MGL display DC not created yet.") ); | |
53 | if ( width ) | |
54 | *width = (g_displayDC->sizex()+1) * 25/72; | |
55 | if ( height ) | |
56 | *height = (g_displayDC->sizey()+1) * 25/72; | |
57 | // FIXME_MGL -- what about returning *real* monitor dimensions? | |
58 | } | |
59 | ||
60 | void wxClientDisplayRect(int *x, int *y, int *width, int *height) | |
61 | { | |
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); | |
69 | // FIXME_MGL -- make it use wxDesktop class when there's one | |
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 | { | |
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; | |
99 | #endif | |
100 | } | |
101 | ||
102 | ||
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 | ||
117 | #ifdef __UNIX__ | |
118 | ||
119 | int wxAddProcessCallback(wxEndProcessData *proc_data, int fd) | |
120 | { | |
121 | wxFAIL_MSG(wxT("wxAddProcessCallback not implemented in wxMGL!")); | |
122 | return 0; | |
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 |