]> git.saurik.com Git - wxWidgets.git/blob - src/dfb/utils.cpp
support real transparency for controls that return HasTransparentBackground() in...
[wxWidgets.git] / src / dfb / utils.cpp
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"
19 #include "wx/evtloop.h"
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
42
43 wxEventLoopBase* wxGUIAppTraits::CreateEventLoop()
44 {
45 return new wxEventLoop;
46 }
47
48 // ----------------------------------------------------------------------------
49 // display characteristics
50 // ----------------------------------------------------------------------------
51
52 bool wxColourDisplay()
53 {
54 #warning "FIXME: wxColourDisplay"
55 return true;
56 }
57
58 int wxDisplayDepth()
59 {
60 return wxTheApp->GetDisplayMode().bpp;
61 }
62
63 void wxDisplaySize(int *width, int *height)
64 {
65 wxVideoMode mode(wxTheApp->GetDisplayMode());
66 if ( width ) *width = mode.w;
67 if ( height ) *height = mode.h;
68 }
69
70 void wxDisplaySizeMM(int *width, int *height)
71 {
72 // FIXME: there's no way to get physical resolution using the DirectDB
73 // API, we hardcode a commonly used value of 72dpi
74 #define DPI 72.0
75 #define PX_TO_MM(x) (int(((x) / DPI) * inches2mm))
76
77 wxDisplaySize(width, height);
78 if ( width ) *width = PX_TO_MM(*width);
79 if ( height ) *height = PX_TO_MM(*height);
80
81 #undef DPI
82 #undef PX_TO_MM
83 }
84
85 void wxClientDisplayRect(int *x, int *y, int *width, int *height)
86 {
87 // return desktop dimensions minus any panels, menus, trays:
88 if (x) *x = 0;
89 if (y) *y = 0;
90 wxDisplaySize(width, height);
91 }
92
93
94 //-----------------------------------------------------------------------------
95 // mouse
96 //-----------------------------------------------------------------------------
97
98 void wxGetMousePosition(int *x, int *y)
99 {
100 wxIDirectFBDisplayLayerPtr layer(wxIDirectFB::Get()->GetDisplayLayer());
101 if ( layer )
102 layer->GetCursorPosition(x, y);
103 }
104
105 wxPoint wxGetMousePosition()
106 {
107 wxPoint pt;
108 wxGetMousePosition(&pt.x, &pt.y);
109 return pt;
110 }
111
112 //-----------------------------------------------------------------------------
113 // keyboard
114 //-----------------------------------------------------------------------------
115
116 bool wxGetKeyState(wxKeyCode key)
117 {
118 wxASSERT_MSG(key != WXK_LBUTTON && key != WXK_RBUTTON && key != WXK_MBUTTON,
119 _T("can't use wxGetKeyState() for mouse buttons"));
120
121 return false; // FIXME
122 }
123
124 //----------------------------------------------------------------------------
125 // misc.
126 //----------------------------------------------------------------------------
127
128 void wxBell()
129 {
130 }
131
132 int wxAddProcessCallback(wxEndProcessData *proc_data, int fd)
133 {
134 wxFAIL_MSG( _T("wxAddProcessCallback not implemented") );
135 return 0;
136 }