]> git.saurik.com Git - wxWidgets.git/blame - src/mgl/utils.cpp
another memory leak fixed
[wxWidgets.git] / src / mgl / utils.cpp
CommitLineData
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
a246f95e
VS
10// For compilers that support precompilation, includes "wx.h".
11#include "wx/wxprec.h"
12
13#ifdef __BORLANDC__
14 #pragma hdrstop
15#endif
16
32b8ec41
VZ
17#include "wx/utils.h"
18#include "wx/string.h"
19
20#include "wx/intl.h"
21#include "wx/log.h"
32b8ec41
VZ
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
a4bbc9f7
VS
35#include "wx/mgl/private.h"
36
32b8ec41
VZ
37//----------------------------------------------------------------------------
38// misc.
39//----------------------------------------------------------------------------
40
41void wxBell()
42{
43 // FIXME_MGL
44}
45
46// ----------------------------------------------------------------------------
47// display characterstics
48// ----------------------------------------------------------------------------
49
a4bbc9f7 50void wxDisplaySize(int *width, int *height)
32b8ec41 51{
1f43b5c9 52 wxASSERT_MSG( g_displayDC, wxT("You must call wxApp::SetDisplayMode before using this function") );
b8c0528d
VS
53 if (width) *width = g_displayDC->sizex()+1;
54 if (height) *height = g_displayDC->sizey()+1;
32b8ec41
VZ
55}
56
7bdc1879 57void wxDisplaySizeMM(int *width, int *height)
32b8ec41 58{
1f43b5c9 59 wxASSERT_MSG( g_displayDC, wxT("You must call wxApp::SetDisplayMode before using this function") );
2343d81b 60 if ( width )
b8c0528d 61 *width = (g_displayDC->sizex()+1) * 25/72;
2343d81b 62 if ( height )
b8c0528d 63 *height = (g_displayDC->sizey()+1) * 25/72;
7bdc1879 64 // FIXME_MGL -- what about returning *real* monitor dimensions?
a4bbc9f7
VS
65}
66
7bdc1879 67void wxClientDisplayRect(int *x, int *y, int *width, int *height)
a4bbc9f7 68{
58061670
VS
69 if ( x ) *x = 0;
70 if ( y ) *y = 0;
7bdc1879 71 wxDisplaySize(width, height);
58061670 72 // FIXME_MGL - windowed version needs different handling
32b8ec41
VZ
73}
74
75bool wxColourDisplay()
76{
1f43b5c9 77 wxASSERT_MSG( g_displayDC, wxT("You must call wxApp::SetDisplayMode before using this function") );
32b8ec41
VZ
78
79 return (wxDisplayDepth() > 1);
80}
81
82int wxDisplayDepth()
83{
1f43b5c9 84 wxASSERT_MSG( g_displayDC, wxT("You must call wxApp::SetDisplayMode before using this function") );
32b8ec41
VZ
85
86 return g_displayDC->getBitsPerPixel();
87}
88
89int wxGetOsVersion(int *majorVsn, int *minorVsn)
90{
a246f95e
VS
91 if ( majorVsn )
92 *majorVsn = MGL_RELEASE_MAJOR;
93 if ( minorVsn )
94 *minorVsn = MGL_RELEASE_MINOR;
2343d81b
VS
95
96#if defined(__UNIX__)
a246f95e 97 return wxMGL_UNIX;
2343d81b 98#elif defined(__OS2__)
a246f95e 99 return wxMGL_OS2;
2343d81b 100#elif defined(__WIN32__)
a246f95e
VS
101 return wxMGL_WIN32;
102#elif defined(__DOS__)
103 return wxMGL_DOS;
104#else
105 #error Platform not supported by wxMGL!
32b8ec41
VZ
106#endif
107}
108
109
7bdc1879
VS
110void wxGetMousePosition(int* x, int* y)
111{
112 MS_getPos(x, y);
113}
114
115wxPoint wxGetMousePosition()
116{
117 wxPoint pt;
118 wxGetMousePosition(&pt.x, &pt.y);
119 return pt;
120}
121
122
123
32b8ec41
VZ
124#ifdef __UNIX__
125
126int wxAddProcessCallback(wxEndProcessData *proc_data, int fd)
127{
2343d81b
VS
128 wxFAIL_MSG(wxT("wxAddProcessCallback not implemented in wxMGL!"));
129 return 0;
32b8ec41
VZ
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