]> Pileus Git - ~andy/gtk/blob - gtk/gtkassistant.h
stylecontext: Do invalidation on first resize container
[~andy/gtk] / gtk / gtkassistant.h
1 /* 
2  * GTK - The GIMP Toolkit
3  * Copyright (C) 1999  Red Hat, Inc.
4  * Copyright (C) 2002  Anders Carlsson <andersca@gnu.org>
5  * Copyright (C) 2003  Matthias Clasen <mclasen@redhat.com>
6  * Copyright (C) 2005  Carlos Garnacho Parro <carlosg@gnome.org>
7  *
8  * All rights reserved.
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2 of the License, or (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
22  */
23
24 #ifndef __GTK_ASSISTANT_H__
25 #define __GTK_ASSISTANT_H__
26
27 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
28 #error "Only <gtk/gtk.h> can be included directly."
29 #endif
30
31 #include <gtk/gtkwindow.h>
32
33 G_BEGIN_DECLS
34
35 #define GTK_TYPE_ASSISTANT         (gtk_assistant_get_type ())
36 #define GTK_ASSISTANT(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_ASSISTANT, GtkAssistant))
37 #define GTK_ASSISTANT_CLASS(c)     (G_TYPE_CHECK_CLASS_CAST    ((c), GTK_TYPE_ASSISTANT, GtkAssistantClass))
38 #define GTK_IS_ASSISTANT(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_ASSISTANT))
39 #define GTK_IS_ASSISTANT_CLASS(c)  (G_TYPE_CHECK_CLASS_TYPE    ((c), GTK_TYPE_ASSISTANT))
40 #define GTK_ASSISTANT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS  ((o), GTK_TYPE_ASSISTANT, GtkAssistantClass))
41
42 /**
43  * GtkAssistantPageType:
44  * @GTK_ASSISTANT_PAGE_CONTENT: The page has regular contents. Both the
45  *  Back and forward buttons will be shown.
46  * @GTK_ASSISTANT_PAGE_INTRO: The page contains an introduction to the
47  *  assistant task. Only the Forward button will be shown if there is a
48  *   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  * @GTK_ASSISTANT_PAGE_PROGRESS: Used for tasks that take a long time to
54  *  complete, blocks the assistant until the page is marked as complete.
55  *   Only the back button will be shown.
56  * @GTK_ASSISTANT_PAGE_CUSTOM: Used for when other page types are not
57  *  appropriate. No buttons will be shown, and the application must
58  *  add its own buttons through gtk_assistant_add_action_widget().
59  *
60  * An enum for determining the page role inside the #GtkAssistant. It's
61  * used to handle buttons sensitivity and visibility.
62  *
63  * Note that an assistant needs to end its page flow with a page of type
64  * %GTK_ASSISTANT_PAGE_CONFIRM, %GTK_ASSISTANT_PAGE_SUMMARY or
65  * %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  */
70 typedef enum
71 {
72   GTK_ASSISTANT_PAGE_CONTENT,
73   GTK_ASSISTANT_PAGE_INTRO,
74   GTK_ASSISTANT_PAGE_CONFIRM,
75   GTK_ASSISTANT_PAGE_SUMMARY,
76   GTK_ASSISTANT_PAGE_PROGRESS,
77   GTK_ASSISTANT_PAGE_CUSTOM
78 } GtkAssistantPageType;
79
80 typedef struct _GtkAssistant        GtkAssistant;
81 typedef struct _GtkAssistantPrivate GtkAssistantPrivate;
82 typedef struct _GtkAssistantClass   GtkAssistantClass;
83
84 struct _GtkAssistant
85 {
86   GtkWindow  parent;
87
88   /*< private >*/
89   GtkAssistantPrivate *priv;
90 };
91
92 struct _GtkAssistantClass
93 {
94   GtkWindowClass parent_class;
95
96   void (* prepare) (GtkAssistant *assistant, GtkWidget *page);
97   void (* apply)   (GtkAssistant *assistant);
98   void (* close)   (GtkAssistant *assistant);
99   void (* cancel)  (GtkAssistant *assistant);
100
101   /* Padding for future expansion */
102   void (*_gtk_reserved1) (void);
103   void (*_gtk_reserved2) (void);
104   void (*_gtk_reserved3) (void);
105   void (*_gtk_reserved4) (void);
106   void (*_gtk_reserved5) (void);
107 };
108
109 /**
110  * GtkAssistantPageFunc:
111  * @current_page: The page number used to calculate the next page.
112  * @data: (closure): user data.
113  *
114  * A function used by gtk_assistant_set_forward_page_func() to know which
115  * is the next page given a current one. It's called both for computing the
116  * next page when the user presses the "forward" button and for handling
117  * the behavior of the "last" button.
118  *
119  * Returns: The next page number.
120  */
121 typedef gint (*GtkAssistantPageFunc) (gint current_page, gpointer data);
122
123 GType                 gtk_assistant_get_type              (void) G_GNUC_CONST;
124 GtkWidget            *gtk_assistant_new                   (void);
125 void                  gtk_assistant_next_page             (GtkAssistant         *assistant);
126 void                  gtk_assistant_previous_page         (GtkAssistant         *assistant);
127 gint                  gtk_assistant_get_current_page      (GtkAssistant         *assistant);
128 void                  gtk_assistant_set_current_page      (GtkAssistant         *assistant,
129                                                            gint                  page_num);
130 gint                  gtk_assistant_get_n_pages           (GtkAssistant         *assistant);
131 GtkWidget            *gtk_assistant_get_nth_page          (GtkAssistant         *assistant,
132                                                            gint                  page_num);
133 gint                  gtk_assistant_prepend_page          (GtkAssistant         *assistant,
134                                                            GtkWidget            *page);
135 gint                  gtk_assistant_append_page           (GtkAssistant         *assistant,
136                                                            GtkWidget            *page);
137 gint                  gtk_assistant_insert_page           (GtkAssistant         *assistant,
138                                                            GtkWidget            *page,
139                                                            gint                  position);
140 GDK_AVAILABLE_IN_3_2
141 void                  gtk_assistant_remove_page           (GtkAssistant         *assistant,
142                                                            gint                  page_num);
143 void                  gtk_assistant_set_forward_page_func (GtkAssistant         *assistant,
144                                                            GtkAssistantPageFunc  page_func,
145                                                            gpointer              data,
146                                                            GDestroyNotify        destroy);
147 void                  gtk_assistant_set_page_type         (GtkAssistant         *assistant,
148                                                            GtkWidget            *page,
149                                                            GtkAssistantPageType  type);
150 GtkAssistantPageType  gtk_assistant_get_page_type         (GtkAssistant         *assistant,
151                                                            GtkWidget            *page);
152 void                  gtk_assistant_set_page_title        (GtkAssistant         *assistant,
153                                                            GtkWidget            *page,
154                                                            const gchar          *title);
155 const gchar *         gtk_assistant_get_page_title        (GtkAssistant         *assistant,
156                                                            GtkWidget            *page);
157
158 GDK_DEPRECATED_IN_3_2
159 void                  gtk_assistant_set_page_header_image (GtkAssistant         *assistant,
160                                                            GtkWidget            *page,
161                                                            GdkPixbuf            *pixbuf);
162 GDK_DEPRECATED_IN_3_2
163 GdkPixbuf            *gtk_assistant_get_page_header_image (GtkAssistant         *assistant,
164                                                            GtkWidget            *page);
165 GDK_DEPRECATED_IN_3_2
166 void                  gtk_assistant_set_page_side_image   (GtkAssistant         *assistant,
167                                                            GtkWidget            *page,
168                                                            GdkPixbuf            *pixbuf);
169 GDK_DEPRECATED_IN_3_2
170 GdkPixbuf            *gtk_assistant_get_page_side_image   (GtkAssistant         *assistant,
171                                                            GtkWidget            *page);
172
173 void                  gtk_assistant_set_page_complete     (GtkAssistant         *assistant,
174                                                            GtkWidget            *page,
175                                                            gboolean              complete);
176 gboolean              gtk_assistant_get_page_complete     (GtkAssistant         *assistant,
177                                                            GtkWidget            *page);
178 void                  gtk_assistant_add_action_widget     (GtkAssistant         *assistant,
179                                                            GtkWidget            *child);
180 void                  gtk_assistant_remove_action_widget  (GtkAssistant         *assistant,
181                                                            GtkWidget            *child);
182
183 void                  gtk_assistant_update_buttons_state  (GtkAssistant *assistant);
184 void                  gtk_assistant_commit                (GtkAssistant *assistant);
185
186 G_END_DECLS
187
188 #endif /* __GTK_ASSISTANT_H__ */