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 CHROME_BROWSER_GTK_BOOKMARK_EDITOR_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_BOOKMARK_EDITOR_GTK_H_ |
6 #define CHROME_BROWSER_GTK_BOOKMARK_EDITOR_GTK_H_ | 6 #define CHROME_BROWSER_GTK_BOOKMARK_EDITOR_GTK_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "app/gtk_integers.h" | 9 #include "app/gtk_integers.h" |
10 #include "app/gtk_signal.h" | 10 #include "app/gtk_signal.h" |
11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
12 #include "base/scoped_ptr.h" | |
12 #include "base/string16.h" | 13 #include "base/string16.h" |
13 #include "chrome/browser/bookmarks/bookmark_editor.h" | 14 #include "chrome/browser/bookmarks/bookmark_editor.h" |
14 #include "chrome/browser/bookmarks/bookmark_model_observer.h" | 15 #include "chrome/browser/bookmarks/bookmark_model_observer.h" |
15 | 16 |
16 class GURL; | 17 class GURL; |
17 | 18 |
18 typedef union _GdkEvent GdkEvent; | 19 typedef union _GdkEvent GdkEvent; |
20 typedef struct _GdkEventButton GdkEventButton; | |
19 typedef struct _GtkTreeIter GtkTreeIter; | 21 typedef struct _GtkTreeIter GtkTreeIter; |
20 typedef struct _GtkTreeSelection GtkTreeSelection; | 22 typedef struct _GtkTreeSelection GtkTreeSelection; |
21 typedef struct _GtkTreeStore GtkTreeStore; | 23 typedef struct _GtkTreeStore GtkTreeStore; |
22 typedef struct _GtkWidget GtkWidget; | 24 typedef struct _GtkWidget GtkWidget; |
23 | 25 |
24 // GTK version of the bookmark editor dialog. | 26 // GTK version of the bookmark editor dialog. |
25 class BookmarkEditorGtk : public BookmarkEditor, | 27 class BookmarkEditorGtk : public BookmarkEditor, |
26 public BookmarkModelObserver { | 28 public BookmarkModelObserver { |
27 FRIEND_TEST_ALL_PREFIXES(BookmarkEditorGtkTest, ChangeParent); | 29 FRIEND_TEST_ALL_PREFIXES(BookmarkEditorGtkTest, ChangeParent); |
28 FRIEND_TEST_ALL_PREFIXES(BookmarkEditorGtkTest, ChangeParentAndURL); | 30 FRIEND_TEST_ALL_PREFIXES(BookmarkEditorGtkTest, ChangeParentAndURL); |
(...skipping 11 matching lines...) Expand all Loading... | |
40 const BookmarkNode* parent, | 42 const BookmarkNode* parent, |
41 const EditDetails& details, | 43 const EditDetails& details, |
42 BookmarkEditor::Configuration configuration); | 44 BookmarkEditor::Configuration configuration); |
43 | 45 |
44 virtual ~BookmarkEditorGtk(); | 46 virtual ~BookmarkEditorGtk(); |
45 | 47 |
46 void Show(); | 48 void Show(); |
47 void Close(); | 49 void Close(); |
48 | 50 |
49 private: | 51 private: |
52 class ContextMenuController; | |
53 friend class ContextMenuController; | |
54 | |
50 void Init(GtkWindow* parent_window); | 55 void Init(GtkWindow* parent_window); |
51 | 56 |
52 // BookmarkModel observer methods. Any structural change results in | 57 // BookmarkModel observer methods. Any structural change results in |
53 // resetting the tree model. | 58 // resetting the tree model. |
54 virtual void Loaded(BookmarkModel* model) { } | 59 virtual void Loaded(BookmarkModel* model) { } |
55 virtual void BookmarkNodeMoved(BookmarkModel* model, | 60 virtual void BookmarkNodeMoved(BookmarkModel* model, |
56 const BookmarkNode* old_parent, | 61 const BookmarkNode* old_parent, |
57 int old_index, | 62 int old_index, |
58 const BookmarkNode* new_parent, | 63 const BookmarkNode* new_parent, |
59 int new_index); | 64 int new_index); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 CHROMEGTK_CALLBACK_0(BookmarkEditorGtk, void, OnSelectionChanged); | 102 CHROMEGTK_CALLBACK_0(BookmarkEditorGtk, void, OnSelectionChanged); |
98 CHROMEGTK_CALLBACK_1(BookmarkEditorGtk, void, OnResponse, int); | 103 CHROMEGTK_CALLBACK_1(BookmarkEditorGtk, void, OnResponse, int); |
99 CHROMEGTK_CALLBACK_1(BookmarkEditorGtk, gboolean, OnWindowDeleteEvent, | 104 CHROMEGTK_CALLBACK_1(BookmarkEditorGtk, gboolean, OnWindowDeleteEvent, |
100 GdkEvent*); | 105 GdkEvent*); |
101 | 106 |
102 CHROMEGTK_CALLBACK_0(BookmarkEditorGtk, void, OnWindowDestroy); | 107 CHROMEGTK_CALLBACK_0(BookmarkEditorGtk, void, OnWindowDestroy); |
103 CHROMEGTK_CALLBACK_0(BookmarkEditorGtk, void, OnEntryChanged); | 108 CHROMEGTK_CALLBACK_0(BookmarkEditorGtk, void, OnEntryChanged); |
104 | 109 |
105 CHROMEGTK_CALLBACK_0(BookmarkEditorGtk, void, OnNewFolderClicked); | 110 CHROMEGTK_CALLBACK_0(BookmarkEditorGtk, void, OnNewFolderClicked); |
106 | 111 |
112 CHROMEGTK_CALLBACK_1(BookmarkEditorGtk, gboolean, OnTreeViewButtonPressEvent, | |
113 GdkEventButton*); | |
114 | |
115 void ShowContextMenu(); | |
evanm
2010/11/13 18:50:12
Can you add docs to these new functions?
I guess
| |
116 | |
117 void NewFolder(); | |
118 | |
107 // Profile the entry is from. | 119 // Profile the entry is from. |
108 Profile* profile_; | 120 Profile* profile_; |
109 | 121 |
110 // The dialog to display on screen. | 122 // The dialog to display on screen. |
111 GtkWidget* dialog_; | 123 GtkWidget* dialog_; |
112 GtkWidget* name_entry_; | 124 GtkWidget* name_entry_; |
113 GtkWidget* url_entry_; // This is NULL if IsEditingFolder. | 125 GtkWidget* url_entry_; // This is NULL if IsEditingFolder. |
114 GtkWidget* tree_view_; | 126 GtkWidget* tree_view_; |
115 GtkWidget* new_folder_button_; | 127 GtkWidget* new_folder_button_; |
116 | 128 |
(...skipping 17 matching lines...) Expand all Loading... | |
134 // Mode used to create nodes from. | 146 // Mode used to create nodes from. |
135 BookmarkModel* bb_model_; | 147 BookmarkModel* bb_model_; |
136 | 148 |
137 // If true, we're running the menu for the bookmark bar or other bookmarks | 149 // If true, we're running the menu for the bookmark bar or other bookmarks |
138 // nodes. | 150 // nodes. |
139 bool running_menu_for_root_; | 151 bool running_menu_for_root_; |
140 | 152 |
141 // Is the tree shown? | 153 // Is the tree shown? |
142 bool show_tree_; | 154 bool show_tree_; |
143 | 155 |
156 // The context menu controller. | |
157 scoped_ptr<ContextMenuController> menu_controller_; | |
158 | |
144 DISALLOW_COPY_AND_ASSIGN(BookmarkEditorGtk); | 159 DISALLOW_COPY_AND_ASSIGN(BookmarkEditorGtk); |
145 }; | 160 }; |
146 | 161 |
147 #endif // CHROME_BROWSER_GTK_BOOKMARK_EDITOR_GTK_H_ | 162 #endif // CHROME_BROWSER_GTK_BOOKMARK_EDITOR_GTK_H_ |
OLD | NEW |