]>
git.saurik.com Git - wxWidgets.git/blob - src/mgl/utils.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/mgl/utils.cpp
4 // Author: Vaclav Slavik
6 // Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
20 #include "wx/string.h"
25 #include "wx/apptrait.h"
26 #include "wx/process.h"
31 #include <sys/types.h>
36 #include "wx/unix/execute.h"
39 #include "wx/mgl/private.h"
41 //----------------------------------------------------------------------------
43 //----------------------------------------------------------------------------
50 bool wxGetKeyState(wxKeyCode key
)
52 wxASSERT_MSG(key
!= WXK_LBUTTON
&& key
!= WXK_RBUTTON
&& key
!=
53 WXK_MBUTTON
, wxT("can't use wxGetKeyState() for mouse buttons"));
60 // ----------------------------------------------------------------------------
61 // display characterstics
62 // ----------------------------------------------------------------------------
64 void wxDisplaySize(int *width
, int *height
)
66 wxASSERT_MSG( g_displayDC
, wxT("You must call wxApp::SetDisplayMode before using this function") );
67 if (width
) *width
= g_displayDC
->sizex()+1;
68 if (height
) *height
= g_displayDC
->sizey()+1;
71 void wxDisplaySizeMM(int *width
, int *height
)
73 wxASSERT_MSG( g_displayDC
, wxT("You must call wxApp::SetDisplayMode before using this function") );
76 MGL_getDotsPerInch(&xDPI
, &yDPI
);
79 *width
= (int)((g_displayDC
->sizex()+1) * 25.4 / xDPI
);
81 *height
= (int)((g_displayDC
->sizey()+1) * 25.4 / yDPI
);
84 void wxClientDisplayRect(int *x
, int *y
, int *width
, int *height
)
88 wxDisplaySize(width
, height
);
89 // FIXME_MGL - windowed version needs different handling
92 bool wxColourDisplay()
94 wxASSERT_MSG( g_displayDC
, wxT("You must call wxApp::SetDisplayMode before using this function") );
96 return (wxDisplayDepth() > 1);
101 wxASSERT_MSG( g_displayDC
, wxT("You must call wxApp::SetDisplayMode before using this function") );
103 return g_displayDC
->getBitsPerPixel();
106 wxPortId
wxGUIAppTraits::GetToolkitVersion(int *verMaj
, int *verMin
) const
109 *verMaj
= MGL_RELEASE_MAJOR
;
111 *verMin
= MGL_RELEASE_MINOR
;
116 void wxGetMousePosition(int* x
, int* y
)
121 wxPoint
wxGetMousePosition()
124 wxGetMousePosition(&pt
.x
, &pt
.y
);
128 wxMouseState
wxGetMouseState()
133 wxGetMousePosition(&x
, &y
);
138 extern unsigned long g_buttonState
;
139 ms
.SetLeftDown(g_buttonState
& EVT_LEFTBUT
);
140 ms
.SetMiddleDown(g_buttonState
& EVT_MIDDLEBUT
);
141 ms
.SetRightDown(g_buttonState
& EVT_RIGHTBUT
);
143 ms
.SetControlDown(EVT_isKeyDown(KB_leftCtrl
) || EVT_isKeyDown(KB_rightCtrl
));
144 ms
.SetShiftDown(EVT_isKeyDown(KB_leftShift
) || EVT_isKeyDown(KB_rightShift
));
145 ms
.SetAltDown(EVT_isKeyDown(KB_leftAlt
));
146 ms
.SetMetaDown(EVT_isKeyDown(KB_rightAlt
));
154 int wxAddProcessCallback(wxEndProcessData
*proc_data
, int fd
)
156 wxFAIL_MSG(wxT("wxAddProcessCallback not implemented in wxMGL!"));
158 #if 0 // FIXME_MGL -do we need it at all?
159 int tag
= gdk_input_add(fd
,
161 GTK_EndProcessDetector
,
162 (gpointer
)proc_data
);