]> git.saurik.com Git - wxWidgets.git/blame - src/mgl/utils.cpp
scrollbar handling simplification
[wxWidgets.git] / src / mgl / utils.cpp
CommitLineData
32b8ec41 1/////////////////////////////////////////////////////////////////////////////
df91131c 2// Name: src/mgl/utils.cpp
32b8ec41
VZ
3// Purpose:
4// Author: Vaclav Slavik
5// Id: $Id$
c41c20a5 6// Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
65571936 7// Licence: wxWindows licence
32b8ec41
VZ
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 17#include "wx/utils.h"
df91131c
WS
18
19#ifndef WX_PRECOMP
20 #include "wx/string.h"
88a7a4e1 21 #include "wx/intl.h"
e4db172a 22 #include "wx/log.h"
df91131c 23#endif
32b8ec41 24
cd478a95 25#include "wx/apptrait.h"
32b8ec41
VZ
26#include "wx/process.h"
27
28#include <stdarg.h>
29#include <string.h>
30#include <sys/stat.h>
31#include <sys/types.h>
32#include <unistd.h>
33#include <mgraph.hpp>
34
35#ifdef __UNIX__
36#include "wx/unix/execute.h"
37#endif
38
a4bbc9f7
VS
39#include "wx/mgl/private.h"
40
32b8ec41
VZ
41//----------------------------------------------------------------------------
42// misc.
43//----------------------------------------------------------------------------
44
45void wxBell()
46{
47 // FIXME_MGL
48}
49
50// ----------------------------------------------------------------------------
51// display characterstics
52// ----------------------------------------------------------------------------
53
a4bbc9f7 54void wxDisplaySize(int *width, int *height)
32b8ec41 55{
9210a48a 56 wxASSERT_MSG( g_displayDC, wxT("You must call wxApp::SetDisplayMode before using this function") );
b8c0528d
VS
57 if (width) *width = g_displayDC->sizex()+1;
58 if (height) *height = g_displayDC->sizey()+1;
32b8ec41
VZ
59}
60
7bdc1879 61void wxDisplaySizeMM(int *width, int *height)
32b8ec41 62{
1f43b5c9 63 wxASSERT_MSG( g_displayDC, wxT("You must call wxApp::SetDisplayMode before using this function") );
39578f9c
VS
64
65 int xDPI, yDPI;
99f0cdf2
WS
66 MGL_getDotsPerInch(&xDPI, &yDPI);
67
68 if ( width )
39578f9c 69 *width = (int)((g_displayDC->sizex()+1) * 25.4 / xDPI);
99f0cdf2 70 if ( height )
39578f9c 71 *height = (int)((g_displayDC->sizey()+1) * 25.4 / yDPI);
a4bbc9f7
VS
72}
73
7bdc1879 74void wxClientDisplayRect(int *x, int *y, int *width, int *height)
a4bbc9f7 75{
58061670
VS
76 if ( x ) *x = 0;
77 if ( y ) *y = 0;
7bdc1879 78 wxDisplaySize(width, height);
58061670 79 // FIXME_MGL - windowed version needs different handling
32b8ec41
VZ
80}
81
82bool wxColourDisplay()
83{
1f43b5c9 84 wxASSERT_MSG( g_displayDC, wxT("You must call wxApp::SetDisplayMode before using this function") );
99f0cdf2 85
32b8ec41
VZ
86 return (wxDisplayDepth() > 1);
87}
88
89int wxDisplayDepth()
90{
1f43b5c9 91 wxASSERT_MSG( g_displayDC, wxT("You must call wxApp::SetDisplayMode before using this function") );
32b8ec41
VZ
92
93 return g_displayDC->getBitsPerPixel();
94}
95
1c53456f
VS
96#if wxUSE_GUI
97
752464f9 98wxToolkitInfo& wxGUIAppTraits::GetToolkitInfo()
32b8ec41 99{
752464f9
VS
100 static wxToolkitInfo info;
101 info.shortName = _T("mgluniv");
102 info.name = _T("wxMGL");
103 info.versionMajor = MGL_RELEASE_MAJOR;
104 info.versionMinor = MGL_RELEASE_MINOR;
105 info.os = wxGTK;
2343d81b 106#if defined(__UNIX__)
752464f9 107 info.os = wxMGL_UNIX;
2343d81b 108#elif defined(__OS2__)
752464f9 109 info.os = wxMGL_OS2;
2343d81b 110#elif defined(__WIN32__)
752464f9 111 info.os = wxMGL_WIN32;
a246f95e 112#elif defined(__DOS__)
752464f9 113 info.os = wxMGL_DOS;
a246f95e
VS
114#else
115 #error Platform not supported by wxMGL!
32b8ec41 116#endif
752464f9 117 return info;
32b8ec41
VZ
118}
119
1c53456f
VS
120#endif
121
83d8eb47 122#if 0
1c53456f
VS
123wxToolkitInfo& wxConsoleAppTraits::GetToolkitInfo()
124{
125 static wxToolkitInfo info;
126 info.shortName = _T("mglbase");
127 info.versionMajor = MGL_RELEASE_MAJOR;
128 info.versionMinor = MGL_RELEASE_MINOR;
129 info.name = _T("wxBase");
130 info.os = wxGTK;
131#if defined(__UNIX__)
132 info.os = wxMGL_UNIX;
133#elif defined(__OS2__)
134 info.os = wxMGL_OS2;
135#elif defined(__WIN32__)
136 info.os = wxMGL_WIN32;
137#elif defined(__DOS__)
138 info.os = wxMGL_DOS;
139#else
140 #error Platform not supported by wxMGL!
141#endif
142 return info;
143}
83d8eb47 144#endif
32b8ec41 145
7bdc1879
VS
146void wxGetMousePosition(int* x, int* y)
147{
148 MS_getPos(x, y);
149}
150
151wxPoint wxGetMousePosition()
152{
153 wxPoint pt;
154 wxGetMousePosition(&pt.x, &pt.y);
155 return pt;
156}
157
158
159
32b8ec41
VZ
160#ifdef __UNIX__
161
162int wxAddProcessCallback(wxEndProcessData *proc_data, int fd)
163{
2343d81b
VS
164 wxFAIL_MSG(wxT("wxAddProcessCallback not implemented in wxMGL!"));
165 return 0;
32b8ec41
VZ
166#if 0 // FIXME_MGL -do we need it at all?
167 int tag = gdk_input_add(fd,
168 GDK_INPUT_READ,
169 GTK_EndProcessDetector,
170 (gpointer)proc_data);
171
172 return tag;
173#endif
174}
175
176#endif