OLD | NEW |
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_TITLEBAR_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_TITLEBAR_GTK_H_ |
6 #define CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_TITLEBAR_GTK_H_ | 6 #define CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_TITLEBAR_GTK_H_ |
7 | 7 |
8 #include "chrome/browser/ui/gtk/browser_titlebar.h" | 8 #include "chrome/browser/ui/gtk/browser_titlebar.h" |
| 9 #include "ui/gfx/skia_util.h" |
9 | 10 |
10 class PanelBrowserWindowGtk; | 11 class PanelBrowserWindowGtk; |
11 | 12 |
12 class PanelBrowserTitlebarGtk : public BrowserTitlebar { | 13 class PanelBrowserTitlebarGtk : public BrowserTitlebar { |
13 public: | 14 public: |
14 PanelBrowserTitlebarGtk(PanelBrowserWindowGtk* browser_window, | 15 PanelBrowserTitlebarGtk(PanelBrowserWindowGtk* browser_window, |
15 GtkWindow* window); | 16 GtkWindow* window); |
16 virtual ~PanelBrowserTitlebarGtk(); | 17 virtual ~PanelBrowserTitlebarGtk(); |
17 | 18 |
18 void UpdateMinimizeRestoreButtonVisibility(); | 19 void UpdateMinimizeRestoreButtonVisibility(); |
19 | 20 |
| 21 // When a panel appears in the same position as the one of the panel being |
| 22 // closed and the cursor stays in the close button, the close button appears |
| 23 // not to be clickable. This is because neither "enter-notify-event" nor |
| 24 // "clicked" event for the new panel gets fired if the mouse does not move. |
| 25 // This creates a bad experience when a user has multiple panels of the same |
| 26 // size (which is typical) and tries closing them all by repeatedly clicking |
| 27 // in the same place on the screen. |
| 28 // |
| 29 // Opened a gtk bug for this - |
| 30 // https://bugzilla.gnome.org/show_bug.cgi?id=667841 |
| 31 void SendEnterNotifyToCloseButtonIfUnderMouse(); |
| 32 |
| 33 // Overridden from BrowserTitlebar: |
| 34 virtual void UpdateButtonBackground(CustomDrawButton* button) OVERRIDE; |
| 35 virtual void UpdateTitleAndIcon() OVERRIDE; |
| 36 virtual void UpdateTextColor() OVERRIDE; |
| 37 |
20 protected: | 38 protected: |
21 // Overridden from BrowserTitlebar: | 39 // Overridden from BrowserTitlebar: |
22 virtual bool BuildButton(const std::string& button_token, | 40 virtual bool BuildButton(const std::string& button_token, |
23 bool left_side) OVERRIDE; | 41 bool left_side) OVERRIDE; |
24 virtual void GetButtonResources(const std::string& button_name, | 42 virtual void GetButtonResources(const std::string& button_name, |
25 int* normal_image_id, | 43 int* normal_image_id, |
26 int* pressed_image_id, | 44 int* pressed_image_id, |
27 int* hover_image_id, | 45 int* hover_image_id, |
28 int* tooltip_id) const OVERRIDE; | 46 int* tooltip_id) const OVERRIDE; |
29 virtual int GetButtonOuterPadding() const OVERRIDE; | 47 virtual int GetButtonOuterPadding() const OVERRIDE; |
30 virtual int GetButtonSpacing() const OVERRIDE; | 48 virtual int GetButtonSpacing() const OVERRIDE; |
31 virtual void HandleButtonClick(GtkWidget* button) OVERRIDE; | 49 virtual void HandleButtonClick(GtkWidget* button) OVERRIDE; |
32 virtual void ShowFaviconMenu(GdkEventButton* event) OVERRIDE; | 50 virtual void ShowFaviconMenu(GdkEventButton* event) OVERRIDE; |
33 | 51 |
34 private: | 52 private: |
35 friend class NativePanelTestingGtk; | 53 friend class NativePanelTestingGtk; |
36 | 54 |
37 CustomDrawButton* unminimize_button() const { | 55 CustomDrawButton* unminimize_button() const { |
38 return unminimize_button_.get(); | 56 return unminimize_button_.get(); |
39 } | 57 } |
40 | 58 |
| 59 SkColor GetTextColor() const; |
| 60 |
41 PanelBrowserWindowGtk* browser_window_; | 61 PanelBrowserWindowGtk* browser_window_; |
42 | 62 |
43 // All other buttons, including close and minimize buttons, are defined in | 63 // All other buttons, including close and minimize buttons, are defined in |
44 // the base class BrowserTitlebar. This is indeed our restore button. But | 64 // the base class BrowserTitlebar. This is indeed our restore button. But |
45 // we name it differently to avoid the confusion with restore_button defined | 65 // we name it differently to avoid the confusion with restore_button defined |
46 // in the base class and used for unmaximize purpose. | 66 // in the base class and used for unmaximize purpose. |
47 scoped_ptr<CustomDrawButton> unminimize_button_; | 67 scoped_ptr<CustomDrawButton> unminimize_button_; |
48 | 68 |
49 DISALLOW_COPY_AND_ASSIGN(PanelBrowserTitlebarGtk); | 69 DISALLOW_COPY_AND_ASSIGN(PanelBrowserTitlebarGtk); |
50 }; | 70 }; |
51 | 71 |
52 #endif // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_TITLEBAR_GTK_H_ | 72 #endif // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_TITLEBAR_GTK_H_ |
OLD | NEW |