Example #1
0
/* Changes the amount of internal padding used by all buttons in a given
   button box. */
int
clip_GTK_BUTTONBOXSETCHILDIPADDING(ClipMachine * ClipMachineMemory)
{
   C_widget *cbbox = _fetch_cw_arg(ClipMachineMemory);

   gint      ipad_x = _clip_parni(ClipMachineMemory, 2);

   gint      ipad_y = _clip_parni(ClipMachineMemory, 3);

   CHECKCWID(cbbox, GTK_IS_BUTTON_BOX);
   CHECKOPT(2, NUMERIC_type_of_ClipVarType);
   CHECKOPT(3, NUMERIC_type_of_ClipVarType);
   gtk_button_box_set_child_ipadding(GTK_BUTTON_BOX(cbbox->widget), ipad_x, ipad_y);
   return 0;
 err:
   return 1;
}
Example #2
0
/*
 * Sets the properties of the widget. This is used for both applying the
 * properties changed in the property editor, and also for loading.
 */
static void
gb_vbutton_box_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
{
  gint size, i, spacing, min_width, min_height, ipad_x, ipad_y;
  gchar *layout;
  gboolean set_child_size = FALSE, set_child_padding = FALSE;
  gboolean queue_resize = FALSE;

  size = gb_widget_input_int (data, Size);
  if (data->apply)
    gb_box_set_size (widget, size);

  layout = gb_widget_input_choice (data, Layout);
  if (data->apply)
    {
      for (i = 0; i < sizeof (GbLayoutValues) / sizeof (GbLayoutValues[0]); i
	   ++)
	{
	  if (!strcmp (layout, GbLayoutChoices[i])
	      || !strcmp (layout, GbLayoutSymbols[i]))
	    {
	      gtk_button_box_set_layout (GTK_BUTTON_BOX (widget), GbLayoutValues
					 [i]);
	      queue_resize = TRUE;
	      break;
	    }
	}
    }

  spacing = gb_widget_input_int (data, Spacing);
  if (data->apply)
    {
      gtk_button_box_set_spacing (GTK_BUTTON_BOX (widget), spacing);
      queue_resize = TRUE;
    }

  min_width = gb_widget_input_int (data, Width);
  if (data->apply)
    set_child_size = TRUE;
  else
    min_width = GTK_BUTTON_BOX (widget)->child_min_width;

  min_height = gb_widget_input_int (data, Height);
  if (data->apply)
    set_child_size = TRUE;
  else
    min_height = GTK_BUTTON_BOX (widget)->child_min_height;

  if (set_child_size)
    {
      gtk_button_box_set_child_size (GTK_BUTTON_BOX (widget),
				     min_width, min_height);
      queue_resize = TRUE;
    }

  ipad_x = gb_widget_input_int (data, XPad);
  if (data->apply)
    set_child_padding = TRUE;
  else
    ipad_x = GTK_BUTTON_BOX (widget)->child_ipad_x;

  ipad_y = gb_widget_input_int (data, YPad);
  if (data->apply)
    set_child_padding = TRUE;
  else
    ipad_y = GTK_BUTTON_BOX (widget)->child_ipad_y;

  if (set_child_padding)
    {
      gtk_button_box_set_child_ipadding (GTK_BUTTON_BOX (widget),
					 ipad_x, ipad_y);
      queue_resize = TRUE;
    }

  if (queue_resize)
    gtk_widget_queue_resize (widget);
}