OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 | 7 |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 | 9 |
10 #include "app/active_window_watcher_x.h" | 10 #include "app/active_window_watcher_x.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 // Retrieves the WidgetGtk associated with |widget|. | 163 // Retrieves the WidgetGtk associated with |widget|. |
164 static WidgetGtk* GetViewForNative(GtkWidget* widget); | 164 static WidgetGtk* GetViewForNative(GtkWidget* widget); |
165 | 165 |
166 // Retrieves the WindowGtk associated with |widget|. | 166 // Retrieves the WindowGtk associated with |widget|. |
167 static WindowGtk* GetWindowForNative(GtkWidget* widget); | 167 static WindowGtk* GetWindowForNative(GtkWidget* widget); |
168 | 168 |
169 // Sets the drop target to NULL. This is invoked by DropTargetGTK when the | 169 // Sets the drop target to NULL. This is invoked by DropTargetGTK when the |
170 // drop is done. | 170 // drop is done. |
171 void ResetDropTarget(); | 171 void ResetDropTarget(); |
172 | 172 |
| 173 // Returns the RootView for |widget|. |
| 174 static RootView* GetRootViewForWidget(GtkWidget* widget); |
| 175 |
173 protected: | 176 protected: |
174 // Returns the view::Event::flags for a GdkEventButton. | 177 // Returns the view::Event::flags for a GdkEventButton. |
175 static int GetFlagsForEventButton(const GdkEventButton& event); | 178 static int GetFlagsForEventButton(const GdkEventButton& event); |
176 | 179 |
177 virtual void OnSizeAllocate(GtkWidget* widget, GtkAllocation* allocation); | 180 virtual void OnSizeAllocate(GtkWidget* widget, GtkAllocation* allocation); |
178 virtual void OnPaint(GtkWidget* widget, GdkEventExpose* event); | 181 virtual void OnPaint(GtkWidget* widget, GdkEventExpose* event); |
179 virtual void OnDragDataGet(GdkDragContext* context, | 182 virtual void OnDragDataGet(GdkDragContext* context, |
180 GtkSelectionData* data, | 183 GtkSelectionData* data, |
181 guint info, | 184 guint info, |
182 guint time); | 185 guint time); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 | 255 |
253 void OnWindowPaint(GtkWidget* widget, GdkEventExpose* event); | 256 void OnWindowPaint(GtkWidget* widget, GdkEventExpose* event); |
254 | 257 |
255 // Process a mouse click | 258 // Process a mouse click |
256 bool ProcessMousePressed(GdkEventButton* event); | 259 bool ProcessMousePressed(GdkEventButton* event); |
257 void ProcessMouseReleased(GdkEventButton* event); | 260 void ProcessMouseReleased(GdkEventButton* event); |
258 | 261 |
259 // Sets the WidgetGtk in the userdata section of the widget. | 262 // Sets the WidgetGtk in the userdata section of the widget. |
260 static void SetViewForNative(GtkWidget* widget, WidgetGtk* view); | 263 static void SetViewForNative(GtkWidget* widget, WidgetGtk* view); |
261 | 264 |
262 static RootView* GetRootViewForWidget(GtkWidget* widget); | |
263 static void SetRootViewForWidget(GtkWidget* widget, RootView* root_view); | 265 static void SetRootViewForWidget(GtkWidget* widget, RootView* root_view); |
264 | 266 |
265 // A set of static signal handlers that bridge | 267 // A set of static signal handlers that bridge |
266 // TODO(beng): alphabetize! | 268 // TODO(beng): alphabetize! |
267 static void CallSizeAllocate(GtkWidget* widget, GtkAllocation* allocation); | 269 static void CallSizeAllocate(GtkWidget* widget, GtkAllocation* allocation); |
268 static gboolean CallPaint(GtkWidget* widget, GdkEventExpose* event); | 270 static gboolean CallPaint(GtkWidget* widget, GdkEventExpose* event); |
269 static gboolean CallWindowPaint(GtkWidget* widget, | 271 static gboolean CallWindowPaint(GtkWidget* widget, |
270 GdkEventExpose* event, | 272 GdkEventExpose* event, |
271 WidgetGtk* widget_gtk); | 273 WidgetGtk* widget_gtk); |
272 static void CallDragDataGet(GtkWidget* widget, | 274 static void CallDragDataGet(GtkWidget* widget, |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 // didn't change. If we didn't cache this and ignore calls when the size | 426 // didn't change. If we didn't cache this and ignore calls when the size |
425 // hasn't changed, we can end up getting stuck in a never ending loop. | 427 // hasn't changed, we can end up getting stuck in a never ending loop. |
426 gfx::Size size_; | 428 gfx::Size size_; |
427 | 429 |
428 DISALLOW_COPY_AND_ASSIGN(WidgetGtk); | 430 DISALLOW_COPY_AND_ASSIGN(WidgetGtk); |
429 }; | 431 }; |
430 | 432 |
431 } // namespace views | 433 } // namespace views |
432 | 434 |
433 #endif // VIEWS_WIDGET_WIDGET_GTK_H_ | 435 #endif // VIEWS_WIDGET_WIDGET_GTK_H_ |
OLD | NEW |