Upstream version 7.35.144.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / gtk / gtk_chrome_link_button.h
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.
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_UI_GTK_GTK_CHROME_LINK_BUTTON_H_
11 #define CHROME_BROWSER_UI_GTK_GTK_CHROME_LINK_BUTTON_H_
12
13 #include <gdk/gdk.h>
14 #include <gtk/gtk.h>
15
16 G_BEGIN_DECLS
17
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, \
21                                             GtkChromeLinkButton))
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, \
31                              GtkChromeLinkButton))
32
33 typedef struct _GtkChromeLinkButton        GtkChromeLinkButton;
34 typedef struct _GtkChromeLinkButtonClass   GtkChromeLinkButtonClass;
35
36 struct _GtkChromeLinkButton {
37   GtkButton button;
38   GtkWidget* label;
39   gchar* normal_markup;
40   gchar* pressed_markup;
41   gchar* insensitive_markup;
42   GtkStateType label_state;
43   gchar normal_color[9];
44   gchar* native_markup;
45   gchar* insensitive_native_markup;
46   gboolean using_native_theme;
47   GdkCursor* hand_cursor;
48   gchar* text;
49   gboolean uses_markup;
50 };
51
52 struct _GtkChromeLinkButtonClass {
53   GtkButtonClass parent_class;
54 };
55
56 // Make a link button with display text |text|.
57 GtkWidget* gtk_chrome_link_button_new(const char* text);
58
59 // As above, but don't escape markup in the text.
60 GtkWidget* gtk_chrome_link_button_new_with_markup(const char* markup);
61
62 // Set whether the link button draws natively (using "link-color"). The default
63 // is TRUE.
64 void gtk_chrome_link_button_set_use_gtk_theme(GtkChromeLinkButton* button,
65                                               gboolean use_gtk);
66
67 // Set the label text of the link.
68 void gtk_chrome_link_button_set_label(GtkChromeLinkButton* button,
69                                       const char* text);
70
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);
75
76 GType gtk_chrome_link_button_get_type();
77
78 G_END_DECLS
79
80 #endif  // CHROME_BROWSER_UI_GTK_GTK_CHROME_LINK_BUTTON_H_