mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 14:10:30 +00:00
Cleanup of notebook tab code
svn path=/trunk/; revision=17623
This commit is contained in:
parent
13cc75654c
commit
954746fa05
@ -1,3 +1,8 @@
|
|||||||
|
2007-04-23 Cody Russell <bratsche@gnome.org>
|
||||||
|
* modules/engines/ms-windows/msw_style.c: Fixed one-pixel drawing error on
|
||||||
|
left-most tab when notebooks are top-oriented. Also general cleanup of
|
||||||
|
notebook tab related code. (Lieven van der Heide, Cody Russell)
|
||||||
|
|
||||||
2007-04-23 Matthias Clasen <mclasen@redhat.com>
|
2007-04-23 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* modules/printbackends/cups/gtkprintbackendcups.c: Reduce
|
* modules/printbackends/cups/gtkprintbackendcups.c: Reduce
|
||||||
|
@ -2245,7 +2245,7 @@ draw_tab (GtkStyle * style,
|
|||||||
(no system API for this, but DrawEdge can draw all the parts of a tab) */
|
(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,
|
static void DrawTab(HDC hdc, const RECT R, gint32 aPosition, gboolean aSelected,
|
||||||
gboolean aDrawLeft, gboolean aDrawRight)
|
gboolean aDrawLeft, gboolean aDrawRight)
|
||||||
{
|
{
|
||||||
gint32 leftFlag, topFlag, rightFlag, lightFlag, shadeFlag;
|
gint32 leftFlag, topFlag, rightFlag, lightFlag, shadeFlag;
|
||||||
RECT topRect, sideRect, bottomRect, lightRect, shadeRect;
|
RECT topRect, sideRect, bottomRect, lightRect, shadeRect;
|
||||||
gint32 selectedOffset, lOffset, rOffset;
|
gint32 selectedOffset, lOffset, rOffset;
|
||||||
@ -2255,7 +2255,8 @@ static void DrawTab(HDC hdc, const RECT R, gint32 aPosition, gboolean aSelected,
|
|||||||
rOffset = aDrawRight ? 2 : 0;
|
rOffset = aDrawRight ? 2 : 0;
|
||||||
|
|
||||||
/* Get info for tab orientation/position (Left, Top, Right, Bottom) */
|
/* Get info for tab orientation/position (Left, Top, Right, Bottom) */
|
||||||
switch (aPosition) {
|
switch (aPosition)
|
||||||
|
{
|
||||||
case BF_LEFT:
|
case BF_LEFT:
|
||||||
leftFlag = BF_TOP; topFlag = BF_LEFT;
|
leftFlag = BF_TOP; topFlag = BF_LEFT;
|
||||||
rightFlag = BF_BOTTOM;
|
rightFlag = BF_BOTTOM;
|
||||||
@ -2268,6 +2269,7 @@ static void DrawTab(HDC hdc, const RECT R, gint32 aPosition, gboolean aSelected,
|
|||||||
SetRect(&lightRect, R.left, R.top, R.left+3, R.top+3);
|
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);
|
SetRect(&shadeRect, R.left+1, R.bottom-2, R.left+2, R.bottom-1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BF_TOP:
|
case BF_TOP:
|
||||||
leftFlag = BF_LEFT; topFlag = BF_TOP;
|
leftFlag = BF_LEFT; topFlag = BF_TOP;
|
||||||
rightFlag = BF_RIGHT;
|
rightFlag = BF_RIGHT;
|
||||||
@ -2292,6 +2294,7 @@ static void DrawTab(HDC hdc, const RECT R, gint32 aPosition, gboolean aSelected,
|
|||||||
SetRect(&lightRect, R.right-3, R.top, R.right-1, R.top+2);
|
SetRect(&lightRect, R.right-3, R.top, R.right-1, R.top+2);
|
||||||
SetRect(&shadeRect, R.right-2, R.bottom-3, R.right, R.bottom-1);
|
SetRect(&shadeRect, R.right-2, R.bottom-3, R.right, R.bottom-1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BF_BOTTOM:
|
case BF_BOTTOM:
|
||||||
leftFlag = BF_LEFT; topFlag = BF_BOTTOM;
|
leftFlag = BF_LEFT; topFlag = BF_BOTTOM;
|
||||||
rightFlag = BF_RIGHT;
|
rightFlag = BF_RIGHT;
|
||||||
@ -2304,6 +2307,7 @@ static void DrawTab(HDC hdc, const RECT R, gint32 aPosition, gboolean aSelected,
|
|||||||
SetRect(&lightRect, R.left, R.bottom-3, R.left+2, R.bottom-1);
|
SetRect(&lightRect, R.left, R.bottom-3, R.left+2, R.bottom-1);
|
||||||
SetRect(&shadeRect, R.right-2, R.bottom-3, R.right, R.bottom-1);
|
SetRect(&shadeRect, R.right-2, R.bottom-3, R.right, R.bottom-1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
g_return_if_reached();
|
g_return_if_reached();
|
||||||
}
|
}
|
||||||
@ -2331,200 +2335,290 @@ static void DrawTab(HDC hdc, const RECT R, gint32 aPosition, gboolean aSelected,
|
|||||||
|
|
||||||
if (aDrawRight)
|
if (aDrawRight)
|
||||||
DrawEdge(hdc, &shadeRect, EDGE_RAISED, BF_SOFT | shadeFlag);
|
DrawEdge(hdc, &shadeRect, EDGE_RAISED, BF_SOFT | shadeFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static gboolean
|
||||||
draw_extension (GtkStyle * style,
|
draw_themed_tab_button (GtkStyle *style,
|
||||||
GdkWindow * window,
|
GdkWindow *window,
|
||||||
GtkStateType state_type,
|
GtkStateType state_type,
|
||||||
GtkShadowType shadow_type,
|
GtkNotebook *notebook,
|
||||||
GdkRectangle * area,
|
gint x, gint y,
|
||||||
GtkWidget * widget,
|
gint width, gint height,
|
||||||
const gchar * detail,
|
gint gap_side)
|
||||||
gint x,
|
|
||||||
gint y, gint width, gint height, GtkPositionType gap_side)
|
|
||||||
{
|
{
|
||||||
if (widget && GTK_IS_NOTEBOOK (widget) && detail && !strcmp (detail, "tab"))
|
|
||||||
{
|
|
||||||
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
|
|
||||||
GdkPixmap *pixmap = NULL;
|
GdkPixmap *pixmap = NULL;
|
||||||
GdkDrawable *target = NULL;
|
gint border_width = gtk_container_get_border_width (GTK_CONTAINER (notebook));
|
||||||
gint x2 = 0, y2 = 0, w2 = width, h2 = height;
|
GtkWidget *widget = GTK_WIDGET (notebook);
|
||||||
int tab_part = XP_THEME_ELEMENT_TAB_ITEM;
|
GdkRectangle draw_rect, clip_rect;
|
||||||
int real_gap_side = gtk_notebook_get_tab_pos (notebook);
|
GdkPixbufRotation rotation = GDK_PIXBUF_ROTATE_NONE;
|
||||||
int border_width = gtk_container_get_border_width (GTK_CONTAINER (notebook));
|
|
||||||
|
|
||||||
/* why this differs from the above gap_side, i have no idea... */
|
if (gap_side == GTK_POS_TOP)
|
||||||
if (real_gap_side == GTK_POS_LEFT)
|
|
||||||
{
|
{
|
||||||
/* Create "rotated" pixmap.. swap width and height */
|
int widget_right;
|
||||||
pixmap = gdk_pixmap_new (window, height, width, -1);
|
|
||||||
target = pixmap;
|
|
||||||
x2 = 0;
|
|
||||||
y2 = 0;
|
|
||||||
w2 = height;
|
|
||||||
h2 = width - (state_type == GTK_STATE_NORMAL ? 0 : notebook->tab_hborder);
|
|
||||||
|
|
||||||
/* If we are currently rendering the bottom-most tab, and if that tab is the selected tab... */
|
|
||||||
if (widget->allocation.y + widget->allocation.height - border_width == y + height &&
|
|
||||||
state_type == GTK_STATE_NORMAL)
|
|
||||||
{
|
|
||||||
w2--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (real_gap_side == GTK_POS_RIGHT)
|
|
||||||
{
|
|
||||||
/* Create "rotated" pixmap.. swap width and height */
|
|
||||||
x2 = 0;
|
|
||||||
y2 = 0;
|
|
||||||
w2 = height;
|
|
||||||
h2 = width - (state_type == GTK_STATE_NORMAL ? 0 : notebook->tab_hborder);
|
|
||||||
pixmap = gdk_pixmap_new (window, w2, h2, -1);
|
|
||||||
target = pixmap;
|
|
||||||
|
|
||||||
/* If we are currently rendering the bottom-most tab, and if that tab is the selected tab... */
|
|
||||||
if (widget->allocation.y + widget->allocation.height - border_width == y + height &&
|
|
||||||
state_type == GTK_STATE_NORMAL)
|
|
||||||
{
|
|
||||||
w2--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (real_gap_side == GTK_POS_TOP)
|
|
||||||
{
|
|
||||||
target = window;
|
|
||||||
x2 = x;
|
|
||||||
y2 = y;
|
|
||||||
w2 = width;
|
|
||||||
if (state_type == GTK_STATE_NORMAL)
|
if (state_type == GTK_STATE_NORMAL)
|
||||||
h2 = height;
|
{
|
||||||
|
draw_rect.x = x;
|
||||||
|
draw_rect.y = y;
|
||||||
|
draw_rect.width = width + 2;
|
||||||
|
draw_rect.height = height;
|
||||||
|
|
||||||
|
clip_rect = draw_rect;
|
||||||
|
clip_rect.height--;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
h2 = height - notebook->tab_vborder;
|
{
|
||||||
|
draw_rect.x = x + 2;
|
||||||
|
draw_rect.y = y;
|
||||||
|
draw_rect.width = width - 2;
|
||||||
|
draw_rect.height = height - 2;
|
||||||
|
clip_rect = draw_rect;
|
||||||
|
}
|
||||||
|
|
||||||
/* If we are currently drawing the right-most tab, and if that tab is the selected tab... */
|
/* If we are currently drawing the right-most tab, and if that tab is the selected tab... */
|
||||||
if (widget->allocation.x + widget->allocation.width - border_width == x + width &&
|
widget_right = widget->allocation.x + widget->allocation.width - border_width - 2;
|
||||||
state_type == GTK_STATE_NORMAL)
|
if (draw_rect.x + draw_rect.width >= widget_right)
|
||||||
{
|
{
|
||||||
x2--;
|
draw_rect.width = clip_rect.width = widget_right - draw_rect.x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (real_gap_side == GTK_POS_BOTTOM)
|
if (gap_side == GTK_POS_BOTTOM)
|
||||||
{
|
{
|
||||||
x2 = 0;
|
int widget_right;
|
||||||
y2 = 0;
|
|
||||||
w2 = width;
|
if (state_type == GTK_STATE_NORMAL)
|
||||||
h2 = height - (state_type == GTK_STATE_NORMAL ? 0 : notebook->tab_vborder * 2);
|
{
|
||||||
pixmap = gdk_pixmap_new (window, w2, h2, -1);
|
draw_rect.x = x;
|
||||||
target = pixmap;
|
draw_rect.y = y;
|
||||||
|
draw_rect.width = width + 2;
|
||||||
|
draw_rect.height = height;
|
||||||
|
|
||||||
|
clip_rect = draw_rect;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
draw_rect.x = x + 2;
|
||||||
|
draw_rect.y = y + 2;
|
||||||
|
draw_rect.width = width - 2;
|
||||||
|
draw_rect.height = height - 2;
|
||||||
|
clip_rect = draw_rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xp_theme_draw (target, tab_part, style, x2, y2, w2, h2, state_type, NULL /*area*/))
|
/* If we are currently drawing the right-most tab, and if that tab is the selected tab... */
|
||||||
|
widget_right = widget->allocation.x + widget->allocation.width - border_width - 2;
|
||||||
|
if (draw_rect.x + draw_rect.width >= widget_right)
|
||||||
{
|
{
|
||||||
GdkPixbufRotation rotation = GDK_PIXBUF_ROTATE_NONE;
|
draw_rect.width = clip_rect.width = widget_right - draw_rect.x;
|
||||||
if (real_gap_side == GTK_POS_BOTTOM)
|
}
|
||||||
|
|
||||||
rotation = GDK_PIXBUF_ROTATE_UPSIDEDOWN;
|
rotation = GDK_PIXBUF_ROTATE_UPSIDEDOWN;
|
||||||
else if (real_gap_side == GTK_POS_LEFT)
|
}
|
||||||
rotation = GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE;
|
else if (gap_side == GTK_POS_LEFT)
|
||||||
else if (real_gap_side == GTK_POS_RIGHT)
|
|
||||||
rotation = GDK_PIXBUF_ROTATE_CLOCKWISE;
|
|
||||||
|
|
||||||
if (rotation != GDK_PIXBUF_ROTATE_NONE)
|
|
||||||
{
|
{
|
||||||
GdkPixbuf * pixbuf, * rotated;
|
int widget_bottom;
|
||||||
|
|
||||||
pixbuf = gdk_pixbuf_get_from_drawable (NULL, target, NULL, x2, y2, 0, 0, w2, h2);
|
if (state_type == GTK_STATE_NORMAL)
|
||||||
|
{
|
||||||
|
draw_rect.x = x;
|
||||||
|
draw_rect.y = y;
|
||||||
|
draw_rect.width = width;
|
||||||
|
draw_rect.height = height + 2;
|
||||||
|
|
||||||
|
clip_rect = draw_rect;
|
||||||
|
clip_rect.width--;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
draw_rect.x = x;
|
||||||
|
draw_rect.y = y + 2;
|
||||||
|
draw_rect.width = width - 2;
|
||||||
|
draw_rect.height = height - 2;
|
||||||
|
clip_rect = draw_rect;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If we are currently drawing the bottom-most tab, and if that tab is the selected tab... */
|
||||||
|
widget_bottom = widget->allocation.x + widget->allocation.height - border_width - 2;
|
||||||
|
if (draw_rect.y + draw_rect.height >= widget_bottom)
|
||||||
|
{
|
||||||
|
draw_rect.height = clip_rect.height = widget_bottom - draw_rect.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
rotation = GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE;
|
||||||
|
}
|
||||||
|
else if (gap_side == GTK_POS_RIGHT)
|
||||||
|
{
|
||||||
|
int widget_bottom;
|
||||||
|
|
||||||
|
if (state_type == GTK_STATE_NORMAL)
|
||||||
|
{
|
||||||
|
draw_rect.x = x + 1;
|
||||||
|
draw_rect.y = y;
|
||||||
|
draw_rect.width = width;
|
||||||
|
draw_rect.height = height + 2;
|
||||||
|
|
||||||
|
clip_rect = draw_rect;
|
||||||
|
clip_rect.width--;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
draw_rect.x = x + 2;
|
||||||
|
draw_rect.y = y + 2;
|
||||||
|
draw_rect.width = width - 2;
|
||||||
|
draw_rect.height = height - 2;
|
||||||
|
clip_rect = draw_rect;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If we are currently drawing the bottom-most tab, and if that tab is the selected tab... */
|
||||||
|
widget_bottom = widget->allocation.x + widget->allocation.height - border_width - 2;
|
||||||
|
if (draw_rect.y + draw_rect.height >= widget_bottom)
|
||||||
|
{
|
||||||
|
draw_rect.height = clip_rect.height = widget_bottom - draw_rect.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
rotation = GDK_PIXBUF_ROTATE_CLOCKWISE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gap_side == GTK_POS_TOP)
|
||||||
|
{
|
||||||
|
if (!xp_theme_draw (window, XP_THEME_ELEMENT_TAB_ITEM, style,
|
||||||
|
draw_rect.x, draw_rect.y,
|
||||||
|
draw_rect.width,draw_rect.height,
|
||||||
|
state_type, &clip_rect))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GdkPixbuf *pixbuf;
|
||||||
|
GdkPixbuf *rotated;
|
||||||
|
|
||||||
|
if (gap_side == GTK_POS_LEFT || gap_side == GTK_POS_RIGHT)
|
||||||
|
{
|
||||||
|
pixmap = gdk_pixmap_new (window, clip_rect.height, clip_rect.width, -1);
|
||||||
|
if (!xp_theme_draw (pixmap, XP_THEME_ELEMENT_TAB_ITEM, style,
|
||||||
|
draw_rect.y - clip_rect.y, draw_rect.x - clip_rect.x,
|
||||||
|
draw_rect.height, draw_rect.width, state_type, 0))
|
||||||
|
{
|
||||||
|
g_object_unref (pixmap);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
pixbuf = gdk_pixbuf_get_from_drawable (NULL, pixmap, NULL, 0, 0, 0, 0,
|
||||||
|
clip_rect.height, clip_rect.width);
|
||||||
|
g_object_unref (pixmap);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pixmap = gdk_pixmap_new (window, clip_rect.width, clip_rect.height, -1);
|
||||||
|
if (!xp_theme_draw (pixmap, XP_THEME_ELEMENT_TAB_ITEM, style,
|
||||||
|
draw_rect.x - clip_rect.x, draw_rect.y - clip_rect.y,
|
||||||
|
draw_rect.width, draw_rect.height, state_type, 0))
|
||||||
|
{
|
||||||
|
g_object_unref (pixmap);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
pixbuf = gdk_pixbuf_get_from_drawable (NULL, pixmap, NULL, 0, 0, 0, 0,
|
||||||
|
clip_rect.width, clip_rect.height);
|
||||||
|
g_object_unref (pixmap);
|
||||||
|
}
|
||||||
|
|
||||||
rotated = gdk_pixbuf_rotate_simple (pixbuf, rotation);
|
rotated = gdk_pixbuf_rotate_simple (pixbuf, rotation);
|
||||||
g_object_unref (pixbuf);
|
g_object_unref (pixbuf);
|
||||||
pixbuf = rotated;
|
pixbuf = rotated;
|
||||||
|
|
||||||
if (real_gap_side == GTK_POS_RIGHT)
|
gdk_draw_pixbuf (window, NULL, pixbuf, 0, 0, clip_rect.x, clip_rect.y,
|
||||||
{
|
clip_rect.width, clip_rect.height, GDK_RGB_DITHER_NONE, 0, 0);
|
||||||
x2 = x + (state_type == GTK_STATE_NORMAL ? 0 : notebook->tab_hborder);
|
g_object_unref (pixbuf);
|
||||||
y2 = y;
|
|
||||||
w2 = width - (state_type == GTK_STATE_NORMAL ? 0 : notebook->tab_hborder);
|
|
||||||
h2 = height;
|
|
||||||
|
|
||||||
if (widget->allocation.y + widget->allocation.height - border_width == y + height &&
|
|
||||||
state_type == GTK_STATE_NORMAL)
|
|
||||||
{
|
|
||||||
h2--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (real_gap_side == GTK_POS_LEFT)
|
|
||||||
{
|
|
||||||
x2 = x;
|
|
||||||
y2 = y;
|
|
||||||
w2 = width - (state_type == GTK_STATE_NORMAL ? 0 : notebook->tab_hborder);
|
|
||||||
h2 = height;
|
|
||||||
|
|
||||||
if (widget->allocation.y + widget->allocation.height - border_width == y + height &&
|
|
||||||
state_type == GTK_STATE_NORMAL)
|
|
||||||
{
|
|
||||||
h2--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (real_gap_side == GTK_POS_BOTTOM)
|
|
||||||
{
|
|
||||||
x2 = x;
|
|
||||||
y2 = y + (state_type == GTK_STATE_NORMAL ? 0 : notebook->tab_vborder);
|
|
||||||
w2 = width;
|
|
||||||
h2 = height - (state_type == GTK_STATE_NORMAL ? 0 : notebook->tab_vborder * 2);
|
|
||||||
/* If we are currently drawing the right-most tab (any state)... */
|
|
||||||
if (widget->allocation.x + widget->allocation.width - border_width == x + width)
|
|
||||||
{
|
|
||||||
x2--;
|
|
||||||
w2--;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gdk_draw_pixbuf (window, NULL, pixbuf, 0, 0, x2, y2, w2, h2, GDK_RGB_DITHER_NONE, 0, 0);
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
g_object_unref (G_OBJECT (pixbuf));
|
static gboolean
|
||||||
|
draw_tab_button (GtkStyle *style,
|
||||||
if (real_gap_side == GTK_POS_LEFT || real_gap_side == GTK_POS_RIGHT || real_gap_side == GTK_POS_BOTTOM)
|
GdkWindow *window,
|
||||||
|
GtkStateType state_type,
|
||||||
|
GtkShadowType shadow_type,
|
||||||
|
GdkRectangle *area,
|
||||||
|
GtkWidget *widget,
|
||||||
|
const gchar *detail,
|
||||||
|
gint x, gint y,
|
||||||
|
gint width, gint height,
|
||||||
|
gint gap_side)
|
||||||
|
{
|
||||||
|
if (gap_side == GTK_POS_TOP || gap_side == GTK_POS_BOTTOM)
|
||||||
{
|
{
|
||||||
g_object_unref (pixmap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
} else if (real_gap_side == GTK_POS_TOP || real_gap_side == GTK_POS_BOTTOM) {
|
|
||||||
/* experimental tab-drawing code from mozilla */
|
/* experimental tab-drawing code from mozilla */
|
||||||
RECT rect;
|
RECT rect;
|
||||||
HDC dc;
|
HDC dc;
|
||||||
gint32 aPosition;
|
gint32 aPosition;
|
||||||
|
|
||||||
if (real_gap_side == GTK_POS_BOTTOM)
|
dc = get_window_dc (style, window, state_type, x, y, width, height, &rect);
|
||||||
g_object_unref (pixmap);
|
|
||||||
|
|
||||||
dc = get_window_dc(style, window, state_type, x, y, width, height, &rect);
|
if (gap_side == GTK_POS_TOP)
|
||||||
|
|
||||||
if (real_gap_side == GTK_POS_TOP)
|
|
||||||
aPosition = BF_TOP;
|
aPosition = BF_TOP;
|
||||||
else if (real_gap_side == GTK_POS_BOTTOM)
|
else if (gap_side == GTK_POS_BOTTOM)
|
||||||
aPosition = BF_BOTTOM;
|
aPosition = BF_BOTTOM;
|
||||||
else if (real_gap_side == GTK_POS_LEFT)
|
else if (gap_side == GTK_POS_LEFT)
|
||||||
aPosition = BF_LEFT;
|
aPosition = BF_LEFT;
|
||||||
else
|
else
|
||||||
aPosition = BF_RIGHT;
|
aPosition = BF_RIGHT;
|
||||||
|
|
||||||
if( state_type == GTK_STATE_PRELIGHT )
|
if(state_type == GTK_STATE_PRELIGHT)
|
||||||
state_type = GTK_STATE_NORMAL;
|
state_type = GTK_STATE_NORMAL;
|
||||||
if (area)
|
if (area)
|
||||||
gdk_gc_set_clip_rectangle (style->dark_gc[state_type], area);
|
gdk_gc_set_clip_rectangle (style->dark_gc[state_type], area);
|
||||||
DrawTab (dc, rect, aPosition, state_type != GTK_STATE_PRELIGHT, (real_gap_side != GTK_POS_LEFT), (real_gap_side != GTK_POS_RIGHT));
|
|
||||||
|
DrawTab (dc, rect, aPosition,
|
||||||
|
state_type != GTK_STATE_PRELIGHT,
|
||||||
|
(gap_side != GTK_POS_LEFT),
|
||||||
|
(gap_side != GTK_POS_RIGHT));
|
||||||
if (area)
|
if (area)
|
||||||
gdk_gc_set_clip_rectangle (style->dark_gc[state_type], NULL);
|
gdk_gc_set_clip_rectangle (style->dark_gc[state_type], NULL);
|
||||||
|
|
||||||
release_window_dc (style, window, state_type);
|
release_window_dc (style, window, state_type);
|
||||||
return;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (real_gap_side == GTK_POS_LEFT || real_gap_side == GTK_POS_RIGHT)
|
return FALSE;
|
||||||
g_object_unref (pixmap);
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
draw_extension (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,
|
||||||
|
GtkPositionType gap_side)
|
||||||
|
{
|
||||||
|
if (widget && GTK_IS_NOTEBOOK (widget) && detail && !strcmp (detail, "tab"))
|
||||||
|
{
|
||||||
|
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
|
||||||
|
|
||||||
|
/* Why this differs from gap_side, I have no idea.. */
|
||||||
|
int real_gap_side = gtk_notebook_get_tab_pos (notebook);
|
||||||
|
|
||||||
|
if (!draw_themed_tab_button (style, window, state_type,
|
||||||
|
GTK_NOTEBOOK (widget), x, y,
|
||||||
|
width, height, real_gap_side))
|
||||||
|
{
|
||||||
|
if (!draw_tab_button (style, window, state_type,
|
||||||
|
shadow_type, area, widget,
|
||||||
|
detail,
|
||||||
|
x, y, width, height, gap_side))
|
||||||
|
{
|
||||||
|
parent_class->draw_extension (style, window, state_type,
|
||||||
|
shadow_type, area, widget, detail,
|
||||||
|
x, y, width, height, real_gap_side);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
parent_class->draw_extension
|
|
||||||
(style, window, state_type, shadow_type, area, widget, detail,
|
|
||||||
x, y, width, height, gap_side);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user