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

Side by Side Diff: chrome/browser/gtk/gtk_chrome_button.cc

Issue 210019: GTK: Add a bunch more widget names for parasite.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: comments Created 11 years, 3 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/bookmark_bar_gtk.cc ('k') | chrome/browser/gtk/gtk_chrome_link_button.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/gtk/gtk_chrome_button.h" 5 #include "chrome/browser/gtk/gtk_chrome_button.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/gfx/gtk_util.h" 8 #include "base/gfx/gtk_util.h"
9 #include "chrome/browser/gtk/nine_box.h" 9 #include "chrome/browser/gtk/nine_box.h"
10 10
(...skipping 26 matching lines...) Expand all
37 G_DEFINE_TYPE(GtkChromeButton, gtk_chrome_button, GTK_TYPE_BUTTON) 37 G_DEFINE_TYPE(GtkChromeButton, gtk_chrome_button, GTK_TYPE_BUTTON)
38 static gboolean gtk_chrome_button_expose(GtkWidget* widget, 38 static gboolean gtk_chrome_button_expose(GtkWidget* widget,
39 GdkEventExpose* event); 39 GdkEventExpose* event);
40 40
41 static void gtk_chrome_button_class_init(GtkChromeButtonClass* button_class) { 41 static void gtk_chrome_button_class_init(GtkChromeButtonClass* button_class) {
42 gtk_rc_parse_string( 42 gtk_rc_parse_string(
43 "style \"chrome-button\" {" 43 "style \"chrome-button\" {"
44 " GtkButton::child-displacement-x = 0" 44 " GtkButton::child-displacement-x = 0"
45 " GtkButton::child-displacement-y = 0" 45 " GtkButton::child-displacement-y = 0"
46 "}" 46 "}"
47 "widget \"*chrome-button\" style \"chrome-button\""); 47 "widget_class \"*.<GtkChromeButton>\" style \"chrome-button\"");
48 48
49 GObjectClass* gobject_class = G_OBJECT_CLASS(button_class); 49 GObjectClass* gobject_class = G_OBJECT_CLASS(button_class);
50 GtkWidgetClass* widget_class = reinterpret_cast<GtkWidgetClass*>( 50 GtkWidgetClass* widget_class = reinterpret_cast<GtkWidgetClass*>(
51 button_class); 51 button_class);
52 widget_class->expose_event = gtk_chrome_button_expose; 52 widget_class->expose_event = gtk_chrome_button_expose;
53 53
54 g_nine_box_prelight = new NineBox( 54 g_nine_box_prelight = new NineBox(
55 IDR_TEXTBUTTON_TOP_LEFT_H, 55 IDR_TEXTBUTTON_TOP_LEFT_H,
56 IDR_TEXTBUTTON_TOP_H, 56 IDR_TEXTBUTTON_TOP_H,
57 IDR_TEXTBUTTON_TOP_RIGHT_H, 57 IDR_TEXTBUTTON_TOP_RIGHT_H,
(...skipping 16 matching lines...) Expand all
74 IDR_TEXTBUTTON_BOTTOM_RIGHT_P); 74 IDR_TEXTBUTTON_BOTTOM_RIGHT_P);
75 75
76 g_type_class_add_private(gobject_class, sizeof(GtkChromeButtonPrivate)); 76 g_type_class_add_private(gobject_class, sizeof(GtkChromeButtonPrivate));
77 } 77 }
78 78
79 static void gtk_chrome_button_init(GtkChromeButton* button) { 79 static void gtk_chrome_button_init(GtkChromeButton* button) {
80 GtkChromeButtonPrivate* priv = GTK_CHROME_BUTTON_GET_PRIVATE(button); 80 GtkChromeButtonPrivate* priv = GTK_CHROME_BUTTON_GET_PRIVATE(button);
81 priv->paint_state = -1; 81 priv->paint_state = -1;
82 priv->use_gtk_rendering = FALSE; 82 priv->use_gtk_rendering = FALSE;
83 83
84 gtk_widget_set_name(GTK_WIDGET(button), "chrome-button");
85 gtk_widget_set_app_paintable(GTK_WIDGET(button), TRUE); 84 gtk_widget_set_app_paintable(GTK_WIDGET(button), TRUE);
86 85
87 GTK_WIDGET_UNSET_FLAGS(button, GTK_CAN_FOCUS); 86 GTK_WIDGET_UNSET_FLAGS(button, GTK_CAN_FOCUS);
88 } 87 }
89 88
90 static gboolean gtk_chrome_button_expose(GtkWidget* widget, 89 static gboolean gtk_chrome_button_expose(GtkWidget* widget,
91 GdkEventExpose* event) { 90 GdkEventExpose* event) {
92 GtkChromeButtonPrivate *priv = GTK_CHROME_BUTTON_GET_PRIVATE(widget); 91 GtkChromeButtonPrivate *priv = GTK_CHROME_BUTTON_GET_PRIVATE(widget);
93 int paint_state = priv->paint_state < 0 ? 92 int paint_state = priv->paint_state < 0 ?
94 GTK_WIDGET_STATE(widget) : priv->paint_state; 93 GTK_WIDGET_STATE(widget) : priv->paint_state;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 } 152 }
154 153
155 void gtk_chrome_button_set_use_gtk_rendering(GtkChromeButton* button, 154 void gtk_chrome_button_set_use_gtk_rendering(GtkChromeButton* button,
156 gboolean value) { 155 gboolean value) {
157 g_return_if_fail(GTK_IS_CHROME_BUTTON(button)); 156 g_return_if_fail(GTK_IS_CHROME_BUTTON(button));
158 GtkChromeButtonPrivate *priv = GTK_CHROME_BUTTON_GET_PRIVATE(button); 157 GtkChromeButtonPrivate *priv = GTK_CHROME_BUTTON_GET_PRIVATE(button);
159 priv->use_gtk_rendering = value; 158 priv->use_gtk_rendering = value;
160 } 159 }
161 160
162 G_END_DECLS 161 G_END_DECLS
OLDNEW
« no previous file with comments | « chrome/browser/gtk/bookmark_bar_gtk.cc ('k') | chrome/browser/gtk/gtk_chrome_link_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698