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/private/timer.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 wxTimerImpl
*wxGUIAppTraits::CreateTimerImpl(wxTimer
*timer
)
50 return new wxUnixTimerImpl(timer
);
53 // ----------------------------------------------------------------------------
54 // display characteristics
55 // ----------------------------------------------------------------------------
57 bool wxColourDisplay()
59 #warning "FIXME: wxColourDisplay"
65 return wxTheApp
->GetDisplayMode().bpp
;
68 void wxDisplaySize(int *width
, int *height
)
70 wxVideoMode
mode(wxTheApp
->GetDisplayMode());
71 if ( width
) *width
= mode
.w
;
72 if ( height
) *height
= mode
.h
;
75 void wxDisplaySizeMM(int *width
, int *height
)
77 // FIXME: there's no way to get physical resolution using the DirectDB
78 // API, we hardcode a commonly used value of 72dpi
80 #define PX_TO_MM(x) (int(((x) / DPI) * inches2mm))
82 wxDisplaySize(width
, height
);
83 if ( width
) *width
= PX_TO_MM(*width
);
84 if ( height
) *height
= PX_TO_MM(*height
);
90 void wxClientDisplayRect(int *x
, int *y
, int *width
, int *height
)
92 // return desktop dimensions minus any panels, menus, trays:
95 wxDisplaySize(width
, height
);
99 //-----------------------------------------------------------------------------
101 //-----------------------------------------------------------------------------
103 void wxGetMousePosition(int *x
, int *y
)
105 wxIDirectFBDisplayLayerPtr
layer(wxIDirectFB::Get()->GetDisplayLayer());
107 layer
->GetCursorPosition(x
, y
);
110 wxPoint
wxGetMousePosition()
113 wxGetMousePosition(&pt
.x
, &pt
.y
);
117 //-----------------------------------------------------------------------------
119 //-----------------------------------------------------------------------------
121 bool wxGetKeyState(wxKeyCode key
)
123 wxASSERT_MSG(key
!= WXK_LBUTTON
&& key
!= WXK_RBUTTON
&& key
!= WXK_MBUTTON
,
124 "can't use wxGetKeyState() for mouse buttons");
126 return false; // FIXME
129 //----------------------------------------------------------------------------
131 //----------------------------------------------------------------------------