]>
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("You must call wxApp::SetDisplayMode before using this function") ); | |
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("You must call wxApp::SetDisplayMode before using this function") ); | |
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 | if ( x ) *x = 0; | |
63 | if ( y ) *y = 0; | |
64 | wxDisplaySize(width, height); | |
65 | // FIXME_MGL - windowed version needs different handling | |
66 | } | |
67 | ||
68 | bool wxColourDisplay() | |
69 | { | |
70 | wxASSERT_MSG( g_displayDC, wxT("You must call wxApp::SetDisplayMode before using this function") ); | |
71 | ||
72 | return (wxDisplayDepth() > 1); | |
73 | } | |
74 | ||
75 | int wxDisplayDepth() | |
76 | { | |
77 | wxASSERT_MSG( g_displayDC, wxT("You must call wxApp::SetDisplayMode before using this function") ); | |
78 | ||
79 | return g_displayDC->getBitsPerPixel(); | |
80 | } | |
81 | ||
82 | int wxGetOsVersion(int *majorVsn, int *minorVsn) | |
83 | { | |
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; | |
95 | #endif | |
96 | } | |
97 | ||
98 | ||
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 | ||
113 | #ifdef __UNIX__ | |
114 | ||
115 | int wxAddProcessCallback(wxEndProcessData *proc_data, int fd) | |
116 | { | |
117 | wxFAIL_MSG(wxT("wxAddProcessCallback not implemented in wxMGL!")); | |
118 | return 0; | |
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 |