Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: chrome/browser/gtk/bookmark_editor_gtk.h

Issue 99131: Create a bookmark editor dialog interface and implement a GTK version. (Closed)
Patch Set: fixes for tony Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_GTK_BOOKMARK_EDITOR_GTK_H_
6 #define CHROME_BROWSER_GTK_BOOKMARK_EDITOR_GTK_H_
7
8 #include <gtk/gtk.h>
9
10 #include "chrome/browser/bookmarks/bookmark_editor.h"
11 #include "chrome/browser/bookmarks/bookmark_model.h"
12
13 // GTK version of the bookmark editor dialog.
14 class BookmarkEditorGtk : public BookmarkEditor,
15 public BookmarkModelObserver {
16 public:
17 BookmarkEditorGtk(GtkWindow* window,
18 Profile* profile,
19 BookmarkNode* parent,
20 BookmarkNode* node,
21 BookmarkEditor::Configuration configuration,
22 BookmarkEditor::Handler* handler);
23
24 virtual ~BookmarkEditorGtk();
25
26 void Show();
27 void Close();
28
29 private:
30 void Init(GtkWindow* parent_window);
31
32 // BookmarkModel observer methods. Any structural change results in
33 // resetting the tree model.
34 virtual void Loaded(BookmarkModel* model) { }
35 virtual void BookmarkNodeMoved(BookmarkModel* model,
36 BookmarkNode* old_parent,
37 int old_index,
38 BookmarkNode* new_parent,
39 int new_index);
40 virtual void BookmarkNodeAdded(BookmarkModel* model,
41 BookmarkNode* parent,
42 int index);
43 virtual void BookmarkNodeRemoved(BookmarkModel* model,
44 BookmarkNode* parent,
45 int index,
46 BookmarkNode* node);
47 virtual void BookmarkNodeChanged(BookmarkModel* model,
48 BookmarkNode* node) {}
49 virtual void BookmarkNodeChildrenReordered(BookmarkModel* model,
50 BookmarkNode* node);
51 virtual void BookmarkNodeFavIconLoaded(BookmarkModel* model,
52 BookmarkNode* node) {}
53
54 // Resets the model of the tree and updates the various buttons appropriately.
55 void Reset();
56
57 // Returns the current url the user has input.
58 GURL GetInputURL() const;
59
60 // Returns the title the user has input.
61 std::wstring GetInputTitle() const;
62
63 void ApplyEdits();
64
65 static void OnResponse(GtkDialog* dialog, int response_id,
66 BookmarkEditorGtk* window);
67
68 static gboolean OnWindowDeleteEvent(GtkWidget* widget,
69 GdkEvent* event,
70 BookmarkEditorGtk* dialog);
71
72 static void OnWindowDestroy(GtkWidget* widget, BookmarkEditorGtk* dialog);
73 static void OnEntryChanged(GtkEditable* entry, BookmarkEditorGtk* dialog);
74
75 // Profile the entry is from.
76 Profile* profile_;
77
78 // The dialog to display on screen.
79 GtkWidget* dialog_;
80 GtkWidget* name_entry_;
81 GtkWidget* url_entry_;
82 GtkWidget* close_button_;
83 GtkWidget* ok_button_;
84 GtkWidget* folder_tree_;
85
86 // TODO(erg): BookmarkEditorView has an EditorTreeModel object here; convert
87 // that into a GObject that implements the interface GtkTreeModel.
88
89 // Initial parent to select. Is only used if node_ is NULL.
90 BookmarkNode* parent_;
91
92 // Node being edited. Is NULL if creating a new node.
93 BookmarkNode* node_;
94
95 // Mode used to create nodes from.
96 BookmarkModel* bb_model_;
97
98 // If true, we're running the menu for the bookmark bar or other bookmarks
99 // nodes.
100 bool running_menu_for_root_;
101
102 // Is the tree shown?
103 bool show_tree_;
104
105 scoped_ptr<BookmarkEditor::Handler> handler_;
106
107 DISALLOW_COPY_AND_ASSIGN(BookmarkEditorGtk);
108 };
109
110 #endif // CHROME_BROWSER_GTK_BOOKMARK_EDITOR_GTK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698