gtkbutton.h 6.59 KB
Newer Older
Cody Russell's avatar
Cody Russell committed
1
/* GTK - The GIMP Toolkit
Elliot Lee's avatar
Elliot Lee committed
2 3 4
 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
 *
 * This library is free software; you can redistribute it and/or
5
 * modify it under the terms of the GNU Lesser General Public
Elliot Lee's avatar
Elliot Lee committed
6 7 8 9 10 11
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 * Lesser General Public License for more details.
Elliot Lee's avatar
Elliot Lee committed
13
 *
14
 * You should have received a copy of the GNU Lesser General Public
Javier Jardón's avatar
Javier Jardón committed
15
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
Elliot Lee's avatar
Elliot Lee committed
16
 */
17 18

/*
19
 * Modified by the GTK+ Team and others 1997-2001.  See the AUTHORS
20 21
 * file for a list of people on the GTK+ Team.  See the ChangeLog
 * files for a list of changes.  These files are distributed with
22
 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
23 24
 */

Elliot Lee's avatar
Elliot Lee committed
25 26 27 28
#ifndef __GTK_BUTTON_H__
#define __GTK_BUTTON_H__


29 30 31 32
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif

33
#include <gtk/gtkbin.h>
34
#include <gtk/gtkimage.h>
Elliot Lee's avatar
Elliot Lee committed
35 36


37
G_BEGIN_DECLS
Elliot Lee's avatar
Elliot Lee committed
38

Tim Janik's avatar
Tim Janik committed
39
#define GTK_TYPE_BUTTON                 (gtk_button_get_type ())
Manish Singh's avatar
Manish Singh committed
40 41 42 43 44
#define GTK_BUTTON(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_BUTTON, GtkButton))
#define GTK_BUTTON_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_BUTTON, GtkButtonClass))
#define GTK_IS_BUTTON(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_BUTTON))
#define GTK_IS_BUTTON_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_BUTTON))
#define GTK_BUTTON_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_BUTTON, GtkButtonClass))
Elliot Lee's avatar
Elliot Lee committed
45

46 47 48
typedef struct _GtkButton             GtkButton;
typedef struct _GtkButtonPrivate      GtkButtonPrivate;
typedef struct _GtkButtonClass        GtkButtonClass;
Elliot Lee's avatar
Elliot Lee committed
49 50 51

struct _GtkButton
{
52
  /*< private >*/
53
  GtkBin bin;
Elliot Lee's avatar
Elliot Lee committed
54

55
  GtkButtonPrivate *priv;
Elliot Lee's avatar
Elliot Lee committed
56 57
};

58 59 60 61 62 63 64 65 66 67 68 69
/**
 * GtkButtonClass:
 * @parent_class: The parent class.
 * @pressed: Signal emitted when the button is pressed. Deprecated: 2.8.
 * @released: Signal emitted when the button is released. Deprecated: 2.8.
 * @clicked: Signal emitted when the button has been activated (pressed and released).
 * @enter: Signal emitted when the pointer enters the button. Deprecated: 2.8.
 * @leave: Signal emitted when the pointer leaves the button. Deprecated: 2.8.
 * @activate: Signal that causes the button to animate press then
 *    release. Applications should never connect to this signal, but use
 *    the @clicked signal.
 */
Elliot Lee's avatar
Elliot Lee committed
70 71
struct _GtkButtonClass
{
72
  GtkBinClass        parent_class;
73 74 75

  /*< public >*/

76 77 78 79 80
  void (* pressed)  (GtkButton *button);
  void (* released) (GtkButton *button);
  void (* clicked)  (GtkButton *button);
  void (* enter)    (GtkButton *button);
  void (* leave)    (GtkButton *button);
81
  void (* activate) (GtkButton *button);
82 83 84

  /*< private >*/

85 86 87 88 89
  /* Padding for future expansion */
  void (*_gtk_reserved1) (void);
  void (*_gtk_reserved2) (void);
  void (*_gtk_reserved3) (void);
  void (*_gtk_reserved4) (void);
Elliot Lee's avatar
Elliot Lee committed
90 91 92
};


93
GDK_AVAILABLE_IN_ALL
Manish Singh's avatar
Manish Singh committed
94
GType          gtk_button_get_type          (void) G_GNUC_CONST;
95
GDK_AVAILABLE_IN_ALL
96
GtkWidget*     gtk_button_new               (void);
97
GDK_AVAILABLE_IN_ALL
98
GtkWidget*     gtk_button_new_with_label    (const gchar    *label);
99 100 101
GDK_AVAILABLE_IN_3_10
GtkWidget*     gtk_button_new_from_icon_name (const gchar    *icon_name,
					      GtkIconSize     size);
102
GDK_DEPRECATED_IN_3_10_FOR(gtk_button_new_with_label)
103
GtkWidget*     gtk_button_new_from_stock    (const gchar    *stock_id);
104
GDK_AVAILABLE_IN_ALL
105
GtkWidget*     gtk_button_new_with_mnemonic (const gchar    *label);
106
GDK_AVAILABLE_IN_ALL
107 108
void           gtk_button_clicked           (GtkButton      *button);
GDK_DEPRECATED
109
void           gtk_button_pressed           (GtkButton      *button);
110
GDK_DEPRECATED
111
void           gtk_button_released          (GtkButton      *button);
112
GDK_DEPRECATED
113
void           gtk_button_enter             (GtkButton      *button);
114
GDK_DEPRECATED
115
void           gtk_button_leave             (GtkButton      *button);
116

117
GDK_AVAILABLE_IN_ALL
118
void                  gtk_button_set_relief         (GtkButton      *button,
119
						     GtkReliefStyle  relief);
120
GDK_AVAILABLE_IN_ALL
121
GtkReliefStyle        gtk_button_get_relief         (GtkButton      *button);
122
GDK_AVAILABLE_IN_ALL
123 124
void                  gtk_button_set_label          (GtkButton      *button,
						     const gchar    *label);
125
GDK_AVAILABLE_IN_ALL
126
const gchar *         gtk_button_get_label          (GtkButton      *button);
127
GDK_AVAILABLE_IN_ALL
128 129
void                  gtk_button_set_use_underline  (GtkButton      *button,
						     gboolean        use_underline);
130
GDK_AVAILABLE_IN_ALL
131
gboolean              gtk_button_get_use_underline  (GtkButton      *button);
132
GDK_DEPRECATED_IN_3_10
133 134
void                  gtk_button_set_use_stock      (GtkButton      *button,
						     gboolean        use_stock);
135
GDK_DEPRECATED_IN_3_10
136
gboolean              gtk_button_get_use_stock      (GtkButton      *button);
137
GDK_DEPRECATED_IN_3_20_FOR(gtk_widget_set_focus_on_click)
138 139
void                  gtk_button_set_focus_on_click (GtkButton      *button,
						     gboolean        focus_on_click);
140
GDK_DEPRECATED_IN_3_20_FOR(gtk_widget_get_focus_on_click)
141
gboolean              gtk_button_get_focus_on_click (GtkButton      *button);
142
GDK_DEPRECATED_IN_3_14
143 144 145
void                  gtk_button_set_alignment      (GtkButton      *button,
						     gfloat          xalign,
						     gfloat          yalign);
146
GDK_DEPRECATED_IN_3_14
147 148 149
void                  gtk_button_get_alignment      (GtkButton      *button,
						     gfloat         *xalign,
						     gfloat         *yalign);
150
GDK_AVAILABLE_IN_ALL
151 152
void                  gtk_button_set_image          (GtkButton      *button,
					             GtkWidget      *image);
153
GDK_AVAILABLE_IN_ALL
154
GtkWidget*            gtk_button_get_image          (GtkButton      *button);
155
GDK_AVAILABLE_IN_ALL
156 157
void                  gtk_button_set_image_position (GtkButton      *button,
						     GtkPositionType position);
158
GDK_AVAILABLE_IN_ALL
159
GtkPositionType       gtk_button_get_image_position (GtkButton      *button);
160
GDK_AVAILABLE_IN_3_6
161 162
void                  gtk_button_set_always_show_image (GtkButton   *button,
                                                        gboolean     always_show);
163
GDK_AVAILABLE_IN_3_6
164
gboolean              gtk_button_get_always_show_image (GtkButton   *button);
165

166
GDK_AVAILABLE_IN_ALL
167 168
GdkWindow*            gtk_button_get_event_window   (GtkButton      *button);

Elliot Lee's avatar
Elliot Lee committed
169

170
G_END_DECLS
Elliot Lee's avatar
Elliot Lee committed
171 172

#endif /* __GTK_BUTTON_H__ */