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