示例#1
0
gboolean
ge_is_combo (GtkWidget * widget)
{
  gboolean result = FALSE;

  if ((widget) && (widget->parent))
    {
      if (GE_IS_COMBO (widget->parent))
	result = TRUE;
      else
	result = ge_is_combo (widget->parent);
    }
  return result;
}
gboolean
ge_is_combo (GtkWidget * widget)
{
  gboolean result = FALSE;
 
  if ((widget) && (gtk_widget_get_parent (widget)))
    {
      if (GE_IS_COMBO (gtk_widget_get_parent (widget)))
	result = TRUE;
      else
	result = ge_is_combo (gtk_widget_get_parent (widget));
    }
  return result;
}
gboolean
ge_is_in_combo_box (GtkWidget * widget)
{
  return ((ge_is_combo (widget) || ge_is_combo_box (widget, TRUE) || ge_is_combo_box_entry (widget)));
}
示例#4
0
/* Standard Border Function */
void
hc_draw_shadow(GtkStyle * style,
	       cairo_t * cr,
	       GtkStateType state_type,
	       GtkShadowType shadow_type,
	       GtkWidget * widget,
	       const gchar * detail,
	       gint x,
	       gint y,
	       gint width,
	       gint height)
{
	/* Border Uses Foreground Color */
	CairoColor foreground = HC_STYLE(style)->color_cube.fg[state_type];

	gint line_width;
	gint clip_x = x, clip_y = y, clip_width = width, clip_height = height;

	/***********************************************/
	/* GTK Sanity Checks                           */
	/***********************************************/
	CHECK_ARGS


	/***********************************************/
	/* GTK Special Cases - adjust Size/Offset      */
	/***********************************************/
	line_width = HC_STYLE(style)->edge_thickness;

	if (CHECK_DETAIL (detail, "menubar") && ge_is_panel_widget_item(widget))
	{
		return;
	}

	/* Spin Button */
	if ((CHECK_DETAIL(detail, "spinbutton_up")) || (CHECK_DETAIL(detail, "spinbutton_down")))
	{
		/* Overdraw Height By Half The Line Width -
			Prevents Double line Between buttons */
		height += floor(line_width / 2);


		/* If Down Button Offset By Half Line Width */
		if (CHECK_DETAIL(detail, "spinbutton_down"))
		{
			y -= floor(line_width / 2);
		}


		/* Overdraw Width By Line Width -
			Prevents Double line Between Entry And Buttons */
		width += line_width;


		/* If LTR Offset X By Line Width */
		if (ge_widget_is_ltr (widget))
		{
			x -= line_width;
		}

		/* Force Border To Use Foreground Widget State */
		if (widget)
		{
			foreground = HC_STYLE(style)->color_cube.fg[gtk_widget_get_state(widget)];
		}
	}


	/* Entry - Force Border To Use Foreground Matching Widget State */
	if (CHECK_DETAIL(detail, "entry") && !ge_is_combo(widget))
	{
		foreground = HC_STYLE(style)->color_cube.fg[widget ? gtk_widget_get_state(widget) : GTK_STATE_NORMAL];
	}


	/* Combo Box Button's */
	if (CHECK_DETAIL(detail, "button") && ge_is_in_combo_box(widget))
	{
		/* Overdraw Width By Line Width -
			Prevents Double Line Between Entry and Button. */
		width += line_width;


		/* If LTR Offset X By Line Width */
		if (ge_widget_is_ltr (widget))
		{
			x -= line_width;
		}


		/* Force Border To Use Foreground Matching Parent State */
		if ((widget) && (gtk_widget_get_parent(widget)))
		{
			gtk_widget_ensure_style(gtk_widget_get_parent(widget));
			ge_gdk_color_to_cairo(&gtk_widget_get_style(gtk_widget_get_parent(widget))->fg[gtk_widget_get_state (widget)], &foreground);
		}
	}


	/***********************************************/
	/* Draw Border                                 */
	/***********************************************/
	/* Clip Border Too Passed Size */
	cairo_rectangle(cr, clip_x, clip_y, clip_width, clip_height);
	cairo_clip(cr);

	/* Set Line Style */
	ge_cairo_set_color(cr, &foreground);
	cairo_set_line_cap(cr, CAIRO_LINE_CAP_BUTT);

	cairo_set_line_width (cr, line_width);
	ge_cairo_inner_rectangle (cr, x, y, width, height);
	
	cairo_stroke(cr);
}