1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
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.
10 #ifndef CHROME_BROWSER_UI_GTK_GTK_CHROME_LINK_BUTTON_H_
11 #define CHROME_BROWSER_UI_GTK_GTK_CHROME_LINK_BUTTON_H_
18 #define GTK_TYPE_CHROME_LINK_BUTTON (gtk_chrome_link_button_get_type ())
19 #define GTK_CHROME_LINK_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \
20 GTK_TYPE_CHROME_LINK_BUTTON, \
22 #define GTK_CHROME_LINK_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \
23 GTK_TYPE_CHROME_LINK_BUTTON, \
24 GtkChromeLinkButtonClass))
25 #define GTK_IS_CHROME_LINK_BUTTON(obj) \
26 (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_CHROME_LINK_BUTTON))
27 #define GTK_IS_CHROME_LINK_BUTTON_CLASS(klass) \
28 (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_CHROME_LINK_BUTTON))
29 #define GTK_CHROME_LINK_BUTTON_GET_CLASS(obj) \
30 (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_CHROME_LINK_BUTTON, \
33 typedef struct _GtkChromeLinkButton GtkChromeLinkButton
;
34 typedef struct _GtkChromeLinkButtonClass GtkChromeLinkButtonClass
;
36 struct _GtkChromeLinkButton
{
40 gchar
* pressed_markup
;
41 gchar
* insensitive_markup
;
42 GtkStateType label_state
;
43 gchar normal_color
[9];
45 gchar
* insensitive_native_markup
;
46 gboolean using_native_theme
;
47 GdkCursor
* hand_cursor
;
52 struct _GtkChromeLinkButtonClass
{
53 GtkButtonClass parent_class
;
56 // Make a link button with display text |text|.
57 GtkWidget
* gtk_chrome_link_button_new(const char* text
);
59 // As above, but don't escape markup in the text.
60 GtkWidget
* gtk_chrome_link_button_new_with_markup(const char* markup
);
62 // Set whether the link button draws natively (using "link-color"). The default
64 void gtk_chrome_link_button_set_use_gtk_theme(GtkChromeLinkButton
* button
,
67 // Set the label text of the link.
68 void gtk_chrome_link_button_set_label(GtkChromeLinkButton
* button
,
71 // Set the color when the link is in a normal state (i.e. not pressed).
72 // If not set, or called NULL |color|, the color will be blue.
73 void gtk_chrome_link_button_set_normal_color(GtkChromeLinkButton
* button
,
74 const GdkColor
* color
);
76 GType
gtk_chrome_link_button_get_type();
80 #endif // CHROME_BROWSER_UI_GTK_GTK_CHROME_LINK_BUTTON_H_