 Chromium Code Reviews
 Chromium Code Reviews Issue 131513005:
  linux_aura: Use GTK button borders in GTK theme mode.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 131513005:
  linux_aura: Use GTK button borders in GTK theme mode.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| OLD | NEW | 
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_LIBGTK2UI_GTK2_BORDER_H_ | |
| 6 #define CHROME_BROWSER_UI_LIBGTK2UI_GTK2_BORDER_H_ | |
| 7 | |
| 8 #include "ui/gfx/image/image_skia.h" | |
| 9 #include "ui/views/border.h" | |
| 10 #include "ui/views/controls/button/button.h" | |
| 
msw
2014/01/21 19:18:19
nit: this include isn't needed.
 
msw
2014/01/22 02:21:08
PING!
 | |
| 11 | |
| 12 namespace gfx { | |
| 13 class Canvas; | |
| 14 } | |
| 15 | |
| 16 namespace views { | |
| 17 class LabelButtonBorder; | |
| 18 class View; | |
| 19 } | |
| 20 | |
| 21 namespace libgtk2ui { | |
| 22 class Gtk2UI; | |
| 23 | |
| 24 // Draws a gtk button border, and manages the memory of the resulting pixbufs. | |
| 25 class Gtk2Border : public views::Border { | |
| 26 public: | |
| 27 Gtk2Border(Gtk2UI* parent, | |
| 
msw
2014/01/21 19:18:19
nit: This isn't really the parent, should it be na
 | |
| 28 views::View* owning_view, | |
| 
msw
2014/01/21 19:18:19
Pass in a views::Button here to avoid static casti
 | |
| 29 views::LabelButtonBorder* label_button_border); | |
| 30 virtual ~Gtk2Border(); | |
| 31 | |
| 32 // Called on theme changes. We invalidate the layout, drop our cached images, | |
| 33 // and update our GTK state. | |
| 34 void InvalidateAndSetUsesGtk(bool use_gtk); | |
| 35 | |
| 36 // Overridden from views::Border: | |
| 37 virtual void Paint(const views::View& view, gfx::Canvas* canvas) OVERRIDE; | |
| 38 virtual gfx::Insets GetInsets() const OVERRIDE; | |
| 39 virtual gfx::Size GetMinimumSize() const OVERRIDE; | |
| 40 | |
| 41 private: | |
| 42 Gtk2UI* parent_; | |
| 43 bool use_gtk_; | |
| 44 | |
| 45 gfx::ImageSkia hovered_; | |
| 46 gfx::ImageSkia pressed_; | |
| 47 | |
| 48 // The view to which we are a border. We keep track of this so that we can | |
| 49 // force invalidate the layout on theme changes. | |
| 50 views::View* owning_view_; | |
| 51 | |
| 52 // Since we don't want to expose the concept of whether we're using a GTK | |
| 53 // theme down to the cross platform views layer, we keep a normal | |
| 54 // LabelButtonBorder and delegate to it whenever we aren't in GTK theme mode. | |
| 55 scoped_ptr<views::LabelButtonBorder> label_button_border_; | |
| 
msw
2014/01/21 19:18:19
This should just be a scoped_ptr<views::Border>.
 | |
| 56 | |
| 57 DISALLOW_COPY_AND_ASSIGN(Gtk2Border); | |
| 58 }; | |
| 59 | |
| 60 } // namespace libgtk2ui | |
| 61 | |
| 62 #endif // CHROME_BROWSER_UI_LIBGTK2UI_GTK2_BORDER_H_ | |
| OLD | NEW |