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 CHROME_BROWSER_GTK_CONSTRAINED_WINDOW_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_CONSTRAINED_WINDOW_GTK_H_ |
6 #define CHROME_BROWSER_GTK_CONSTRAINED_WINDOW_GTK_H_ | 6 #define CHROME_BROWSER_GTK_CONSTRAINED_WINDOW_GTK_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
10 | 10 |
11 #include "app/gtk_signal.h" | 11 #include "app/gtk_signal.h" |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "chrome/browser/gtk/owned_widget_gtk.h" | 13 #include "chrome/browser/gtk/owned_widget_gtk.h" |
14 #include "chrome/browser/tab_contents/constrained_window.h" | 14 #include "chrome/browser/tab_contents/constrained_window.h" |
15 | 15 |
16 class TabContents; | 16 class TabContents; |
17 class TabContentsViewGtk; | 17 class TabContentsViewGtk; |
18 typedef struct _GtkWidget GtkWidget; | |
19 | 18 |
20 class ConstrainedWindowGtkDelegate { | 19 class ConstrainedWindowGtkDelegate { |
21 public: | 20 public: |
22 // Returns the widget that will be put in the constrained window's container. | 21 // Returns the widget that will be put in the constrained window's container. |
23 virtual GtkWidget* GetWidgetRoot() = 0; | 22 virtual GtkWidget* GetWidgetRoot() = 0; |
24 | 23 |
25 // Tells the delegate to either delete itself or set up a task to delete | 24 // Tells the delegate to either delete itself or set up a task to delete |
26 // itself later. | 25 // itself later. |
27 virtual void DeleteDelegate() = 0; | 26 virtual void DeleteDelegate() = 0; |
28 | 27 |
(...skipping 20 matching lines...) Expand all Loading... |
49 | 48 |
50 // Returns the View that we collaborate with to position ourselves. | 49 // Returns the View that we collaborate with to position ourselves. |
51 TabContentsViewGtk* ContainingView(); | 50 TabContentsViewGtk* ContainingView(); |
52 | 51 |
53 private: | 52 private: |
54 friend class ConstrainedWindow; | 53 friend class ConstrainedWindow; |
55 | 54 |
56 ConstrainedWindowGtk(TabContents* owner, | 55 ConstrainedWindowGtk(TabContents* owner, |
57 ConstrainedWindowGtkDelegate* delegate); | 56 ConstrainedWindowGtkDelegate* delegate); |
58 | 57 |
59 // Connects the ESC accelerator to the window. | 58 // Handler for Escape. |
60 void ConnectAccelerators(); | 59 CHROMEGTK_CALLBACK_1(ConstrainedWindowGtk, gboolean, OnKeyPress, |
61 | 60 GdkEventKey*); |
62 // Handles an ESC accelerator being pressed. | |
63 CHROMEG_CALLBACK_3(ConstrainedWindowGtk, gboolean, OnEscape, GtkAccelGroup*, | |
64 GObject*, guint, GdkModifierType); | |
65 | 61 |
66 // The TabContents that owns and constrains this ConstrainedWindow. | 62 // The TabContents that owns and constrains this ConstrainedWindow. |
67 TabContents* owner_; | 63 TabContents* owner_; |
68 | 64 |
69 // The top level widget container that exports to our TabContentsViewGtk. | 65 // The top level widget container that exports to our TabContentsViewGtk. |
70 OwnedWidgetGtk border_; | 66 OwnedWidgetGtk border_; |
71 | 67 |
72 // Delegate that provides the contents of this constrained window. | 68 // Delegate that provides the contents of this constrained window. |
73 ConstrainedWindowGtkDelegate* delegate_; | 69 ConstrainedWindowGtkDelegate* delegate_; |
74 | 70 |
75 // Stores if |ShowConstrainedWindow()| has been called. | 71 // Stores if |ShowConstrainedWindow()| has been called. |
76 bool visible_; | 72 bool visible_; |
77 | 73 |
78 GtkAccelGroup* accel_group_; | |
79 | |
80 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowGtk); | 74 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowGtk); |
81 }; | 75 }; |
82 | 76 |
83 #endif // CHROME_BROWSER_GTK_CONSTRAINED_WINDOW_GTK_H_ | 77 #endif // CHROME_BROWSER_GTK_CONSTRAINED_WINDOW_GTK_H_ |
OLD | NEW |