| OLD | NEW |
| 1 // Copyright (c) 2010 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 // Creates a link button that shows |text| in blue and underlined. The cursor | |
| 6 // changes to a hand when over the link. This is like the GTK LinkButton, but | |
| 7 // it doesn't call the global URI link handler, etc. It is a button subclass, | |
| 8 // so you can just handle the clicked signal. | |
| 9 | |
| 10 #ifndef CHROME_BROWSER_GTK_GTK_CHROME_LINK_BUTTON_H_ | 5 #ifndef CHROME_BROWSER_GTK_GTK_CHROME_LINK_BUTTON_H_ |
| 11 #define CHROME_BROWSER_GTK_GTK_CHROME_LINK_BUTTON_H_ | 6 #define CHROME_BROWSER_GTK_GTK_CHROME_LINK_BUTTON_H_ |
| 12 #pragma once | 7 #pragma once |
| 13 | 8 |
| 14 #include <gdk/gdk.h> | 9 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" |
| 15 #include <gtk/gtk.h> | 10 // TODO(msw): remove this file once all includes have been updated. |
| 16 | |
| 17 G_BEGIN_DECLS | |
| 18 | |
| 19 #define GTK_TYPE_CHROME_LINK_BUTTON (gtk_chrome_link_button_get_type ()) | |
| 20 #define GTK_CHROME_LINK_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \ | |
| 21 GTK_TYPE_CHROME_LINK_BUTTON, \ | |
| 22 GtkChromeLinkButton)) | |
| 23 #define GTK_CHROME_LINK_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \ | |
| 24 GTK_TYPE_CHROME_LINK_BUTTON, \ | |
| 25 GtkChromeLinkButtonClass)) | |
| 26 #define GTK_IS_CHROME_LINK_BUTTON(obj) \ | |
| 27 (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_CHROME_LINK_BUTTON)) | |
| 28 #define GTK_IS_CHROME_LINK_BUTTON_CLASS(klass) \ | |
| 29 (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_CHROME_LINK_BUTTON)) | |
| 30 #define GTK_CHROME_LINK_BUTTON_GET_CLASS(obj) \ | |
| 31 (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_CHROME_LINK_BUTTON, \ | |
| 32 GtkChromeLinkButton)) | |
| 33 | |
| 34 typedef struct _GtkChromeLinkButton GtkChromeLinkButton; | |
| 35 typedef struct _GtkChromeLinkButtonClass GtkChromeLinkButtonClass; | |
| 36 | |
| 37 struct _GtkChromeLinkButton { | |
| 38 GtkButton button; | |
| 39 GtkWidget* label; | |
| 40 gchar* normal_markup; | |
| 41 gchar* pressed_markup; | |
| 42 gboolean is_normal; | |
| 43 gchar normal_color[9]; | |
| 44 gchar* native_markup; | |
| 45 gboolean using_native_theme; | |
| 46 GdkCursor* hand_cursor; | |
| 47 gchar* text; | |
| 48 gboolean uses_markup; | |
| 49 }; | |
| 50 | |
| 51 struct _GtkChromeLinkButtonClass { | |
| 52 GtkButtonClass parent_class; | |
| 53 }; | |
| 54 | |
| 55 // Make a link button with display text |text|. | |
| 56 GtkWidget* gtk_chrome_link_button_new(const char* text); | |
| 57 | |
| 58 // As above, but don't escape markup in the text. | |
| 59 GtkWidget* gtk_chrome_link_button_new_with_markup(const char* markup); | |
| 60 | |
| 61 // Set whether the link button draws natively (using "link-color"). The default | |
| 62 // is TRUE. | |
| 63 void gtk_chrome_link_button_set_use_gtk_theme(GtkChromeLinkButton* button, | |
| 64 gboolean use_gtk); | |
| 65 | |
| 66 // Set the label text of the link. | |
| 67 void gtk_chrome_link_button_set_label(GtkChromeLinkButton* button, | |
| 68 const char* text); | |
| 69 | |
| 70 // Set the color when the link is in a normal state (i.e. not pressed). | |
| 71 // If not set, or called NULL |color|, the color will be blue. | |
| 72 void gtk_chrome_link_button_set_normal_color(GtkChromeLinkButton* button, | |
| 73 const GdkColor* color); | |
| 74 | |
| 75 GType gtk_chrome_link_button_get_type(); | |
| 76 | |
| 77 G_END_DECLS | |
| 78 | 11 |
| 79 #endif // CHROME_BROWSER_GTK_GTK_CHROME_LINK_BUTTON_H_ | 12 #endif // CHROME_BROWSER_GTK_GTK_CHROME_LINK_BUTTON_H_ |
| OLD | NEW |