pike.git / src / post_modules / GTK2 / source / gtkcheckbutton.pre

version» Context lines:

pike.git/src/post_modules/GTK2/source/gtkcheckbutton.pre:5:   //! toggle buttons, but look a little different. Rather than   //! being buttons with text inside them, they are small squares with   //! the text to the right of them. These are often used for toggling   //! options on and off in applications.   //! IMG: GTK2.Check_button( "title" )      //! Style properties:   //! int indicator-size   //! int indicator-spacing    - void create(?string label) + void create(string|mapping|void label_or_props)   //! The argument, if specified, is the label of the item.   //! If no label is specified, use object->add() to add some   //! other widget (such as an pixmap or image widget)   {    pgtk_verify_not_inited();    pgtk_verify_setup();    if (args) { -  gchar *s=PGTK_GETSTR(Pike_sp-args); -  if (s) { -  THIS->obj=G_OBJECT(gtk_check_button_new_with_mnemonic(s)); -  PGTK_FREESTR(s); +  if (Pike_sp[-args].type==PIKE_T_STRING) { +  struct pike_string *t; +  GtkWidget *gcb; +  get_all_args("create",args,"%T",&t); +  if (t) { +  if (g_utf8_validate((char *)STR0(t),t->len,NULL)) +  gcb=gtk_check_button_new_with_mnemonic((char *)STR0(t)); +  else +  gcb=gtk_check_button_new();    } else -  THIS->obj=G_OBJECT(gtk_check_button_new()); +  gcb=gtk_check_button_new(); +  THIS->obj=G_OBJECT(gcb);    } else { -  THIS->obj=G_OBJECT(gtk_check_button_new()); +  INIT_WITH_PROPS(GTK_TYPE_CHECK_BUTTON);    } -  +  my_pop_n_elems(args); +  } else { +  GtkWidget *gcb; +  gcb=gtk_check_button_new(); +  THIS->obj=G_OBJECT(gcb); +  }    pgtk__init_this_object();   }