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

📄 msw_style.c

📁 This GTK+ version 2.12.3. GTK+ is a multi-platform toolkit for creating graphical user interfaces.
💻 C
📖 第 1 页 / 共 5 页
字号:
	        InflateRect( &rect, -1, -1 );                FrameRect( dc, &rect, GetSysColorBrush(COLOR_BTNSHADOW) );	        InflateRect( &rect, -1, -1 );                FillRect( dc, &rect, GetSysColorBrush(COLOR_BTNFACE) );            }	}	else {		if( is_default || GTK_WIDGET_HAS_FOCUS(widget) ) {                    FrameRect( dc, &rect, GetSysColorBrush(COLOR_WINDOWFRAME) );                    InflateRect( &rect, -1, -1 );		}		DrawFrameControl( dc, &rect, DFC_BUTTON, DFCS_BUTTONPUSH );	}	release_window_dc(style, window, state_type);}static voiddraw_box (GtkStyle * style,	  GdkWindow * window,	  GtkStateType state_type,	  GtkShadowType shadow_type,	  GdkRectangle * area,	  GtkWidget * widget,	  const gchar * detail, gint x, gint y, gint width, gint height){    if (is_combo_box_child (widget) && detail && !strcmp (detail, "button")) {        RECT rect;        HDC dc;        int cx;                   dc = get_window_dc (style, window, state_type, x, y, width - cx, height, &rect);        FillRect (dc, &rect, GetSysColorBrush(COLOR_WINDOW));        release_window_dc (style, window, state_type);	cx = 2 * GetSystemMetrics (SM_CXEDGE) + 16; /* TODO evaluate arrow width */        x += width - cx;        width = cx;	if (xp_theme_is_active () && xp_theme_draw (	    window, XP_THEME_ELEMENT_COMBOBUTTON, style,	    x, y, width, height, state_type, area))	    return;    }    if (detail &&	(!strcmp (detail, "button") || !strcmp (detail, "buttondefault")))	{	    if (GTK_IS_TREE_VIEW (widget->parent)		|| GTK_IS_CLIST (widget->parent))		{		    if (xp_theme_draw			(window, XP_THEME_ELEMENT_LIST_HEADER, style, x, y,			 width, height, state_type, area))			return;                    else {                        HDC dc;                        RECT rect;                        dc = get_window_dc( style, window, state_type, x, y, width, height, &rect );                        DrawFrameControl( dc, &rect, DFC_BUTTON, DFCS_BUTTONPUSH |                             (state_type == GTK_STATE_ACTIVE ? (DFCS_PUSHED|DFCS_FLAT) : 0 ) );                        release_window_dc( style, window, state_type );		}		}	    else if (is_toolbar_child (widget->parent)                    || (GTK_RELIEF_NONE == gtk_button_get_relief(GTK_BUTTON(widget)) ) )		{			if( draw_tool_button( window, widget, style, x, y, 					  width, height, state_type, area ) )		{			return;		}		}	    else		{			gboolean is_default = GTK_WIDGET_HAS_DEFAULT(widget);		    if (xp_theme_draw			(window,			 is_default ? XP_THEME_ELEMENT_DEFAULT_BUTTON :			 XP_THEME_ELEMENT_BUTTON, style, x, y, width, height,			 state_type, area))			{				return;			}			draw_push_button( window, widget, style, 				x, y, width, height, state_type, is_default );			return;		}            return;	}    else if (detail && !strcmp (detail, "spinbutton"))	{	    if (xp_theme_is_drawable (XP_THEME_ELEMENT_SPIN_BUTTON_UP))		{		    return;		}	}    else if (detail && (!strcmp (detail, "spinbutton_up")			|| !strcmp (detail, "spinbutton_down")))	{	    if ( ! xp_theme_draw ( window,			       (!strcmp (detail, "spinbutton_up"))			       ? XP_THEME_ELEMENT_SPIN_BUTTON_UP			       : XP_THEME_ELEMENT_SPIN_BUTTON_DOWN,			       style, x, y, width, height, state_type, area))		{                RECT rect;                HDC dc;                dc = get_window_dc( style, window, state_type,                                    x, y, width, height, &rect );                DrawEdge( dc, &rect,                         state_type == GTK_STATE_ACTIVE ? EDGE_SUNKEN : EDGE_RAISED, BF_RECT );                release_window_dc( style, window, state_type );		}            return;	}    else if (detail && !strcmp (detail, "slider"))	{	    if (GTK_IS_SCROLLBAR (widget))		{		    GtkScrollbar *scrollbar = GTK_SCROLLBAR (widget);		    gboolean is_v = GTK_IS_VSCROLLBAR (widget);			if (xp_theme_draw (window,				       is_v				       ? XP_THEME_ELEMENT_SCROLLBAR_V				       : XP_THEME_ELEMENT_SCROLLBAR_H,				       style, x, y, width, height, state_type,				       area))			{			    XpThemeElement gripper =				(is_v ? XP_THEME_ELEMENT_SCROLLBAR_GRIPPER_V :				 XP_THEME_ELEMENT_SCROLLBAR_GRIPPER_H);			    /* Do not display grippers on tiny scroll bars,			       the limit imposed is rather arbitrary, perhaps			       we can fetch the gripper geometry from			       somewhere and use that... */			    if ((gripper ==				 XP_THEME_ELEMENT_SCROLLBAR_GRIPPER_H				 && width < 16)				|| (gripper ==				    XP_THEME_ELEMENT_SCROLLBAR_GRIPPER_V				    && height < 16))				{				    return;				}			    xp_theme_draw (window, gripper, style, x, y,					   width, height, state_type, area);			    return;			}		    else			{			    if (scrollbar->range.adjustment->page_size >=				(scrollbar->range.adjustment->upper -				 scrollbar->range.adjustment->lower))				return;			}		}	}    else if (detail && !strcmp (detail, "bar"))	{	    if (widget && GTK_IS_PROGRESS_BAR (widget))		{		    GtkProgressBar *progress_bar = GTK_PROGRESS_BAR (widget);		    XpThemeElement xp_progress_bar =			map_gtk_progress_bar_to_xp (progress_bar, FALSE);		    if (xp_theme_draw (window, xp_progress_bar, style, x, y,							   width, height, state_type, area))			{			    return;			}			shadow_type = GTK_SHADOW_NONE;		}	}    else if (detail && strcmp (detail, "menuitem") == 0)	{	    shadow_type = GTK_SHADOW_NONE;        if( draw_menu_item(window, widget, style,             x, y, width, height, state_type, area ) )		{		    return;		}	}    else if (detail && !strcmp (detail, "trough"))	{	    if (widget && GTK_IS_PROGRESS_BAR (widget))		{		    GtkProgressBar *progress_bar = GTK_PROGRESS_BAR (widget);		    XpThemeElement xp_progress_bar =			map_gtk_progress_bar_to_xp (progress_bar, TRUE);		    if (xp_theme_draw			(window, xp_progress_bar, style, x, y, width, height,			 state_type, area))			{			    return;			}		    else			{			    /* Blank in classic Windows */			}		}	    else if (widget && GTK_IS_SCROLLBAR (widget))		{		    gboolean is_vertical = GTK_IS_VSCROLLBAR (widget);		    if (xp_theme_draw (window,				       is_vertical				       ? XP_THEME_ELEMENT_TROUGH_V				       : XP_THEME_ELEMENT_TROUGH_H,				       style,				       x, y, width, height, state_type, area))			{			    return;			}		    else			{                            HDC dc;                            RECT rect;			    sanitize_size (window, &width, &height);                            dc = get_window_dc( style, window, state_type, x, y, width, height, &rect );                            SetTextColor( dc, GetSysColor(COLOR_3DHILIGHT) );                            SetBkColor( dc, GetSysColor(COLOR_BTNFACE) );                            FillRect( dc, &rect, get_dither_brush() );                            release_window_dc( style, window, state_type );			    return;			}		}	    else if (widget && GTK_IS_SCALE (widget))		{		    gboolean is_vertical = GTK_IS_VSCALE (widget);		    if (!xp_theme_is_active ())			{			    parent_class->draw_box (style, window, state_type,						    GTK_SHADOW_NONE, area,						    widget, detail, x, y,						    width, height);			}		    if (is_vertical)			{			    if (xp_theme_draw				(window, XP_THEME_ELEMENT_SCALE_TROUGH_V,				 style, (2 * x + width) / 2, y, 2, height,				 state_type, area))				return;			    parent_class->draw_box (style, window, state_type,						    GTK_SHADOW_ETCHED_IN,						    area, NULL, NULL,						    (2 * x + width) / 2, y, 1,						    height);			}		    else			{			    if (xp_theme_draw				(window, XP_THEME_ELEMENT_SCALE_TROUGH_H,				 style, x, (2 * y + height) / 2, width, 2,				 state_type, area))				return;			    parent_class->draw_box (style, window, state_type,						    GTK_SHADOW_ETCHED_IN,						    area, NULL, NULL, x,						    (2 * y + height) / 2,						    width, 1);			}		    return;		}	}    else if (detail && strcmp (detail, "optionmenu") == 0)	{	    if (xp_theme_draw (window, XP_THEME_ELEMENT_EDIT_TEXT,			       style, x, y, width, height, state_type, area))		{		    return;		}	}    else if (detail	     && (strcmp (detail, "vscrollbar") == 0		 || strcmp (detail, "hscrollbar") == 0))	{            return;	}    else if (detail	     && (strcmp (detail, "handlebox_bin") == 0		 || strcmp (detail, "toolbar") == 0		 || strcmp (detail, "menubar") == 0))	{            sanitize_size( window, &width, &height );	    if (xp_theme_draw (window, XP_THEME_ELEMENT_REBAR,			       style, x, y, width, height, state_type, area))		{		    return;		}	}    else if (detail && (!strcmp (detail, "handlebox")))	/* grip */	{            if( !xp_theme_is_active() ) {                return;            }	}    else if (detail && !strcmp (detail, "notebook") && GTK_IS_NOTEBOOK (widget))	{	    GtkNotebook *notebook = GTK_NOTEBOOK (widget);	    if (xp_theme_draw (window, XP_THEME_ELEMENT_TAB_PANE, style,			       x, y, width, height, state_type, area))		{		    return;		}	}    else	{	    const gchar *name = gtk_widget_get_name (widget);	    if (name && !strcmp (name, "gtk-tooltips"))		{		    if (xp_theme_draw			(window, XP_THEME_ELEMENT_TOOLTIP, style, x, y, width,			 height, state_type, area))			{			    return;			}		    else			{			    HBRUSH brush;			    RECT rect;			    HDC hdc;				hdc = get_window_dc(style, window, state_type, x, y, width, height, &rect);			    brush = GetSysColorBrush (COLOR_3DDKSHADOW);			    if (brush)				FrameRect (hdc, &rect, brush);			    InflateRect (&rect, -1, -1);			    FillRect (hdc, &rect,				      (HBRUSH) (COLOR_INFOBK + 1));				release_window_dc (style, window, state_type);			    return;			}		}	}    parent_class->draw_box (style, window, state_type, shadow_type, area,			    widget, detail, x, y, width, height);    if (detail && strcmp (detail, "optionmenu") == 0)	{	    GtkRequisition indicator_size;	    GtkBorder indicator_spacing;	    gint vline_x;	    option_menu_get_props (widget, &indicator_size,				   &indicator_spacing);	    sanitize_size (window, &width, &height);	    if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)		vline_x =		    x + indicator_size.width + indicator_spacing.left +		    indicator_spacing.right;	    else		vline_x =		    x + width - (indicator_size.width +				 indicator_spacing.left +				 indicator_spacing.right) - style->xthickness;	    parent_class->draw_vline (style, window, state_type, area, widget,				      detail,				      y + style->ythickness + 1,				      y + height - style->ythickness - 3,				      vline_x);	}}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){    GtkRequisition indicator_size;    GtkBorder indicator_spacing;    gint arrow_height;    g_return_if_fail (style != NULL);    g_return_if_fail (window != NULL);    if (detail && !strcmp (detail, "optionmenutab"))	{	    if (xp_theme_draw (window, XP_THEME_ELEMENT_COMBOBUTTON,			       style, x - 5, widget->allocation.y + 1,			       width + 10, widget->allocation.height - 2,			       state, area))		{		    return;		}	}    option_menu_get_props (widget, &indicator_size, &indicator_spacing);    x += (width - indicator_size.width) / 2;    arrow_height = (indicator_size.width + 1) / 2;    y += (height - arrow_height) / 2;    draw_varrow (window, style->black_gc, shadow, area, GTK_ARROW_DOWN,		 x, y, indicator_size.width, arrow_height);}/* Draw classic Windows tab - thanks Mozilla!  (no system API for this, but DrawEdge can draw all the parts of a tab) */static void DrawTab(HDC hdc, const RECT R, gint32 aPosition, gboolean aSelected,                     gboolean aDrawLeft, gboolean aDrawRight){  gint32 leftFlag, topFlag, rightFlag, lightFlag, shadeFlag;  RECT topRect, sideRect, bottomRect, lightRect, shadeRect;  gint32 selectedOffset, lOffset, rOffset;  selectedOffset = aSelected ? 1 : 0;  lOffset = aDrawLeft ? 2 : 0;  rOffset = aDrawRight ? 2 : 0;  /* Get info for tab orientation/position (Left, Top, Right, Bottom) */  switch (aPosition)    {    case BF_LEFT:      leftFlag = BF_TOP; topFlag = BF_LEFT;      rightFlag = BF_BOTTOM;      lightFlag = BF_DIAGONAL_ENDTOPRIGHT;      shadeFlag = BF_DIAGONAL_ENDBOTTOMRIGHT;      SetRect(&topRect, R.left, R.top+lOffset, R.right, R.bottom-rOffset);      SetRect(&sideRect, R.left+2, R.top, R.right-2+selectedOffset, R.bottom);      SetRect(&bottomRect, R.right-2, R.top, R.right, R.bottom);      SetRect(&lightRect, R.left, R.top, R.left+3, R.top+3);      SetRect(&shadeRect, R.left+1, R.bottom-2, R.left+2, R.bottom-1);      break;    case BF_TOP:      leftFlag = BF_LEFT; topFlag = BF_TOP;      righ

⌨️ 快捷键说明

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