OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef VIEWS_WIDGET_NATIVE_WIDGET_GTK_H_ | 5 #ifndef VIEWS_WIDGET_NATIVE_WIDGET_GTK_H_ |
6 #define VIEWS_WIDGET_NATIVE_WIDGET_GTK_H_ | 6 #define VIEWS_WIDGET_NATIVE_WIDGET_GTK_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
10 | 10 |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 if (event && event->window != dest) { | 231 if (event && event->window != dest) { |
232 gint dest_x, dest_y; | 232 gint dest_x, dest_y; |
233 gdk_window_get_root_origin(dest, &dest_x, &dest_y); | 233 gdk_window_get_root_origin(dest, &dest_x, &dest_y); |
234 event->x = event->x_root - dest_x; | 234 event->x = event->x_root - dest_x; |
235 event->y = event->y_root - dest_y; | 235 event->y = event->y_root - dest_y; |
236 } | 236 } |
237 return reinterpret_cast<GdkEvent*>(event); | 237 return reinterpret_cast<GdkEvent*>(event); |
238 } | 238 } |
239 | 239 |
240 // Event handlers: | 240 // Event handlers: |
241 CHROMEGTK_CALLBACK_1(NativeWidgetGtk, gboolean, OnButtonPress, | 241 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, gboolean, OnButtonPress, |
242 GdkEventButton*); | 242 GdkEventButton*); |
243 CHROMEGTK_CALLBACK_1(NativeWidgetGtk, void, OnSizeRequest, GtkRequisition*); | 243 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, void, OnSizeRequest, |
244 CHROMEGTK_CALLBACK_1(NativeWidgetGtk, void, OnSizeAllocate, GtkAllocation*); | 244 GtkRequisition*); |
245 CHROMEGTK_CALLBACK_1(NativeWidgetGtk, gboolean, OnPaint, GdkEventExpose*); | 245 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, void, OnSizeAllocate, |
246 CHROMEGTK_CALLBACK_4(NativeWidgetGtk, void, OnDragDataGet, | 246 GtkAllocation*); |
247 GdkDragContext*, GtkSelectionData*, guint, guint); | 247 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, gboolean, OnPaint, |
248 CHROMEGTK_CALLBACK_6(NativeWidgetGtk, void, OnDragDataReceived, | 248 GdkEventExpose*); |
249 GdkDragContext*, gint, gint, GtkSelectionData*, | 249 CHROMEGTK_VIRTUAL_CALLBACK_4(NativeWidgetGtk, void, OnDragDataGet, |
250 guint, guint); | 250 GdkDragContext*, GtkSelectionData*, guint, |
251 CHROMEGTK_CALLBACK_4(NativeWidgetGtk, gboolean, OnDragDrop, | 251 guint); |
252 GdkDragContext*, gint, gint, guint); | 252 CHROMEGTK_VIRTUAL_CALLBACK_6(NativeWidgetGtk, void, OnDragDataReceived, |
253 CHROMEGTK_CALLBACK_1(NativeWidgetGtk, void, OnDragEnd, GdkDragContext*); | 253 GdkDragContext*, gint, gint, GtkSelectionData*, |
254 CHROMEGTK_CALLBACK_2(NativeWidgetGtk, gboolean, OnDragFailed, | 254 guint, guint); |
255 GdkDragContext*, GtkDragResult); | 255 CHROMEGTK_VIRTUAL_CALLBACK_4(NativeWidgetGtk, gboolean, OnDragDrop, |
256 CHROMEGTK_CALLBACK_2(NativeWidgetGtk, void, OnDragLeave, | 256 GdkDragContext*, gint, gint, guint); |
257 GdkDragContext*, guint); | 257 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, void, OnDragEnd, |
258 CHROMEGTK_CALLBACK_4(NativeWidgetGtk, gboolean, OnDragMotion, | 258 GdkDragContext*); |
259 GdkDragContext*, gint, gint, guint); | 259 CHROMEGTK_VIRTUAL_CALLBACK_2(NativeWidgetGtk, gboolean, OnDragFailed, |
260 CHROMEGTK_CALLBACK_1(NativeWidgetGtk, gboolean, OnEnterNotify, | 260 GdkDragContext*, GtkDragResult); |
261 GdkEventCrossing*); | 261 CHROMEGTK_VIRTUAL_CALLBACK_2(NativeWidgetGtk, void, OnDragLeave, |
262 CHROMEGTK_CALLBACK_1(NativeWidgetGtk, gboolean, OnLeaveNotify, | 262 GdkDragContext*, guint); |
263 GdkEventCrossing*); | 263 CHROMEGTK_VIRTUAL_CALLBACK_4(NativeWidgetGtk, gboolean, OnDragMotion, |
264 CHROMEGTK_CALLBACK_1(NativeWidgetGtk, gboolean, OnMotionNotify, | 264 GdkDragContext*, gint, gint, guint); |
265 GdkEventMotion*); | 265 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, gboolean, OnEnterNotify, |
266 CHROMEGTK_CALLBACK_1(NativeWidgetGtk, gboolean, OnButtonRelease, | 266 GdkEventCrossing*); |
267 GdkEventButton*); | 267 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, gboolean, OnLeaveNotify, |
268 CHROMEGTK_CALLBACK_1(NativeWidgetGtk, gboolean, OnFocusIn, GdkEventFocus*); | 268 GdkEventCrossing*); |
269 CHROMEGTK_CALLBACK_1(NativeWidgetGtk, gboolean, OnFocusOut, GdkEventFocus*); | 269 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, gboolean, OnMotionNotify, |
270 CHROMEGTK_CALLBACK_1(NativeWidgetGtk, gboolean, OnEventKey, GdkEventKey*); | 270 GdkEventMotion*); |
271 CHROMEGTK_CALLBACK_4(NativeWidgetGtk, gboolean, OnQueryTooltip, | 271 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, gboolean, OnButtonRelease, |
272 gint, gint, gboolean, GtkTooltip*); | 272 GdkEventButton*); |
273 CHROMEGTK_CALLBACK_1(NativeWidgetGtk, gboolean, OnScroll, GdkEventScroll*); | 273 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, gboolean, OnFocusIn, |
274 CHROMEGTK_CALLBACK_1(NativeWidgetGtk, gboolean, OnVisibilityNotify, | 274 GdkEventFocus*); |
275 GdkEventVisibility*); | 275 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, gboolean, OnFocusOut, |
276 CHROMEGTK_CALLBACK_1(NativeWidgetGtk, gboolean, OnGrabBrokeEvent, GdkEvent*); | 276 GdkEventFocus*); |
277 CHROMEGTK_CALLBACK_1(NativeWidgetGtk, void, OnGrabNotify, gboolean); | 277 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, gboolean, OnEventKey, |
278 CHROMEGTK_CALLBACK_0(NativeWidgetGtk, void, OnDestroy); | 278 GdkEventKey*); |
279 CHROMEGTK_CALLBACK_0(NativeWidgetGtk, void, OnShow); | 279 CHROMEGTK_VIRTUAL_CALLBACK_4(NativeWidgetGtk, gboolean, OnQueryTooltip, gint, |
280 CHROMEGTK_CALLBACK_0(NativeWidgetGtk, void, OnMap); | 280 gint, gboolean, GtkTooltip*); |
281 CHROMEGTK_CALLBACK_0(NativeWidgetGtk, void, OnHide); | 281 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, gboolean, OnScroll, |
282 CHROMEGTK_CALLBACK_1(NativeWidgetGtk, gboolean, OnWindowStateEvent, | 282 GdkEventScroll*); |
283 GdkEventWindowState*); | 283 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, gboolean, OnVisibilityNotify, |
284 CHROMEGTK_CALLBACK_1(NativeWidgetGtk, gboolean, OnConfigureEvent, | 284 GdkEventVisibility*); |
285 GdkEventConfigure*); | 285 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, gboolean, OnGrabBrokeEvent, |
| 286 GdkEvent*); |
| 287 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, void, OnGrabNotify, gboolean); |
| 288 CHROMEGTK_VIRTUAL_CALLBACK_0(NativeWidgetGtk, void, OnDestroy); |
| 289 CHROMEGTK_VIRTUAL_CALLBACK_0(NativeWidgetGtk, void, OnShow); |
| 290 CHROMEGTK_VIRTUAL_CALLBACK_0(NativeWidgetGtk, void, OnMap); |
| 291 CHROMEGTK_VIRTUAL_CALLBACK_0(NativeWidgetGtk, void, OnHide); |
| 292 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, gboolean, OnWindowStateEvent, |
| 293 GdkEventWindowState*); |
| 294 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, gboolean, OnConfigureEvent, |
| 295 GdkEventConfigure*); |
286 | 296 |
287 // Invoked when the widget is destroyed and right before the object | 297 // Invoked when the widget is destroyed and right before the object |
288 // destruction. Useful for overriding. | 298 // destruction. Useful for overriding. |
289 virtual void OnDestroyed(GObject *where_the_object_was); | 299 virtual void OnDestroyed(GObject *where_the_object_was); |
290 static void OnDestroyedThunk(gpointer data, GObject *where_the_object_was) { | 300 static void OnDestroyedThunk(gpointer data, GObject *where_the_object_was) { |
291 reinterpret_cast<NativeWidgetGtk*>(data)->OnDestroyed(where_the_object_was); | 301 reinterpret_cast<NativeWidgetGtk*>(data)->OnDestroyed(where_the_object_was); |
292 } | 302 } |
293 | 303 |
294 // Invoked when gtk grab is stolen by other GtkWidget in the same | 304 // Invoked when gtk grab is stolen by other GtkWidget in the same |
295 // application. | 305 // application. |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 bool is_menu_; | 467 bool is_menu_; |
458 | 468 |
459 scoped_ptr<ui::GtkSignalRegistrar> signal_registrar_; | 469 scoped_ptr<ui::GtkSignalRegistrar> signal_registrar_; |
460 | 470 |
461 DISALLOW_COPY_AND_ASSIGN(NativeWidgetGtk); | 471 DISALLOW_COPY_AND_ASSIGN(NativeWidgetGtk); |
462 }; | 472 }; |
463 | 473 |
464 } // namespace views | 474 } // namespace views |
465 | 475 |
466 #endif // VIEWS_WIDGET_NATIVE_WIDGET_GTK_H_ | 476 #endif // VIEWS_WIDGET_NATIVE_WIDGET_GTK_H_ |
OLD | NEW |