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

Unified Diff: chrome/browser/gtk/gtk_skinny_button.cc

Issue 160084: Chaos geolocation demo, non-WebKit part. Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 4 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
« no previous file with comments | « chrome/browser/gtk/gtk_skinny_button.h ('k') | chrome/browser/gtk/infobar_gtk.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gtk/gtk_skinny_button.cc
===================================================================
--- chrome/browser/gtk/gtk_skinny_button.cc (revision 0)
+++ chrome/browser/gtk/gtk_skinny_button.cc (revision 0)
@@ -0,0 +1,72 @@
+// Copyright (c) 2009 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.
+
+#include "chrome/browser/gtk/gtk_skinny_button.h"
+
+#include <stdlib.h>
+
+#include "base/logging.h"
+
+namespace {
+
+// Set the GTK style on our custom link button. We don't want any border around
+// the link text.
+void SetLinkButtonStyle() {
+ static bool style_was_set = false;
+
+ if (style_was_set)
+ return;
+ style_was_set = true;
+
+ gtk_rc_parse_string(
+ "style \"skinny-button\" {"
+ " GtkButton::inner-border = {5, 5, 0, 0}"
+ " GtkButton::child-displacement-x = 0"
+ " GtkButton::child-displacement-y = 0"
+ " xthickness = 0"
+ " ythickness = 0"
+ "}"
+ "widget \"*skinny-button\" style \"skinny-button\"");
+}
+
+} // namespace
+
+G_BEGIN_DECLS
+G_DEFINE_TYPE(GtkSkinnyButton, gtk_skinny_button, GTK_TYPE_BUTTON)
+
+static void gtk_skinny_button_destroy(GtkObject* object) {
+ GtkSkinnyButton* button = GTK_SKINNY_BUTTON(object);
+
+ free(button->click_button_event);
+ button->click_button_event = NULL;
+
+ GTK_OBJECT_CLASS(gtk_skinny_button_parent_class)->destroy(object);
+}
+
+static void gtk_skinny_button_class_init(
+ GtkSkinnyButtonClass* link_button_class) {
+ GtkObjectClass* object_class =
+ reinterpret_cast<GtkObjectClass*>(link_button_class);
+
+ object_class->destroy = &gtk_skinny_button_destroy;
+}
+
+static void gtk_skinny_button_init(GtkSkinnyButton* button) {
+ SetLinkButtonStyle();
+
+ gtk_widget_set_name(GTK_WIDGET(button), "skinny-button");
+}
+
+GtkWidget* gtk_skinny_button_new_with_label(const char* text) {
+ GtkWidget* lb = GTK_WIDGET(g_object_new(GTK_TYPE_SKINNY_BUTTON, NULL));
+ gtk_button_set_label(GTK_BUTTON(lb), text);
+ return lb;
+}
+
+const GdkEventButton* gtk_skinny_button_get_event_for_click(
+ GtkSkinnyButton* button) {
+ return button->click_button_event;
+}
+
+G_END_DECLS
Property changes on: chrome/browser/gtk/gtk_skinny_button.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « chrome/browser/gtk/gtk_skinny_button.h ('k') | chrome/browser/gtk/infobar_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698