| 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 |
| 11 namespace gfx { |
| 12 class Canvas; |
| 13 } |
| 14 |
| 15 namespace views { |
| 16 class CustomButton; |
| 17 } |
| 18 |
| 19 namespace libgtk2ui { |
| 20 class Gtk2UI; |
| 21 |
| 22 // Draws a gtk button border, and manages the memory of the resulting pixbufs. |
| 23 class Gtk2Border : public views::Border { |
| 24 public: |
| 25 Gtk2Border(Gtk2UI* gtk2_ui, |
| 26 views::CustomButton* owning_button, |
| 27 views::Border* border); |
| 28 virtual ~Gtk2Border(); |
| 29 |
| 30 // Called on theme changes. We invalidate the layout, drop our cached images, |
| 31 // and update our GTK state. |
| 32 void InvalidateAndSetUsesGtk(bool use_gtk); |
| 33 |
| 34 // Overridden from views::Border: |
| 35 virtual void Paint(const views::View& view, gfx::Canvas* canvas) OVERRIDE; |
| 36 virtual gfx::Insets GetInsets() const OVERRIDE; |
| 37 virtual gfx::Size GetMinimumSize() const OVERRIDE; |
| 38 |
| 39 private: |
| 40 Gtk2UI* gtk2_ui_; |
| 41 bool use_gtk_; |
| 42 |
| 43 gfx::ImageSkia hovered_; |
| 44 gfx::ImageSkia pressed_; |
| 45 |
| 46 // The view to which we are a border. We keep track of this so that we can |
| 47 // force invalidate the layout on theme changes. |
| 48 views::CustomButton* owning_button_; |
| 49 |
| 50 // Since we don't want to expose the concept of whether we're using a GTK |
| 51 // theme down to the cross platform views layer, we keep a normal Border and |
| 52 // delegate to it whenever we aren't in GTK theme mode. |
| 53 scoped_ptr<views::Border> border_; |
| 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(Gtk2Border); |
| 56 }; |
| 57 |
| 58 } // namespace libgtk2ui |
| 59 |
| 60 #endif // CHROME_BROWSER_UI_LIBGTK2UI_GTK2_BORDER_H_ |
| OLD | NEW |