]>
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 | 44 | { |
1f43b5c9 | 45 | wxASSERT_MSG( g_displayDC, wxT("You must call wxApp::SetDisplayMode before using this function") ); |
b8c0528d VS |
46 | if (width) *width = g_displayDC->sizex()+1; |
47 | if (height) *height = g_displayDC->sizey()+1; | |
32b8ec41 VZ |
48 | } |
49 | ||
7bdc1879 | 50 | void wxDisplaySizeMM(int *width, int *height) |
32b8ec41 | 51 | { |
1f43b5c9 | 52 | wxASSERT_MSG( g_displayDC, wxT("You must call wxApp::SetDisplayMode before using this function") ); |
2343d81b | 53 | if ( width ) |
b8c0528d | 54 | *width = (g_displayDC->sizex()+1) * 25/72; |
2343d81b | 55 | if ( height ) |
b8c0528d | 56 | *height = (g_displayDC->sizey()+1) * 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 | { |
58061670 VS |
62 | if ( x ) *x = 0; |
63 | if ( y ) *y = 0; | |
7bdc1879 | 64 | wxDisplaySize(width, height); |
58061670 | 65 | // FIXME_MGL - windowed version needs different handling |
32b8ec41 VZ |
66 | } |
67 | ||
68 | bool wxColourDisplay() | |
69 | { | |
1f43b5c9 | 70 | wxASSERT_MSG( g_displayDC, wxT("You must call wxApp::SetDisplayMode before using this function") ); |
32b8ec41 VZ |
71 | |
72 | return (wxDisplayDepth() > 1); | |
73 | } | |
74 | ||
75 | int wxDisplayDepth() | |
76 | { | |
1f43b5c9 | 77 | wxASSERT_MSG( g_displayDC, wxT("You must call wxApp::SetDisplayMode before using this function") ); |
32b8ec41 VZ |
78 | |
79 | return g_displayDC->getBitsPerPixel(); | |
80 | } | |
81 | ||
82 | int wxGetOsVersion(int *majorVsn, int *minorVsn) | |
83 | { | |
2343d81b VS |
84 | if ( majorVsn ) |
85 | *majorVsn = MGL_RELEASE_MAJOR; | |
86 | if ( minorVsn ) | |
87 | *minorVsn = MGL_RELEASE_MINOR; | |
88 | ||
89 | #if defined(__UNIX__) | |
90 | return wxMGL_UNIX; | |
91 | #elif defined(__OS2__) | |
92 | return wxMGL_OS2; | |
93 | #elif defined(__WIN32__) | |
94 | return wxMGL_WIN32; | |
32b8ec41 VZ |
95 | #endif |
96 | } | |
97 | ||
98 | ||
7bdc1879 VS |
99 | void wxGetMousePosition(int* x, int* y) |
100 | { | |
101 | MS_getPos(x, y); | |
102 | } | |
103 | ||
104 | wxPoint wxGetMousePosition() | |
105 | { | |
106 | wxPoint pt; | |
107 | wxGetMousePosition(&pt.x, &pt.y); | |
108 | return pt; | |
109 | } | |
110 | ||
111 | ||
112 | ||
32b8ec41 VZ |
113 | #ifdef __UNIX__ |
114 | ||
115 | int wxAddProcessCallback(wxEndProcessData *proc_data, int fd) | |
116 | { | |
2343d81b VS |
117 | wxFAIL_MSG(wxT("wxAddProcessCallback not implemented in wxMGL!")); |
118 | return 0; | |
32b8ec41 VZ |
119 | #if 0 // FIXME_MGL -do we need it at all? |
120 | int tag = gdk_input_add(fd, | |
121 | GDK_INPUT_READ, | |
122 | GTK_EndProcessDetector, | |
123 | (gpointer)proc_data); | |
124 | ||
125 | return tag; | |
126 | #endif | |
127 | } | |
128 | ||
129 | #endif |