Esempio n. 1
0
static void get_port_connection_modes(GtkCombo *combo)
{
    GtkWidget *item;
    char *descr;

    descr = g_strdup(_("Connect to all available jack ports"));
    item = gtk_list_item_new_with_label(descr);
    gtk_widget_show(item);
    g_free(descr);
    gtk_combo_set_item_string(combo, GTK_ITEM(item), "CONNECT_ALL");
    gtk_container_add(GTK_CONTAINER(combo->list), item);

    descr = g_strdup(_("Connect only the output ports"));
    item = gtk_list_item_new_with_label(descr);
    gtk_widget_show(item);
    g_free(descr);
    gtk_combo_set_item_string(combo, GTK_ITEM(item), "CONNECT_OUTPUT");
    gtk_container_add(GTK_CONTAINER(combo->list), item);

    descr = g_strdup(_("Connect to no ports"));
    item = gtk_list_item_new_with_label(descr);
    gtk_widget_show(item);
    g_free(descr);
    gtk_combo_set_item_string(combo, GTK_ITEM(item), "CONNECT_NONE");
    gtk_container_add(GTK_CONTAINER(combo->list), item);
}
Esempio n. 2
0
//__________________________________________________________________
void        _HYPlatformPullDown::_AddMenuItem   (_String& newItem, long index)
{
    if (theMenu) {
        GList * singleItem   = g_list_alloc();
        singleItem->prev = singleItem->next = nil;
        if (newItem.Equal(&menuSeparator)) {
            GtkWidget * itemContents = gtk_separator_menu_item_new ();
            gtk_widget_show (itemContents);
            singleItem->data = gtk_list_item_new();
            gtk_container_add((GtkContainer*)singleItem->data,itemContents);
            gtk_combo_set_item_string (GTK_COMBO (theMenu), GTK_ITEM (singleItem->data), "");
            gtk_widget_set_sensitive((GtkWidget*)singleItem->data,false);
            widgetList.InsertElement ((BaseRef)itemContents,2*index,false,false);
        } else {
            _String inItem = newItem;
            if (newItem.beginswith ("(")) {
                inItem.Trim (1,-1);
            }

            GtkWidget * itemContents = gtk_menu_item_new_with_label (inItem.sData);
            gtk_widget_show (itemContents);
            singleItem->data = gtk_list_item_new();
            gtk_container_add((GtkContainer*)singleItem->data,itemContents);
            gtk_combo_set_item_string (GTK_COMBO (theMenu), GTK_ITEM (singleItem->data), inItem.sData);
            gtk_widget_set_sensitive((GtkWidget*)singleItem->data,inItem.sLength == newItem.sLength);
            widgetList.InsertElement ((BaseRef)itemContents,2*index,false,false);
        }
        widgetList.InsertElement ((BaseRef)singleItem->data,2*index,false,false);
        GdkColor convColor = HYColorToGDKColor(_hyGTKMenuBackground);
        gtk_widget_modify_bg ((GtkWidget*)singleItem->data, GTK_STATE_INSENSITIVE, 
        	&convColor);
        gtk_widget_show ((GtkWidget*)singleItem->data);
        if (index<0) {
            gtk_list_append_items (GTK_LIST (GTK_COMBO (theMenu)->list), singleItem);
        } else {
            gtk_list_insert_items (GTK_LIST (GTK_COMBO (theMenu)->list), singleItem, index);
        }

        /*printf ("\nAdding menu item %s at %d\n", newItem.sData, index);
        for (long k = 0; k<widgetList.lLength; k++)
            printf ("%d %s\n", k, GTK_OBJECT_TYPE_NAME (GTK_WIDGET (widgetList(k))));*/
    }

    if (((_HYPullDown*)this)->MenuItemCount()==1||selection==index) {
        cbSelection = -1;
        _RefreshComboBox();
    }
}
Esempio n. 3
0
/* call this function on an item if it isn't a label or you
   want it to have a different value to be displayed in the entry */
int
clip_GTK_COMBOSETITEMSTRING(ClipMachine * ClipMachineMemory)
{
   C_widget *ccmb = _fetch_cw_arg(ClipMachineMemory);

   C_widget *citem = _fetch_cwidget(ClipMachineMemory, _clip_spar(ClipMachineMemory, 2));

   gchar    *string = _clip_parc(ClipMachineMemory, 3);

   gchar     empty_string[] = "\0";

   CHECKCWID(ccmb, GTK_IS_COMBO);
   CHECKOPT2(2, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType);
   CHECKCWID(citem, GTK_IS_WIDGET);
   CHECKOPT(3, CHARACTER_type_of_ClipVarType);
   if (_clip_parinfo(ClipMachineMemory, 3) == UNDEF_type_of_ClipVarType)
      string = empty_string;
   LOCALE_TO_UTF(string);
   gtk_combo_set_item_string(GTK_COMBO(ccmb->widget), GTK_ITEM(citem->widget), string);
   FREE_TEXT(string);
   return 0;
 err:
   return 1;
}
Esempio n. 4
0
void
gb_label_get_standard_properties (GtkWidget * widget,
				  GbWidgetGetArgData * data,
				  const char *label_p,
				  const char *use_underline_p,
				  const char *use_markup_p,
				  const char *justify_p,
				  const char *wrap_p,
				  const char *selectable_p,
				  const char *xalign_p,
				  const char *yalign_p,
				  const char *xpad_p,
				  const char *ypad_p,
				  const char *focus_target_p)
{
  const gchar *label_text;
  gint i;

  label_text = gtk_label_get_label (GTK_LABEL (widget));
  gb_widget_output_translatable_text (data, label_p, label_text);

  gb_widget_output_bool (data, use_underline_p,
			 gtk_label_get_use_underline (GTK_LABEL (widget)));
  gb_widget_output_bool (data, use_markup_p,
			 GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), use_markup_p)));

  for (i = 0; i < sizeof (GbJustifyValues) / sizeof (GbJustifyValues[0]); i++)
    {
      if (GbJustifyValues[i] == GTK_LABEL (widget)->jtype)
	gb_widget_output_choice (data, justify_p, i, GbJustifySymbols[i]);
    }
  gb_widget_output_bool (data, wrap_p, GTK_LABEL (widget)->wrap);
  gb_widget_output_bool (data, selectable_p,
			 gtk_label_get_selectable (GTK_LABEL (widget)));
  gb_widget_output_float (data, xalign_p, GTK_MISC (widget)->xalign);
  gb_widget_output_float (data, yalign_p, GTK_MISC (widget)->yalign);
  gb_widget_output_int (data, xpad_p, GTK_MISC (widget)->xpad);
  gb_widget_output_int (data, ypad_p, GTK_MISC (widget)->ypad);

  /* Labels not in buttons may have a focus target widget. */
  if (!gb_label_find_mnemonic_widget (widget))
    {
      gchar *accel_target;

      accel_target = gtk_object_get_data (GTK_OBJECT (widget), focus_target_p);

      /* If we're showing we need to display the list of possible focus target
	 widgets. We walk the tree of widgets in this component, and if a
	 widget has CAN_FOCUS set, we add it to the list. */
      if (data->action == GB_SHOWING)
	{
	  GList *focus_targets = NULL, *standard_items = NULL;
	  GtkWidget *item, *combo;

	  property_set_visible (focus_target_p, TRUE);

	  gb_label_get_focus_targets (gtk_widget_get_toplevel (widget),
				      &focus_targets);
	  property_set_combo_strings (focus_target_p, focus_targets);
	  g_list_free (focus_targets);

	  combo = property_get_value_widget (focus_target_p);

	  item = gtk_list_item_new_with_label (_("Auto"));
	  gtk_widget_show (item);
	  standard_items = g_list_append (standard_items, item);

	  item = gtk_list_item_new ();
	  gtk_widget_set_sensitive (item, FALSE);
	  gtk_widget_show (item);
	  standard_items = g_list_append (standard_items, item);
	  gtk_combo_set_item_string (GTK_COMBO (combo), GTK_ITEM (item), "");

	  gtk_list_prepend_items (GTK_LIST (GTK_COMBO (combo)->list),
				  standard_items);

	  if (!accel_target)
	    {
	      accel_target = _("Auto");
	    }
	  gb_widget_output_combo (data, focus_target_p, accel_target);
	}
      else
	{
	  /* When saving, we only save the property if it has been set. */
	  if (accel_target)
	    {
	      /* First check that the widget is still there, and if it isn't
		 just skip it. */
	      if (glade_util_find_widget (gtk_widget_get_toplevel (widget),
					  accel_target))
		{
		  gb_widget_output_combo (data, focus_target_p, accel_target);
		}
	    }
	  else
	    {
	      /* If no target has been set, and the label has an underlined
		 key, we try to find a default target and save that. */
	      if (gtk_label_get_use_underline (GTK_LABEL (widget)))
		{
		  GtkWidget *accel_target;

		  accel_target = glade_util_find_default_accelerator_target (widget);
		  if (accel_target)
		    {
		      gb_widget_output_string (data, focus_target_p, gtk_widget_get_name (accel_target));
		    }
		}
	    }
	}
    }
  else
    {
      if (data->action == GB_SHOWING)
	{
	  property_set_visible (focus_target_p, FALSE);
	}
    }
}