| 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 = >k_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
|
|
|
|
|