OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/ui/gtk/browser_window_gtk.h" | 8 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
9 #include "chrome/browser/ui/gtk/menu_gtk.h" | 9 #include "chrome/browser/ui/gtk/menu_gtk.h" |
10 #include "chrome/browser/ui/panels/native_panel.h" | 10 #include "chrome/browser/ui/panels/native_panel.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 protected: | 34 protected: |
35 // BrowserWindowGtk overrides | 35 // BrowserWindowGtk overrides |
36 virtual bool GetWindowEdge(int x, int y, GdkWindowEdge* edge) OVERRIDE; | 36 virtual bool GetWindowEdge(int x, int y, GdkWindowEdge* edge) OVERRIDE; |
37 virtual bool HandleTitleBarLeftMousePress( | 37 virtual bool HandleTitleBarLeftMousePress( |
38 GdkEventButton* event, | 38 GdkEventButton* event, |
39 guint32 last_click_time, | 39 guint32 last_click_time, |
40 gfx::Point last_click_position) OVERRIDE; | 40 gfx::Point last_click_position) OVERRIDE; |
41 virtual void SaveWindowPosition() OVERRIDE; | 41 virtual void SaveWindowPosition() OVERRIDE; |
42 virtual void SetGeometryHints() OVERRIDE; | 42 virtual void SetGeometryHints() OVERRIDE; |
43 virtual bool UseCustomFrame() OVERRIDE; | 43 virtual bool UseCustomFrame() OVERRIDE; |
| 44 virtual void OnSizeChanged(int width, int height) OVERRIDE; |
44 | 45 |
45 // Overridden from NativePanel: | 46 // Overridden from NativePanel: |
46 virtual void ShowPanel() OVERRIDE; | 47 virtual void ShowPanel() OVERRIDE; |
47 virtual void ShowPanelInactive() OVERRIDE; | 48 virtual void ShowPanelInactive() OVERRIDE; |
48 virtual gfx::Rect GetPanelBounds() const OVERRIDE; | 49 virtual gfx::Rect GetPanelBounds() const OVERRIDE; |
49 virtual void SetPanelBounds(const gfx::Rect& bounds) OVERRIDE; | 50 virtual void SetPanelBounds(const gfx::Rect& bounds) OVERRIDE; |
50 virtual void OnPanelExpansionStateChanged( | 51 virtual void OnPanelExpansionStateChanged( |
51 Panel::ExpansionState expansion_state) OVERRIDE; | 52 Panel::ExpansionState expansion_state) OVERRIDE; |
52 virtual bool ShouldBringUpPanelTitlebar(int mouse_x, | 53 virtual bool ShouldBringUpPanelTitlebar(int mouse_x, |
53 int mouse_y) const OVERRIDE; | 54 int mouse_y) const OVERRIDE; |
(...skipping 15 matching lines...) Expand all Loading... |
69 bool* is_keyboard_shortcut) OVERRIDE; | 70 bool* is_keyboard_shortcut) OVERRIDE; |
70 virtual void HandlePanelKeyboardEvent( | 71 virtual void HandlePanelKeyboardEvent( |
71 const NativeWebKeyboardEvent& event) OVERRIDE; | 72 const NativeWebKeyboardEvent& event) OVERRIDE; |
72 virtual Browser* GetPanelBrowser() const OVERRIDE; | 73 virtual Browser* GetPanelBrowser() const OVERRIDE; |
73 virtual void DestroyPanelBrowser() OVERRIDE; | 74 virtual void DestroyPanelBrowser() OVERRIDE; |
74 virtual gfx::Size GetNonClientAreaExtent() const OVERRIDE; | 75 virtual gfx::Size GetNonClientAreaExtent() const OVERRIDE; |
75 virtual int GetRestoredHeight() const OVERRIDE; | 76 virtual int GetRestoredHeight() const OVERRIDE; |
76 virtual void SetRestoredHeight(int height) OVERRIDE; | 77 virtual void SetRestoredHeight(int height) OVERRIDE; |
77 | 78 |
78 private: | 79 private: |
79 // Resize the window as specified by the bounds. Move the window to the | 80 // Resize the window as specified by the bounds. |
80 // specified location only if "move" is true. We set the window gravity to be | 81 // Panels use window gravity of GDK_GRAVITY_SOUTH_EAST which means the |
81 // GDK_GRAVITY_SOUTH_EAST which means the window is anchored to the bottom | 82 // window is anchored to the bottom right corner on resize, making it |
82 // right corner on resize, making it unnecessary to move the window if the | 83 // unnecessary to move the window if the bottom right corner is unchanged. |
83 // bottom right corner is unchanged, for example when we minimize to the | 84 // For example, when we minimize to the bottom, moving can actually |
84 // bottom. Moving can actually result in the wrong behavior. | 85 // result in the wrong behavior. |
85 // - Say window is 100x100 with x,y=900,900 on a 1000x1000 screen. | 86 // - Say window is 100x100 with x,y=900,900 on a 1000x1000 screen. |
86 // - Say you minimize the window to 100x3 and move it to 900,997 to keep it | 87 // - Say you minimize the window to 100x3 and move it to 900,997 to keep it |
87 // anchored to the bottom. | 88 // anchored to the bottom. |
88 // - resize is an async operation and the window manager will decide that | 89 // - resize is an async operation and the window manager will decide that |
89 // the move will take the window off screen and it won't honor the | 90 // the move will take the window off screen and it won't honor the |
90 // request. | 91 // request. |
91 // - When resize finally happens, you'll have a 100x3 window a x,y=900,900. | 92 // - When resize finally happens, you'll have a 100x3 window a x,y=900,900. |
92 void SetBoundsImpl(const gfx::Rect& bounds, bool move); | 93 // Set |force_move| to true to force a move regardless. Otherwise, the |
| 94 // window is only moved if the bottom right corner is being changed. |
| 95 void SetBoundsImpl(const gfx::Rect& bounds, bool force_move); |
93 | 96 |
94 // MessageLoop::Observer implementation: | 97 // MessageLoop::Observer implementation: |
95 virtual void WillProcessEvent(GdkEvent* event) OVERRIDE; | 98 virtual void WillProcessEvent(GdkEvent* event) OVERRIDE; |
96 virtual void DidProcessEvent(GdkEvent* event) OVERRIDE; | 99 virtual void DidProcessEvent(GdkEvent* event) OVERRIDE; |
97 | 100 |
98 void CreateDragWidget(); | 101 void CreateDragWidget(); |
99 void DestroyDragWidget(); | 102 void DestroyDragWidget(); |
100 void EndDrag(bool canceled); | 103 void EndDrag(bool canceled); |
101 void CleanupDragDrop(); | 104 void CleanupDragDrop(); |
102 | 105 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 scoped_ptr<Panel> panel_; | 152 scoped_ptr<Panel> panel_; |
150 gfx::Rect bounds_; | 153 gfx::Rect bounds_; |
151 | 154 |
152 scoped_ptr<PanelSettingsMenuModel> settings_menu_model_; | 155 scoped_ptr<PanelSettingsMenuModel> settings_menu_model_; |
153 scoped_ptr<MenuGtk> settings_menu_; | 156 scoped_ptr<MenuGtk> settings_menu_; |
154 | 157 |
155 // Stores the original height of the panel so we can restore it after it's | 158 // Stores the original height of the panel so we can restore it after it's |
156 // been minimized. | 159 // been minimized. |
157 int restored_height_; | 160 int restored_height_; |
158 | 161 |
| 162 // False until the window has been allocated and the size of browser window |
| 163 // frame around the content is known. |
| 164 bool non_client_area_size_known_; |
| 165 |
159 DISALLOW_COPY_AND_ASSIGN(PanelBrowserWindowGtk); | 166 DISALLOW_COPY_AND_ASSIGN(PanelBrowserWindowGtk); |
160 }; | 167 }; |
161 | 168 |
162 #endif // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_ | 169 #endif // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_ |
OLD | NEW |