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

📄 pixbuf-draw.c

📁 linux下电话本所依赖的一些图形库
💻 C
📖 第 1 页 / 共 2 页
字号:
      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);  match_data.function = TOKEN_D_OPTION;  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_option (style, window, state, shadow, area, widget, detail,			       x, y, width, height);}static voiddraw_tab (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_TAB;  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_tab (style, window, state, shadow, area, widget, detail,			    x, y, width, height);}static voiddraw_shadow_gap (GtkStyle       *style,		 GdkWindow      *window,		 GtkStateType    state,		 GtkShadowType   shadow,		 GdkRectangle   *area,		 GtkWidget      *widget,		 const gchar    *detail,		 gint            x,		 gint            y,		 gint            width,		 gint            height,		 GtkPositionType gap_side,		 gint            gap_x,		 gint            gap_width){  ThemeMatchData match_data;    match_data.function = TOKEN_D_SHADOW_GAP;  match_data.detail = (gchar *)detail;  match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;  match_data.flags = (THEME_MATCH_SHADOW | 		      THEME_MATCH_STATE | 		      THEME_MATCH_ORIENTATION);  match_data.shadow = shadow;  match_data.state = state;    if (!draw_gap_image (style, window, area, widget, &match_data, FALSE,		       x, y, width, height, gap_side, gap_x, gap_width))    parent_class->draw_shadow_gap (style, window, state, shadow, area, widget, detail,				   x, y, width, height, gap_side, gap_x, gap_width);}static voiddraw_box_gap (GtkStyle       *style,	      GdkWindow      *window,	      GtkStateType    state,	      GtkShadowType   shadow,	      GdkRectangle   *area,	      GtkWidget      *widget,	      const gchar    *detail,	      gint            x,	      gint            y,	      gint            width,	      gint            height,	      GtkPositionType gap_side,	      gint            gap_x,	      gint            gap_width){  ThemeMatchData match_data;    match_data.function = TOKEN_D_BOX_GAP;  match_data.detail = (gchar *)detail;  match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;  match_data.flags = (THEME_MATCH_SHADOW | 		      THEME_MATCH_STATE | 		      THEME_MATCH_ORIENTATION);  match_data.shadow = shadow;  match_data.state = state;    if (!draw_gap_image (style, window, area, widget, &match_data, TRUE,		       x, y, width, height, gap_side, gap_x, gap_width))    parent_class->draw_box_gap (style, window, state, shadow, area, widget, detail,				x, y, width, height, gap_side, gap_x, gap_width);}static voiddraw_extension (GtkStyle       *style,		GdkWindow      *window,		GtkStateType    state,		GtkShadowType   shadow,		GdkRectangle   *area,		GtkWidget      *widget,		const gchar    *detail,		gint            x,		gint            y,		gint            width,		gint            height,		GtkPositionType gap_side){  ThemeMatchData match_data;    g_return_if_fail(style != NULL);  g_return_if_fail(window != NULL);  /* Why? */  if (width >=0)    width++;  if (height >=0)    height++;    match_data.function = TOKEN_D_EXTENSION;  match_data.detail = (gchar *)detail;  match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE | THEME_MATCH_GAP_SIDE;  match_data.shadow = shadow;  match_data.state = state;  match_data.gap_side = gap_side;  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,			  x, y, width, height))    parent_class->draw_extension (style, window, state, shadow, area, widget, detail,				  x, y, width, height, gap_side);}static voiddraw_focus (GtkStyle     *style,	    GdkWindow    *window,	    GtkStateType  state_type,	    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_FOCUS;  match_data.detail = (gchar *)detail;  match_data.flags = 0;    if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, FALSE,			  x, y, width, height))    parent_class->draw_focus (style, window, state_type, area, widget, detail,			      x, y, width, height);}static voiddraw_slider (GtkStyle      *style,	     GdkWindow     *window,	     GtkStateType   state,	     GtkShadowType  shadow,	     GdkRectangle  *area,	     GtkWidget     *widget,	     const gchar   *detail,	     gint           x,	     gint           y,	     gint           width,	     gint           height,	     GtkOrientation orientation){  ThemeMatchData           match_data;    g_return_if_fail(style != NULL);  g_return_if_fail(window != NULL);  match_data.function = TOKEN_D_SLIDER;  match_data.detail = (gchar *)detail;  match_data.flags = (THEME_MATCH_SHADOW | 		      THEME_MATCH_STATE | 		      THEME_MATCH_ORIENTATION);  match_data.shadow = shadow;  match_data.state = state;  match_data.orientation = orientation;  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,			  x, y, width, height))    parent_class->draw_slider (style, window, state, shadow, area, widget, detail,			       x, y, width, height, orientation);}static voiddraw_handle (GtkStyle      *style,	     GdkWindow     *window,	     GtkStateType   state,	     GtkShadowType  shadow,	     GdkRectangle  *area,	     GtkWidget     *widget,	     const gchar   *detail,	     gint           x,	     gint           y,	     gint           width,	     gint           height,	     GtkOrientation orientation){  ThemeMatchData match_data;    g_return_if_fail (style != NULL);  g_return_if_fail (window != NULL);  match_data.function = TOKEN_D_HANDLE;  match_data.detail = (gchar *)detail;  match_data.flags = (THEME_MATCH_SHADOW | 		      THEME_MATCH_STATE | 		      THEME_MATCH_ORIENTATION);  match_data.shadow = shadow;  match_data.state = state;  match_data.orientation = orientation;  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,			  x, y, width, height))    parent_class->draw_handle (style, window, state, shadow, area, widget, detail,			       x, y, width, height, orientation);}GType pixbuf_type_style = 0;voidpixbuf_style_register_type (GTypeModule *module){  static const GTypeInfo object_info =  {    sizeof (PixbufStyleClass),    (GBaseInitFunc) NULL,    (GBaseFinalizeFunc) NULL,    (GClassInitFunc) pixbuf_style_class_init,    NULL,           /* class_finalize */    NULL,           /* class_data */    sizeof (PixbufStyle),    0,              /* n_preallocs */    (GInstanceInitFunc) pixbuf_style_init,  };    pixbuf_type_style = g_type_module_register_type (module,						   GTK_TYPE_STYLE,						   "PixbufStyle",						   &object_info, 0);}static voidpixbuf_style_init (PixbufStyle *style){}static voidpixbuf_style_class_init (PixbufStyleClass *klass){  GtkStyleClass *style_class = GTK_STYLE_CLASS (klass);  parent_class = g_type_class_peek_parent (klass);  style_class->draw_hline = draw_hline;  style_class->draw_vline = draw_vline;  style_class->draw_shadow = draw_shadow;  style_class->draw_arrow = draw_arrow;  style_class->draw_diamond = draw_diamond;  style_class->draw_string = draw_string;  style_class->draw_box = draw_box;  style_class->draw_flat_box = draw_flat_box;  style_class->draw_check = draw_check;  style_class->draw_option = draw_option;  style_class->draw_tab = draw_tab;  style_class->draw_shadow_gap = draw_shadow_gap;  style_class->draw_box_gap = draw_box_gap;  style_class->draw_extension = draw_extension;  style_class->draw_focus = draw_focus;  style_class->draw_slider = draw_slider;  style_class->draw_handle = draw_handle;}

⌨️ 快捷键说明

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