⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pixbuf-draw.c

📁 This GTK+ version 2.12.3. GTK+ is a multi-platform toolkit for creating graphical user interfaces.
💻 C
📖 第 1 页 / 共 3 页
字号:
{  ThemeImage    *image;  ThemeMatchData match_data;    g_return_if_fail (style != NULL);  g_return_if_fail (window != NULL);  match_data.function = TOKEN_D_VLINE;  match_data.detail = (gchar *)detail;  match_data.flags = THEME_MATCH_ORIENTATION | THEME_MATCH_STATE;  match_data.state = state;  match_data.orientation = GTK_ORIENTATION_VERTICAL;    image = match_theme_image (style, &match_data);  if (image)    {      if (image->background)	theme_pixbuf_render (image->background,			     window, NULL, area, COMPONENT_ALL, FALSE,			     x, y1, 2, (y2 - y1) + 1);    }  else    parent_class->draw_vline (style, window, state, area, widget, detail,			      y1, y2, x);}static voiddraw_shadow(GtkStyle     *style,	    GdkWindow    *window,	    GtkStateType  state,	    GtkShadowType shadow,	    GdkRectangle *area,	    GtkWidget    *widget,	    const gchar  *detail,	    gint          x,	    gint          y,	    gint          width,	    gint          height){  ThemeMatchData match_data;    g_return_if_fail(style != NULL);  g_return_if_fail(window != NULL);  match_data.function = TOKEN_D_SHADOW;  match_data.detail = (gchar *)detail;  match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;  match_data.shadow = shadow;  match_data.state = state;  if (!draw_simple_image (style, window, area, widget, &match_data, FALSE, FALSE,			  x, y, width, height))    parent_class->draw_shadow (style, window, state, shadow, area, widget, detail,			       x, y, width, height);}/* This function makes up for some brokeness in gtkrange.c * where we never get the full arrow of the stepper button * and the type of button in a single drawing function. * * It doesn't work correctly when the scrollbar is squished * to the point we don't have room for full-sized steppers. */static voidreverse_engineer_stepper_box (GtkWidget    *range,			      GtkArrowType  arrow_type,			      gint         *x,			      gint         *y,			      gint         *width,			      gint         *height){  gint slider_width = 14, stepper_size = 14;  gint box_width;  gint box_height;    if (range && GTK_IS_RANGE (range))    {      gtk_widget_style_get (range,			    "slider_width", &slider_width,			    "stepper_size", &stepper_size,			    NULL);    }	  if (arrow_type == GTK_ARROW_UP || arrow_type == GTK_ARROW_DOWN)    {      box_width = slider_width;      box_height = stepper_size;    }  else    {      box_width = stepper_size;      box_height = slider_width;    }  *x = *x - (box_width - *width) / 2;  *y = *y - (box_height - *height) / 2;  *width = box_width;  *height = box_height;}static voiddraw_arrow (GtkStyle     *style,	    GdkWindow    *window,	    GtkStateType  state,	    GtkShadowType shadow,	    GdkRectangle *area,	    GtkWidget    *widget,	    const gchar  *detail,	    GtkArrowType  arrow_direction,	    gint          fill,	    gint          x,	    gint          y,	    gint          width,	    gint          height){  ThemeMatchData match_data;    g_return_if_fail(style != NULL);  g_return_if_fail(window != NULL);  if (detail &&      (strcmp (detail, "hscrollbar") == 0 || strcmp (detail, "vscrollbar") == 0))    {      /* This is a hack to work around the fact that scrollbar steppers are drawn       * as a box + arrow, so we never have       *       *   The full bounding box of the scrollbar        *   The arrow direction       *       * At the same time. We simulate an extra paint function, "STEPPER", by doing       * nothing for the box, and then here, reverse engineering the box that       * was passed to draw box and using that       */      gint box_x = x;      gint box_y = y;      gint box_width = width;      gint box_height = height;      reverse_engineer_stepper_box (widget, arrow_direction,				    &box_x, &box_y, &box_width, &box_height);      match_data.function = TOKEN_D_STEPPER;      match_data.detail = (gchar *)detail;      match_data.flags = (THEME_MATCH_SHADOW | 			  THEME_MATCH_STATE | 			  THEME_MATCH_ARROW_DIRECTION);      match_data.shadow = shadow;      match_data.state = state;      match_data.arrow_direction = arrow_direction;            if (draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,			     box_x, box_y, box_width, box_height))	{	  /* The theme included stepper images, we're done */	  return;	}      /* Otherwise, draw the full box, and fall through to draw the arrow       */      match_data.function = TOKEN_D_BOX;      match_data.detail = (gchar *)detail;      match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;      match_data.shadow = shadow;      match_data.state = state;            if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,			      box_x, box_y, box_width, box_height))	parent_class->draw_box (style, window, state, shadow, area, widget, detail,				box_x, box_y, box_width, box_height);    }  match_data.function = TOKEN_D_ARROW;  match_data.detail = (gchar *)detail;  match_data.flags = (THEME_MATCH_SHADOW | 		      THEME_MATCH_STATE | 		      THEME_MATCH_ARROW_DIRECTION);  match_data.shadow = shadow;  match_data.state = state;  match_data.arrow_direction = arrow_direction;    if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,			  x, y, width, height))    parent_class->draw_arrow (style, window, state, shadow, area, widget, detail,			      arrow_direction, fill, x, y, width, height);}static voiddraw_diamond (GtkStyle     *style,	      GdkWindow    *window,	      GtkStateType  state,	      GtkShadowType shadow,	      GdkRectangle *area,	      GtkWidget    *widget,	      const gchar  *detail,	      gint          x,	      gint          y,	      gint          width,	      gint          height){  ThemeMatchData match_data;    g_return_if_fail(style != NULL);  g_return_if_fail(window != NULL);  match_data.function = TOKEN_D_DIAMOND;  match_data.detail = (gchar *)detail;  match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;  match_data.shadow = shadow;  match_data.state = state;    if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,			  x, y, width, height))    parent_class->draw_diamond (style, window, state, shadow, area, widget, detail,				x, y, width, height);}static voiddraw_string (GtkStyle * style,	     GdkWindow * window,	     GtkStateType state,	     GdkRectangle * area,	     GtkWidget * widget,	     const gchar *detail,	     gint x,	     gint y,	     const gchar * string){  g_return_if_fail(style != NULL);  g_return_if_fail(window != NULL);  if (state == GTK_STATE_INSENSITIVE)    {      if (area)	{	  gdk_gc_set_clip_rectangle(style->white_gc, area);	  gdk_gc_set_clip_rectangle(style->fg_gc[state], area);	}      gdk_draw_string(window, gtk_style_get_font (style), style->fg_gc[state], x, y, string);            if (area)	{	  gdk_gc_set_clip_rectangle(style->white_gc, NULL);	  gdk_gc_set_clip_rectangle(style->fg_gc[state], NULL);	}    }  else    {      gdk_gc_set_clip_rectangle(style->fg_gc[state], area);      gdk_draw_string(window, gtk_style_get_font (style), style->fg_gc[state], x, y, string);      gdk_gc_set_clip_rectangle(style->fg_gc[state], NULL);    }}static voiddraw_box (GtkStyle     *style,	  GdkWindow    *window, 	  GtkStateType  state, 	  GtkShadowType shadow, 	  GdkRectangle *area, 	  GtkWidget    *widget,	  const gchar  *detail,	  gint          x,	  gint          y,	  gint          width,	  gint          height){  ThemeMatchData match_data;  g_return_if_fail(style != NULL);  g_return_if_fail(window != NULL);  if (detail &&      (strcmp (detail, "hscrollbar") == 0 || strcmp (detail, "vscrollbar") == 0))    {      /* We handle this in draw_arrow */      return;    }  match_data.function = TOKEN_D_BOX;  match_data.detail = (gchar *)detail;  match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;  match_data.shadow = shadow;  match_data.state = state;  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,			  x, y, width, height)) {    parent_class->draw_box (style, window, state, shadow, area, widget, detail,			    x, y, width, height);  }}static voiddraw_flat_box (GtkStyle     *style,	       GdkWindow    *window,	       GtkStateType  state,	       GtkShadowType shadow,	       GdkRectangle *area,	       GtkWidget    *widget,	       const gchar  *detail,	       gint          x,	       gint          y,	       gint          width,	       gint          height){  ThemeMatchData match_data;    g_return_if_fail(style != NULL);  g_return_if_fail(window != NULL);  match_data.function = TOKEN_D_FLAT_BOX;  match_data.detail = (gchar *)detail;  match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;  match_data.shadow = shadow;  match_data.state = state;  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,			  x, y, width, height))    parent_class->draw_flat_box (style, window, state, shadow, area, widget, detail,				 x, y, width, height);}static voiddraw_check (GtkStyle     *style,	    GdkWindow    *window,	    GtkStateType  state,	    GtkShadowType shadow,	    GdkRectangle *area,	    GtkWidget    *widget,	    const gchar  *detail,	    gint          x,	    gint          y,	    gint          width,	    gint          height){  ThemeMatchData match_data;    g_return_if_fail(style != NULL);  g_return_if_fail(window != NULL);  match_data.function = TOKEN_D_CHECK;  match_data.detail = (gchar *)detail;  match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;  match_data.shadow = shadow;  match_data.state = state;    if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,			  x, y, width, height))    parent_class->draw_check (style, window, state, shadow, area, widget, detail,			      x, y, width, height);}static voiddraw_option (GtkStyle      *style,	     GdkWindow     *window,	     GtkStateType  state,	     GtkShadowType shadow,	     GdkRectangle *area,	     GtkWidget    *widget,	     const gchar  *detail,	     gint          x,	     gint          y,	     gint          width,	     gint          height){  ThemeMatchData match_data;    g_return_if_fail(style != NULL);  g_return_if_fail(window != NULL);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -