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

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: Sync Created 8 years, 8 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:
23 PanelBrowserWindowGtk(Browser* browser, Panel* panel, 28 PanelBrowserWindowGtk(Browser* browser, Panel* panel,
24 const gfx::Rect& bounds); 29 const gfx::Rect& bounds);
25 virtual ~PanelBrowserWindowGtk(); 30 virtual ~PanelBrowserWindowGtk();
26 31
27 // BrowserWindowGtk override 32 // BrowserWindowGtk override
28 virtual void Init() OVERRIDE; 33 virtual void Init() OVERRIDE;
29 34
30 // BrowserWindow overrides 35 // BrowserWindow overrides
31 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; 36 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
32 virtual TitleDecoration GetWindowTitle(std::string* title) const OVERRIDE; 37 virtual bool IsMinimized() const OVERRIDE;
33 38
34 // Overrides BrowserWindowGtk::NotificationObserver::Observe 39 // Overrides BrowserWindowGtk::NotificationObserver::Observe
35 virtual void Observe(int type, 40 virtual void Observe(int type,
36 const content::NotificationSource& source, 41 const content::NotificationSource& source,
37 const content::NotificationDetails& details) OVERRIDE; 42 const content::NotificationDetails& details) OVERRIDE;
38 43
44 // NativePanel overrides
jennb 2012/04/27 18:36:13 Please don't separate the NativePanel overrides.
jianli 2012/04/27 20:22:34 Moved it back since we're not relying on getting p
45 virtual bool IsDrawingAttention() const OVERRIDE;
46
39 Panel* panel() const { return panel_.get(); } 47 Panel* panel() const { return panel_.get(); }
40 48
41 protected: 49 protected:
42 // BrowserWindowGtk overrides 50 // BrowserWindowGtk overrides
43 virtual BrowserTitlebar* CreateBrowserTitlebar() OVERRIDE; 51 virtual BrowserTitlebar* CreateBrowserTitlebar() OVERRIDE;
44 virtual bool GetWindowEdge(int x, int y, GdkWindowEdge* edge) OVERRIDE; 52 virtual bool GetWindowEdge(int x, int y, GdkWindowEdge* edge) OVERRIDE;
45 virtual bool HandleTitleBarLeftMousePress( 53 virtual bool HandleTitleBarLeftMousePress(
46 GdkEventButton* event, 54 GdkEventButton* event,
47 guint32 last_click_time, 55 guint32 last_click_time,
48 gfx::Point last_click_position) OVERRIDE; 56 gfx::Point last_click_position) OVERRIDE;
49 virtual bool HandleWindowEdgeLeftMousePress( 57 virtual bool HandleWindowEdgeLeftMousePress(
50 GtkWindow* window, 58 GtkWindow* window,
51 GdkWindowEdge edge, 59 GdkWindowEdge edge,
52 GdkEventButton* event) OVERRIDE; 60 GdkEventButton* event) OVERRIDE;
53 virtual void SaveWindowPosition() OVERRIDE; 61 virtual void SaveWindowPosition() OVERRIDE;
54 virtual void SetGeometryHints() OVERRIDE; 62 virtual void SetGeometryHints() OVERRIDE;
55 virtual bool UseCustomFrame() OVERRIDE; 63 virtual bool UseCustomFrame() OVERRIDE;
64 virtual bool UsingCustomPopupFrame() const OVERRIDE;
56 virtual void OnSizeChanged(int width, int height) OVERRIDE; 65 virtual void OnSizeChanged(int width, int height) OVERRIDE;
57 virtual void DrawCustomFrame(cairo_t* cr, GtkWidget* widget, 66 virtual void DrawCustomFrame(cairo_t* cr, GtkWidget* widget,
58 GdkEventExpose* event) OVERRIDE; 67 GdkEventExpose* event) OVERRIDE;
59 virtual void DrawPopupFrame(cairo_t* cr, GtkWidget* widget, 68 virtual void DrawPopupFrame(cairo_t* cr, GtkWidget* widget,
60 GdkEventExpose* event) OVERRIDE; 69 GdkEventExpose* event) OVERRIDE;
61 virtual void ActiveWindowChanged(GdkWindow* active_window) OVERRIDE; 70 virtual void ActiveWindowChanged(GdkWindow* active_window) OVERRIDE;
62 71
63 // Overridden from NativePanel: 72 // Overridden from NativePanel:
64 virtual void ShowPanel() OVERRIDE; 73 virtual void ShowPanel() OVERRIDE;
65 virtual void ShowPanelInactive() OVERRIDE; 74 virtual void ShowPanelInactive() OVERRIDE;
66 virtual gfx::Rect GetPanelBounds() const OVERRIDE; 75 virtual gfx::Rect GetPanelBounds() const OVERRIDE;
67 virtual void SetPanelBounds(const gfx::Rect& bounds) OVERRIDE; 76 virtual void SetPanelBounds(const gfx::Rect& bounds) OVERRIDE;
68 virtual void SetPanelBoundsInstantly(const gfx::Rect& bounds) OVERRIDE; 77 virtual void SetPanelBoundsInstantly(const gfx::Rect& bounds) OVERRIDE;
69 virtual void ClosePanel() OVERRIDE; 78 virtual void ClosePanel() OVERRIDE;
70 virtual void ActivatePanel() OVERRIDE; 79 virtual void ActivatePanel() OVERRIDE;
71 virtual void DeactivatePanel() OVERRIDE; 80 virtual void DeactivatePanel() OVERRIDE;
72 virtual bool IsPanelActive() const OVERRIDE; 81 virtual bool IsPanelActive() const OVERRIDE;
73 virtual void PreventActivationByOS(bool prevent_activation) OVERRIDE; 82 virtual void PreventActivationByOS(bool prevent_activation) OVERRIDE;
74 virtual gfx::NativeWindow GetNativePanelHandle() OVERRIDE; 83 virtual gfx::NativeWindow GetNativePanelHandle() OVERRIDE;
75 virtual void UpdatePanelTitleBar() OVERRIDE; 84 virtual void UpdatePanelTitleBar() OVERRIDE;
76 virtual void UpdatePanelLoadingAnimations(bool should_animate) OVERRIDE; 85 virtual void UpdatePanelLoadingAnimations(bool should_animate) OVERRIDE;
77 virtual void ShowTaskManagerForPanel() OVERRIDE; 86 virtual void ShowTaskManagerForPanel() OVERRIDE;
78 virtual FindBar* CreatePanelFindBar() OVERRIDE; 87 virtual FindBar* CreatePanelFindBar() OVERRIDE;
79 virtual void NotifyPanelOnUserChangedTheme() OVERRIDE; 88 virtual void NotifyPanelOnUserChangedTheme() OVERRIDE;
80 virtual void PanelWebContentsFocused(content::WebContents* contents) OVERRIDE; 89 virtual void PanelWebContentsFocused(content::WebContents* contents) OVERRIDE;
81 virtual void PanelCut() OVERRIDE; 90 virtual void PanelCut() OVERRIDE;
82 virtual void PanelCopy() OVERRIDE; 91 virtual void PanelCopy() OVERRIDE;
83 virtual void PanelPaste() OVERRIDE; 92 virtual void PanelPaste() OVERRIDE;
84 virtual void DrawAttention(bool draw_attention) OVERRIDE; 93 virtual void DrawAttention(bool draw_attention) OVERRIDE;
85 virtual bool IsDrawingAttention() const OVERRIDE;
86 virtual bool PreHandlePanelKeyboardEvent( 94 virtual bool PreHandlePanelKeyboardEvent(
87 const NativeWebKeyboardEvent& event, 95 const NativeWebKeyboardEvent& event,
88 bool* is_keyboard_shortcut) OVERRIDE; 96 bool* is_keyboard_shortcut) OVERRIDE;
89 virtual void HandlePanelKeyboardEvent( 97 virtual void HandlePanelKeyboardEvent(
90 const NativeWebKeyboardEvent& event) OVERRIDE; 98 const NativeWebKeyboardEvent& event) OVERRIDE;
91 virtual void FullScreenModeChanged(bool is_full_screen) OVERRIDE; 99 virtual void FullScreenModeChanged(bool is_full_screen) OVERRIDE;
92 virtual Browser* GetPanelBrowser() const OVERRIDE; 100 virtual Browser* GetPanelBrowser() const OVERRIDE;
93 virtual void DestroyPanelBrowser() OVERRIDE; 101 virtual void DestroyPanelBrowser() OVERRIDE;
94 virtual gfx::Size WindowSizeFromContentSize( 102 virtual gfx::Size WindowSizeFromContentSize(
95 const gfx::Size& content_size) const OVERRIDE; 103 const gfx::Size& content_size) const OVERRIDE;
(...skipping 15 matching lines...) Expand all
111 119
112 // Overridden from AnimationDelegate: 120 // Overridden from AnimationDelegate:
113 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; 121 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
114 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; 122 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
115 123
116 // Creates helper for handling drags if not already created. 124 // Creates helper for handling drags if not already created.
117 void EnsureDragHelperCreated(); 125 void EnsureDragHelperCreated();
118 126
119 void SetBoundsInternal(const gfx::Rect& bounds, bool animate); 127 void SetBoundsInternal(const gfx::Rect& bounds, bool animate);
120 128
121 void DrawAttentionFrame(cairo_t* cr, GtkWidget* widget, 129 PanelBrowserTitlebarGtk* GetTitlebar() const;
jennb 2012/04/27 18:36:13 This gets confusing with base class having a title
jianli 2012/04/27 20:22:34 Done.
122 GdkEventExpose* event); 130
123 GdkRectangle GetTitlebarRectForDrawAttention() const; 131 const gfx::Image* GetFrameTheme() const;
124 132
125 CHROMEGTK_CALLBACK_1(PanelBrowserWindowGtk, gboolean, 133 CHROMEGTK_CALLBACK_1(PanelBrowserWindowGtk, gboolean,
126 OnTitlebarButtonReleaseEvent, GdkEventButton*); 134 OnTitlebarButtonReleaseEvent, GdkEventButton*);
127 135
128 scoped_ptr<Panel> panel_; 136 scoped_ptr<Panel> panel_;
129 gfx::Rect bounds_; 137 gfx::Rect bounds_;
130 138
131 scoped_ptr<PanelDragGtk> drag_helper_; 139 scoped_ptr<PanelDragGtk> drag_helper_;
132 140
133 // Size of window frame. Empty until the window has been allocated and sized. 141 // 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 153 // current one completes. In this case, we want to start the new animation
146 // from where the last one left. 154 // from where the last one left.
147 gfx::Rect last_animation_progressed_bounds_; 155 gfx::Rect last_animation_progressed_bounds_;
148 156
149 content::NotificationRegistrar registrar_; 157 content::NotificationRegistrar registrar_;
150 158
151 DISALLOW_COPY_AND_ASSIGN(PanelBrowserWindowGtk); 159 DISALLOW_COPY_AND_ASSIGN(PanelBrowserWindowGtk);
152 }; 160 };
153 161
154 #endif // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_ 162 #endif // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698