]> Pileus Git - ~andy/gtk/blob - gtk/gtkassistant.h
Merge branch 'gtk-2-90'
[~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, write to the
22  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23  * Boston, MA 02111-1307, USA.
24  */
25
26 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
27 #error "Only <gtk/gtk.h> can be included directly."
28 #endif
29
30 #ifndef __GTK_ASSISTANT_H__
31 #define __GTK_ASSISTANT_H__
32
33 #include <gtk/gtkwindow.h>
34
35 G_BEGIN_DECLS
36
37 #define GTK_TYPE_ASSISTANT         (gtk_assistant_get_type ())
38 #define GTK_ASSISTANT(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_ASSISTANT, GtkAssistant))
39 #define GTK_ASSISTANT_CLASS(c)     (G_TYPE_CHECK_CLASS_CAST    ((c), GTK_TYPE_ASSISTANT, GtkAssistantClass))
40 #define GTK_IS_ASSISTANT(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_ASSISTANT))
41 #define GTK_IS_ASSISTANT_CLASS(c)  (G_TYPE_CHECK_CLASS_TYPE    ((c), GTK_TYPE_ASSISTANT))
42 #define GTK_ASSISTANT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS  ((o), GTK_TYPE_ASSISTANT, GtkAssistantClass))
43
44 /**
45  * GtkAssistantPageType:
46  * @GTK_ASSISTANT_PAGE_CONTENT: The page has regular contents.
47  * @GTK_ASSISTANT_PAGE_INTRO: The page contains an introduction to the
48  *  assistant task.
49  * @GTK_ASSISTANT_PAGE_CONFIRM: The page lets the user confirm or deny the
50  *  changes.
51  * @GTK_ASSISTANT_PAGE_SUMMARY: The page informs the user of the changes
52  *  done.
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  *
56  * An enum for determining the page role inside the #GtkAssistant. It's
57  * used to handle buttons sensitivity and visibility.
58  *
59  * Note that an assistant needs to end its page flow with a page of type
60  * %GTK_ASSISTANT_PAGE_CONFIRM or %GTK_ASSISTANT_PAGE_SUMMARY to be correct.
61  */
62 typedef enum
63 {
64   GTK_ASSISTANT_PAGE_CONTENT,
65   GTK_ASSISTANT_PAGE_INTRO,
66   GTK_ASSISTANT_PAGE_CONFIRM,
67   GTK_ASSISTANT_PAGE_SUMMARY,
68   GTK_ASSISTANT_PAGE_PROGRESS
69 } GtkAssistantPageType;
70
71 typedef struct _GtkAssistant        GtkAssistant;
72 typedef struct _GtkAssistantPrivate GtkAssistantPrivate;
73 typedef struct _GtkAssistantClass   GtkAssistantClass;
74
75 struct _GtkAssistant
76 {
77   GtkWindow  parent;
78
79   GtkWidget *GSEAL (cancel);
80   GtkWidget *GSEAL (forward);
81   GtkWidget *GSEAL (back);
82   GtkWidget *GSEAL (apply);
83   GtkWidget *GSEAL (close);
84   GtkWidget *GSEAL (last);
85
86   /*< private >*/
87   GtkAssistantPrivate *GSEAL (priv);
88 };
89
90 struct _GtkAssistantClass
91 {
92   GtkWindowClass parent_class;
93
94   void (* prepare) (GtkAssistant *assistant, GtkWidget *page);
95   void (* apply)   (GtkAssistant *assistant);
96   void (* close)   (GtkAssistant *assistant);
97   void (* cancel)  (GtkAssistant *assistant);
98
99   /* Padding for future expansion */
100   void (*_gtk_reserved1) (void);
101   void (*_gtk_reserved2) (void);
102   void (*_gtk_reserved3) (void);
103   void (*_gtk_reserved4) (void);
104   void (*_gtk_reserved5) (void);
105 };
106
107 /**
108  * GtkAssistantPageFunc:
109  * @current_page: The page number used to calculate the next page.
110  * @data: user data.
111  *
112  * A function used by gtk_assistant_set_forward_page_func() to know which
113  * is the next page given a current one. It's called both for computing the
114  * next page when the user presses the "forward" button and for handling
115  * the behavior of the "last" button.
116  *
117  * Returns: The next page number.
118  */
119 typedef gint (*GtkAssistantPageFunc) (gint current_page, gpointer data);
120
121 GType                 gtk_assistant_get_type              (void) G_GNUC_CONST;
122 GtkWidget            *gtk_assistant_new                   (void);
123 gint                  gtk_assistant_get_current_page      (GtkAssistant         *assistant);
124 void                  gtk_assistant_set_current_page      (GtkAssistant         *assistant,
125                                                            gint                  page_num);
126 gint                  gtk_assistant_get_n_pages           (GtkAssistant         *assistant);
127 GtkWidget            *gtk_assistant_get_nth_page          (GtkAssistant         *assistant,
128                                                            gint                  page_num);
129 gint                  gtk_assistant_prepend_page          (GtkAssistant         *assistant,
130                                                            GtkWidget            *page);
131 gint                  gtk_assistant_append_page           (GtkAssistant         *assistant,
132                                                            GtkWidget            *page);
133 gint                  gtk_assistant_insert_page           (GtkAssistant         *assistant,
134                                                            GtkWidget            *page,
135                                                            gint                  position);
136 void                  gtk_assistant_set_forward_page_func (GtkAssistant         *assistant,
137                                                            GtkAssistantPageFunc  page_func,
138                                                            gpointer              data,
139                                                            GDestroyNotify        destroy);
140 void                  gtk_assistant_set_page_type         (GtkAssistant         *assistant,
141                                                            GtkWidget            *page,
142                                                            GtkAssistantPageType  type);
143 GtkAssistantPageType  gtk_assistant_get_page_type         (GtkAssistant         *assistant,
144                                                            GtkWidget            *page);
145 void                  gtk_assistant_set_page_title        (GtkAssistant         *assistant,
146                                                            GtkWidget            *page,
147                                                            const gchar          *title);
148 G_CONST_RETURN gchar *gtk_assistant_get_page_title        (GtkAssistant         *assistant,
149                                                            GtkWidget            *page);
150 void                  gtk_assistant_set_page_header_image (GtkAssistant         *assistant,
151                                                            GtkWidget            *page,
152                                                            GdkPixbuf            *pixbuf);
153 GdkPixbuf            *gtk_assistant_get_page_header_image (GtkAssistant         *assistant,
154                                                            GtkWidget            *page);
155 void                  gtk_assistant_set_page_side_image   (GtkAssistant         *assistant,
156                                                            GtkWidget            *page,
157                                                            GdkPixbuf            *pixbuf);
158 GdkPixbuf            *gtk_assistant_get_page_side_image   (GtkAssistant         *assistant,
159                                                            GtkWidget            *page);
160 void                  gtk_assistant_set_page_complete     (GtkAssistant         *assistant,
161                                                            GtkWidget            *page,
162                                                            gboolean              complete);
163 gboolean              gtk_assistant_get_page_complete     (GtkAssistant         *assistant,
164                                                            GtkWidget            *page);
165 void                  gtk_assistant_add_action_widget     (GtkAssistant         *assistant,
166                                                            GtkWidget            *child);
167 void                  gtk_assistant_remove_action_widget  (GtkAssistant         *assistant,
168                                                            GtkWidget            *child);
169
170 void                  gtk_assistant_update_buttons_state  (GtkAssistant *assistant);
171
172 G_END_DECLS
173
174 #endif /* __GTK_ASSISTANT_H__ */