]> git.saurik.com Git - wxWidgets.git/blame - src/dfb/utils.cpp
Italian translation corrections from Roberto Boriotti.
[wxWidgets.git] / src / dfb / utils.cpp
CommitLineData
b3c86150
VS
1/////////////////////////////////////////////////////////////////////////////
2// Name: src/dfb/utils.cpp
3// Purpose: Miscellaneous utility functions and classes
4// Author: Vaclav Slavik
5// Created: 2006-08-08
6// RCS-ID: $Id$
7// Copyright: (c) 2006 REA Elektronik GmbH
8// Licence: wxWindows licence
9/////////////////////////////////////////////////////////////////////////////
10
11// For compilers that support precompilation, includes "wx.h".
12#include "wx/wxprec.h"
13
14#ifdef __BORLANDC__
15 #pragma hdrstop
16#endif
17
18#include "wx/utils.h"
b46b1d59 19#include "wx/evtloop.h"
b3c86150
VS
20#include "wx/apptrait.h"
21#include "wx/unix/execute.h"
86e9b8f2 22#include "wx/unix/private/timer.h"
b3c86150
VS
23
24#ifndef WX_PRECOMP
25 #include "wx/app.h"
26#endif
27
28#include "wx/dfb/private.h"
29#include <directfb_version.h>
30
31// ----------------------------------------------------------------------------
32// toolkit info
33// ----------------------------------------------------------------------------
34
35wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, int *verMin) const
36{
37 if ( verMaj ) *verMaj = DIRECTFB_MAJOR_VERSION;
38 if ( verMin ) *verMaj = DIRECTFB_MINOR_VERSION;
39
40 return wxPORT_DFB;
41}
42
b46b1d59 43
2ddff00c 44wxEventLoopBase* wxGUIAppTraits::CreateEventLoop()
b46b1d59
VZ
45{
46 return new wxEventLoop;
2ddff00c
VZ
47}
48
86e9b8f2
VS
49wxTimerImpl *wxGUIAppTraits::CreateTimerImpl(wxTimer *timer)
50{
51 return new wxUnixTimerImpl(timer);
52}
53
b3c86150
VS
54// ----------------------------------------------------------------------------
55// display characteristics
56// ----------------------------------------------------------------------------
57
58bool wxColourDisplay()
59{
60 #warning "FIXME: wxColourDisplay"
61 return true;
62}
63
64int wxDisplayDepth()
65{
66 return wxTheApp->GetDisplayMode().bpp;
67}
68
69void wxDisplaySize(int *width, int *height)
70{
71 wxVideoMode mode(wxTheApp->GetDisplayMode());
72 if ( width ) *width = mode.w;
73 if ( height ) *height = mode.h;
74}
75
76void wxDisplaySizeMM(int *width, int *height)
77{
78 // FIXME: there's no way to get physical resolution using the DirectDB
79 // API, we hardcode a commonly used value of 72dpi
80 #define DPI 72.0
81 #define PX_TO_MM(x) (int(((x) / DPI) * inches2mm))
82
83 wxDisplaySize(width, height);
84 if ( width ) *width = PX_TO_MM(*width);
85 if ( height ) *height = PX_TO_MM(*height);
86
87 #undef DPI
88 #undef PX_TO_MM
89}
90
91void wxClientDisplayRect(int *x, int *y, int *width, int *height)
92{
93 // return desktop dimensions minus any panels, menus, trays:
94 if (x) *x = 0;
95 if (y) *y = 0;
96 wxDisplaySize(width, height);
97}
98
b3c86150
VS
99
100//-----------------------------------------------------------------------------
101// mouse
102//-----------------------------------------------------------------------------
103
104void wxGetMousePosition(int *x, int *y)
105{
a5b31f4e 106 wxIDirectFBDisplayLayerPtr layer(wxIDirectFB::Get()->GetDisplayLayer());
52c8d32a
VS
107 if ( layer )
108 layer->GetCursorPosition(x, y);
b3c86150
VS
109}
110
111wxPoint wxGetMousePosition()
112{
113 wxPoint pt;
114 wxGetMousePosition(&pt.x, &pt.y);
115 return pt;
116}
117
118//-----------------------------------------------------------------------------
119// keyboard
120//-----------------------------------------------------------------------------
121
122bool wxGetKeyState(wxKeyCode key)
123{
124 wxASSERT_MSG(key != WXK_LBUTTON && key != WXK_RBUTTON && key != WXK_MBUTTON,
a5001e93 125 "can't use wxGetKeyState() for mouse buttons");
b3c86150
VS
126
127 return false; // FIXME
128}
129
130//----------------------------------------------------------------------------
131// misc.
132//----------------------------------------------------------------------------
133
134void wxBell()
135{
136}