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

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

Issue 10180011: Support painting panels with chromium themes on GTK. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch to land Created 8 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 | 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"
11 #include "chrome/browser/ui/panels/native_panel.h" 11 #include "chrome/browser/ui/panels/native_panel.h"
12 #include "ui/base/animation/animation_delegate.h" 12 #include "ui/base/animation/animation_delegate.h"
13 13
14 class Panel; 14 class Panel;
15 class PanelBoundsAnimation; 15 class PanelBoundsAnimation;
16 class PanelBrowserTitlebarGtk;
16 class PanelDragGtk; 17 class PanelDragGtk;
17 class NativePanelTestingGtk; 18 class NativePanelTestingGtk;
18 19
20 namespace gfx {
21 class Image;
22 }
23
19 class PanelBrowserWindowGtk : public BrowserWindowGtk, 24 class PanelBrowserWindowGtk : public BrowserWindowGtk,
20 public NativePanel, 25 public NativePanel,
21 public ui::AnimationDelegate { 26 public ui::AnimationDelegate {
22 public: 27 public:
28 enum PaintState {
29 PAINT_AS_ACTIVE,
30 PAINT_AS_INACTIVE,
31 PAINT_FOR_ATTENTION
32 };
33
23 PanelBrowserWindowGtk(Browser* browser, Panel* panel, 34 PanelBrowserWindowGtk(Browser* browser, Panel* panel,
24 const gfx::Rect& bounds); 35 const gfx::Rect& bounds);
25 virtual ~PanelBrowserWindowGtk(); 36 virtual ~PanelBrowserWindowGtk();
26 37
27 // BrowserWindowGtk override 38 // BrowserWindowGtk override
28 virtual void Init() OVERRIDE; 39 virtual void Init() OVERRIDE;
40 virtual bool ShouldDrawContentDropShadow() const OVERRIDE;
29 41
30 // BrowserWindow overrides 42 // BrowserWindow overrides
31 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; 43 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
32 virtual TitleDecoration GetWindowTitle(std::string* title) const OVERRIDE;
33 44
34 // Overrides BrowserWindowGtk::NotificationObserver::Observe 45 // Overrides BrowserWindowGtk::NotificationObserver::Observe
35 virtual void Observe(int type, 46 virtual void Observe(int type,
36 const content::NotificationSource& source, 47 const content::NotificationSource& source,
37 const content::NotificationDetails& details) OVERRIDE; 48 const content::NotificationDetails& details) OVERRIDE;
38 49
50 PaintState GetPaintState() const;
51
39 Panel* panel() const { return panel_.get(); } 52 Panel* panel() const { return panel_.get(); }
40 53
41 protected: 54 protected:
42 // BrowserWindowGtk overrides 55 // BrowserWindowGtk overrides
43 virtual BrowserTitlebar* CreateBrowserTitlebar() OVERRIDE; 56 virtual BrowserTitlebar* CreateBrowserTitlebar() OVERRIDE;
44 virtual bool GetWindowEdge(int x, int y, GdkWindowEdge* edge) OVERRIDE; 57 virtual bool GetWindowEdge(int x, int y, GdkWindowEdge* edge) OVERRIDE;
45 virtual bool HandleTitleBarLeftMousePress( 58 virtual bool HandleTitleBarLeftMousePress(
46 GdkEventButton* event, 59 GdkEventButton* event,
47 guint32 last_click_time, 60 guint32 last_click_time,
48 gfx::Point last_click_position) OVERRIDE; 61 gfx::Point last_click_position) OVERRIDE;
49 virtual bool HandleWindowEdgeLeftMousePress( 62 virtual bool HandleWindowEdgeLeftMousePress(
50 GtkWindow* window, 63 GtkWindow* window,
51 GdkWindowEdge edge, 64 GdkWindowEdge edge,
52 GdkEventButton* event) OVERRIDE; 65 GdkEventButton* event) OVERRIDE;
53 virtual void SaveWindowPosition() OVERRIDE; 66 virtual void SaveWindowPosition() OVERRIDE;
54 virtual void SetGeometryHints() OVERRIDE; 67 virtual void SetGeometryHints() OVERRIDE;
55 virtual bool UseCustomFrame() OVERRIDE; 68 virtual bool UseCustomFrame() const OVERRIDE;
69 virtual bool UsingCustomPopupFrame() const OVERRIDE;
56 virtual void OnSizeChanged(int width, int height) OVERRIDE; 70 virtual void OnSizeChanged(int width, int height) OVERRIDE;
57 virtual void DrawCustomFrame(cairo_t* cr, GtkWidget* widget, 71 virtual void DrawCustomFrame(cairo_t* cr, GtkWidget* widget,
58 GdkEventExpose* event) OVERRIDE; 72 GdkEventExpose* event) OVERRIDE;
59 virtual void DrawPopupFrame(cairo_t* cr, GtkWidget* widget, 73 virtual void DrawPopupFrame(cairo_t* cr, GtkWidget* widget,
60 GdkEventExpose* event) OVERRIDE; 74 GdkEventExpose* event) OVERRIDE;
61 virtual void ActiveWindowChanged(GdkWindow* active_window) OVERRIDE; 75 virtual void ActiveWindowChanged(GdkWindow* active_window) OVERRIDE;
62 76
63 // Overridden from NativePanel: 77 // Overridden from NativePanel:
64 virtual void ShowPanel() OVERRIDE; 78 virtual void ShowPanel() OVERRIDE;
65 virtual void ShowPanelInactive() OVERRIDE; 79 virtual void ShowPanelInactive() OVERRIDE;
(...skipping 23 matching lines...) Expand all
89 virtual void HandlePanelKeyboardEvent( 103 virtual void HandlePanelKeyboardEvent(
90 const NativeWebKeyboardEvent& event) OVERRIDE; 104 const NativeWebKeyboardEvent& event) OVERRIDE;
91 virtual void FullScreenModeChanged(bool is_full_screen) OVERRIDE; 105 virtual void FullScreenModeChanged(bool is_full_screen) OVERRIDE;
92 virtual Browser* GetPanelBrowser() const OVERRIDE; 106 virtual Browser* GetPanelBrowser() const OVERRIDE;
93 virtual void DestroyPanelBrowser() OVERRIDE; 107 virtual void DestroyPanelBrowser() OVERRIDE;
94 virtual gfx::Size WindowSizeFromContentSize( 108 virtual gfx::Size WindowSizeFromContentSize(
95 const gfx::Size& content_size) const OVERRIDE; 109 const gfx::Size& content_size) const OVERRIDE;
96 virtual gfx::Size ContentSizeFromWindowSize( 110 virtual gfx::Size ContentSizeFromWindowSize(
97 const gfx::Size& window_size) const OVERRIDE; 111 const gfx::Size& window_size) const OVERRIDE;
98 virtual int TitleOnlyHeight() const OVERRIDE; 112 virtual int TitleOnlyHeight() const OVERRIDE;
99 virtual gfx::Size IconOnlySize() const OVERRIDE;
100 virtual void EnsurePanelFullyVisible() OVERRIDE; 113 virtual void EnsurePanelFullyVisible() OVERRIDE;
101 virtual void SetPanelAppIconVisibility(bool visible) OVERRIDE; 114 virtual void SetPanelAppIconVisibility(bool visible) OVERRIDE;
102 virtual void SetPanelAlwaysOnTop(bool on_top) OVERRIDE; 115 virtual void SetPanelAlwaysOnTop(bool on_top) OVERRIDE;
103 virtual void EnableResizeByMouse(bool enable) OVERRIDE; 116 virtual void EnableResizeByMouse(bool enable) OVERRIDE;
104 117
105 private: 118 private:
106 friend class NativePanelTestingGtk; 119 friend class NativePanelTestingGtk;
107 120
108 void StartBoundsAnimation(const gfx::Rect& from_bounds, 121 void StartBoundsAnimation(const gfx::Rect& from_bounds,
109 const gfx::Rect& to_bounds); 122 const gfx::Rect& to_bounds);
110 bool IsAnimatingBounds() const; 123 bool IsAnimatingBounds() const;
111 124
112 // Overridden from AnimationDelegate: 125 // Overridden from AnimationDelegate:
113 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; 126 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
114 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; 127 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
115 128
116 // Creates helper for handling drags if not already created. 129 // Creates helper for handling drags if not already created.
117 void EnsureDragHelperCreated(); 130 void EnsureDragHelperCreated();
118 131
119 void SetBoundsInternal(const gfx::Rect& bounds, bool animate); 132 void SetBoundsInternal(const gfx::Rect& bounds, bool animate);
120 133
121 void DrawAttentionFrame(cairo_t* cr, GtkWidget* widget, 134 PanelBrowserTitlebarGtk* GetPanelTitlebar() const;
122 GdkEventExpose* event); 135
123 GdkRectangle GetTitlebarRectForDrawAttention() const; 136 // Returns the theme image to paint the frame.
137 const gfx::Image* GetThemeFrameImage() const;
124 138
125 CHROMEGTK_CALLBACK_1(PanelBrowserWindowGtk, gboolean, 139 CHROMEGTK_CALLBACK_1(PanelBrowserWindowGtk, gboolean,
126 OnTitlebarButtonReleaseEvent, GdkEventButton*); 140 OnTitlebarButtonReleaseEvent, GdkEventButton*);
127 141
128 scoped_ptr<Panel> panel_; 142 scoped_ptr<Panel> panel_;
129 gfx::Rect bounds_; 143 gfx::Rect bounds_;
130 144
131 scoped_ptr<PanelDragGtk> drag_helper_; 145 scoped_ptr<PanelDragGtk> drag_helper_;
132 146
133 // Size of window frame. Empty until the window has been allocated and sized. 147 // Size of window frame. Empty until the window has been allocated and sized.
(...skipping 11 matching lines...) Expand all
145 // current one completes. In this case, we want to start the new animation 159 // current one completes. In this case, we want to start the new animation
146 // from where the last one left. 160 // from where the last one left.
147 gfx::Rect last_animation_progressed_bounds_; 161 gfx::Rect last_animation_progressed_bounds_;
148 162
149 content::NotificationRegistrar registrar_; 163 content::NotificationRegistrar registrar_;
150 164
151 DISALLOW_COPY_AND_ASSIGN(PanelBrowserWindowGtk); 165 DISALLOW_COPY_AND_ASSIGN(PanelBrowserWindowGtk);
152 }; 166 };
153 167
154 #endif // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_ 168 #endif // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel_browser_window_cocoa.mm ('k') | chrome/browser/ui/panels/panel_browser_window_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698