OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_WIDGET_GTK_H_ | 5 #ifndef VIEWS_WIDGET_WIDGET_GTK_H_ |
6 #define VIEWS_WIDGET_WIDGET_GTK_H_ | 6 #define VIEWS_WIDGET_WIDGET_GTK_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
10 | 10 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 virtual bool ContainsNativeView(gfx::NativeView native_view); | 191 virtual bool ContainsNativeView(gfx::NativeView native_view); |
192 | 192 |
193 // Overridden from FocusTraversable: | 193 // Overridden from FocusTraversable: |
194 virtual FocusSearch* GetFocusSearch(); | 194 virtual FocusSearch* GetFocusSearch(); |
195 virtual FocusTraversable* GetFocusTraversableParent(); | 195 virtual FocusTraversable* GetFocusTraversableParent(); |
196 virtual View* GetFocusTraversableParentView(); | 196 virtual View* GetFocusTraversableParentView(); |
197 | 197 |
198 // Clears the focus on the native widget having the focus. | 198 // Clears the focus on the native widget having the focus. |
199 virtual void ClearNativeFocus(); | 199 virtual void ClearNativeFocus(); |
200 | 200 |
| 201 // Handles a keyboard event by sending it to our focus manager. |
| 202 // Returns true if it's handled by the focus manager. |
| 203 bool HandleKeyboardEvent(GdkEventKey* event); |
| 204 |
201 protected: | 205 protected: |
202 // If widget containes another widget, translates event coordinates to the | 206 // If widget containes another widget, translates event coordinates to the |
203 // contained widget's coordinates, else returns original event coordinates. | 207 // contained widget's coordinates, else returns original event coordinates. |
204 template<class Event> bool GetContainedWidgetEventCoordinates(Event* event, | 208 template<class Event> bool GetContainedWidgetEventCoordinates(Event* event, |
205 int* x, | 209 int* x, |
206 int* y) { | 210 int* y) { |
207 if (event == NULL || x == NULL || y == NULL) | 211 if (event == NULL || x == NULL || y == NULL) |
208 return false; | 212 return false; |
209 *x = event->x; | 213 *x = event->x; |
210 *y = event->y; | 214 *y = event->y; |
(...skipping 29 matching lines...) Expand all Loading... |
240 CHROMEGTK_CALLBACK_2(WidgetGtk, void, OnDragLeave, | 244 CHROMEGTK_CALLBACK_2(WidgetGtk, void, OnDragLeave, |
241 GdkDragContext*, guint); | 245 GdkDragContext*, guint); |
242 CHROMEGTK_CALLBACK_4(WidgetGtk, gboolean, OnDragMotion, | 246 CHROMEGTK_CALLBACK_4(WidgetGtk, gboolean, OnDragMotion, |
243 GdkDragContext*, gint, gint, guint); | 247 GdkDragContext*, gint, gint, guint); |
244 CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnEnterNotify, GdkEventCrossing*); | 248 CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnEnterNotify, GdkEventCrossing*); |
245 CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnLeaveNotify, GdkEventCrossing*); | 249 CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnLeaveNotify, GdkEventCrossing*); |
246 CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnMotionNotify, GdkEventMotion*); | 250 CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnMotionNotify, GdkEventMotion*); |
247 CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnButtonRelease, GdkEventButton*); | 251 CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnButtonRelease, GdkEventButton*); |
248 CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnFocusIn, GdkEventFocus*); | 252 CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnFocusIn, GdkEventFocus*); |
249 CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnFocusOut, GdkEventFocus*); | 253 CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnFocusOut, GdkEventFocus*); |
250 CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnKeyPress, GdkEventKey*); | 254 CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnKeyEvent, GdkEventKey*); |
251 CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnKeyRelease, GdkEventKey*); | |
252 CHROMEGTK_CALLBACK_4(WidgetGtk, gboolean, OnQueryTooltip, | 255 CHROMEGTK_CALLBACK_4(WidgetGtk, gboolean, OnQueryTooltip, |
253 gint, gint, gboolean, GtkTooltip*); | 256 gint, gint, gboolean, GtkTooltip*); |
254 CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnScroll, GdkEventScroll*); | 257 CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnScroll, GdkEventScroll*); |
255 CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnVisibilityNotify, | 258 CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnVisibilityNotify, |
256 GdkEventVisibility*); | 259 GdkEventVisibility*); |
257 CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnGrabBrokeEvent, GdkEvent*); | 260 CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnGrabBrokeEvent, GdkEvent*); |
258 CHROMEGTK_CALLBACK_1(WidgetGtk, void, OnGrabNotify, gboolean); | 261 CHROMEGTK_CALLBACK_1(WidgetGtk, void, OnGrabNotify, gboolean); |
259 CHROMEGTK_CALLBACK_0(WidgetGtk, void, OnDestroy); | 262 CHROMEGTK_CALLBACK_0(WidgetGtk, void, OnDestroy); |
260 CHROMEGTK_CALLBACK_0(WidgetGtk, void, OnShow); | 263 CHROMEGTK_CALLBACK_0(WidgetGtk, void, OnShow); |
261 CHROMEGTK_CALLBACK_0(WidgetGtk, void, OnHide); | 264 CHROMEGTK_CALLBACK_0(WidgetGtk, void, OnHide); |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 WidgetDelegate* delegate_; | 432 WidgetDelegate* delegate_; |
430 | 433 |
431 // If true, the window stays on top of the screen. This is only used | 434 // If true, the window stays on top of the screen. This is only used |
432 // for types other than TYPE_CHILD. | 435 // for types other than TYPE_CHILD. |
433 bool always_on_top_; | 436 bool always_on_top_; |
434 | 437 |
435 // If true, we enable the content widget's double buffering. | 438 // If true, we enable the content widget's double buffering. |
436 // This is false by default. | 439 // This is false by default. |
437 bool is_double_buffered_; | 440 bool is_double_buffered_; |
438 | 441 |
| 442 // Indicates if we should handle the upcoming Alt key release event. |
| 443 bool should_handle_menu_key_release_; |
| 444 |
439 DISALLOW_COPY_AND_ASSIGN(WidgetGtk); | 445 DISALLOW_COPY_AND_ASSIGN(WidgetGtk); |
440 }; | 446 }; |
441 | 447 |
442 } // namespace views | 448 } // namespace views |
443 | 449 |
444 #endif // VIEWS_WIDGET_WIDGET_GTK_H_ | 450 #endif // VIEWS_WIDGET_WIDGET_GTK_H_ |
OLD | NEW |