]>
git.saurik.com Git - wxWidgets.git/blob - src/mgl/utils.cpp
c20c5db3ef2be391b705c7add7321189ac525bc3
   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(); 
 108 wxToolkitInfo
& wxGUIAppTraits::GetToolkitInfo() 
 110     static wxToolkitInfo info
; 
 111     info
.shortName 
= _T("mgluniv"); 
 112     info
.name 
= _T("wxMGL"); 
 113     info
.versionMajor 
= MGL_RELEASE_MAJOR
; 
 114     info
.versionMinor 
= MGL_RELEASE_MINOR
; 
 116 #if defined(__UNIX__) 
 117     info
.os 
= wxMGL_UNIX
; 
 118 #elif defined(__OS2__) 
 120 #elif defined(__WIN32__) 
 121     info
.os 
= wxMGL_WIN32
; 
 122 #elif defined(__DOS__) 
 125     #error Platform not supported by wxMGL! 
 133 wxToolkitInfo
& wxConsoleAppTraits::GetToolkitInfo() 
 135     static wxToolkitInfo info
; 
 136     info
.shortName 
= _T("mglbase"); 
 137     info
.versionMajor 
= MGL_RELEASE_MAJOR
; 
 138     info
.versionMinor 
= MGL_RELEASE_MINOR
; 
 139     info
.name 
= _T("wxBase"); 
 141 #if defined(__UNIX__) 
 142     info
.os 
= wxMGL_UNIX
; 
 143 #elif defined(__OS2__) 
 145 #elif defined(__WIN32__) 
 146     info
.os 
= wxMGL_WIN32
; 
 147 #elif defined(__DOS__) 
 150     #error Platform not supported by wxMGL! 
 156 void wxGetMousePosition(int* x
, int* y
) 
 161 wxPoint 
wxGetMousePosition() 
 164     wxGetMousePosition(&pt
.x
, &pt
.y
); 
 172 int wxAddProcessCallback(wxEndProcessData 
*proc_data
, int fd
) 
 174     wxFAIL_MSG(wxT("wxAddProcessCallback not implemented in wxMGL!")); 
 176 #if 0 // FIXME_MGL -do we need it at all? 
 177     int tag 
= gdk_input_add(fd
, 
 179                             GTK_EndProcessDetector
, 
 180                             (gpointer
)proc_data
);