Exemple #1
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_vbox_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
{
  gboolean homogeneous;
  gint spacing, size;

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

  homogeneous = gb_widget_input_bool (data, Homogeneous);
  if (data->apply)
    gtk_box_set_homogeneous (GTK_BOX (widget), homogeneous);

  spacing = gb_widget_input_int (data, Spacing);
  if (data->apply)
    gtk_box_set_spacing (GTK_BOX (widget), spacing);
}
Exemple #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_hbutton_box_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
{
    gint size, i, spacing;
    gchar *layout;
    gboolean queue_resize = FALSE;

    if (data->action != GB_LOADING)
    {
        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;
            }
        }
    }

    if (!gb_hbutton_box_is_dialog_action_area (widget))
    {
        spacing = gb_widget_input_int (data, Spacing);
        if (data->apply)
        {
            gtk_box_set_spacing (GTK_BOX (widget), spacing);
            queue_resize = TRUE;
        }
    }

    if (queue_resize)
        gtk_widget_queue_resize (widget);
}
/*
 * 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);
}