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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2009 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 #include "chrome/browser/gtk/gtk_skinny_button.h"
6
7 #include <stdlib.h>
8
9 #include "base/logging.h"
10
11 namespace {
12
13 // Set the GTK style on our custom link button. We don't want any border around
14 // the link text.
15 void SetLinkButtonStyle() {
16 static bool style_was_set = false;
17
18 if (style_was_set)
19 return;
20 style_was_set = true;
21
22 gtk_rc_parse_string(
23 "style \"skinny-button\" {"
24 " GtkButton::inner-border = {5, 5, 0, 0}"
25 " GtkButton::child-displacement-x = 0"
26 " GtkButton::child-displacement-y = 0"
27 " xthickness = 0"
28 " ythickness = 0"
29 "}"
30 "widget \"*skinny-button\" style \"skinny-button\"");
31 }
32
33 } // namespace
34
35 G_BEGIN_DECLS
36 G_DEFINE_TYPE(GtkSkinnyButton, gtk_skinny_button, GTK_TYPE_BUTTON)
37
38 static void gtk_skinny_button_destroy(GtkObject* object) {
39 GtkSkinnyButton* button = GTK_SKINNY_BUTTON(object);
40
41 free(button->click_button_event);
42 button->click_button_event = NULL;
43
44 GTK_OBJECT_CLASS(gtk_skinny_button_parent_class)->destroy(object);
45 }
46
47 static void gtk_skinny_button_class_init(
48 GtkSkinnyButtonClass* link_button_class) {
49 GtkObjectClass* object_class =
50 reinterpret_cast<GtkObjectClass*>(link_button_class);
51
52 object_class->destroy = &gtk_skinny_button_destroy;
53 }
54
55 static void gtk_skinny_button_init(GtkSkinnyButton* button) {
56 SetLinkButtonStyle();
57
58 gtk_widget_set_name(GTK_WIDGET(button), "skinny-button");
59 }
60
61 GtkWidget* gtk_skinny_button_new_with_label(const char* text) {
62 GtkWidget* lb = GTK_WIDGET(g_object_new(GTK_TYPE_SKINNY_BUTTON, NULL));
63 gtk_button_set_label(GTK_BUTTON(lb), text);
64 return lb;
65 }
66
67 const GdkEventButton* gtk_skinny_button_get_event_for_click(
68 GtkSkinnyButton* button) {
69 return button->click_button_event;
70 }
71
72 G_END_DECLS
OLDNEW
« 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