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 wxEventLoopBase
* wxGUIAppTraits::CreateEventLoop()
45 return new wxEventLoop
;
48 // ----------------------------------------------------------------------------
49 // display characteristics
50 // ----------------------------------------------------------------------------
52 bool wxColourDisplay()
54 #warning "FIXME: wxColourDisplay"
60 return wxTheApp
->GetDisplayMode().bpp
;
63 void wxDisplaySize(int *width
, int *height
)
65 wxVideoMode
mode(wxTheApp
->GetDisplayMode());
66 if ( width
) *width
= mode
.w
;
67 if ( height
) *height
= mode
.h
;
70 void wxDisplaySizeMM(int *width
, int *height
)
72 // FIXME: there's no way to get physical resolution using the DirectDB
73 // API, we hardcode a commonly used value of 72dpi
75 #define PX_TO_MM(x) (int(((x) / DPI) * inches2mm))
77 wxDisplaySize(width
, height
);
78 if ( width
) *width
= PX_TO_MM(*width
);
79 if ( height
) *height
= PX_TO_MM(*height
);
85 void wxClientDisplayRect(int *x
, int *y
, int *width
, int *height
)
87 // return desktop dimensions minus any panels, menus, trays:
90 wxDisplaySize(width
, height
);
94 //-----------------------------------------------------------------------------
96 //-----------------------------------------------------------------------------
98 void wxGetMousePosition(int *x
, int *y
)
100 wxIDirectFBDisplayLayerPtr
layer(wxIDirectFB::Get()->GetDisplayLayer());
102 layer
->GetCursorPosition(x
, y
);
105 wxPoint
wxGetMousePosition()
108 wxGetMousePosition(&pt
.x
, &pt
.y
);
112 //-----------------------------------------------------------------------------
114 //-----------------------------------------------------------------------------
116 bool wxGetKeyState(wxKeyCode key
)
118 wxASSERT_MSG(key
!= WXK_LBUTTON
&& key
!= WXK_RBUTTON
&& key
!= WXK_MBUTTON
,
119 "can't use wxGetKeyState() for mouse buttons");
121 return false; // FIXME
124 //----------------------------------------------------------------------------
126 //----------------------------------------------------------------------------