OLD | NEW |
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 // Creates a link button that shows |text| in blue and underlined. The cursor | 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 | 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, | 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. | 8 // so you can just handle the clicked signal. |
9 | 9 |
10 #ifndef CHROME_BROWSER_GTK_GTK_CHROME_LINK_BUTTON_H_ | 10 #ifndef CHROME_BROWSER_GTK_GTK_CHROME_LINK_BUTTON_H_ |
(...skipping 19 matching lines...) Expand all Loading... |
30 (G_TYPE_INSTANCE_GET_CLASS ((obj), \ | 30 (G_TYPE_INSTANCE_GET_CLASS ((obj), \ |
31 GTK_TYPE_CHROME_LINK_BUTTON, \ | 31 GTK_TYPE_CHROME_LINK_BUTTON, \ |
32 GtkChromeLinkButton)) | 32 GtkChromeLinkButton)) |
33 | 33 |
34 typedef struct _GtkChromeLinkButton GtkChromeLinkButton; | 34 typedef struct _GtkChromeLinkButton GtkChromeLinkButton; |
35 typedef struct _GtkChromeLinkButtonClass GtkChromeLinkButtonClass; | 35 typedef struct _GtkChromeLinkButtonClass GtkChromeLinkButtonClass; |
36 | 36 |
37 struct _GtkChromeLinkButton { | 37 struct _GtkChromeLinkButton { |
38 GtkButton button; | 38 GtkButton button; |
39 GtkWidget* label; | 39 GtkWidget* label; |
40 char* blue_markup; | 40 gchar* blue_markup; |
41 char* red_markup; | 41 gchar* red_markup; |
42 gboolean is_blue; | 42 gboolean is_blue; |
43 GdkCursor* hand_cursor; | 43 GdkCursor* hand_cursor; |
44 GdkEventButton* click_button_event; | 44 GdkEventButton* click_button_event; |
45 }; | 45 }; |
46 | 46 |
47 struct _GtkChromeLinkButtonClass { | 47 struct _GtkChromeLinkButtonClass { |
48 GtkButtonClass parent_class; | 48 GtkButtonClass parent_class; |
49 }; | 49 }; |
50 | 50 |
| 51 // Make a link button with display text |text|. |
51 GtkWidget* gtk_chrome_link_button_new(const char* text); | 52 GtkWidget* gtk_chrome_link_button_new(const char* text); |
52 | 53 |
| 54 // As above, but don't escape markup in the text. |
| 55 GtkWidget* gtk_chrome_link_button_new_with_markup(const char* markup); |
| 56 |
53 // Call this from within a "clicked" handler to get the release event that | 57 // Call this from within a "clicked" handler to get the release event that |
54 // triggered the click. It will return NULL if the click was triggered by a | 58 // triggered the click. It will return NULL if the click was triggered by a |
55 // keyboard event. | 59 // keyboard event. |
56 const GdkEventButton* gtk_chrome_link_button_get_event_for_click( | 60 const GdkEventButton* gtk_chrome_link_button_get_event_for_click( |
57 GtkChromeLinkButton* button); | 61 GtkChromeLinkButton* button); |
58 | 62 |
59 GType gtk_chrome_link_button_get_type(); | 63 GType gtk_chrome_link_button_get_type(); |
60 | 64 |
61 G_END_DECLS | 65 G_END_DECLS |
62 | 66 |
63 #endif // CHROME_BROWSER_GTK_GTK_CHROME_LINK_BUTTON_H_ | 67 #endif // CHROME_BROWSER_GTK_GTK_CHROME_LINK_BUTTON_H_ |
OLD | NEW |