OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_GTK_EDIT_SEARCH_ENGINE_DIALOG_H_ |
| 6 #define CHROME_BROWSER_UI_GTK_EDIT_SEARCH_ENGINE_DIALOG_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <gtk/gtk.h> |
| 10 #include <string> |
| 11 |
| 12 #include "app/gtk_signal.h" |
| 13 #include "base/basictypes.h" |
| 14 #include "base/scoped_ptr.h" |
| 15 #include "base/string16.h" |
| 16 |
| 17 class AccessibleWidgetHelper; |
| 18 class EditSearchEngineController; |
| 19 class EditSearchEngineControllerDelegate; |
| 20 class Profile; |
| 21 class TemplateURL; |
| 22 |
| 23 class EditSearchEngineDialog { |
| 24 public: |
| 25 EditSearchEngineDialog(GtkWindow* parent_window, |
| 26 const TemplateURL* template_url, |
| 27 EditSearchEngineControllerDelegate* delegate, |
| 28 Profile* profile); |
| 29 virtual ~EditSearchEngineDialog(); |
| 30 |
| 31 private: |
| 32 // Create and show the window. |
| 33 void Init(GtkWindow* parent_window, Profile* profile); |
| 34 |
| 35 // Retrieve the user input in the various fields. |
| 36 string16 GetTitleInput() const; |
| 37 string16 GetKeywordInput() const; |
| 38 std::string GetURLInput() const; |
| 39 |
| 40 // Set sensitivity of buttons based on entry state. |
| 41 void EnableControls(); |
| 42 |
| 43 // Updates the tooltip and image of the image view based on is_valid. If |
| 44 // is_valid is false the tooltip of the image view is set to the message with |
| 45 // id invalid_message_id, otherwise the tooltip is set to the empty text. |
| 46 void UpdateImage(GtkWidget* image, bool is_valid, int invalid_message_id); |
| 47 |
| 48 // Callback for entry changes. |
| 49 CHROMEG_CALLBACK_0(EditSearchEngineDialog, void, OnEntryChanged, |
| 50 GtkEditable*); |
| 51 |
| 52 // Callback for dialog buttons. |
| 53 CHROMEG_CALLBACK_1(EditSearchEngineDialog, void, OnResponse, GtkDialog*, int); |
| 54 |
| 55 // Callback for window destruction. |
| 56 CHROMEGTK_CALLBACK_0(EditSearchEngineDialog, void, OnWindowDestroy); |
| 57 |
| 58 // The dialog window. |
| 59 GtkWidget* dialog_; |
| 60 |
| 61 // Text entries for each field. |
| 62 GtkWidget* title_entry_; |
| 63 GtkWidget* keyword_entry_; |
| 64 GtkWidget* url_entry_; |
| 65 |
| 66 // Images showing whether each entry is okay or has errors. |
| 67 GtkWidget* title_image_; |
| 68 GtkWidget* keyword_image_; |
| 69 GtkWidget* url_image_; |
| 70 |
| 71 // The ok button (we need a reference to it so we can de-activate it when the |
| 72 // entries are not all filled in.) |
| 73 GtkWidget* ok_button_; |
| 74 |
| 75 scoped_ptr<EditSearchEngineController> controller_; |
| 76 |
| 77 // Helper object to manage accessibility metadata. |
| 78 scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_; |
| 79 |
| 80 DISALLOW_COPY_AND_ASSIGN(EditSearchEngineDialog); |
| 81 }; |
| 82 |
| 83 #endif // CHROME_BROWSER_UI_GTK_EDIT_SEARCH_ENGINE_DIALOG_H_ |
OLD | NEW |