Example #1
0
void
clearlooks_set_toolbar_parameters (ToolbarParameters *toolbar, GtkWidget *widget, GdkWindow *window, gint x, gint y)
{
	toolbar->topmost = FALSE;

	if (x == 0 && y == 0) {
		if (widget && widget->allocation.x == 0 && widget->allocation.y == 0)
		{
			if (widget->window == window && GE_IS_TOOLBAR (widget))
			{
				toolbar->topmost = TRUE;
			}
		}
	}
}
gboolean
ge_is_toolbar_item (GtkWidget * widget)
{
  gboolean result = FALSE;
 
  if ((widget) && (gtk_widget_get_parent (widget))) {
    if ((GE_IS_BONOBO_TOOLBAR (gtk_widget_get_parent (widget)))
	|| (GE_IS_BONOBO_DOCK_ITEM (gtk_widget_get_parent (widget)))
	|| (GE_IS_EGG_TOOLBAR (gtk_widget_get_parent (widget)))
	|| (GE_IS_TOOLBAR (gtk_widget_get_parent (widget)))
	|| (GE_IS_HANDLE_BOX (gtk_widget_get_parent (widget))))
      result = TRUE;
    else
      result = ge_is_toolbar_item (gtk_widget_get_parent (widget));
  }
  return result;
}
Example #3
0
static void
clearlooks_style_draw_handle (DRAW_ARGS, GtkOrientation orientation)
{
	ClearlooksStyle  *clearlooks_style = CLEARLOOKS_STYLE (style);
	ClearlooksColors *colors = &clearlooks_style->colors;
	cairo_t          *cr;
	gboolean         is_horizontal;

	CHECK_ARGS
	SANITIZE_SIZE

	cr = ge_gdk_drawable_to_cairo (window, area);

	/* Evil hack to work around broken orientation for toolbars */
	is_horizontal = (width > height);

	if (DETAIL ("handlebox"))
	{
		WidgetParameters params;
		HandleParameters handle;

		clearlooks_set_widget_parameters (widget, style, state_type, &params);
		handle.type = CL_HANDLE_TOOLBAR;
		handle.horizontal = is_horizontal;

		/* Is this ever true? -Daniel */
		if (GE_IS_TOOLBAR (widget) && shadow_type != GTK_SHADOW_NONE)
		{
			ToolbarParameters toolbar;

			clearlooks_set_toolbar_parameters (&toolbar, widget, window, x, y);

			toolbar.style = clearlooks_style->toolbarstyle;

			cairo_save (cr);
			STYLE_FUNCTION(draw_toolbar) (cr, colors, &params, &toolbar, x, y, width, height);
			cairo_restore (cr);
		}

		STYLE_FUNCTION(draw_handle) (cr, colors, &params, &handle,
		                        x, y, width, height);
	}
	else if (DETAIL ("paned"))
	{
		WidgetParameters params;
		HandleParameters handle;

		clearlooks_set_widget_parameters (widget, style, state_type, &params);
		handle.type = CL_HANDLE_SPLITTER;
		handle.horizontal = orientation == GTK_ORIENTATION_HORIZONTAL;

		STYLE_FUNCTION(draw_handle) (cr, colors, &params, &handle,
		                        x, y, width, height);
	}
	else
	{
		WidgetParameters params;
		HandleParameters handle;

		clearlooks_set_widget_parameters (widget, style, state_type, &params);
		handle.type = CL_HANDLE_TOOLBAR;
		handle.horizontal = is_horizontal;

		/* Is this ever true? -Daniel */
		if (GE_IS_TOOLBAR (widget) && shadow_type != GTK_SHADOW_NONE)
		{
			ToolbarParameters toolbar;

			clearlooks_set_toolbar_parameters (&toolbar, widget, window, x, y);

			toolbar.style = clearlooks_style->toolbarstyle;

			cairo_save (cr);
			STYLE_FUNCTION(draw_toolbar) (cr, colors, &params, &toolbar, x, y, width, height);
			cairo_restore (cr);
		}

		STYLE_FUNCTION(draw_handle) (cr, colors, &params, &handle,
		                        x, y, width, height);
	}

	cairo_destroy (cr);
}