OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/gtk/gtk_chrome_link_button.h" | 5 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include "chrome/browser/ui/gtk/gtk_util.h" | 9 #include "chrome/browser/ui/gtk/gtk_util.h" |
10 #include "ui/base/gtk/gtk_compat.h" | 10 #include "ui/base/gtk/gtk_compat.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 button->is_normal = TRUE; | 132 button->is_normal = TRUE; |
133 } | 133 } |
134 | 134 |
135 // Draw the link inside the button. | 135 // Draw the link inside the button. |
136 gtk_container_propagate_expose(GTK_CONTAINER(widget), label, event); | 136 gtk_container_propagate_expose(GTK_CONTAINER(widget), label, event); |
137 | 137 |
138 // Draw the focus rectangle. | 138 // Draw the focus rectangle. |
139 if (gtk_widget_has_focus(widget)) { | 139 if (gtk_widget_has_focus(widget)) { |
140 GtkAllocation allocation; | 140 GtkAllocation allocation; |
141 gtk_widget_get_allocation(widget, &allocation); | 141 gtk_widget_get_allocation(widget, &allocation); |
142 gtk_paint_focus(widget->style, widget->window, | 142 gtk_paint_focus(gtk_widget_get_style(widget), |
| 143 gtk_widget_get_window(widget), |
143 gtk_widget_get_state(widget), | 144 gtk_widget_get_state(widget), |
144 &event->area, widget, NULL, | 145 &event->area, widget, NULL, |
145 allocation.x, allocation.y, | 146 allocation.x, allocation.y, |
146 allocation.width, allocation.height); | 147 allocation.width, allocation.height); |
147 } | 148 } |
148 | 149 |
149 return TRUE; | 150 return TRUE; |
150 } | 151 } |
151 | 152 |
152 static void gtk_chrome_link_button_enter(GtkButton* button) { | 153 static void gtk_chrome_link_button_enter(GtkButton* button) { |
153 GtkWidget* widget = GTK_WIDGET(button); | 154 GtkWidget* widget = GTK_WIDGET(button); |
154 GtkChromeLinkButton* link_button = GTK_CHROME_LINK_BUTTON(button); | 155 GtkChromeLinkButton* link_button = GTK_CHROME_LINK_BUTTON(button); |
155 gdk_window_set_cursor(widget->window, link_button->hand_cursor); | 156 gdk_window_set_cursor(gtk_widget_get_window(widget), |
| 157 link_button->hand_cursor); |
156 } | 158 } |
157 | 159 |
158 static void gtk_chrome_link_button_leave(GtkButton* button) { | 160 static void gtk_chrome_link_button_leave(GtkButton* button) { |
159 GtkWidget* widget = GTK_WIDGET(button); | 161 GtkWidget* widget = GTK_WIDGET(button); |
160 gdk_window_set_cursor(widget->window, NULL); | 162 gdk_window_set_cursor(widget->window, NULL); |
161 } | 163 } |
162 | 164 |
163 static void gtk_chrome_link_button_destroy(GtkObject* object) { | 165 static void gtk_chrome_link_button_destroy(GtkObject* object) { |
164 GtkChromeLinkButton* button = GTK_CHROME_LINK_BUTTON(object); | 166 GtkChromeLinkButton* button = GTK_CHROME_LINK_BUTTON(object); |
165 | 167 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 strncpy(button->normal_color, "blue", 9); | 258 strncpy(button->normal_color, "blue", 9); |
257 } | 259 } |
258 | 260 |
259 gtk_chrome_link_button_set_text(button); | 261 gtk_chrome_link_button_set_text(button); |
260 | 262 |
261 if (gtk_widget_get_visible(GTK_WIDGET(button))) | 263 if (gtk_widget_get_visible(GTK_WIDGET(button))) |
262 gtk_widget_queue_draw(GTK_WIDGET(button)); | 264 gtk_widget_queue_draw(GTK_WIDGET(button)); |
263 } | 265 } |
264 | 266 |
265 G_END_DECLS | 267 G_END_DECLS |
OLD | NEW |