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