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

Side by Side Diff: chrome/browser/ui/panels/panel_browser_window_gtk.h

Issue 10483010: Change the visual appearance of panel on GTK per new UI design. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch Created 8 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_ 5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_
6 #define CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_ 6 #define CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_
7 7
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "chrome/browser/ui/gtk/browser_window_gtk.h" 10 #include "chrome/browser/ui/gtk/browser_window_gtk.h"
(...skipping 10 matching lines...) Expand all
21 class Image; 21 class Image;
22 } 22 }
23 23
24 class PanelBrowserWindowGtk : public BrowserWindowGtk, 24 class PanelBrowserWindowGtk : public BrowserWindowGtk,
25 public NativePanel, 25 public NativePanel,
26 public ui::AnimationDelegate { 26 public ui::AnimationDelegate {
27 public: 27 public:
28 enum PaintState { 28 enum PaintState {
29 PAINT_AS_ACTIVE, 29 PAINT_AS_ACTIVE,
30 PAINT_AS_INACTIVE, 30 PAINT_AS_INACTIVE,
31 PAINT_AS_MINIMIZED,
31 PAINT_FOR_ATTENTION 32 PAINT_FOR_ATTENTION
32 }; 33 };
33 34
34 PanelBrowserWindowGtk(Browser* browser, Panel* panel, 35 PanelBrowserWindowGtk(Browser* browser, Panel* panel,
35 const gfx::Rect& bounds); 36 const gfx::Rect& bounds);
36 virtual ~PanelBrowserWindowGtk(); 37 virtual ~PanelBrowserWindowGtk();
37 38
38 // BrowserWindowGtk override 39 // BrowserWindowGtk override
39 virtual void Init() OVERRIDE; 40 virtual void Init() OVERRIDE;
40 virtual bool ShouldDrawContentDropShadow() const OVERRIDE;
41 41
42 // BrowserWindow overrides 42 // BrowserWindow overrides
43 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; 43 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
44 44
45 // Overrides BrowserWindowGtk::NotificationObserver::Observe 45 // Overrides BrowserWindowGtk::NotificationObserver::Observe
46 virtual void Observe(int type, 46 virtual void Observe(int type,
47 const content::NotificationSource& source, 47 const content::NotificationSource& source,
48 const content::NotificationDetails& details) OVERRIDE; 48 const content::NotificationDetails& details) OVERRIDE;
49 49
50 PaintState GetPaintState() const; 50 bool UsingDefaultTheme() const;
51 51
52 Panel* panel() const { return panel_.get(); } 52 Panel* panel() const { return panel_.get(); }
53 PaintState paint_state() const { return paint_state_; }
53 54
54 protected: 55 protected:
55 // BrowserWindowGtk overrides 56 // BrowserWindowGtk overrides
56 virtual BrowserTitlebar* CreateBrowserTitlebar() OVERRIDE; 57 virtual BrowserTitlebarBase* CreateBrowserTitlebar() OVERRIDE;
57 virtual bool GetWindowEdge(int x, int y, GdkWindowEdge* edge) OVERRIDE; 58 virtual bool GetWindowEdge(int x, int y, GdkWindowEdge* edge) OVERRIDE;
58 virtual GdkRegion* GetWindowShape(int width, int height) const OVERRIDE; 59 virtual GdkRegion* GetWindowShape(int width, int height) const OVERRIDE;
59 virtual void DrawCustomFrameBorder(GtkWidget* widget) OVERRIDE;
60 virtual bool HandleTitleBarLeftMousePress( 60 virtual bool HandleTitleBarLeftMousePress(
61 GdkEventButton* event, 61 GdkEventButton* event,
62 guint32 last_click_time, 62 guint32 last_click_time,
63 gfx::Point last_click_position) OVERRIDE; 63 gfx::Point last_click_position) OVERRIDE;
64 virtual bool HandleWindowEdgeLeftMousePress( 64 virtual bool HandleWindowEdgeLeftMousePress(
65 GtkWindow* window, 65 GtkWindow* window,
66 GdkWindowEdge edge, 66 GdkWindowEdge edge,
67 GdkEventButton* event) OVERRIDE; 67 GdkEventButton* event) OVERRIDE;
68 virtual void SaveWindowPosition() OVERRIDE; 68 virtual void SaveWindowPosition() OVERRIDE;
69 virtual void SetGeometryHints() OVERRIDE; 69 virtual void SetGeometryHints() OVERRIDE;
70 virtual bool UseCustomFrame() const OVERRIDE; 70 virtual bool UseCustomFrame() const OVERRIDE;
71 virtual bool UsingCustomPopupFrame() const OVERRIDE; 71 virtual void DrawFrame(GtkWidget* widget, GdkEventExpose* event) OVERRIDE;
72 virtual void OnSizeChanged(int width, int height) OVERRIDE; 72 virtual void OnSizeChanged(int width, int height) OVERRIDE;
73 virtual void DrawCustomFrame(cairo_t* cr, GtkWidget* widget,
74 GdkEventExpose* event) OVERRIDE;
75 virtual void DrawPopupFrame(cairo_t* cr, GtkWidget* widget,
76 GdkEventExpose* event) OVERRIDE;
77 virtual void ActiveWindowChanged(GdkWindow* active_window) OVERRIDE; 73 virtual void ActiveWindowChanged(GdkWindow* active_window) OVERRIDE;
78 74
79 // Overridden from NativePanel: 75 // Overridden from NativePanel:
80 virtual void ShowPanel() OVERRIDE; 76 virtual void ShowPanel() OVERRIDE;
81 virtual void ShowPanelInactive() OVERRIDE; 77 virtual void ShowPanelInactive() OVERRIDE;
82 virtual gfx::Rect GetPanelBounds() const OVERRIDE; 78 virtual gfx::Rect GetPanelBounds() const OVERRIDE;
83 virtual void SetPanelBounds(const gfx::Rect& bounds) OVERRIDE; 79 virtual void SetPanelBounds(const gfx::Rect& bounds) OVERRIDE;
84 virtual void SetPanelBoundsInstantly(const gfx::Rect& bounds) OVERRIDE; 80 virtual void SetPanelBoundsInstantly(const gfx::Rect& bounds) OVERRIDE;
85 virtual void ClosePanel() OVERRIDE; 81 virtual void ClosePanel() OVERRIDE;
86 virtual void ActivatePanel() OVERRIDE; 82 virtual void ActivatePanel() OVERRIDE;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; 127 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
132 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; 128 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
133 129
134 // Creates helper for handling drags if not already created. 130 // Creates helper for handling drags if not already created.
135 void EnsureDragHelperCreated(); 131 void EnsureDragHelperCreated();
136 132
137 void SetBoundsInternal(const gfx::Rect& bounds, bool animate); 133 void SetBoundsInternal(const gfx::Rect& bounds, bool animate);
138 134
139 PanelBrowserTitlebarGtk* GetPanelTitlebar() const; 135 PanelBrowserTitlebarGtk* GetPanelTitlebar() const;
140 136
141 // Returns the theme image to paint the frame. 137 // Returns the image to paint the frame.
142 const gfx::Image* GetThemeFrameImage() const; 138 const gfx::Image* GetFrameBackground() const;
139 const gfx::Image* GetDefaultFrameBackground() const;
140 const gfx::Image* GetThemedFrameBackground() const;
143 141
144 CHROMEGTK_CALLBACK_1(PanelBrowserWindowGtk, gboolean, 142 CHROMEGTK_CALLBACK_1(PanelBrowserWindowGtk, gboolean,
145 OnTitlebarButtonReleaseEvent, GdkEventButton*); 143 OnTitlebarButtonReleaseEvent, GdkEventButton*);
146 144
147 scoped_ptr<Panel> panel_; 145 scoped_ptr<Panel> panel_;
148 gfx::Rect bounds_; 146 gfx::Rect bounds_;
149 147
150 scoped_ptr<PanelDragGtk> drag_helper_; 148 scoped_ptr<PanelDragGtk> drag_helper_;
151 149
152 // Size of window frame. Empty until the window has been allocated and sized. 150 // Size of window frame. Empty until the window has been allocated and sized.
153 gfx::Size frame_size_; 151 gfx::Size frame_size_;
154 152
153 // Indicates different painting state, active, drawing attention or else.
154 PaintState paint_state_;
155
155 // Indicates that the panel is currently drawing attention. 156 // Indicates that the panel is currently drawing attention.
156 bool is_drawing_attention_; 157 bool is_drawing_attention_;
157 158
158 // Used to animate the bounds change. 159 // Used to animate the bounds change.
159 scoped_ptr<PanelBoundsAnimation> bounds_animator_; 160 scoped_ptr<PanelBoundsAnimation> bounds_animator_;
160 gfx::Rect animation_start_bounds_; 161 gfx::Rect animation_start_bounds_;
161 162
162 // This records the bounds set on the last animation progress notification. 163 // This records the bounds set on the last animation progress notification.
163 // We need this for the case where a new bounds animation starts before the 164 // We need this for the case where a new bounds animation starts before the
164 // current one completes. In this case, we want to start the new animation 165 // current one completes. In this case, we want to start the new animation
165 // from where the last one left. 166 // from where the last one left.
166 gfx::Rect last_animation_progressed_bounds_; 167 gfx::Rect last_animation_progressed_bounds_;
167 168
168 content::NotificationRegistrar registrar_; 169 content::NotificationRegistrar registrar_;
169 170
170 DISALLOW_COPY_AND_ASSIGN(PanelBrowserWindowGtk); 171 DISALLOW_COPY_AND_ASSIGN(PanelBrowserWindowGtk);
171 }; 172 };
172 173
173 #endif // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_ 174 #endif // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698