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

Side by Side Diff: chrome/browser/ui/libgtk2ui/gtk2_border.h

Issue 239093007: Update Windows UI on system color changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make Widget the observer, address additional comments. Created 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_LIBGTK2UI_GTK2_BORDER_H_ 5 #ifndef CHROME_BROWSER_UI_LIBGTK2UI_GTK2_BORDER_H_
6 #define CHROME_BROWSER_UI_LIBGTK2UI_GTK2_BORDER_H_ 6 #define CHROME_BROWSER_UI_LIBGTK2UI_GTK2_BORDER_H_
7 7
8 #include "ui/gfx/image/image_skia.h" 8 #include "ui/gfx/image/image_skia.h"
9 #include "ui/native_theme/native_theme.h" 9 #include "ui/native_theme/native_theme.h"
10 #include "ui/views/border.h" 10 #include "ui/views/border.h"
11 #include "ui/views/controls/button/button.h" 11 #include "ui/views/controls/button/button.h"
12 #include "ui/views/linux_ui/native_theme_change_observer.h"
13 12
14 namespace gfx { 13 namespace gfx {
15 class Canvas; 14 class Canvas;
16 } 15 }
17 16
18 namespace views { 17 namespace views {
19 class LabelButton; 18 class LabelButton;
20 class Border; 19 class Border;
21 } 20 }
22 21
23 namespace libgtk2ui { 22 namespace libgtk2ui {
24 class Gtk2UI; 23 class Gtk2UI;
25 24
26 // Draws a gtk button border, and manages the memory of the resulting pixbufs. 25 // Draws a gtk button border, and manages the memory of the resulting pixbufs.
27 class Gtk2Border : public views::Border, 26 class Gtk2Border : public views::Border, public ui::NativeThemeObserver {
28 public views::NativeThemeChangeObserver {
29 public: 27 public:
30 Gtk2Border(Gtk2UI* gtk2_ui, 28 Gtk2Border(Gtk2UI* gtk2_ui,
31 views::LabelButton* owning_button, 29 views::LabelButton* owning_button,
32 scoped_ptr<views::Border> border); 30 scoped_ptr<views::Border> border);
33 virtual ~Gtk2Border(); 31 virtual ~Gtk2Border();
34 32
35 // Overridden from views::Border: 33 // Overridden from views::Border:
36 virtual void Paint(const views::View& view, gfx::Canvas* canvas) OVERRIDE; 34 virtual void Paint(const views::View& view, gfx::Canvas* canvas) OVERRIDE;
37 virtual gfx::Insets GetInsets() const OVERRIDE; 35 virtual gfx::Insets GetInsets() const OVERRIDE;
38 virtual gfx::Size GetMinimumSize() const OVERRIDE; 36 virtual gfx::Size GetMinimumSize() const OVERRIDE;
39 37
40 // Overridden from views::NativeThemeChangeObserver: 38 // Overridden from views::NativeThemeChangeObserver:
41 virtual void OnNativeThemeChanged() OVERRIDE; 39 virtual void OnNativeThemeUpdate() OVERRIDE;
42 40
43 private: 41 private:
44 void PaintState(const ui::NativeTheme::State state, 42 void PaintState(const ui::NativeTheme::State state,
45 const ui::NativeTheme::ExtraParams& extra, 43 const ui::NativeTheme::ExtraParams& extra,
46 const gfx::Rect& rect, 44 const gfx::Rect& rect,
47 gfx::Canvas* canvas); 45 gfx::Canvas* canvas);
48 46
49 bool ShouldDrawBorder(bool focused, views::Button::ButtonState state); 47 bool ShouldDrawBorder(bool focused, views::Button::ButtonState state);
50 48
51 Gtk2UI* gtk2_ui_; 49 Gtk2UI* gtk2_ui_;
52 50
53 gfx::ImageSkia button_images_[2][views::Button::STATE_COUNT]; 51 gfx::ImageSkia button_images_[2][views::Button::STATE_COUNT];
54 52
55 // The view to which we are a border. We keep track of this so that we can 53 // The view to which we are a border. We keep track of this so that we can
56 // force invalidate the layout on theme changes. 54 // force invalidate the layout on theme changes.
57 views::LabelButton* owning_button_; 55 views::LabelButton* owning_button_;
58 56
59 // Since we don't want to expose the concept of whether we're using a GTK 57 // Since we don't want to expose the concept of whether we're using a GTK
60 // theme down to the cross platform views layer, we keep a normal Border and 58 // theme down to the cross platform views layer, we keep a normal Border and
61 // delegate to it whenever we aren't in GTK theme mode. 59 // delegate to it whenever we aren't in GTK theme mode.
62 scoped_ptr<views::Border> border_; 60 scoped_ptr<views::Border> border_;
63 61
64 DISALLOW_COPY_AND_ASSIGN(Gtk2Border); 62 DISALLOW_COPY_AND_ASSIGN(Gtk2Border);
65 }; 63 };
66 64
67 } // namespace libgtk2ui 65 } // namespace libgtk2ui
68 66
69 #endif // CHROME_BROWSER_UI_LIBGTK2UI_GTK2_BORDER_H_ 67 #endif // CHROME_BROWSER_UI_LIBGTK2UI_GTK2_BORDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698