1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/dfb/utils.cpp
3 // Purpose: Miscellaneous utility functions and classes
4 // Author: Vaclav Slavik
7 // Copyright: (c) 2006 REA Elektronik GmbH
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
19 #include "wx/evtloop.h"
20 #include "wx/apptrait.h"
21 #include "wx/unix/execute.h"
27 #include "wx/dfb/private.h"
28 #include <directfb_version.h>
30 // ----------------------------------------------------------------------------
32 // ----------------------------------------------------------------------------
34 wxPortId
wxGUIAppTraits::GetToolkitVersion(int *verMaj
, int *verMin
) const
36 if ( verMaj
) *verMaj
= DIRECTFB_MAJOR_VERSION
;
37 if ( verMin
) *verMaj
= DIRECTFB_MINOR_VERSION
;
43 wxEventLoop
* wxGUIAppTraits::CreateEventLoop()
45 return new wxEventLoop
;
47 // ----------------------------------------------------------------------------
48 // display characteristics
49 // ----------------------------------------------------------------------------
51 bool wxColourDisplay()
53 #warning "FIXME: wxColourDisplay"
59 return wxTheApp
->GetDisplayMode().bpp
;
62 void wxDisplaySize(int *width
, int *height
)
64 wxVideoMode
mode(wxTheApp
->GetDisplayMode());
65 if ( width
) *width
= mode
.w
;
66 if ( height
) *height
= mode
.h
;
69 void wxDisplaySizeMM(int *width
, int *height
)
71 // FIXME: there's no way to get physical resolution using the DirectDB
72 // API, we hardcode a commonly used value of 72dpi
74 #define PX_TO_MM(x) (int(((x) / DPI) * inches2mm))
76 wxDisplaySize(width
, height
);
77 if ( width
) *width
= PX_TO_MM(*width
);
78 if ( height
) *height
= PX_TO_MM(*height
);
84 void wxClientDisplayRect(int *x
, int *y
, int *width
, int *height
)
86 // return desktop dimensions minus any panels, menus, trays:
89 wxDisplaySize(width
, height
);
93 //-----------------------------------------------------------------------------
95 //-----------------------------------------------------------------------------
97 void wxGetMousePosition(int *x
, int *y
)
99 wxIDirectFBDisplayLayerPtr
layer(wxIDirectFB::Get()->GetDisplayLayer());
101 layer
->GetCursorPosition(x
, y
);
104 wxPoint
wxGetMousePosition()
107 wxGetMousePosition(&pt
.x
, &pt
.y
);
111 //-----------------------------------------------------------------------------
113 //-----------------------------------------------------------------------------
115 bool wxGetKeyState(wxKeyCode key
)
117 wxASSERT_MSG(key
!= WXK_LBUTTON
&& key
!= WXK_RBUTTON
&& key
!= WXK_MBUTTON
,
118 _T("can't use wxGetKeyState() for mouse buttons"));
120 return false; // FIXME
123 //----------------------------------------------------------------------------
125 //----------------------------------------------------------------------------
131 int wxAddProcessCallback(wxEndProcessData
*proc_data
, int fd
)
133 wxFAIL_MSG( _T("wxAddProcessCallback not implemented") );