]> git.saurik.com Git - wxWidgets.git/blob - src/mgl/utils.cpp
Added clipboard cut and paste
[wxWidgets.git] / src / mgl / utils.cpp
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 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
12
13 #ifdef __BORLANDC__
14 #pragma hdrstop
15 #endif
16
17 #include "wx/utils.h"
18 #include "wx/string.h"
19
20 #include "wx/intl.h"
21 #include "wx/log.h"
22 #include "wx/process.h"
23
24 #include <stdarg.h>
25 #include <string.h>
26 #include <sys/stat.h>
27 #include <sys/types.h>
28 #include <unistd.h>
29 #include <mgraph.hpp>
30
31 #ifdef __UNIX__
32 #include "wx/unix/execute.h"
33 #endif
34
35 #include "wx/mgl/private.h"
36
37 //----------------------------------------------------------------------------
38 // misc.
39 //----------------------------------------------------------------------------
40
41 void wxBell()
42 {
43 // FIXME_MGL
44 }
45
46 // ----------------------------------------------------------------------------
47 // display characterstics
48 // ----------------------------------------------------------------------------
49
50 void wxDisplaySize(int *width, int *height)
51 {
52 wxASSERT_MSG( g_displayDC, wxT("You must call wxApp::SetDisplayMode before using this function") );
53 if (width) *width = g_displayDC->sizex()+1;
54 if (height) *height = g_displayDC->sizey()+1;
55 }
56
57 void wxDisplaySizeMM(int *width, int *height)
58 {
59 wxASSERT_MSG( g_displayDC, wxT("You must call wxApp::SetDisplayMode before using this function") );
60 if ( width )
61 *width = (g_displayDC->sizex()+1) * 25/72;
62 if ( height )
63 *height = (g_displayDC->sizey()+1) * 25/72;
64 // FIXME_MGL -- what about returning *real* monitor dimensions?
65 }
66
67 void wxClientDisplayRect(int *x, int *y, int *width, int *height)
68 {
69 if ( x ) *x = 0;
70 if ( y ) *y = 0;
71 wxDisplaySize(width, height);
72 // FIXME_MGL - windowed version needs different handling
73 }
74
75 bool wxColourDisplay()
76 {
77 wxASSERT_MSG( g_displayDC, wxT("You must call wxApp::SetDisplayMode before using this function") );
78
79 return (wxDisplayDepth() > 1);
80 }
81
82 int wxDisplayDepth()
83 {
84 wxASSERT_MSG( g_displayDC, wxT("You must call wxApp::SetDisplayMode before using this function") );
85
86 return g_displayDC->getBitsPerPixel();
87 }
88
89 int wxGetOsVersion(int *majorVsn, int *minorVsn)
90 {
91 if ( majorVsn )
92 *majorVsn = MGL_RELEASE_MAJOR;
93 if ( minorVsn )
94 *minorVsn = MGL_RELEASE_MINOR;
95
96 #if defined(__UNIX__)
97 return wxMGL_UNIX;
98 #elif defined(__OS2__)
99 return wxMGL_OS2;
100 #elif defined(__WIN32__)
101 return wxMGL_WIN32;
102 #elif defined(__DOS__)
103 return wxMGL_DOS;
104 #else
105 #error Platform not supported by wxMGL!
106 #endif
107 }
108
109
110 void wxGetMousePosition(int* x, int* y)
111 {
112 MS_getPos(x, y);
113 }
114
115 wxPoint wxGetMousePosition()
116 {
117 wxPoint pt;
118 wxGetMousePosition(&pt.x, &pt.y);
119 return pt;
120 }
121
122
123
124 #ifdef __UNIX__
125
126 int wxAddProcessCallback(wxEndProcessData *proc_data, int fd)
127 {
128 wxFAIL_MSG(wxT("wxAddProcessCallback not implemented in wxMGL!"));
129 return 0;
130 #if 0 // FIXME_MGL -do we need it at all?
131 int tag = gdk_input_add(fd,
132 GDK_INPUT_READ,
133 GTK_EndProcessDetector,
134 (gpointer)proc_data);
135
136 return tag;
137 #endif
138 }
139
140 #endif