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

Unified Diff: chrome/browser/ui/libgtk2ui/gtk2_border.h

Issue 131513005: linux_aura: Use GTK button borders in GTK theme mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/libgtk2ui/gtk2_border.h
diff --git a/chrome/browser/ui/libgtk2ui/gtk2_border.h b/chrome/browser/ui/libgtk2ui/gtk2_border.h
new file mode 100644
index 0000000000000000000000000000000000000000..df3b52b89c266cc8259af8cbb71818893a489017
--- /dev/null
+++ b/chrome/browser/ui/libgtk2ui/gtk2_border.h
@@ -0,0 +1,62 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_LIBGTK2UI_GTK2_BORDER_H_
+#define CHROME_BROWSER_UI_LIBGTK2UI_GTK2_BORDER_H_
+
+#include "ui/gfx/image/image_skia.h"
+#include "ui/views/border.h"
+#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!
+
+namespace gfx {
+class Canvas;
+}
+
+namespace views {
+class LabelButtonBorder;
+class View;
+}
+
+namespace libgtk2ui {
+class Gtk2UI;
+
+// Draws a gtk button border, and manages the memory of the resulting pixbufs.
+class Gtk2Border : public views::Border {
+ public:
+ Gtk2Border(Gtk2UI* parent,
msw 2014/01/21 19:18:19 nit: This isn't really the parent, should it be na
+ views::View* owning_view,
msw 2014/01/21 19:18:19 Pass in a views::Button here to avoid static casti
+ views::LabelButtonBorder* label_button_border);
+ virtual ~Gtk2Border();
+
+ // Called on theme changes. We invalidate the layout, drop our cached images,
+ // and update our GTK state.
+ void InvalidateAndSetUsesGtk(bool use_gtk);
+
+ // Overridden from views::Border:
+ virtual void Paint(const views::View& view, gfx::Canvas* canvas) OVERRIDE;
+ virtual gfx::Insets GetInsets() const OVERRIDE;
+ virtual gfx::Size GetMinimumSize() const OVERRIDE;
+
+ private:
+ Gtk2UI* parent_;
+ bool use_gtk_;
+
+ gfx::ImageSkia hovered_;
+ gfx::ImageSkia pressed_;
+
+ // The view to which we are a border. We keep track of this so that we can
+ // force invalidate the layout on theme changes.
+ views::View* owning_view_;
+
+ // Since we don't want to expose the concept of whether we're using a GTK
+ // theme down to the cross platform views layer, we keep a normal
+ // LabelButtonBorder and delegate to it whenever we aren't in GTK theme mode.
+ scoped_ptr<views::LabelButtonBorder> label_button_border_;
msw 2014/01/21 19:18:19 This should just be a scoped_ptr<views::Border>.
+
+ DISALLOW_COPY_AND_ASSIGN(Gtk2Border);
+};
+
+} // namespace libgtk2ui
+
+#endif // CHROME_BROWSER_UI_LIBGTK2UI_GTK2_BORDER_H_
« no previous file with comments | « no previous file | chrome/browser/ui/libgtk2ui/gtk2_border.cc » ('j') | chrome/browser/ui/libgtk2ui/gtk2_border.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698