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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 button->using_native_theme ? button->native_markup : | 130 button->using_native_theme ? button->native_markup : |
131 button->normal_markup); | 131 button->normal_markup); |
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; |
| 141 gtk_widget_get_allocation(widget, &allocation); |
140 gtk_paint_focus(widget->style, widget->window, | 142 gtk_paint_focus(widget->style, widget->window, |
141 gtk_widget_get_state(widget), | 143 gtk_widget_get_state(widget), |
142 &event->area, widget, NULL, | 144 &event->area, widget, NULL, |
143 widget->allocation.x, widget->allocation.y, | 145 allocation.x, allocation.y, |
144 widget->allocation.width, widget->allocation.height); | 146 allocation.width, allocation.height); |
145 } | 147 } |
146 | 148 |
147 return TRUE; | 149 return TRUE; |
148 } | 150 } |
149 | 151 |
150 static void gtk_chrome_link_button_enter(GtkButton* button) { | 152 static void gtk_chrome_link_button_enter(GtkButton* button) { |
151 GtkWidget* widget = GTK_WIDGET(button); | 153 GtkWidget* widget = GTK_WIDGET(button); |
152 GtkChromeLinkButton* link_button = GTK_CHROME_LINK_BUTTON(button); | 154 GtkChromeLinkButton* link_button = GTK_CHROME_LINK_BUTTON(button); |
153 gdk_window_set_cursor(widget->window, link_button->hand_cursor); | 155 gdk_window_set_cursor(widget->window, link_button->hand_cursor); |
154 } | 156 } |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 strncpy(button->normal_color, "blue", 9); | 256 strncpy(button->normal_color, "blue", 9); |
255 } | 257 } |
256 | 258 |
257 gtk_chrome_link_button_set_text(button); | 259 gtk_chrome_link_button_set_text(button); |
258 | 260 |
259 if (gtk_widget_get_visible(GTK_WIDGET(button))) | 261 if (gtk_widget_get_visible(GTK_WIDGET(button))) |
260 gtk_widget_queue_draw(GTK_WIDGET(button)); | 262 gtk_widget_queue_draw(GTK_WIDGET(button)); |
261 } | 263 } |
262 | 264 |
263 G_END_DECLS | 265 G_END_DECLS |
OLD | NEW |