OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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_EXTENSIONS_MEDIA_GALLERIES_DIALOG_GTK_H_ |
| 6 #define CHROME_BROWSER_UI_GTK_EXTENSIONS_MEDIA_GALLERIES_DIALOG_GTK_H_ |
| 7 |
| 8 #include <gtk/gtk.h> |
| 9 #include <map> |
| 10 |
| 11 #include "base/compiler_specific.h" |
| 12 #include "chrome/browser/media_gallery/media_galleries_dialog_controller.h" |
| 13 #include "chrome/browser/ui/gtk/constrained_window_gtk.h" |
| 14 #include "ui/base/gtk/gtk_signal.h" |
| 15 #include "ui/base/gtk/owned_widget_gtk.h" |
| 16 |
| 17 namespace chrome { |
| 18 |
| 19 class MediaGalleriesDialogController; |
| 20 |
| 21 // The media galleries configuration view for Gtk. It will immediately show |
| 22 // upon construction. |
| 23 class MediaGalleriesDialogGtk : public MediaGalleriesDialog, |
| 24 public ConstrainedWindowGtkDelegate { |
| 25 public: |
| 26 explicit MediaGalleriesDialogGtk(MediaGalleriesDialogController* controller); |
| 27 virtual ~MediaGalleriesDialogGtk() {} |
| 28 |
| 29 // MediaGalleriesDialog implementation: |
| 30 virtual void UpdateGallery(const MediaGalleryPrefInfo* gallery, |
| 31 bool permitted) OVERRIDE; |
| 32 |
| 33 // ConstrainedWindowGtkDelegate implementation: |
| 34 virtual GtkWidget* GetWidgetRoot() OVERRIDE; |
| 35 virtual GtkWidget* GetFocusWidget() OVERRIDE; |
| 36 virtual void DeleteDelegate() OVERRIDE; |
| 37 |
| 38 // Event callbacks. |
| 39 CHROMEGTK_CALLBACK_0(MediaGalleriesDialogGtk, void, OnToggled); |
| 40 CHROMEGTK_CALLBACK_0(MediaGalleriesDialogGtk, void, OnAddFolder); |
| 41 CHROMEGTK_CALLBACK_0(MediaGalleriesDialogGtk, void, OnConfirm); |
| 42 CHROMEGTK_CALLBACK_0(MediaGalleriesDialogGtk, void, OnCancel); |
| 43 |
| 44 private: |
| 45 typedef std::map<const MediaGalleryPrefInfo*, GtkWidget*> CheckboxMap; |
| 46 |
| 47 // Creates the widget hierarchy. |
| 48 void InitWidgets(); |
| 49 |
| 50 // Updates the state of the confirm button. It will be disabled when |
| 51 void UpdateConfirmButtonState(); |
| 52 |
| 53 MediaGalleriesDialogController* controller_; |
| 54 ConstrainedWindowGtk* window_; |
| 55 |
| 56 // The root widget for the dialog. |
| 57 ui::OwnedWidgetGtk contents_; |
| 58 |
| 59 // The confirm button. |
| 60 GtkWidget* confirm_; |
| 61 |
| 62 // This widget holds all the checkboxes. |
| 63 GtkWidget* checkbox_container_; |
| 64 |
| 65 // A map from MediaGalleryPrefInfo struct (owned by controller) to the |
| 66 // GtkCheckButton that controls it. |
| 67 CheckboxMap checkbox_map_; |
| 68 |
| 69 // When true, checkbox toggles are ignored (used when updating the UI). |
| 70 bool ignore_toggles_; |
| 71 |
| 72 // True if the user has pressed accept. |
| 73 bool accepted_; |
| 74 |
| 75 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogGtk); |
| 76 }; |
| 77 |
| 78 } // namespace chrome |
| 79 |
| 80 #endif // CHROME_BROWSER_UI_GTK_EXTENSIONS_MEDIA_GALLERIES_DIALOG_GTK_H_ |
OLD | NEW |