1 // Copyright (c) 2013 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_PANELS_PANEL_STACK_WINDOW_GTK_H_ 6 #define CHROME_BROWSER_UI_GTK_PANELS_PANEL_STACK_WINDOW_GTK_H_ 7 8 #include <gtk/gtk.h> 9 10 #include <list> 11 #include <map> 12 13 #include "chrome/browser/ui/panels/native_panel_stack_window.h" 14 #include "ui/base/gtk/gtk_signal.h" 15 #include "ui/base/x/active_window_watcher_x_observer.h" 16 17 class PanelStackWindowGtk : public NativePanelStackWindow, 18 public ui::ActiveWindowWatcherXObserver { 19 public: 20 explicit PanelStackWindowGtk(NativePanelStackWindowDelegate* delegate); 21 virtual ~PanelStackWindowGtk(); 22 23 protected: 24 // Overridden from NativePanelStackWindow: 25 virtual void Close() OVERRIDE; 26 virtual void AddPanel(Panel* panel) OVERRIDE; 27 virtual void RemovePanel(Panel* panel) OVERRIDE; 28 virtual void MergeWith(NativePanelStackWindow* another) OVERRIDE; 29 virtual bool IsEmpty() const OVERRIDE; 30 virtual bool HasPanel(Panel* panel) const OVERRIDE; 31 virtual void MovePanelsBy(const gfx::Vector2d& delta) OVERRIDE; 32 virtual void BeginBatchUpdatePanelBounds(bool animate) OVERRIDE; 33 virtual void AddPanelBoundsForBatchUpdate(Panel* panel, 34 const gfx::Rect& bounds) OVERRIDE; 35 virtual void EndBatchUpdatePanelBounds() OVERRIDE; 36 virtual bool IsAnimatingPanelBounds() const OVERRIDE; 37 virtual void Minimize() OVERRIDE; 38 virtual bool IsMinimized() const OVERRIDE; 39 virtual void DrawSystemAttention(bool draw_attention) OVERRIDE; 40 virtual void OnPanelActivated(Panel* panel) OVERRIDE; 41 42 private: 43 typedef std::list<Panel*> Panels; 44 45 // Overridden from ActiveWindowWatcherXObserver. 46 virtual void ActiveWindowChanged(GdkWindow* active_window) OVERRIDE; 47 48 CHROMEGTK_CALLBACK_1(PanelStackWindowGtk, gboolean, OnWindowDeleteEvent, 49 GdkEvent*); 50 CHROMEGTK_CALLBACK_1(PanelStackWindowGtk, gboolean, OnWindowState, 51 GdkEventWindowState*); 52 53 void EnsureWindowCreated(); 54 void SetStackWindowBounds(); 55 56 // The map value is new bounds of the panel. 57 typedef std::map<Panel*, gfx::Rect> BoundsUpdates; 58 59 NativePanelStackWindowDelegate* delegate_; 60 61 // The background window that provides the aggregated taskbar presence for all 62 // the panels in the stack. 63 GtkWindow* window_; 64 65 Panels panels_; 66 67 bool is_minimized_; 68 69 // For batch bounds update. 70 bool bounds_updates_started_; 71 BoundsUpdates bounds_updates_; 72 73 DISALLOW_COPY_AND_ASSIGN(PanelStackWindowGtk); 74 }; 75 76 #endif // CHROME_BROWSER_UI_GTK_PANELS_PANEL_STACK_WINDOW_GTK_H_ 77 78