gtkassistant.h 10.7 KB
Newer Older
Matthias Clasen's avatar
Matthias Clasen committed
1
/* 
Cody Russell's avatar
Cody Russell committed
2
 * GTK - The GIMP Toolkit
Matthias Clasen's avatar
Matthias Clasen committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
 * Copyright (C) 1999  Red Hat, Inc.
 * Copyright (C) 2002  Anders Carlsson <andersca@gnu.org>
 * Copyright (C) 2003  Matthias Clasen <mclasen@redhat.com>
 * Copyright (C) 2005  Carlos Garnacho Parro <carlosg@gnome.org>
 *
 * All rights reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
Javier Jardón's avatar
Javier Jardón committed
21
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
Matthias Clasen's avatar
Matthias Clasen committed
22 23
 */

24 25 26
#ifndef __GTK_ASSISTANT_H__
#define __GTK_ASSISTANT_H__

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

Matthias Clasen's avatar
Matthias Clasen committed
31 32 33 34 35 36 37 38 39 40 41
#include <gtk/gtkwindow.h>

G_BEGIN_DECLS

#define GTK_TYPE_ASSISTANT         (gtk_assistant_get_type ())
#define GTK_ASSISTANT(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_ASSISTANT, GtkAssistant))
#define GTK_ASSISTANT_CLASS(c)     (G_TYPE_CHECK_CLASS_CAST    ((c), GTK_TYPE_ASSISTANT, GtkAssistantClass))
#define GTK_IS_ASSISTANT(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_ASSISTANT))
#define GTK_IS_ASSISTANT_CLASS(c)  (G_TYPE_CHECK_CLASS_TYPE    ((c), GTK_TYPE_ASSISTANT))
#define GTK_ASSISTANT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS  ((o), GTK_TYPE_ASSISTANT, GtkAssistantClass))

42 43
/**
 * GtkAssistantPageType:
44 45
 * @GTK_ASSISTANT_PAGE_CONTENT: The page has regular contents. Both the
 *  Back and forward buttons will be shown.
46
 * @GTK_ASSISTANT_PAGE_INTRO: The page contains an introduction to the
47 48
 *  assistant task. Only the Forward button will be shown if there is a
 *   next page.
49
 * @GTK_ASSISTANT_PAGE_CONFIRM: The page lets the user confirm or deny the
50
 *  changes. The Back and Apply buttons will be shown.
51
 * @GTK_ASSISTANT_PAGE_SUMMARY: The page informs the user of the changes
52
 *  done. Only the Close button will be shown.
53 54
 * @GTK_ASSISTANT_PAGE_PROGRESS: Used for tasks that take a long time to
 *  complete, blocks the assistant until the page is marked as complete.
55
 *   Only the back button will be shown.
56 57 58
 * @GTK_ASSISTANT_PAGE_CUSTOM: Used for when other page types are not
 *  appropriate. No buttons will be shown, and the application must
 *  add its own buttons through gtk_assistant_add_action_widget().
59 60 61 62 63
 *
 * An enum for determining the page role inside the #GtkAssistant. It's
 * used to handle buttons sensitivity and visibility.
 *
 * Note that an assistant needs to end its page flow with a page of type
64 65
 * %GTK_ASSISTANT_PAGE_CONFIRM, %GTK_ASSISTANT_PAGE_SUMMARY or
 * %GTK_ASSISTANT_PAGE_PROGRESS to be correct.
66
 *
67
 * The Cancel button will only be shown if the page isn’t “committed”.
68
 * See gtk_assistant_commit() for details.
69
 */
Matthias Clasen's avatar
Matthias Clasen committed
70 71 72 73 74 75
typedef enum
{
  GTK_ASSISTANT_PAGE_CONTENT,
  GTK_ASSISTANT_PAGE_INTRO,
  GTK_ASSISTANT_PAGE_CONFIRM,
  GTK_ASSISTANT_PAGE_SUMMARY,
76 77
  GTK_ASSISTANT_PAGE_PROGRESS,
  GTK_ASSISTANT_PAGE_CUSTOM
Matthias Clasen's avatar
Matthias Clasen committed
78 79
} GtkAssistantPageType;

80 81 82
typedef struct _GtkAssistant        GtkAssistant;
typedef struct _GtkAssistantPrivate GtkAssistantPrivate;
typedef struct _GtkAssistantClass   GtkAssistantClass;
Matthias Clasen's avatar
Matthias Clasen committed
83 84 85 86 87

struct _GtkAssistant
{
  GtkWindow  parent;

88
  /*< private >*/
89
  GtkAssistantPrivate *priv;
Matthias Clasen's avatar
Matthias Clasen committed
90 91
};

92 93 94
/**
 * GtkAssistantClass:
 * @parent_class: The parent class.
95
 * @prepare: Signal emitted when a new page is set as the assistant’s current page, before making the new page visible.
96 97 98 99
 * @apply: Signal emitted when the apply button is clicked.
 * @close: Signal emitted either when the close button or last page apply button is clicked.
 * @cancel: Signal emitted when the cancel button is clicked.
 */
Matthias Clasen's avatar
Matthias Clasen committed
100 101 102 103
struct _GtkAssistantClass
{
  GtkWindowClass parent_class;

104 105
  /*< public >*/

106
  void (* prepare) (GtkAssistant *assistant, GtkWidget *page);
Matthias Clasen's avatar
Matthias Clasen committed
107 108 109 110
  void (* apply)   (GtkAssistant *assistant);
  void (* close)   (GtkAssistant *assistant);
  void (* cancel)  (GtkAssistant *assistant);

111 112
  /*< private >*/

Matthias Clasen's avatar
Matthias Clasen committed
113 114 115 116 117 118 119 120
  /* Padding for future expansion */
  void (*_gtk_reserved1) (void);
  void (*_gtk_reserved2) (void);
  void (*_gtk_reserved3) (void);
  void (*_gtk_reserved4) (void);
  void (*_gtk_reserved5) (void);
};

121 122 123
/**
 * GtkAssistantPageFunc:
 * @current_page: The page number used to calculate the next page.
124
 * @data: (closure): user data.
125 126
 *
 * A function used by gtk_assistant_set_forward_page_func() to know which
127
 * is the next page given a current one. It’s called both for computing the
128 129
 * next page when the user presses the “forward” button and for handling
 * the behavior of the “last” button.
130 131 132
 *
 * Returns: The next page number.
 */
Matthias Clasen's avatar
Matthias Clasen committed
133 134
typedef gint (*GtkAssistantPageFunc) (gint current_page, gpointer data);

135
GDK_AVAILABLE_IN_ALL
Matthias Clasen's avatar
Matthias Clasen committed
136
GType                 gtk_assistant_get_type              (void) G_GNUC_CONST;
137
GDK_AVAILABLE_IN_ALL
Matthias Clasen's avatar
Matthias Clasen committed
138
GtkWidget            *gtk_assistant_new                   (void);
139
GDK_AVAILABLE_IN_ALL
140
void                  gtk_assistant_next_page             (GtkAssistant         *assistant);
141
GDK_AVAILABLE_IN_ALL
142
void                  gtk_assistant_previous_page         (GtkAssistant         *assistant);
143
GDK_AVAILABLE_IN_ALL
Matthias Clasen's avatar
Matthias Clasen committed
144
gint                  gtk_assistant_get_current_page      (GtkAssistant         *assistant);
145
GDK_AVAILABLE_IN_ALL
Matthias Clasen's avatar
Matthias Clasen committed
146
void                  gtk_assistant_set_current_page      (GtkAssistant         *assistant,
147
                                                           gint                  page_num);
148
GDK_AVAILABLE_IN_ALL
Matthias Clasen's avatar
Matthias Clasen committed
149
gint                  gtk_assistant_get_n_pages           (GtkAssistant         *assistant);
150
GDK_AVAILABLE_IN_ALL
Matthias Clasen's avatar
Matthias Clasen committed
151
GtkWidget            *gtk_assistant_get_nth_page          (GtkAssistant         *assistant,
152
                                                           gint                  page_num);
153
GDK_AVAILABLE_IN_ALL
Matthias Clasen's avatar
Matthias Clasen committed
154
gint                  gtk_assistant_prepend_page          (GtkAssistant         *assistant,
155
                                                           GtkWidget            *page);
156
GDK_AVAILABLE_IN_ALL
Matthias Clasen's avatar
Matthias Clasen committed
157
gint                  gtk_assistant_append_page           (GtkAssistant         *assistant,
158
                                                           GtkWidget            *page);
159
GDK_AVAILABLE_IN_ALL
Matthias Clasen's avatar
Matthias Clasen committed
160
gint                  gtk_assistant_insert_page           (GtkAssistant         *assistant,
161 162
                                                           GtkWidget            *page,
                                                           gint                  position);
163
GDK_AVAILABLE_IN_3_2
Matthias Clasen's avatar
Matthias Clasen committed
164
void                  gtk_assistant_remove_page           (GtkAssistant         *assistant,
165
                                                           gint                  page_num);
166
GDK_AVAILABLE_IN_ALL
Matthias Clasen's avatar
Matthias Clasen committed
167
void                  gtk_assistant_set_forward_page_func (GtkAssistant         *assistant,
168 169 170
                                                           GtkAssistantPageFunc  page_func,
                                                           gpointer              data,
                                                           GDestroyNotify        destroy);
171
GDK_AVAILABLE_IN_ALL
Matthias Clasen's avatar
Matthias Clasen committed
172
void                  gtk_assistant_set_page_type         (GtkAssistant         *assistant,
173 174
                                                           GtkWidget            *page,
                                                           GtkAssistantPageType  type);
175
GDK_AVAILABLE_IN_ALL
Matthias Clasen's avatar
Matthias Clasen committed
176
GtkAssistantPageType  gtk_assistant_get_page_type         (GtkAssistant         *assistant,
177
                                                           GtkWidget            *page);
178
GDK_AVAILABLE_IN_ALL
Matthias Clasen's avatar
Matthias Clasen committed
179
void                  gtk_assistant_set_page_title        (GtkAssistant         *assistant,
180 181
                                                           GtkWidget            *page,
                                                           const gchar          *title);
182
GDK_AVAILABLE_IN_ALL
183
const gchar *         gtk_assistant_get_page_title        (GtkAssistant         *assistant,
184 185
                                                           GtkWidget            *page);

186
GDK_DEPRECATED_IN_3_2
Matthias Clasen's avatar
Matthias Clasen committed
187
void                  gtk_assistant_set_page_header_image (GtkAssistant         *assistant,
188 189
                                                           GtkWidget            *page,
                                                           GdkPixbuf            *pixbuf);
190
GDK_DEPRECATED_IN_3_2
Matthias Clasen's avatar
Matthias Clasen committed
191
GdkPixbuf            *gtk_assistant_get_page_header_image (GtkAssistant         *assistant,
192
                                                           GtkWidget            *page);
193
GDK_DEPRECATED_IN_3_2
Matthias Clasen's avatar
Matthias Clasen committed
194
void                  gtk_assistant_set_page_side_image   (GtkAssistant         *assistant,
195 196
                                                           GtkWidget            *page,
                                                           GdkPixbuf            *pixbuf);
197
GDK_DEPRECATED_IN_3_2
Matthias Clasen's avatar
Matthias Clasen committed
198
GdkPixbuf            *gtk_assistant_get_page_side_image   (GtkAssistant         *assistant,
199 200
                                                           GtkWidget            *page);

201
GDK_AVAILABLE_IN_ALL
Matthias Clasen's avatar
Matthias Clasen committed
202
void                  gtk_assistant_set_page_complete     (GtkAssistant         *assistant,
203 204
                                                           GtkWidget            *page,
                                                           gboolean              complete);
205
GDK_AVAILABLE_IN_ALL
Matthias Clasen's avatar
Matthias Clasen committed
206
gboolean              gtk_assistant_get_page_complete     (GtkAssistant         *assistant,
207
                                                           GtkWidget            *page);
208
GDK_AVAILABLE_IN_ALL
Matthias Clasen's avatar
Matthias Clasen committed
209
void                  gtk_assistant_add_action_widget     (GtkAssistant         *assistant,
210
                                                           GtkWidget            *child);
211
GDK_AVAILABLE_IN_ALL
Matthias Clasen's avatar
Matthias Clasen committed
212
void                  gtk_assistant_remove_action_widget  (GtkAssistant         *assistant,
213
                                                           GtkWidget            *child);
Matthias Clasen's avatar
Matthias Clasen committed
214

215
GDK_AVAILABLE_IN_ALL
216
void                  gtk_assistant_update_buttons_state  (GtkAssistant *assistant);
217
GDK_AVAILABLE_IN_ALL
218
void                  gtk_assistant_commit                (GtkAssistant *assistant);
219

220 221 222 223 224 225 226 227
GDK_AVAILABLE_IN_3_18
void                  gtk_assistant_set_page_has_padding  (GtkAssistant *assistant,
                                                           GtkWidget    *page,
                                                           gboolean      has_padding);
GDK_AVAILABLE_IN_3_18
gboolean              gtk_assistant_get_page_has_padding  (GtkAssistant *assistant,
                                                           GtkWidget    *page);

Matthias Clasen's avatar
Matthias Clasen committed
228 229 230
G_END_DECLS

#endif /* __GTK_ASSISTANT_H__ */