コード例 #1
0
static VALUE
settings_s_install_property(VALUE self, VALUE spec)
{
    GParamSpec* pspec = G_PARAM_SPEC(RVAL2GOBJ(spec));
    if (rb_block_given_p()){
        VALUE func = rb_block_proc();
        rb_hash_aset(prop_func_table, spec, func);
        gtk_settings_install_property_parser(pspec, (GtkRcPropertyParser)rc_property_parser);
    } else {
        gtk_settings_install_property(pspec);
    }
    return self;
}
コード例 #2
0
ファイル: gtkimagemenuitem.c プロジェクト: krh/gtk
static void
gtk_image_menu_item_class_init (GtkImageMenuItemClass *klass)
{
    GObjectClass *gobject_class = (GObjectClass*) klass;
    GtkObjectClass *object_class = (GtkObjectClass*) klass;
    GtkWidgetClass *widget_class = (GtkWidgetClass*) klass;
    GtkMenuItemClass *menu_item_class = (GtkMenuItemClass*) klass;
    GtkContainerClass *container_class = (GtkContainerClass*) klass;

    object_class->destroy = gtk_image_menu_item_destroy;

    widget_class->screen_changed = gtk_image_menu_item_screen_changed;
    widget_class->size_request = gtk_image_menu_item_size_request;
    widget_class->size_allocate = gtk_image_menu_item_size_allocate;
    widget_class->map = gtk_image_menu_item_map;

    container_class->forall = gtk_image_menu_item_forall;
    container_class->remove = gtk_image_menu_item_remove;

    menu_item_class->toggle_size_request = gtk_image_menu_item_toggle_size_request;
    menu_item_class->set_label           = gtk_image_menu_item_set_label;
    menu_item_class->get_label           = gtk_image_menu_item_get_label;

    gobject_class->finalize     = gtk_image_menu_item_finalize;
    gobject_class->set_property = gtk_image_menu_item_set_property;
    gobject_class->get_property = gtk_image_menu_item_get_property;

    g_object_class_install_property (gobject_class,
                                     PROP_IMAGE,
                                     g_param_spec_object ("image",
                                             P_("Image widget"),
                                             P_("Child widget to appear next to the menu text"),
                                             GTK_TYPE_WIDGET,
                                             GTK_PARAM_READWRITE));
    /**
     * GtkImageMenuItem:use-stock:
     *
     * If %TRUE, the label set in the menuitem is used as a
     * stock id to select the stock item for the item.
     *
     * Since: 2.16
     **/
    g_object_class_install_property (gobject_class,
                                     PROP_USE_STOCK,
                                     g_param_spec_boolean ("use-stock",
                                             P_("Use stock"),
                                             P_("Whether to use the label text to create a stock menu item"),
                                             FALSE,
                                             GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT));

    /**
     * GtkImageMenuItem:always-show-image:
     *
     * If %TRUE, the menu item will ignore the #GtkSettings:gtk-menu-images
     * setting and always show the image, if available.
     *
     * Use this property if the menuitem would be useless or hard to use
     * without the image.
     *
     * Since: 2.16
     **/
    g_object_class_install_property (gobject_class,
                                     PROP_ALWAYS_SHOW_IMAGE,
                                     g_param_spec_boolean ("always-show-image",
                                             P_("Always show image"),
                                             P_("Whether the image will always be shown"),
                                             FALSE,
                                             GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT));

    /**
     * GtkImageMenuItem:accel-group:
     *
     * The Accel Group to use for stock accelerator keys
     *
     * Since: 2.16
     **/
    g_object_class_install_property (gobject_class,
                                     PROP_ACCEL_GROUP,
                                     g_param_spec_object ("accel-group",
                                             P_("Accel Group"),
                                             P_("The Accel Group to use for stock accelerator keys"),
                                             GTK_TYPE_ACCEL_GROUP,
                                             GTK_PARAM_WRITABLE));

    gtk_settings_install_property (g_param_spec_boolean ("gtk-menu-images",
                                   P_("Show menu images"),
                                   P_("Whether images should be shown in menus"),
                                   TRUE,
                                   GTK_PARAM_READWRITE));


    g_type_class_add_private (object_class, sizeof (GtkImageMenuItemPrivate));

}
コード例 #3
0
static void
setup_im (GtkOXIMInfo *info)
{
  XIMValuesList *ic_values = NULL;
  XIMCallback im_destroy_callback;
  GdkDisplay *display;

  if (info->im == NULL)
    return;

  im_destroy_callback.client_data = (XPointer)info;
  im_destroy_callback.callback = (XIMProc)xim_destroy_callback;
  XSetIMValues (info->im,
		XNDestroyCallback, &im_destroy_callback,
		NULL);

  XGetIMValues (info->im,
		XNQueryInputStyle, &info->xim_styles,
		XNQueryICValuesList, &ic_values,
		NULL);

  info->settings = gtk_settings_get_for_screen (info->screen);

  if (!g_object_class_find_property (G_OBJECT_GET_CLASS (info->settings),
				     "gtk-im-preedit-style"))
    gtk_settings_install_property (g_param_spec_enum ("gtk-im-preedit-style",
						      P_("IM Preedit style"),
						      P_("How to draw the input method preedit string"),
						      GTK_TYPE_IM_PREEDIT_STYLE,
						      GTK_IM_PREEDIT_CALLBACK,
						      G_PARAM_READWRITE));

  if (!g_object_class_find_property (G_OBJECT_GET_CLASS (info->settings),
				     "gtk-im-status-style"))
    gtk_settings_install_property (g_param_spec_enum ("gtk-im-status-style",
						      P_("IM Status style"),
						      P_("How to draw the input method statusbar"),
						      GTK_TYPE_IM_STATUS_STYLE,
						      GTK_IM_STATUS_CALLBACK,
						      G_PARAM_READWRITE));

  info->preedit_set = g_signal_connect_swapped (info->settings,
						"notify::gtk-im-preedit-style",
						G_CALLBACK (preedit_style_change),
						info);

  info->supports_string_conversion = FALSE;
  if (ic_values)
    {
      int i;

      for (i = 0; i < ic_values->count_values; i++)
	if (strcmp (ic_values->supported_values[i],
		    XNStringConversionCallback) == 0)
	  {
	    info->supports_string_conversion = TRUE;
	    break;
	  }

#if 0
      for (i = 0; i < ic_values->count_values; i++)
	g_print ("%s\n", ic_values->supported_values[i]);
      for (i = 0; i < xim_styles->count_styles; i++)
	g_print ("%#x\n", xim_styles->supported_styles[i]);
#endif

      XFree (ic_values);
    }

  preedit_style_change (info);
  
  display = gdk_screen_get_display (info->screen);
  info->display_closed_cb = g_signal_connect (display, "closed",
	                                      G_CALLBACK (xim_info_display_closed), info);
}