]> git.saurik.com Git - wxWidgets.git/blob - src/gtk1/utilsgtk.cpp
Get rid of wxMenu::m_startRadioGroup in wxOSX.
[wxWidgets.git] / src / gtk1 / utilsgtk.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/gtk1/utilsgtk.cpp
3 // Purpose:
4 // Author: Robert Roebling
5 // Id: $Id$
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
12
13 #include "wx/utils.h"
14
15 #ifndef WX_PRECOMP
16 #include "wx/string.h"
17 #include "wx/intl.h"
18 #include "wx/log.h"
19 #endif
20
21 #include "wx/apptrait.h"
22 #include "wx/gtk1/private/timer.h"
23 #include "wx/evtloop.h"
24 #include "wx/process.h"
25
26 #include <stdarg.h>
27 #include <string.h>
28 #include <sys/stat.h>
29 #include <sys/types.h>
30 #include <sys/wait.h> // for WNOHANG
31 #include <unistd.h>
32
33 #include "glib.h"
34 #include "gdk/gdk.h"
35 #include "gtk/gtk.h"
36 #include "gtk/gtkfeatures.h"
37 #include "gdk/gdkx.h"
38
39 #ifdef HAVE_X11_XKBLIB_H
40 /* under HP-UX and Solaris 2.6, at least, XKBlib.h defines structures with
41 * field named "explicit" - which is, of course, an error for a C++
42 * compiler. To be on the safe side, just redefine it everywhere. */
43 #define explicit __wx_explicit
44
45 #include "X11/XKBlib.h"
46
47 #undef explicit
48 #endif // HAVE_X11_XKBLIB_H
49
50 //-----------------------------------------------------------------------------
51 // data
52 //-----------------------------------------------------------------------------
53
54 extern GtkWidget *wxGetRootWindow();
55
56 //----------------------------------------------------------------------------
57 // misc.
58 //----------------------------------------------------------------------------
59
60 void wxBell()
61 {
62 gdk_beep();
63 }
64
65 /* Don't synthesize KeyUp events holding down a key and producing
66 KeyDown events with autorepeat. */
67 #ifdef HAVE_X11_XKBLIB_H
68 bool wxSetDetectableAutoRepeat( bool flag )
69 {
70 Bool result;
71 XkbSetDetectableAutoRepeat( GDK_DISPLAY(), flag, &result );
72 return result; /* true if keyboard hardware supports this mode */
73 }
74 #else
75 bool wxSetDetectableAutoRepeat( bool WXUNUSED(flag) )
76 {
77 return false;
78 }
79 #endif
80
81 // ----------------------------------------------------------------------------
82 // display characterstics
83 // ----------------------------------------------------------------------------
84
85 void *wxGetDisplay()
86 {
87 return GDK_DISPLAY();
88 }
89
90 void wxDisplaySize( int *width, int *height )
91 {
92 if (width) *width = gdk_screen_width();
93 if (height) *height = gdk_screen_height();
94 }
95
96 void wxDisplaySizeMM( int *width, int *height )
97 {
98 if (width) *width = gdk_screen_width_mm();
99 if (height) *height = gdk_screen_height_mm();
100 }
101
102 void wxGetMousePosition( int* x, int* y )
103 {
104 gdk_window_get_pointer( NULL, x, y, NULL );
105 }
106
107 bool wxColourDisplay()
108 {
109 return true;
110 }
111
112 int wxDisplayDepth()
113 {
114 return gdk_window_get_visual( wxGetRootWindow()->window )->depth;
115 }
116
117 wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
118 {
119 return wxGenericFindWindowAtPoint(pt);
120 }
121
122
123 // ----------------------------------------------------------------------------
124 // subprocess routines
125 // ----------------------------------------------------------------------------
126
127 #if wxUSE_TIMER
128
129 wxTimerImpl* wxGUIAppTraits::CreateTimerImpl(wxTimer *timer)
130 {
131 return new wxGTKTimerImpl(timer);
132 }
133
134 #endif // wxUSE_TIMER
135
136 // ----------------------------------------------------------------------------
137 // wxPlatformInfo-related
138 // ----------------------------------------------------------------------------
139
140 wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, int *verMin) const
141 {
142 if ( verMaj )
143 *verMaj = gtk_major_version;
144 if ( verMin )
145 *verMin = gtk_minor_version;
146
147 return wxPORT_GTK;
148 }
149
150 wxEventLoopBase* wxGUIAppTraits::CreateEventLoop()
151 {
152 return new wxEventLoop;
153 }
154