f284492006-08-03Lance Dillon /* -*- C -*- */
d007812006-10-31Martin Nilsson require gtk210;
f284492006-08-03Lance Dillon class GTK2.Assistant; inherit GTK2.Window; //! Properties: //! <p> //! int complete //! GDK2.Pixbuf header-image //! GTK2.AssistantPageType page-type //! GDK2.Pixbuf sidebar-image //! string title //! <p> //! Style properties: //! <p> //! int content-padding //! int header-padding signal apply; signal cancel; signal close; signal prepare;
54167f2007-10-14Lance Dillon %{
14c2282009-01-03Martin Nilsson gint pgtk2_assistant_callback(gint cur_page, struct signal_data *d) { gint res;
54167f2007-10-14Lance Dillon  push_svalue(&d->args);
bdcd552016-03-03Henrik Grubbström (Grubba)  safe_apply_svalue(&d->cb, 2, 1);
14c2282009-01-03Martin Nilsson  res=(gint)Pike_sp[-1].u.integer;
54167f2007-10-14Lance Dillon  pop_stack(); return res; } %}
f284492006-08-03Lance Dillon //! A GTK2.Assistant is a widget used to represent a generally complex //! operation splitted in several steps, guiding the user through its pages //! and controlling the page flow to collect the necessary data. void create(?mapping(string:mixed) props) //! Create a new assistant. { pgtk2_verify_not_inited(); pgtk2_verify_setup(); if (args) { INIT_WITH_PROPS(GTK_TYPE_ASSISTANT); pgtk2_pop_n_elems(args); } else { GtkWidget *gd; gd=gtk_assistant_new(); THIS->obj=G_OBJECT(gd); } pgtk2__init_this_object(); } int get_current_page(); //! Returns the page number of the current page. Returns -1 if there are //! no pages. void set_current_page(int page_num); //! Switches the page to page_num. int get_n_pages(); //! Returns the number of pages. +GTK2.Widget get_nth_page(int page_num); //! Returnss the child widget contained in page number page_num. int prepend_page(GTK2.Widget page); //! Prepends a page to the assistant. int append_page(GTK2.Widget page); //! Appends a page to the assistant. int insert_page(GTK2.Widget page, int pos); //! Inserts a page at a given position. If pos equals -1 it will append the //! page. void set_page_type(GTK2.Widget page, int type); //! Sets the page type for page. The page type determines the page behavior. int get_page_type(GTK2.Widget page); //! Gets the page type of page. void set_page_title(GTK2.Widget page, string title); //! Sets a title for page. The title is displayed in the header area of the //! assistant when page is the current page. string get_page_title(GTK2.Widget page); //! Gets the title for page. void set_page_header_image(GTK2.Widget page, GDK2.Pixbuf pixbuf); //! Sets a header image for page. This image is displayed in the header area //! of the assistant when page is the current page. +GDK2.Pixbuf get_page_header_image(GTK2.Widget page); //! Gets the header image for page. void set_page_side_image(GTK2.Widget page, GDK2.Pixbuf pixbuf); //! Sets a side image for page. This image is displayed in the side area of //! the assistant when page is the current page. +GDK2.Pixbuf get_page_side_image(GTK2.Widget page); //! Gets the side image for page. void set_page_complete(GTK2.Widget page, int complete); //! Sets whether page contents are complete. This will make assistant update //! the buttons state to be able to continue the task. int get_page_complete(GTK2.Widget page); //! Gets whether page is complete. void add_action_widget(GTK2.Widget child); //! Adds a widget to the action area. void remove_action_widget(GTK2.Widget child); //! Removes a widget from the action area. void update_buttons_state(); //! Forces the assistant to recompute the buttons state. //! <p> //! GTK+ automatically takes care of this in most situations, e.g. when the //! user goes to a different page, or when the visibility or completeness //! of a page changes. //! <p> //! One situation where it can be necessary to call this function is when //! changing a value on the current page affects the future page flow of the //! assistant.
54167f2007-10-14Lance Dillon void set_forward_page_func(function f, mixed data) //! Set the forward page function. { struct svalue *sv1,*sv2; struct signal_data *sd;
96f5f42018-08-05Martin Nilsson  get_all_args(NULL,args,"%*%*",&sv1,&sv2);
54167f2007-10-14Lance Dillon  sd=(struct signal_data *)g_malloc(sizeof(struct signal_data)); if (sd==NULL) SIMPLE_OUT_OF_MEMORY_ERROR("set_forward_page_func",sizeof(struct signal_data)); assign_svalue_no_free(&sd->cb,sv1); assign_svalue_no_free(&sd->args,sv2);
14c2282009-01-03Martin Nilsson  gtk_assistant_set_forward_page_func(GTK_ASSISTANT(THIS->obj),(GtkAssistantPageFunc)pgtk2_assistant_callback,sd,(GtkDestroyNotify)pgtk2_free_signal_data);
54167f2007-10-14Lance Dillon  RETURN_THIS(); }
f284492006-08-03Lance Dillon endrequire;