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_IS_ASSISTANT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_ASSISTANT)) 38 39 /** 40 * GtkAssistantPageType: 41 * @GTK_ASSISTANT_PAGE_CONTENT: The page has regular contents. Both the 42 * Back and forward buttons will be shown. 43 * @GTK_ASSISTANT_PAGE_INTRO: The page contains an introduction to the 44 * assistant task. Only the Forward button will be shown if there is a 45 * next page. 46 * @GTK_ASSISTANT_PAGE_CONFIRM: The page lets the user confirm or deny the 47 * changes. The Back and Apply buttons will be shown. 48 * @GTK_ASSISTANT_PAGE_SUMMARY: The page informs the user of the changes 49 * done. Only the Close button will be shown. 50 * @GTK_ASSISTANT_PAGE_PROGRESS: Used for tasks that take a long time to 51 * complete, blocks the assistant until the page is marked as complete. 52 * Only the back button will be shown. 53 * @GTK_ASSISTANT_PAGE_CUSTOM: Used for when other page types are not 54 * appropriate. No buttons will be shown, and the application must 55 * add its own buttons through gtk_assistant_add_action_widget(). 56 * 57 * Determines the page role inside a `GtkAssistant`. 58 * 59 * The role is used to handle buttons sensitivity and visibility. 60 * 61 * Note that an assistant needs to end its page flow with a page of type 62 * %GTK_ASSISTANT_PAGE_CONFIRM, %GTK_ASSISTANT_PAGE_SUMMARY or 63 * %GTK_ASSISTANT_PAGE_PROGRESS to be correct. 64 * 65 * The Cancel button will only be shown if the page isn’t “committed”. 66 * See gtk_assistant_commit() for details. 67 */ 68 typedef enum 69 { 70 GTK_ASSISTANT_PAGE_CONTENT, 71 GTK_ASSISTANT_PAGE_INTRO, 72 GTK_ASSISTANT_PAGE_CONFIRM, 73 GTK_ASSISTANT_PAGE_SUMMARY, 74 GTK_ASSISTANT_PAGE_PROGRESS, 75 GTK_ASSISTANT_PAGE_CUSTOM 76 } GtkAssistantPageType; 77 78 typedef struct _GtkAssistant GtkAssistant; 79 80 #define GTK_TYPE_ASSISTANT_PAGE (gtk_assistant_page_get_type ()) 81 #define GTK_ASSISTANT_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ASSISTANT_PAGE, GtkAssistantPage)) 82 #define GTK_IS_ASSISTANT_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ASSISTANT_PAGE)) 83 84 typedef struct _GtkAssistantPage GtkAssistantPage; 85 86 /** 87 * GtkAssistantPageFunc: 88 * @current_page: The page number used to calculate the next page. 89 * @data: (closure): user data. 90 * 91 * Type of callback used to calculate the next page in a `GtkAssistant`. 92 * 93 * It’s called both for computing the next page when the user presses the 94 * “forward” button and for handling the behavior of the “last” button. 95 * 96 * See [method@Gtk.Assistant.set_forward_page_func]. 97 * 98 * Returns: The next page number 99 */ 100 typedef int (*GtkAssistantPageFunc) (int current_page, gpointer data); 101 102 GDK_AVAILABLE_IN_ALL 103 GType gtk_assistant_page_get_type (void) G_GNUC_CONST; 104 GDK_AVAILABLE_IN_ALL 105 GType gtk_assistant_get_type (void) G_GNUC_CONST; 106 GDK_AVAILABLE_IN_ALL 107 GtkWidget *gtk_assistant_new (void); 108 GDK_AVAILABLE_IN_ALL 109 void gtk_assistant_next_page (GtkAssistant *assistant); 110 GDK_AVAILABLE_IN_ALL 111 void gtk_assistant_previous_page (GtkAssistant *assistant); 112 GDK_AVAILABLE_IN_ALL 113 int gtk_assistant_get_current_page (GtkAssistant *assistant); 114 GDK_AVAILABLE_IN_ALL 115 void gtk_assistant_set_current_page (GtkAssistant *assistant, 116 int page_num); 117 GDK_AVAILABLE_IN_ALL 118 int gtk_assistant_get_n_pages (GtkAssistant *assistant); 119 GDK_AVAILABLE_IN_ALL 120 GtkWidget *gtk_assistant_get_nth_page (GtkAssistant *assistant, 121 int page_num); 122 GDK_AVAILABLE_IN_ALL 123 int gtk_assistant_prepend_page (GtkAssistant *assistant, 124 GtkWidget *page); 125 GDK_AVAILABLE_IN_ALL 126 int gtk_assistant_append_page (GtkAssistant *assistant, 127 GtkWidget *page); 128 GDK_AVAILABLE_IN_ALL 129 int gtk_assistant_insert_page (GtkAssistant *assistant, 130 GtkWidget *page, 131 int position); 132 GDK_AVAILABLE_IN_ALL 133 void gtk_assistant_remove_page (GtkAssistant *assistant, 134 int page_num); 135 GDK_AVAILABLE_IN_ALL 136 void gtk_assistant_set_forward_page_func (GtkAssistant *assistant, 137 GtkAssistantPageFunc page_func, 138 gpointer data, 139 GDestroyNotify destroy); 140 GDK_AVAILABLE_IN_ALL 141 void gtk_assistant_set_page_type (GtkAssistant *assistant, 142 GtkWidget *page, 143 GtkAssistantPageType type); 144 GDK_AVAILABLE_IN_ALL 145 GtkAssistantPageType gtk_assistant_get_page_type (GtkAssistant *assistant, 146 GtkWidget *page); 147 GDK_AVAILABLE_IN_ALL 148 void gtk_assistant_set_page_title (GtkAssistant *assistant, 149 GtkWidget *page, 150 const char *title); 151 GDK_AVAILABLE_IN_ALL 152 const char * gtk_assistant_get_page_title (GtkAssistant *assistant, 153 GtkWidget *page); 154 155 GDK_AVAILABLE_IN_ALL 156 void gtk_assistant_set_page_complete (GtkAssistant *assistant, 157 GtkWidget *page, 158 gboolean complete); 159 GDK_AVAILABLE_IN_ALL 160 gboolean gtk_assistant_get_page_complete (GtkAssistant *assistant, 161 GtkWidget *page); 162 GDK_AVAILABLE_IN_ALL 163 void gtk_assistant_add_action_widget (GtkAssistant *assistant, 164 GtkWidget *child); 165 GDK_AVAILABLE_IN_ALL 166 void gtk_assistant_remove_action_widget (GtkAssistant *assistant, 167 GtkWidget *child); 168 169 GDK_AVAILABLE_IN_ALL 170 void gtk_assistant_update_buttons_state (GtkAssistant *assistant); 171 GDK_AVAILABLE_IN_ALL 172 void gtk_assistant_commit (GtkAssistant *assistant); 173 174 GDK_AVAILABLE_IN_ALL 175 GtkAssistantPage * gtk_assistant_get_page (GtkAssistant *assistant, 176 GtkWidget *child); 177 GDK_AVAILABLE_IN_ALL 178 GtkWidget * gtk_assistant_page_get_child (GtkAssistantPage *page); 179 180 GDK_AVAILABLE_IN_ALL 181 GListModel * gtk_assistant_get_pages (GtkAssistant *assistant); 182 183 G_END_DECLS 184 185 #endif /* __GTK_ASSISTANT_H__ */ 186