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_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_GTK_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_GTK_H_ |
6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_GTK_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_GTK_H_ |
7 | 7 |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
15 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" | 15 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" |
16 #include "chrome/browser/toolbar_model.h" | 16 #include "chrome/browser/toolbar_model.h" |
17 #include "chrome/common/notification_observer.h" | 17 #include "chrome/common/notification_observer.h" |
18 #include "chrome/common/notification_registrar.h" | 18 #include "chrome/common/notification_registrar.h" |
19 #include "chrome/common/owned_widget_gtk.h" | 19 #include "chrome/common/owned_widget_gtk.h" |
20 #include "chrome/common/page_transition_types.h" | 20 #include "chrome/common/page_transition_types.h" |
21 #include "webkit/glue/window_open_disposition.h" | 21 #include "webkit/glue/window_open_disposition.h" |
22 | 22 |
23 class AutocompleteEditController; | 23 class AutocompleteEditController; |
24 class AutocompleteEditModel; | 24 class AutocompleteEditModel; |
25 class AutocompletePopupPositioner; | |
26 class AutocompletePopupView; | 25 class AutocompletePopupView; |
| 26 class BubblePositioner; |
27 class CommandUpdater; | 27 class CommandUpdater; |
28 class Profile; | 28 class Profile; |
29 class TabContents; | 29 class TabContents; |
30 | 30 |
31 #if !defined(TOOLKIT_VIEWS) | 31 #if !defined(TOOLKIT_VIEWS) |
32 class GtkThemeProvider; | 32 class GtkThemeProvider; |
33 #endif | 33 #endif |
34 | 34 |
35 class AutocompleteEditViewGtk : public AutocompleteEditView, | 35 class AutocompleteEditViewGtk : public AutocompleteEditView, |
36 public NotificationObserver { | 36 public NotificationObserver { |
37 public: | 37 public: |
38 // Modeled like the Windows CHARRANGE. Represent a pair of cursor position | 38 // Modeled like the Windows CHARRANGE. Represent a pair of cursor position |
39 // offsets. Since GtkTextIters are invalid after the buffer is changed, we | 39 // offsets. Since GtkTextIters are invalid after the buffer is changed, we |
40 // work in character offsets (not bytes). | 40 // work in character offsets (not bytes). |
41 struct CharRange { | 41 struct CharRange { |
42 CharRange() : cp_min(0), cp_max(0) { } | 42 CharRange() : cp_min(0), cp_max(0) { } |
43 CharRange(int n, int x) : cp_min(n), cp_max(x) { } | 43 CharRange(int n, int x) : cp_min(n), cp_max(x) { } |
44 | 44 |
45 // Work in integers to match the gint GTK APIs. | 45 // Work in integers to match the gint GTK APIs. |
46 int cp_min; // For a selection: Represents the start. | 46 int cp_min; // For a selection: Represents the start. |
47 int cp_max; // For a selection: Represents the end (insert position). | 47 int cp_max; // For a selection: Represents the end (insert position). |
48 }; | 48 }; |
49 | 49 |
50 AutocompleteEditViewGtk(AutocompleteEditController* controller, | 50 AutocompleteEditViewGtk(AutocompleteEditController* controller, |
51 ToolbarModel* toolbar_model, | 51 ToolbarModel* toolbar_model, |
52 Profile* profile, | 52 Profile* profile, |
53 CommandUpdater* command_updater, | 53 CommandUpdater* command_updater, |
54 bool popup_window_mode, | 54 bool popup_window_mode, |
55 AutocompletePopupPositioner* popup_positioner); | 55 const BubblePositioner* bubble_positioner); |
56 ~AutocompleteEditViewGtk(); | 56 ~AutocompleteEditViewGtk(); |
57 | 57 |
58 // Initialize, create the underlying widgets, etc. | 58 // Initialize, create the underlying widgets, etc. |
59 void Init(); | 59 void Init(); |
60 | 60 |
61 GtkWidget* widget() { return alignment_.get(); } | 61 GtkWidget* widget() { return alignment_.get(); } |
62 | 62 |
63 // Returns the width, in pixels, needed to display the current text. The | 63 // Returns the width, in pixels, needed to display the current text. The |
64 // returned value includes margins and borders. | 64 // returned value includes margins and borders. |
65 int TextWidth(); | 65 int TextWidth(); |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 | 410 |
411 // If a character is inserted, store it in this variable so that it can | 411 // If a character is inserted, store it in this variable so that it can |
412 // be used later in "key-press-event" signal handler to determine if a Tab or | 412 // be used later in "key-press-event" signal handler to determine if a Tab or |
413 // Enter key event is handled by IME or not. | 413 // Enter key event is handled by IME or not. |
414 char char_inserted_; | 414 char char_inserted_; |
415 | 415 |
416 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditViewGtk); | 416 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditViewGtk); |
417 }; | 417 }; |
418 | 418 |
419 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_GTK_H_ | 419 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_GTK_H_ |
OLD | NEW |