1997-11-24 22:37:52 +00:00
|
|
|
/* GTK - The GIMP Toolkit
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
1998-04-13 02:02:47 +00:00
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
1997-11-24 22:37:52 +00:00
|
|
|
*/
|
1999-02-24 07:37:18 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Modified by the GTK+ Team and others 1997-1999. See the AUTHORS
|
|
|
|
* file for a list of people on the GTK+ Team. See the ChangeLog
|
|
|
|
* files for a list of changes. These files are distributed with
|
|
|
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
|
|
|
*/
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
#include <math.h>
|
|
|
|
#include "gtkgc.h"
|
1998-11-06 22:05:02 +00:00
|
|
|
#include "gtkrc.h"
|
1997-11-24 22:37:52 +00:00
|
|
|
#include "gtkstyle.h"
|
1998-11-06 22:05:02 +00:00
|
|
|
#include "gtkthemes.h"
|
1997-11-28 06:47:01 +00:00
|
|
|
#include "gtkwidget.h"
|
1998-11-06 22:05:02 +00:00
|
|
|
#include "gtkthemes.h"
|
|
|
|
#include "gdk/gdkprivate.h"
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
#define LIGHTNESS_MULT 1.3
|
|
|
|
#define DARKNESS_MULT 0.7
|
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
/* actually glib should do that for us */
|
|
|
|
#ifndef M_PI
|
|
|
|
#define M_PI 3.14159265358979323846
|
|
|
|
#endif /* M_PI */
|
|
|
|
#ifndef M_PI_4
|
|
|
|
#define M_PI_4 0.78539816339744830962
|
|
|
|
#endif /* M_PI_4 */
|
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
static void gtk_style_init (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkColormap *colormap,
|
|
|
|
gint depth);
|
1997-11-24 22:37:52 +00:00
|
|
|
static void gtk_style_destroy (GtkStyle *style);
|
|
|
|
|
|
|
|
static void gtk_default_draw_hline (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x1,
|
|
|
|
gint x2,
|
|
|
|
gint y);
|
1997-11-24 22:37:52 +00:00
|
|
|
static void gtk_default_draw_vline (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint y1,
|
|
|
|
gint y2,
|
|
|
|
gint x);
|
1997-11-24 22:37:52 +00:00
|
|
|
static void gtk_default_draw_shadow (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height);
|
1998-11-06 22:05:02 +00:00
|
|
|
static void gtk_default_draw_shadow (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height);
|
1997-11-24 22:37:52 +00:00
|
|
|
static void gtk_default_draw_polygon (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
GdkPoint *points,
|
|
|
|
gint npoints,
|
|
|
|
gboolean fill);
|
1997-11-24 22:37:52 +00:00
|
|
|
static void gtk_default_draw_arrow (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
GtkArrowType arrow_type,
|
|
|
|
gboolean fill,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height);
|
1997-11-24 22:37:52 +00:00
|
|
|
static void gtk_default_draw_diamond (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height);
|
1997-11-24 22:37:52 +00:00
|
|
|
static void gtk_default_draw_oval (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height);
|
1997-11-24 22:37:52 +00:00
|
|
|
static void gtk_default_draw_string (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
const gchar *string);
|
1998-11-06 22:05:02 +00:00
|
|
|
static void gtk_default_draw_box (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height);
|
1998-11-06 22:05:02 +00:00
|
|
|
static void gtk_default_draw_flat_box (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height);
|
1998-11-06 22:05:02 +00:00
|
|
|
static void gtk_default_draw_check (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height);
|
1998-11-06 22:05:02 +00:00
|
|
|
static void gtk_default_draw_option (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height);
|
1998-11-06 22:05:02 +00:00
|
|
|
static void gtk_default_draw_cross (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height);
|
1998-11-06 22:05:02 +00:00
|
|
|
static void gtk_default_draw_ramp (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
GtkArrowType arrow_type,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height);
|
1998-11-06 22:05:02 +00:00
|
|
|
static void gtk_default_draw_tab (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height);
|
1998-11-06 22:05:02 +00:00
|
|
|
static void gtk_default_draw_shadow_gap (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GtkPositionType gap_side,
|
|
|
|
gint gap_x,
|
|
|
|
gint gap_width);
|
1998-11-06 22:05:02 +00:00
|
|
|
static void gtk_default_draw_box_gap (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GtkPositionType gap_side,
|
|
|
|
gint gap_x,
|
|
|
|
gint gap_width);
|
1998-11-06 22:05:02 +00:00
|
|
|
static void gtk_default_draw_extension (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GtkPositionType gap_side);
|
1998-11-06 22:05:02 +00:00
|
|
|
static void gtk_default_draw_focus (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height);
|
1998-11-06 22:05:02 +00:00
|
|
|
static void gtk_default_draw_slider (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GtkOrientation orientation);
|
1998-11-06 22:05:02 +00:00
|
|
|
static void gtk_default_draw_handle (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GtkOrientation orientation);
|
1998-11-06 22:05:02 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
static void gtk_style_shade (GdkColor *a, GdkColor *b, gdouble k);
|
|
|
|
static void rgb_to_hls (gdouble *r, gdouble *g, gdouble *b);
|
|
|
|
static void hls_to_rgb (gdouble *h, gdouble *l, gdouble *s);
|
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
|
1998-11-30 19:07:15 +00:00
|
|
|
static const GtkStyleClass default_class =
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1999-01-11 18:49:54 +00:00
|
|
|
2,
|
|
|
|
2,
|
|
|
|
gtk_default_draw_hline,
|
|
|
|
gtk_default_draw_vline,
|
|
|
|
gtk_default_draw_shadow,
|
|
|
|
gtk_default_draw_polygon,
|
|
|
|
gtk_default_draw_arrow,
|
|
|
|
gtk_default_draw_diamond,
|
|
|
|
gtk_default_draw_oval,
|
|
|
|
gtk_default_draw_string,
|
|
|
|
gtk_default_draw_box,
|
|
|
|
gtk_default_draw_flat_box,
|
|
|
|
gtk_default_draw_check,
|
|
|
|
gtk_default_draw_option,
|
|
|
|
gtk_default_draw_cross,
|
|
|
|
gtk_default_draw_ramp,
|
|
|
|
gtk_default_draw_tab,
|
|
|
|
gtk_default_draw_shadow_gap,
|
|
|
|
gtk_default_draw_box_gap,
|
|
|
|
gtk_default_draw_extension,
|
|
|
|
gtk_default_draw_focus,
|
|
|
|
gtk_default_draw_slider,
|
|
|
|
gtk_default_draw_handle
|
1997-11-24 22:37:52 +00:00
|
|
|
};
|
1998-11-06 22:05:02 +00:00
|
|
|
GdkFont *default_font = NULL;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
static GdkColor gtk_default_normal_fg = { 0, 0, 0, 0 };
|
|
|
|
static GdkColor gtk_default_active_fg = { 0, 0, 0, 0 };
|
|
|
|
static GdkColor gtk_default_prelight_fg = { 0, 0, 0, 0 };
|
|
|
|
static GdkColor gtk_default_selected_fg = { 0, 0xffff, 0xffff, 0xffff };
|
|
|
|
static GdkColor gtk_default_insensitive_fg = { 0, 0x7530, 0x7530, 0x7530 };
|
|
|
|
|
|
|
|
static GdkColor gtk_default_normal_bg = { 0, 0xd6d6, 0xd6d6, 0xd6d6 };
|
|
|
|
static GdkColor gtk_default_active_bg = { 0, 0xc350, 0xc350, 0xc350 };
|
|
|
|
static GdkColor gtk_default_prelight_bg = { 0, 0xea60, 0xea60, 0xea60 };
|
|
|
|
static GdkColor gtk_default_selected_bg = { 0, 0, 0, 0x9c40 };
|
|
|
|
static GdkColor gtk_default_insensitive_bg = { 0, 0xd6d6, 0xd6d6, 0xd6d6 };
|
|
|
|
|
1998-02-27 16:31:06 +00:00
|
|
|
GtkStyle*
|
1999-01-15 18:41:43 +00:00
|
|
|
gtk_style_copy (GtkStyle *style)
|
1998-02-27 16:31:06 +00:00
|
|
|
{
|
|
|
|
GtkStyle *new_style;
|
|
|
|
guint i;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-02-27 16:31:06 +00:00
|
|
|
g_return_val_if_fail (style != NULL, NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-02-27 16:31:06 +00:00
|
|
|
new_style = gtk_style_new ();
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-02-27 16:31:06 +00:00
|
|
|
for (i = 0; i < 5; i++)
|
|
|
|
{
|
|
|
|
new_style->fg[i] = style->fg[i];
|
|
|
|
new_style->bg[i] = style->bg[i];
|
|
|
|
new_style->text[i] = style->text[i];
|
|
|
|
new_style->base[i] = style->base[i];
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-02-27 16:31:06 +00:00
|
|
|
new_style->bg_pixmap[i] = style->bg_pixmap[i];
|
|
|
|
}
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-03-10 01:15:03 +00:00
|
|
|
gdk_font_unref (new_style->font);
|
1998-02-27 16:31:06 +00:00
|
|
|
new_style->font = style->font;
|
|
|
|
gdk_font_ref (new_style->font);
|
1999-03-17 03:42:22 +00:00
|
|
|
|
|
|
|
if (style->rc_style)
|
|
|
|
{
|
|
|
|
new_style->rc_style = style->rc_style;
|
|
|
|
gtk_rc_style_ref (style->rc_style);
|
|
|
|
}
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-03-17 03:42:22 +00:00
|
|
|
if (style->engine)
|
|
|
|
{
|
|
|
|
new_style->engine = style->engine;
|
|
|
|
gtk_theme_engine_ref(new_style->engine);
|
|
|
|
new_style->engine->duplicate_style (new_style, style);
|
|
|
|
}
|
|
|
|
|
1998-02-27 16:31:06 +00:00
|
|
|
return new_style;
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
static GtkStyle*
|
1999-01-15 18:41:43 +00:00
|
|
|
gtk_style_duplicate (GtkStyle *style)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
|
|
|
GtkStyle *new_style;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
g_return_val_if_fail (style != NULL, NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
new_style = gtk_style_copy (style);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
style->styles = g_slist_append (style->styles, new_style);
|
|
|
|
new_style->styles = style->styles;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
return new_style;
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
GtkStyle*
|
1998-05-03 22:41:32 +00:00
|
|
|
gtk_style_new (void)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
GtkStyle *style;
|
|
|
|
gint i;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-01-30 23:47:09 +00:00
|
|
|
style = g_new0 (GtkStyle, 1);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (!default_font)
|
1999-02-10 00:21:09 +00:00
|
|
|
{
|
|
|
|
default_font =
|
|
|
|
gdk_font_load ("-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*");
|
|
|
|
if (!default_font)
|
|
|
|
default_font = gdk_font_load ("fixed");
|
|
|
|
if (!default_font)
|
|
|
|
g_error ("Unable to load default font.");
|
|
|
|
}
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
style->font = default_font;
|
|
|
|
gdk_font_ref (style->font);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-12-18 02:17:14 +00:00
|
|
|
style->ref_count = 1;
|
1997-11-24 22:37:52 +00:00
|
|
|
style->attach_count = 0;
|
|
|
|
style->colormap = NULL;
|
|
|
|
style->depth = -1;
|
|
|
|
style->klass = &default_class;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
style->black.red = 0;
|
|
|
|
style->black.green = 0;
|
|
|
|
style->black.blue = 0;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
style->white.red = 65535;
|
|
|
|
style->white.green = 65535;
|
|
|
|
style->white.blue = 65535;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
style->black_gc = NULL;
|
|
|
|
style->white_gc = NULL;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
style->fg[GTK_STATE_NORMAL] = gtk_default_normal_fg;
|
|
|
|
style->fg[GTK_STATE_ACTIVE] = gtk_default_active_fg;
|
|
|
|
style->fg[GTK_STATE_PRELIGHT] = gtk_default_prelight_fg;
|
|
|
|
style->fg[GTK_STATE_SELECTED] = gtk_default_selected_fg;
|
|
|
|
style->fg[GTK_STATE_INSENSITIVE] = gtk_default_insensitive_fg;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
style->bg[GTK_STATE_NORMAL] = gtk_default_normal_bg;
|
|
|
|
style->bg[GTK_STATE_ACTIVE] = gtk_default_active_bg;
|
|
|
|
style->bg[GTK_STATE_PRELIGHT] = gtk_default_prelight_bg;
|
|
|
|
style->bg[GTK_STATE_SELECTED] = gtk_default_selected_bg;
|
|
|
|
style->bg[GTK_STATE_INSENSITIVE] = gtk_default_insensitive_bg;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
new function gtk_container_child_arg_set, similar to
Wed Jun 24 14:14:32 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
to gtk_container_child_arg_setv, but takes a variable argument list.
new function gtk_container_get_child_arg_type, which is needed by
gtk_object_collect_args.
* gtk/gtkobject.c: changed prototype for gtk_object_collect_args, to
take a function pointer to figure the argument type.
adapted callers to pass gtk_object_get_arg_type.
* gtk/gtkwidget.c: adapted gtk_object_collect_args callers to pass
gtk_object_get_arg_type..
* gtk/gtkpacker.h:
* gtk/gtkpacker.c:
(gtk_packer_reorder_child): new function to change the packing order
of a child.
(gtk_packer_size_request):
(gtk_packer_size_allocate): take container->border_width into acount.
* gtk/gtkpacker.c: implemented widget arguments:
"GtkPacker::spacing", "GtkPacker::border_width", "GtkPacker::pad_x",
"GtkPacker::pad_y", "GtkPacker::ipad_x", "GtkPacker::ipad_y".
implemented child arguments:
"GtkPacker::side", "GtkPacker::anchor", "GtkPacker::expand",
"GtkPacker::fill_x", "GtkPacker::fill_y", "GtkPacker::use_default",
"GtkPacker::border_width", "GtkPacker::pad_x", "GtkPacker::pad_y",
"GtkPacker::ipad_x", "GtkPacker::ipad_y", "GtkPacker::position".
* gtk/gtkmisc.c (gtk_misc_set_arg): for padding args, set the padding,
not the alignment.
* gtk/gtkeventbox.h:
* gtk/gtkeventbox.c: GtkType and macro fixups.
* gtk/testgtk.c (entry_toggle_sensitive): new function to toggle
sensitivity of an entry.
* gtk/gtkstyle.c (gtk_style_new): support normal grey as default color
for insensitive base.
* gtk/gtkentry.c (gtk_entry_realize): set the window backgrounds
widget state dependent.
(gtk_entry_style_set): likewise.
(gtk_entry_state_changed): set background color on state changes.
(gtk_entry_draw_text): for non selected text, use state dependent
colors.
* gtk/gtktogglebutton.c: support for widget arguments
"GtkToggleButton::active" and "GtkToggleButton::draw_indicator".
1998-06-24 12:22:23 +00:00
|
|
|
for (i = 0; i < 4; i++)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
style->text[i] = style->fg[i];
|
|
|
|
style->base[i] = style->white;
|
|
|
|
}
|
1999-01-11 18:49:54 +00:00
|
|
|
|
new function gtk_container_child_arg_set, similar to
Wed Jun 24 14:14:32 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
to gtk_container_child_arg_setv, but takes a variable argument list.
new function gtk_container_get_child_arg_type, which is needed by
gtk_object_collect_args.
* gtk/gtkobject.c: changed prototype for gtk_object_collect_args, to
take a function pointer to figure the argument type.
adapted callers to pass gtk_object_get_arg_type.
* gtk/gtkwidget.c: adapted gtk_object_collect_args callers to pass
gtk_object_get_arg_type..
* gtk/gtkpacker.h:
* gtk/gtkpacker.c:
(gtk_packer_reorder_child): new function to change the packing order
of a child.
(gtk_packer_size_request):
(gtk_packer_size_allocate): take container->border_width into acount.
* gtk/gtkpacker.c: implemented widget arguments:
"GtkPacker::spacing", "GtkPacker::border_width", "GtkPacker::pad_x",
"GtkPacker::pad_y", "GtkPacker::ipad_x", "GtkPacker::ipad_y".
implemented child arguments:
"GtkPacker::side", "GtkPacker::anchor", "GtkPacker::expand",
"GtkPacker::fill_x", "GtkPacker::fill_y", "GtkPacker::use_default",
"GtkPacker::border_width", "GtkPacker::pad_x", "GtkPacker::pad_y",
"GtkPacker::ipad_x", "GtkPacker::ipad_y", "GtkPacker::position".
* gtk/gtkmisc.c (gtk_misc_set_arg): for padding args, set the padding,
not the alignment.
* gtk/gtkeventbox.h:
* gtk/gtkeventbox.c: GtkType and macro fixups.
* gtk/testgtk.c (entry_toggle_sensitive): new function to toggle
sensitivity of an entry.
* gtk/gtkstyle.c (gtk_style_new): support normal grey as default color
for insensitive base.
* gtk/gtkentry.c (gtk_entry_realize): set the window backgrounds
widget state dependent.
(gtk_entry_style_set): likewise.
(gtk_entry_state_changed): set background color on state changes.
(gtk_entry_draw_text): for non selected text, use state dependent
colors.
* gtk/gtktogglebutton.c: support for widget arguments
"GtkToggleButton::active" and "GtkToggleButton::draw_indicator".
1998-06-24 12:22:23 +00:00
|
|
|
style->base[GTK_STATE_INSENSITIVE] = gtk_default_insensitive_bg;
|
|
|
|
style->text[GTK_STATE_INSENSITIVE] = gtk_default_insensitive_bg;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
for (i = 0; i < 5; i++)
|
|
|
|
style->bg_pixmap[i] = NULL;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
style->engine = NULL;
|
|
|
|
style->engine_data = NULL;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
style->rc_style = NULL;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
for (i = 0; i < 5; i++)
|
|
|
|
{
|
|
|
|
style->fg_gc[i] = NULL;
|
|
|
|
style->bg_gc[i] = NULL;
|
|
|
|
style->light_gc[i] = NULL;
|
|
|
|
style->dark_gc[i] = NULL;
|
|
|
|
style->mid_gc[i] = NULL;
|
|
|
|
style->text_gc[i] = NULL;
|
|
|
|
style->base_gc[i] = NULL;
|
|
|
|
}
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return style;
|
|
|
|
}
|
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
GtkStyle*
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_style_attach (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-11-06 22:05:02 +00:00
|
|
|
GSList *styles;
|
|
|
|
GtkStyle *new_style = NULL;
|
1997-11-24 22:37:52 +00:00
|
|
|
GdkColormap *colormap;
|
|
|
|
gint depth;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_val_if_fail (style != NULL, NULL);
|
|
|
|
g_return_val_if_fail (window != NULL, NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
colormap = gdk_window_get_colormap (window);
|
1998-05-01 04:23:59 +00:00
|
|
|
depth = gdk_window_get_visual (window)->depth;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
if (!style->styles)
|
|
|
|
style->styles = g_slist_append (NULL, style);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
styles = style->styles;
|
|
|
|
while (styles)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-11-06 22:05:02 +00:00
|
|
|
new_style = styles->data;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
if (new_style->attach_count == 0)
|
1999-01-15 18:41:43 +00:00
|
|
|
{
|
|
|
|
gtk_style_init (new_style, colormap, depth);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if (new_style->colormap == colormap &&
|
|
|
|
new_style->depth == depth)
|
|
|
|
break;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
new_style = NULL;
|
|
|
|
styles = styles->next;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
if (!new_style)
|
|
|
|
{
|
|
|
|
new_style = gtk_style_duplicate (style);
|
|
|
|
gtk_style_init (new_style, colormap, depth);
|
|
|
|
}
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
if (new_style->attach_count == 0)
|
|
|
|
gtk_style_ref (new_style);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
new_style->attach_count++;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
return new_style;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_style_detach (GtkStyle *style)
|
|
|
|
{
|
|
|
|
gint i;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_if_fail (style != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
style->attach_count -= 1;
|
|
|
|
if (style->attach_count == 0)
|
|
|
|
{
|
1998-11-06 22:05:02 +00:00
|
|
|
if (style->engine)
|
1999-01-15 18:41:43 +00:00
|
|
|
style->engine->unrealize_style (style);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_gc_release (style->black_gc);
|
|
|
|
gtk_gc_release (style->white_gc);
|
1998-11-06 22:05:02 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
for (i = 0; i < 5; i++)
|
1999-01-15 18:41:43 +00:00
|
|
|
{
|
|
|
|
gtk_gc_release (style->fg_gc[i]);
|
|
|
|
gtk_gc_release (style->bg_gc[i]);
|
|
|
|
gtk_gc_release (style->light_gc[i]);
|
|
|
|
gtk_gc_release (style->dark_gc[i]);
|
|
|
|
gtk_gc_release (style->mid_gc[i]);
|
|
|
|
gtk_gc_release (style->text_gc[i]);
|
|
|
|
gtk_gc_release (style->base_gc[i]);
|
|
|
|
}
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
gtk_style_unref (style);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GtkStyle*
|
|
|
|
gtk_style_ref (GtkStyle *style)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (style != NULL, NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
style->ref_count += 1;
|
|
|
|
return style;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_style_unref (GtkStyle *style)
|
|
|
|
{
|
|
|
|
g_return_if_fail (style != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
style->ref_count -= 1;
|
|
|
|
if (style->ref_count == 0)
|
|
|
|
gtk_style_destroy (style);
|
|
|
|
}
|
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
static void
|
1999-01-15 18:41:43 +00:00
|
|
|
gtk_style_init (GtkStyle *style,
|
|
|
|
GdkColormap *colormap,
|
|
|
|
gint depth)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
|
|
|
GdkGCValues gc_values;
|
|
|
|
GdkGCValuesMask gc_values_mask;
|
|
|
|
gint i;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
g_return_if_fail (style != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
style->colormap = colormap;
|
|
|
|
style->depth = depth;
|
|
|
|
|
|
|
|
for (i = 0; i < 5; i++)
|
|
|
|
{
|
|
|
|
gtk_style_shade (&style->bg[i], &style->light[i], LIGHTNESS_MULT);
|
|
|
|
gtk_style_shade (&style->bg[i], &style->dark[i], DARKNESS_MULT);
|
|
|
|
|
|
|
|
style->mid[i].red = (style->light[i].red + style->dark[i].red) / 2;
|
|
|
|
style->mid[i].green = (style->light[i].green + style->dark[i].green) / 2;
|
|
|
|
style->mid[i].blue = (style->light[i].blue + style->dark[i].blue) / 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
gdk_color_black (colormap, &style->black);
|
|
|
|
gdk_color_white (colormap, &style->white);
|
|
|
|
|
|
|
|
gc_values_mask = GDK_GC_FOREGROUND | GDK_GC_FONT;
|
|
|
|
if (style->font->type == GDK_FONT_FONT)
|
|
|
|
{
|
|
|
|
gc_values.font = style->font;
|
|
|
|
}
|
|
|
|
else if (style->font->type == GDK_FONT_FONTSET)
|
|
|
|
{
|
|
|
|
gc_values.font = default_font;
|
|
|
|
}
|
|
|
|
|
|
|
|
gc_values.foreground = style->black;
|
|
|
|
style->black_gc = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
|
|
|
|
|
|
|
|
gc_values.foreground = style->white;
|
|
|
|
style->white_gc = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
|
|
|
|
|
|
|
|
for (i = 0; i < 5; i++)
|
|
|
|
{
|
|
|
|
if (style->rc_style && style->rc_style->bg_pixmap_name[i])
|
1999-01-15 18:41:43 +00:00
|
|
|
style->bg_pixmap[i] = gtk_rc_load_image (style->colormap,
|
|
|
|
&style->bg[i],
|
|
|
|
style->rc_style->bg_pixmap_name[i]);
|
1998-11-06 22:05:02 +00:00
|
|
|
|
|
|
|
if (!gdk_color_alloc (colormap, &style->fg[i]))
|
1999-01-15 18:41:43 +00:00
|
|
|
g_warning ("unable to allocate color: ( %d %d %d )",
|
|
|
|
style->fg[i].red, style->fg[i].green, style->fg[i].blue);
|
1998-11-06 22:05:02 +00:00
|
|
|
if (!gdk_color_alloc (colormap, &style->bg[i]))
|
1999-01-15 18:41:43 +00:00
|
|
|
g_warning ("unable to allocate color: ( %d %d %d )",
|
|
|
|
style->bg[i].red, style->bg[i].green, style->bg[i].blue);
|
1998-11-06 22:05:02 +00:00
|
|
|
if (!gdk_color_alloc (colormap, &style->light[i]))
|
1999-01-15 18:41:43 +00:00
|
|
|
g_warning ("unable to allocate color: ( %d %d %d )",
|
|
|
|
style->light[i].red, style->light[i].green, style->light[i].blue);
|
1998-11-06 22:05:02 +00:00
|
|
|
if (!gdk_color_alloc (colormap, &style->dark[i]))
|
1999-01-15 18:41:43 +00:00
|
|
|
g_warning ("unable to allocate color: ( %d %d %d )",
|
|
|
|
style->dark[i].red, style->dark[i].green, style->dark[i].blue);
|
1998-11-06 22:05:02 +00:00
|
|
|
if (!gdk_color_alloc (colormap, &style->mid[i]))
|
1999-01-15 18:41:43 +00:00
|
|
|
g_warning ("unable to allocate color: ( %d %d %d )",
|
|
|
|
style->mid[i].red, style->mid[i].green, style->mid[i].blue);
|
1998-11-06 22:05:02 +00:00
|
|
|
if (!gdk_color_alloc (colormap, &style->text[i]))
|
1999-01-15 18:41:43 +00:00
|
|
|
g_warning ("unable to allocate color: ( %d %d %d )",
|
|
|
|
style->text[i].red, style->text[i].green, style->text[i].blue);
|
1998-11-06 22:05:02 +00:00
|
|
|
if (!gdk_color_alloc (colormap, &style->base[i]))
|
1999-01-15 18:41:43 +00:00
|
|
|
g_warning ("unable to allocate color: ( %d %d %d )",
|
|
|
|
style->base[i].red, style->base[i].green, style->base[i].blue);
|
1998-11-06 22:05:02 +00:00
|
|
|
|
|
|
|
gc_values.foreground = style->fg[i];
|
|
|
|
style->fg_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
|
|
|
|
|
|
|
|
gc_values.foreground = style->bg[i];
|
|
|
|
style->bg_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
|
|
|
|
|
|
|
|
gc_values.foreground = style->light[i];
|
|
|
|
style->light_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
|
|
|
|
|
|
|
|
gc_values.foreground = style->dark[i];
|
|
|
|
style->dark_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
|
|
|
|
|
|
|
|
gc_values.foreground = style->mid[i];
|
|
|
|
style->mid_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
|
|
|
|
|
|
|
|
gc_values.foreground = style->text[i];
|
|
|
|
style->text_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
gc_values.foreground = style->base[i];
|
|
|
|
style->base_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
|
|
|
|
}
|
1999-01-15 18:41:43 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
if (style->engine)
|
|
|
|
style->engine->realize_style (style);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_style_destroy (GtkStyle *style)
|
|
|
|
{
|
|
|
|
g_return_if_fail (style->attach_count == 0);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
if (style->styles)
|
|
|
|
{
|
|
|
|
if (style->styles->data != style)
|
1999-01-15 18:41:43 +00:00
|
|
|
g_slist_remove (style->styles, style);
|
1998-11-06 22:05:02 +00:00
|
|
|
else
|
1999-01-15 18:41:43 +00:00
|
|
|
{
|
|
|
|
GSList *tmp_list = style->styles->next;
|
|
|
|
|
|
|
|
while (tmp_list)
|
|
|
|
{
|
|
|
|
((GtkStyle*) tmp_list->data)->styles = style->styles->next;
|
|
|
|
tmp_list = tmp_list->next;
|
|
|
|
}
|
|
|
|
g_slist_free_1 (style->styles);
|
|
|
|
}
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
if (style->engine)
|
|
|
|
{
|
|
|
|
style->engine->destroy_style (style);
|
|
|
|
gtk_theme_engine_unref (style->engine);
|
|
|
|
}
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
gdk_font_unref (style->font);
|
|
|
|
if (style->rc_style)
|
|
|
|
gtk_rc_style_unref (style->rc_style);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
g_free (style);
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
void
|
|
|
|
gtk_draw_hline (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
gint x1,
|
|
|
|
gint x2,
|
|
|
|
gint y)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_hline != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_hline (style, window, state_type, NULL, NULL, NULL, x1, x2, y);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_draw_vline (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
gint y1,
|
|
|
|
gint y2,
|
|
|
|
gint x)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_vline != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_vline (style, window, state_type, NULL, NULL, NULL, y1, y2, x);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_draw_shadow (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_shadow != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_shadow (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_draw_polygon (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkPoint *points,
|
|
|
|
gint npoints,
|
|
|
|
gboolean fill)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
1999-01-15 18:41:43 +00:00
|
|
|
g_return_if_fail (style->klass->draw_polygon != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_polygon (style, window, state_type, shadow_type, NULL, NULL, NULL, points, npoints, fill);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_draw_arrow (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GtkArrowType arrow_type,
|
|
|
|
gboolean fill,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_arrow != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_arrow (style, window, state_type, shadow_type, NULL, NULL, NULL, arrow_type, fill, x, y, width, height);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_draw_diamond (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_diamond != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_diamond (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_draw_oval (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_oval != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_oval (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_draw_string (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
const gchar *string)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
1999-01-15 18:41:43 +00:00
|
|
|
g_return_if_fail (style->klass->draw_string != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_string (style, window, state_type, NULL, NULL, NULL, x, y, string);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
void
|
|
|
|
gtk_draw_box (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1999-01-11 18:49:54 +00:00
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_box != NULL);
|
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_box (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
void
|
|
|
|
gtk_draw_flat_box (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1999-01-11 18:49:54 +00:00
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_flat_box != NULL);
|
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_flat_box (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
void
|
1999-01-15 18:41:43 +00:00
|
|
|
gtk_draw_check (GtkStyle *style,
|
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1999-01-11 18:49:54 +00:00
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_check != NULL);
|
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_check (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
void
|
1999-01-15 18:41:43 +00:00
|
|
|
gtk_draw_option (GtkStyle *style,
|
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1999-01-11 18:49:54 +00:00
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_option != NULL);
|
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_option (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
void
|
1999-01-15 18:41:43 +00:00
|
|
|
gtk_draw_cross (GtkStyle *style,
|
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1999-01-11 18:49:54 +00:00
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_cross != NULL);
|
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_cross (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
void
|
1999-01-15 18:41:43 +00:00
|
|
|
gtk_draw_ramp (GtkStyle *style,
|
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GtkArrowType arrow_type,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
1999-01-11 18:49:54 +00:00
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_ramp != NULL);
|
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_ramp (style, window, state_type, shadow_type, NULL, NULL, NULL, arrow_type, x, y, width, height);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
void
|
1999-01-15 18:41:43 +00:00
|
|
|
gtk_draw_tab (GtkStyle *style,
|
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1999-01-11 18:49:54 +00:00
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_tab != NULL);
|
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_tab (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
void
|
|
|
|
gtk_draw_shadow_gap (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GtkPositionType gap_side,
|
|
|
|
gint gap_x,
|
|
|
|
gint gap_width)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
1999-01-11 18:49:54 +00:00
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_shadow_gap != NULL);
|
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_shadow_gap (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, gap_side, gap_x, gap_width);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
void
|
|
|
|
gtk_draw_box_gap (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GtkPositionType gap_side,
|
|
|
|
gint gap_x,
|
|
|
|
gint gap_width)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1999-01-11 18:49:54 +00:00
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_box_gap != NULL);
|
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_box_gap (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, gap_side, gap_x, gap_width);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
void
|
|
|
|
gtk_draw_extension (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GtkPositionType gap_side)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
1999-01-11 18:49:54 +00:00
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_extension != NULL);
|
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_extension (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, gap_side);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
void
|
1999-01-15 18:41:43 +00:00
|
|
|
gtk_draw_focus (GtkStyle *style,
|
|
|
|
GdkWindow *window,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1999-01-11 18:49:54 +00:00
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_focus != NULL);
|
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_focus (style, window, NULL, NULL, NULL, x, y, width, height);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
void
|
1999-01-15 18:41:43 +00:00
|
|
|
gtk_draw_slider (GtkStyle *style,
|
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GtkOrientation orientation)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1999-01-11 18:49:54 +00:00
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_slider != NULL);
|
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_slider (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, orientation);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
void
|
1999-01-15 18:41:43 +00:00
|
|
|
gtk_draw_handle (GtkStyle *style,
|
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GtkOrientation orientation)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1999-01-11 18:49:54 +00:00
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_handle != NULL);
|
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_handle (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, orientation);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1999-01-12 15:12:14 +00:00
|
|
|
void
|
1999-01-15 18:41:43 +00:00
|
|
|
gtk_style_set_background (GtkStyle *style,
|
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type)
|
1999-01-12 15:12:14 +00:00
|
|
|
{
|
|
|
|
GdkPixmap *pixmap;
|
|
|
|
gint parent_relative;
|
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
|
1999-01-12 15:12:14 +00:00
|
|
|
if (style->engine && style->engine->set_background)
|
|
|
|
{
|
1999-01-15 18:41:43 +00:00
|
|
|
style->engine->set_background (style, window, state_type);
|
|
|
|
|
1999-01-12 15:12:14 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (style->bg_pixmap[state_type])
|
|
|
|
{
|
|
|
|
if (style->bg_pixmap[state_type] == (GdkPixmap*) GDK_PARENT_RELATIVE)
|
1999-01-15 18:41:43 +00:00
|
|
|
{
|
|
|
|
pixmap = NULL;
|
|
|
|
parent_relative = TRUE;
|
|
|
|
}
|
1999-01-12 15:12:14 +00:00
|
|
|
else
|
1999-01-15 18:41:43 +00:00
|
|
|
{
|
|
|
|
pixmap = style->bg_pixmap[state_type];
|
|
|
|
parent_relative = FALSE;
|
|
|
|
}
|
1999-01-12 15:12:14 +00:00
|
|
|
|
|
|
|
gdk_window_set_back_pixmap (window, pixmap, parent_relative);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
gdk_window_set_background (window, &style->bg[state_type]);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
/* Default functions */
|
|
|
|
void
|
1999-01-12 15:12:14 +00:00
|
|
|
gtk_style_apply_default_background (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
gboolean set_bg,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-11-06 22:05:02 +00:00
|
|
|
GdkRectangle new_rect, old_rect;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-15 15:54:39 +00:00
|
|
|
if (area)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-11-06 22:05:02 +00:00
|
|
|
old_rect.x = x;
|
|
|
|
old_rect.y = y;
|
|
|
|
old_rect.width = width;
|
|
|
|
old_rect.height = height;
|
|
|
|
|
1999-01-15 15:54:39 +00:00
|
|
|
if (!gdk_rectangle_intersect (area, &old_rect, &new_rect))
|
1999-01-15 18:41:43 +00:00
|
|
|
return;
|
1999-01-15 15:54:39 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
new_rect.x = x;
|
|
|
|
new_rect.y = y;
|
|
|
|
new_rect.width = width;
|
|
|
|
new_rect.height = height;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!style->bg_pixmap[state_type] ||
|
1999-01-15 18:41:43 +00:00
|
|
|
gdk_window_get_type (window) == GDK_WINDOW_PIXMAP ||
|
|
|
|
(!set_bg && style->bg_pixmap[state_type] != (GdkPixmap*) GDK_PARENT_RELATIVE))
|
1999-01-15 15:54:39 +00:00
|
|
|
{
|
|
|
|
GdkGC *gc = style->bg_gc[state_type];
|
1999-01-15 18:41:43 +00:00
|
|
|
|
1999-01-15 15:54:39 +00:00
|
|
|
if (style->bg_pixmap[state_type])
|
1999-01-15 18:41:43 +00:00
|
|
|
{
|
|
|
|
gdk_gc_set_fill (gc, GDK_TILED);
|
|
|
|
gdk_gc_set_tile (gc, style->bg_pixmap[state_type]);
|
|
|
|
}
|
|
|
|
|
1999-01-15 15:54:39 +00:00
|
|
|
gdk_draw_rectangle (window, gc, TRUE,
|
1999-01-15 18:41:43 +00:00
|
|
|
new_rect.x, new_rect.y, new_rect.width, new_rect.height);
|
1999-01-15 15:54:39 +00:00
|
|
|
if (style->bg_pixmap[state_type])
|
1999-01-15 18:41:43 +00:00
|
|
|
gdk_gc_set_fill (gc, GDK_SOLID);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
1999-01-15 15:54:39 +00:00
|
|
|
else
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
1999-01-15 15:54:39 +00:00
|
|
|
if (set_bg)
|
1999-01-15 18:41:43 +00:00
|
|
|
{
|
|
|
|
if (style->bg_pixmap[state_type] == (GdkPixmap*) GDK_PARENT_RELATIVE)
|
|
|
|
gdk_window_set_back_pixmap (window, NULL, TRUE);
|
|
|
|
else
|
|
|
|
gdk_window_set_back_pixmap (window, style->bg_pixmap[state_type], FALSE);
|
|
|
|
}
|
1998-11-06 22:05:02 +00:00
|
|
|
|
1999-01-15 15:54:39 +00:00
|
|
|
gdk_window_clear_area (window,
|
1999-01-15 18:41:43 +00:00
|
|
|
new_rect.x, new_rect.y,
|
|
|
|
new_rect.width, new_rect.height);
|
1999-01-12 15:12:14 +00:00
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_default_draw_hline (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x1,
|
|
|
|
gint x2,
|
|
|
|
gint y)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1999-01-11 18:49:54 +00:00
|
|
|
gint thickness_light;
|
|
|
|
gint thickness_dark;
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
|
|
|
|
thickness_light = style->klass->ythickness / 2;
|
|
|
|
thickness_dark = style->klass->ythickness - thickness_light;
|
|
|
|
|
|
|
|
if (area)
|
|
|
|
{
|
|
|
|
gdk_gc_set_clip_rectangle (style->light_gc[state_type], area);
|
|
|
|
gdk_gc_set_clip_rectangle (style->dark_gc[state_type], area);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (detail && !strcmp (detail, "label"))
|
|
|
|
{
|
|
|
|
if (state_type == GTK_STATE_INSENSITIVE)
|
1999-01-15 18:41:43 +00:00
|
|
|
gdk_draw_line (window, style->white_gc, x1 + 1, y + 1, x2 + 1, y + 1);
|
1999-01-11 18:49:54 +00:00
|
|
|
gdk_draw_line (window, style->fg_gc[state_type], x1, y, x2, y);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (i = 0; i < thickness_dark; i++)
|
1999-01-15 18:41:43 +00:00
|
|
|
{
|
|
|
|
gdk_draw_line (window, style->light_gc[state_type], x2 - i - 1, y + i, x2, y + i);
|
|
|
|
gdk_draw_line (window, style->dark_gc[state_type], x1, y + i, x2 - i - 1, y + i);
|
|
|
|
}
|
1999-01-11 18:49:54 +00:00
|
|
|
|
|
|
|
y += thickness_dark;
|
|
|
|
for (i = 0; i < thickness_light; i++)
|
1999-01-15 18:41:43 +00:00
|
|
|
{
|
|
|
|
gdk_draw_line (window, style->dark_gc[state_type], x1, y + i, x1 + thickness_light - i - 1, y + i);
|
|
|
|
gdk_draw_line (window, style->light_gc[state_type], x1 + thickness_light - i - 1, y + i, x2, y + i);
|
|
|
|
}
|
1999-01-11 18:49:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (area)
|
|
|
|
{
|
|
|
|
gdk_gc_set_clip_rectangle (style->light_gc[state_type], NULL);
|
|
|
|
gdk_gc_set_clip_rectangle (style->dark_gc[state_type], NULL);
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_default_draw_vline (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint y1,
|
|
|
|
gint y2,
|
|
|
|
gint x)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1999-01-11 18:49:54 +00:00
|
|
|
gint thickness_light;
|
|
|
|
gint thickness_dark;
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
|
|
|
|
thickness_light = style->klass->xthickness / 2;
|
|
|
|
thickness_dark = style->klass->xthickness - thickness_light;
|
|
|
|
|
|
|
|
if (area)
|
|
|
|
{
|
|
|
|
gdk_gc_set_clip_rectangle (style->light_gc[state_type], area);
|
|
|
|
gdk_gc_set_clip_rectangle (style->dark_gc[state_type], area);
|
|
|
|
}
|
|
|
|
for (i = 0; i < thickness_dark; i++)
|
|
|
|
{
|
|
|
|
gdk_draw_line (window, style->light_gc[state_type], x + i, y2 - i - 1, x + i, y2);
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_draw_line (window, style->dark_gc[state_type], x + i, y1, x + i, y2 - i - 1);
|
1999-01-11 18:49:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
x += thickness_dark;
|
|
|
|
for (i = 0; i < thickness_light; i++)
|
|
|
|
{
|
|
|
|
gdk_draw_line (window, style->dark_gc[state_type], x + i, y1, x + i, y1 + thickness_light - i);
|
|
|
|
gdk_draw_line (window, style->light_gc[state_type], x + i, y1 + thickness_light - i, x + i, y2);
|
|
|
|
}
|
|
|
|
if (area)
|
|
|
|
{
|
|
|
|
gdk_gc_set_clip_rectangle (style->light_gc[state_type], NULL);
|
|
|
|
gdk_gc_set_clip_rectangle (style->dark_gc[state_type], NULL);
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_default_draw_shadow (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-11-06 22:05:02 +00:00
|
|
|
GdkGC *gc1 = NULL;
|
|
|
|
GdkGC *gc2 = NULL;
|
1997-11-24 22:37:52 +00:00
|
|
|
gint thickness_light;
|
|
|
|
gint thickness_dark;
|
|
|
|
gint i;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (window != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if ((width == -1) && (height == -1))
|
|
|
|
gdk_window_get_size (window, &width, &height);
|
|
|
|
else if (width == -1)
|
|
|
|
gdk_window_get_size (window, &width, NULL);
|
|
|
|
else if (height == -1)
|
|
|
|
gdk_window_get_size (window, NULL, &height);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
switch (shadow_type)
|
|
|
|
{
|
|
|
|
case GTK_SHADOW_NONE:
|
1998-11-06 22:05:02 +00:00
|
|
|
return;
|
1997-11-24 22:37:52 +00:00
|
|
|
case GTK_SHADOW_IN:
|
|
|
|
case GTK_SHADOW_ETCHED_IN:
|
|
|
|
gc1 = style->light_gc[state_type];
|
|
|
|
gc2 = style->dark_gc[state_type];
|
|
|
|
break;
|
|
|
|
case GTK_SHADOW_OUT:
|
|
|
|
case GTK_SHADOW_ETCHED_OUT:
|
|
|
|
gc1 = style->dark_gc[state_type];
|
|
|
|
gc2 = style->light_gc[state_type];
|
|
|
|
break;
|
|
|
|
}
|
1999-01-11 18:49:54 +00:00
|
|
|
|
|
|
|
if (area)
|
|
|
|
{
|
|
|
|
gdk_gc_set_clip_rectangle (gc1, area);
|
|
|
|
gdk_gc_set_clip_rectangle (gc2, area);
|
|
|
|
if (shadow_type == GTK_SHADOW_IN ||
|
1999-01-15 18:41:43 +00:00
|
|
|
shadow_type == GTK_SHADOW_OUT)
|
|
|
|
{
|
|
|
|
gdk_gc_set_clip_rectangle (style->black_gc, area);
|
|
|
|
gdk_gc_set_clip_rectangle (style->bg_gc[state_type], area);
|
|
|
|
}
|
1999-01-11 18:49:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (shadow_type)
|
|
|
|
{
|
1997-11-24 22:37:52 +00:00
|
|
|
case GTK_SHADOW_NONE:
|
|
|
|
break;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
case GTK_SHADOW_IN:
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x, y + height - 1, x + width - 1, y + height - 1);
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x + width - 1, y, x + width - 1, y + height - 1);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_draw_line (window, style->bg_gc[state_type],
|
|
|
|
x + 1, y + height - 2, x + width - 2, y + height - 2);
|
|
|
|
gdk_draw_line (window, style->bg_gc[state_type],
|
|
|
|
x + width - 2, y + 1, x + width - 2, y + height - 2);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_draw_line (window, style->black_gc,
|
|
|
|
x + 1, y + 1, x + width - 2, y + 1);
|
|
|
|
gdk_draw_line (window, style->black_gc,
|
|
|
|
x + 1, y + 1, x + 1, y + height - 2);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x, y, x + width - 1, y);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x, y, x, y + height - 1);
|
|
|
|
break;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
case GTK_SHADOW_OUT:
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x + 1, y + height - 2, x + width - 2, y + height - 2);
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x + width - 2, y + 1, x + width - 2, y + height - 2);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x, y, x + width - 1, y);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x, y, x, y + height - 1);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_draw_line (window, style->bg_gc[state_type],
|
|
|
|
x + 1, y + 1, x + width - 2, y + 1);
|
|
|
|
gdk_draw_line (window, style->bg_gc[state_type],
|
|
|
|
x + 1, y + 1, x + 1, y + height - 2);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_draw_line (window, style->black_gc,
|
|
|
|
x, y + height - 1, x + width - 1, y + height - 1);
|
|
|
|
gdk_draw_line (window, style->black_gc,
|
|
|
|
x + width - 1, y, x + width - 1, y + height - 1);
|
|
|
|
break;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
case GTK_SHADOW_ETCHED_IN:
|
|
|
|
case GTK_SHADOW_ETCHED_OUT:
|
|
|
|
thickness_light = 1;
|
|
|
|
thickness_dark = 1;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
for (i = 0; i < thickness_dark; i++)
|
|
|
|
{
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x + i,
|
|
|
|
y + height - i - 1,
|
|
|
|
x + width - i - 1,
|
|
|
|
y + height - i - 1);
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x + width - i - 1,
|
|
|
|
y + i,
|
|
|
|
x + width - i - 1,
|
|
|
|
y + height - i - 1);
|
1999-01-15 18:41:43 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + i,
|
|
|
|
y + i,
|
|
|
|
x + width - i - 2,
|
|
|
|
y + i);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + i,
|
|
|
|
y + i,
|
|
|
|
x + i,
|
|
|
|
y + height - i - 2);
|
|
|
|
}
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
for (i = 0; i < thickness_light; i++)
|
|
|
|
{
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x + thickness_dark + i,
|
|
|
|
y + thickness_dark + i,
|
|
|
|
x + width - thickness_dark - i - 1,
|
|
|
|
y + thickness_dark + i);
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x + thickness_dark + i,
|
|
|
|
y + thickness_dark + i,
|
|
|
|
x + thickness_dark + i,
|
|
|
|
y + height - thickness_dark - i - 1);
|
1999-01-15 18:41:43 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + thickness_dark + i,
|
|
|
|
y + height - thickness_light - i - 1,
|
|
|
|
x + width - thickness_light - 1,
|
|
|
|
y + height - thickness_light - i - 1);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + width - thickness_light - i - 1,
|
|
|
|
y + thickness_dark + i,
|
|
|
|
x + width - thickness_light - i - 1,
|
|
|
|
y + height - thickness_light - 1);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
1999-01-11 18:49:54 +00:00
|
|
|
if (area)
|
|
|
|
{
|
|
|
|
gdk_gc_set_clip_rectangle (gc1, NULL);
|
|
|
|
gdk_gc_set_clip_rectangle (gc2, NULL);
|
|
|
|
if (shadow_type == GTK_SHADOW_IN ||
|
1999-01-15 18:41:43 +00:00
|
|
|
shadow_type == GTK_SHADOW_OUT)
|
|
|
|
{
|
|
|
|
gdk_gc_set_clip_rectangle (style->black_gc, NULL);
|
|
|
|
gdk_gc_set_clip_rectangle (style->bg_gc[state_type], NULL);
|
|
|
|
}
|
1999-01-11 18:49:54 +00:00
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_default_draw_polygon (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
GdkPoint *points,
|
|
|
|
gint npoints,
|
|
|
|
gboolean fill)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
static const gdouble pi_over_4 = M_PI_4;
|
|
|
|
static const gdouble pi_3_over_4 = M_PI_4 * 3;
|
|
|
|
GdkGC *gc1;
|
|
|
|
GdkGC *gc2;
|
|
|
|
GdkGC *gc3;
|
|
|
|
GdkGC *gc4;
|
|
|
|
gdouble angle;
|
|
|
|
gint xadjust;
|
|
|
|
gint yadjust;
|
|
|
|
gint i;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
g_return_if_fail (points != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
switch (shadow_type)
|
|
|
|
{
|
|
|
|
case GTK_SHADOW_IN:
|
|
|
|
gc1 = style->bg_gc[state_type];
|
|
|
|
gc2 = style->dark_gc[state_type];
|
|
|
|
gc3 = style->light_gc[state_type];
|
|
|
|
gc4 = style->black_gc;
|
|
|
|
break;
|
1999-01-11 18:49:54 +00:00
|
|
|
case GTK_SHADOW_ETCHED_IN:
|
1998-11-06 22:05:02 +00:00
|
|
|
gc1 = style->light_gc[state_type];
|
|
|
|
gc2 = style->dark_gc[state_type];
|
|
|
|
gc3 = style->dark_gc[state_type];
|
|
|
|
gc4 = style->light_gc[state_type];
|
|
|
|
break;
|
1997-11-24 22:37:52 +00:00
|
|
|
case GTK_SHADOW_OUT:
|
|
|
|
gc1 = style->dark_gc[state_type];
|
|
|
|
gc2 = style->light_gc[state_type];
|
|
|
|
gc3 = style->black_gc;
|
|
|
|
gc4 = style->bg_gc[state_type];
|
|
|
|
break;
|
1999-01-11 18:49:54 +00:00
|
|
|
case GTK_SHADOW_ETCHED_OUT:
|
1998-11-06 22:05:02 +00:00
|
|
|
gc1 = style->dark_gc[state_type];
|
|
|
|
gc2 = style->light_gc[state_type];
|
|
|
|
gc3 = style->light_gc[state_type];
|
|
|
|
gc4 = style->dark_gc[state_type];
|
|
|
|
break;
|
1997-11-24 22:37:52 +00:00
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
1999-01-11 18:49:54 +00:00
|
|
|
|
|
|
|
if (area)
|
|
|
|
{
|
|
|
|
gdk_gc_set_clip_rectangle (gc1, area);
|
|
|
|
gdk_gc_set_clip_rectangle (gc2, area);
|
|
|
|
gdk_gc_set_clip_rectangle (gc3, area);
|
|
|
|
gdk_gc_set_clip_rectangle (gc4, area);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fill)
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, npoints);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-01-31 05:12:37 +00:00
|
|
|
npoints--;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
for (i = 0; i < npoints; i++)
|
|
|
|
{
|
1998-01-31 05:12:37 +00:00
|
|
|
if ((points[i].x == points[i+1].x) &&
|
1999-01-15 18:41:43 +00:00
|
|
|
(points[i].y == points[i+1].y))
|
|
|
|
{
|
|
|
|
angle = 0;
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
else
|
1999-01-15 18:41:43 +00:00
|
|
|
{
|
|
|
|
angle = atan2 (points[i+1].y - points[i].y,
|
|
|
|
points[i+1].x - points[i].x);
|
|
|
|
}
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if ((angle > -pi_3_over_4) && (angle < pi_over_4))
|
1999-01-15 18:41:43 +00:00
|
|
|
{
|
|
|
|
if (angle > -pi_over_4)
|
|
|
|
{
|
|
|
|
xadjust = 0;
|
|
|
|
yadjust = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
xadjust = 1;
|
|
|
|
yadjust = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
points[i].x-xadjust, points[i].y-yadjust,
|
|
|
|
points[i+1].x-xadjust, points[i+1].y-yadjust);
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
points[i].x, points[i].y,
|
|
|
|
points[i+1].x, points[i+1].y);
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
else
|
1999-01-15 18:41:43 +00:00
|
|
|
{
|
|
|
|
if ((angle < -pi_3_over_4) || (angle > pi_3_over_4))
|
|
|
|
{
|
|
|
|
xadjust = 0;
|
|
|
|
yadjust = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
xadjust = 1;
|
|
|
|
yadjust = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
gdk_draw_line (window, gc4,
|
|
|
|
points[i].x+xadjust, points[i].y+yadjust,
|
|
|
|
points[i+1].x+xadjust, points[i+1].y+yadjust);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
points[i].x, points[i].y,
|
|
|
|
points[i+1].x, points[i+1].y);
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1999-01-15 18:41:43 +00:00
|
|
|
|
1999-01-11 18:49:54 +00:00
|
|
|
if (area)
|
|
|
|
{
|
|
|
|
gdk_gc_set_clip_rectangle (gc1, NULL);
|
|
|
|
gdk_gc_set_clip_rectangle (gc2, NULL);
|
|
|
|
gdk_gc_set_clip_rectangle (gc3, NULL);
|
|
|
|
gdk_gc_set_clip_rectangle (gc4, NULL);
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_default_draw_arrow (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
GtkArrowType arrow_type,
|
|
|
|
gboolean fill,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1999-01-11 18:49:54 +00:00
|
|
|
GdkGC *gc1;
|
|
|
|
GdkGC *gc2;
|
|
|
|
GdkGC *gc3;
|
|
|
|
GdkGC *gc4;
|
|
|
|
gint half_width;
|
|
|
|
gint half_height;
|
|
|
|
GdkPoint points[3];
|
|
|
|
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
|
|
|
|
switch (shadow_type)
|
|
|
|
{
|
|
|
|
case GTK_SHADOW_IN:
|
|
|
|
gc1 = style->bg_gc[state_type];
|
|
|
|
gc2 = style->dark_gc[state_type];
|
|
|
|
gc3 = style->light_gc[state_type];
|
|
|
|
gc4 = style->black_gc;
|
|
|
|
break;
|
|
|
|
case GTK_SHADOW_OUT:
|
|
|
|
gc1 = style->dark_gc[state_type];
|
|
|
|
gc2 = style->light_gc[state_type];
|
|
|
|
gc3 = style->black_gc;
|
|
|
|
gc4 = style->bg_gc[state_type];
|
|
|
|
break;
|
|
|
|
case GTK_SHADOW_ETCHED_IN:
|
|
|
|
gc1 = style->light_gc[state_type];
|
|
|
|
gc2 = style->dark_gc[state_type];
|
|
|
|
gc3 = NULL;
|
|
|
|
gc4 = NULL;
|
|
|
|
break;
|
|
|
|
case GTK_SHADOW_ETCHED_OUT:
|
|
|
|
gc1 = style->dark_gc[state_type];
|
|
|
|
gc2 = style->light_gc[state_type];
|
|
|
|
gc3 = NULL;
|
|
|
|
gc4 = NULL;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((width == -1) && (height == -1))
|
|
|
|
gdk_window_get_size (window, &width, &height);
|
|
|
|
else if (width == -1)
|
|
|
|
gdk_window_get_size (window, &width, NULL);
|
|
|
|
else if (height == -1)
|
|
|
|
gdk_window_get_size (window, NULL, &height);
|
|
|
|
|
|
|
|
half_width = width / 2;
|
|
|
|
half_height = height / 2;
|
|
|
|
|
|
|
|
if (area)
|
|
|
|
{
|
|
|
|
gdk_gc_set_clip_rectangle (gc1, area);
|
|
|
|
gdk_gc_set_clip_rectangle (gc2, area);
|
|
|
|
if ((gc3) && (gc4))
|
1999-01-15 18:41:43 +00:00
|
|
|
{
|
|
|
|
gdk_gc_set_clip_rectangle (gc3, area);
|
|
|
|
gdk_gc_set_clip_rectangle (gc4, area);
|
|
|
|
}
|
1999-01-11 18:49:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (arrow_type)
|
|
|
|
{
|
|
|
|
case GTK_ARROW_UP:
|
|
|
|
if (fill)
|
1999-01-15 18:41:43 +00:00
|
|
|
{
|
|
|
|
points[0].x = x + half_width;
|
|
|
|
points[0].y = y;
|
|
|
|
points[1].x = x;
|
|
|
|
points[1].y = y + height - 1;
|
|
|
|
points[2].x = x + width - 1;
|
|
|
|
points[2].y = y + height - 1;
|
|
|
|
|
|
|
|
gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, 3);
|
|
|
|
}
|
1999-01-11 18:49:54 +00:00
|
|
|
|
|
|
|
switch (shadow_type)
|
1999-01-15 18:41:43 +00:00
|
|
|
{
|
|
|
|
case GTK_SHADOW_IN:
|
|
|
|
case GTK_SHADOW_OUT:
|
|
|
|
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x + 1, y + height - 2,
|
|
|
|
x + width - 2, y + height - 2);
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x + 0, y + height - 1,
|
|
|
|
x + width - 1, y + height - 1);
|
|
|
|
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x + width - 2, y + height - 1,
|
|
|
|
x + half_width, y + 1);
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x + width - 1, y + height - 1,
|
|
|
|
x + half_width, y);
|
|
|
|
|
|
|
|
gdk_draw_line (window, gc4,
|
|
|
|
x + half_width, y + 1,
|
|
|
|
x + 1, y + height - 1);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + half_width, y,
|
|
|
|
x, y + height - 1);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GTK_SHADOW_ETCHED_IN:
|
|
|
|
case GTK_SHADOW_ETCHED_OUT:
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x + half_width, y + 1,
|
|
|
|
x + 1, y + height - 1);
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x + 1, y + height - 1,
|
|
|
|
x + width - 1, y + height - 1);
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x + width - 1, y + height - 1,
|
|
|
|
x + half_width + 1, y + 1);
|
|
|
|
|
|
|
|
points[0].x = x + half_width;
|
|
|
|
points[0].y = y;
|
|
|
|
points[1].x = x;
|
|
|
|
points[1].y = y + height - 2;
|
|
|
|
points[2].x = x + width - 2;
|
|
|
|
points[2].y = y + height - 2;
|
|
|
|
|
|
|
|
gdk_draw_polygon (window, gc2, FALSE, points, 3);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
1999-01-11 18:49:54 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GTK_ARROW_DOWN:
|
|
|
|
if (fill)
|
1999-01-15 18:41:43 +00:00
|
|
|
{
|
|
|
|
points[0].x = x + width - 1;
|
|
|
|
points[0].y = y;
|
1998-11-06 22:05:02 +00:00
|
|
|
points[1].x = x;
|
1999-01-15 18:41:43 +00:00
|
|
|
points[1].y = y;
|
|
|
|
points[2].x = x + half_width;
|
|
|
|
points[2].y = y + height - 1;
|
|
|
|
|
|
|
|
gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, 3);
|
|
|
|
}
|
1999-01-11 18:49:54 +00:00
|
|
|
switch (shadow_type)
|
1999-01-15 18:41:43 +00:00
|
|
|
{
|
|
|
|
case GTK_SHADOW_IN:
|
|
|
|
case GTK_SHADOW_OUT:
|
|
|
|
gdk_draw_line (window, gc4,
|
|
|
|
x + width - 2,
|
|
|
|
y + 1, x + 1, y + 1);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + width - 1, y,
|
|
|
|
x, y);
|
|
|
|
|
|
|
|
gdk_draw_line (window, gc4,
|
|
|
|
x + 1, y,
|
|
|
|
x + half_width, y + height - 2);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x, y,
|
|
|
|
x + half_width, y + height - 1);
|
|
|
|
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x + half_width, y + height - 2,
|
|
|
|
x + width - 2, y);
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x + half_width, y + height - 1,
|
|
|
|
x + width - 1, y);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GTK_SHADOW_ETCHED_IN:
|
|
|
|
case GTK_SHADOW_ETCHED_OUT:
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x + width - 1, y + 1,
|
|
|
|
x + 1, y + 1);
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x + 1, y + 1,
|
|
|
|
x + half_width + 1, y + height - 1);
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x + half_width + 1, y + height - 2,
|
|
|
|
x + width - 1, y);
|
|
|
|
|
|
|
|
points[0].x = x + width - 2;
|
|
|
|
points[0].y = y;
|
|
|
|
points[1].x = x;
|
|
|
|
points[1].y = y;
|
|
|
|
points[2].x = x + half_width;
|
|
|
|
points[2].y = y + height - 2;
|
|
|
|
|
|
|
|
gdk_draw_polygon (window, gc2, FALSE, points, 3);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
1999-01-11 18:49:54 +00:00
|
|
|
break;
|
|
|
|
case GTK_ARROW_LEFT:
|
1998-11-06 22:05:02 +00:00
|
|
|
if (fill)
|
1999-01-15 18:41:43 +00:00
|
|
|
{
|
|
|
|
points[0].x = x;
|
|
|
|
points[0].y = y + half_height;
|
|
|
|
points[1].x = x + width - 1;
|
|
|
|
points[1].y = y + height - 1;
|
|
|
|
points[2].x = x + width - 1;
|
|
|
|
points[2].y = y;
|
|
|
|
|
|
|
|
gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, 3);
|
|
|
|
}
|
1999-01-11 18:49:54 +00:00
|
|
|
|
|
|
|
switch (shadow_type)
|
1999-01-15 18:41:43 +00:00
|
|
|
{
|
|
|
|
case GTK_SHADOW_IN:
|
|
|
|
case GTK_SHADOW_OUT:
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x + 1, y + half_height,
|
|
|
|
x + width - 1, y + height - 1);
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x, y + half_height,
|
|
|
|
x + width - 1, y + height - 1);
|
|
|
|
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x + width - 2, y + height - 1,
|
|
|
|
x + width - 2, y + 1);
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x + width - 1, y + height - 1,
|
|
|
|
x + width - 1, y);
|
|
|
|
|
|
|
|
gdk_draw_line (window, gc4,
|
|
|
|
x + width - 1, y + 1,
|
|
|
|
x + 1, y + half_height);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + width - 1, y,
|
|
|
|
x, y + half_height);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GTK_SHADOW_ETCHED_IN:
|
|
|
|
case GTK_SHADOW_ETCHED_OUT:
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x + width - 1, y + 1,
|
|
|
|
x + 1, y + half_height);
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x + 1, y + half_height + 1,
|
|
|
|
x + width - 1, y + height - 1);
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x + width - 1, y + height - 1,
|
|
|
|
x + width - 1, y + 1);
|
|
|
|
|
|
|
|
points[0].x = x + width - 2;
|
|
|
|
points[0].y = y;
|
|
|
|
points[1].x = x;
|
|
|
|
points[1].y = y + half_height;
|
|
|
|
points[2].x = x + width - 2;
|
|
|
|
points[2].y = y + height - 2;
|
|
|
|
|
|
|
|
gdk_draw_polygon (window, gc2, FALSE, points, 3);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
1999-01-11 18:49:54 +00:00
|
|
|
break;
|
|
|
|
case GTK_ARROW_RIGHT:
|
|
|
|
if (fill)
|
1999-01-15 18:41:43 +00:00
|
|
|
{
|
|
|
|
points[0].x = x + width - 1;
|
|
|
|
points[0].y = y + half_height;
|
|
|
|
points[1].x = x;
|
|
|
|
points[1].y = y;
|
|
|
|
points[2].x = x;
|
|
|
|
points[2].y = y + height - 1;
|
|
|
|
|
|
|
|
gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, 3);
|
|
|
|
}
|
1999-01-11 18:49:54 +00:00
|
|
|
|
|
|
|
switch (shadow_type)
|
1999-01-15 18:41:43 +00:00
|
|
|
{
|
|
|
|
case GTK_SHADOW_IN:
|
|
|
|
case GTK_SHADOW_OUT:
|
|
|
|
gdk_draw_line (window, gc4,
|
|
|
|
x + width - 1, y + half_height,
|
|
|
|
x + 1, y + 1);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + width - 1, y + half_height,
|
|
|
|
x, y);
|
|
|
|
gdk_draw_line (window, gc4,
|
|
|
|
x + 1, y + 1,
|
|
|
|
x + 1, y + height - 2);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x, y,
|
|
|
|
x, y + height - 1);
|
|
|
|
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x + 1, y + height - 2,
|
|
|
|
x + width - 1, y + half_height);
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x, y + height - 1,
|
|
|
|
x + width - 1, y + half_height);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GTK_SHADOW_ETCHED_IN:
|
|
|
|
case GTK_SHADOW_ETCHED_OUT:
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x + width - 1, y + half_height + 1,
|
|
|
|
x + 1, y + 1);
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x + 1, y + 1,
|
|
|
|
x + 1, y + height - 1);
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x + 1, y + height - 1,
|
|
|
|
x + width - 1, y + half_height + 1);
|
|
|
|
|
|
|
|
points[0].x = x + width - 2;
|
|
|
|
points[0].y = y + half_height;
|
|
|
|
points[1].x = x;
|
|
|
|
points[1].y = y;
|
|
|
|
points[2].x = x;
|
|
|
|
points[2].y = y + height - 1;
|
|
|
|
|
|
|
|
gdk_draw_polygon (window, gc2, FALSE, points, 3);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
1999-01-11 18:49:54 +00:00
|
|
|
break;
|
|
|
|
}
|
1999-01-15 18:41:43 +00:00
|
|
|
|
1999-01-11 18:49:54 +00:00
|
|
|
if (area)
|
|
|
|
{
|
|
|
|
gdk_gc_set_clip_rectangle (gc1, NULL);
|
|
|
|
gdk_gc_set_clip_rectangle (gc2, NULL);
|
|
|
|
if (gc3)
|
1999-01-15 18:41:43 +00:00
|
|
|
{
|
|
|
|
gdk_gc_set_clip_rectangle (gc3, NULL);
|
|
|
|
gdk_gc_set_clip_rectangle (gc4, NULL);
|
|
|
|
}
|
1999-01-11 18:49:54 +00:00
|
|
|
}
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_default_draw_diamond (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
1999-01-11 18:49:54 +00:00
|
|
|
gint half_width;
|
|
|
|
gint half_height;
|
|
|
|
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
|
|
|
|
if ((width == -1) && (height == -1))
|
|
|
|
gdk_window_get_size (window, &width, &height);
|
|
|
|
else if (width == -1)
|
|
|
|
gdk_window_get_size (window, &width, NULL);
|
|
|
|
else if (height == -1)
|
|
|
|
gdk_window_get_size (window, NULL, &height);
|
|
|
|
|
|
|
|
half_width = width / 2;
|
|
|
|
half_height = height / 2;
|
|
|
|
|
|
|
|
if (area)
|
|
|
|
{
|
|
|
|
gdk_gc_set_clip_rectangle (style->light_gc[state_type], area);
|
|
|
|
gdk_gc_set_clip_rectangle (style->bg_gc[state_type], area);
|
|
|
|
gdk_gc_set_clip_rectangle (style->dark_gc[state_type], area);
|
|
|
|
gdk_gc_set_clip_rectangle (style->black_gc, area);
|
|
|
|
}
|
|
|
|
switch (shadow_type)
|
|
|
|
{
|
|
|
|
case GTK_SHADOW_IN:
|
|
|
|
gdk_draw_line (window, style->bg_gc[state_type],
|
1999-01-15 18:41:43 +00:00
|
|
|
x + 2, y + half_height,
|
|
|
|
x + half_width, y + height - 2);
|
1999-01-11 18:49:54 +00:00
|
|
|
gdk_draw_line (window, style->bg_gc[state_type],
|
1999-01-15 18:41:43 +00:00
|
|
|
x + half_width, y + height - 2,
|
|
|
|
x + width - 2, y + half_height);
|
1999-01-11 18:49:54 +00:00
|
|
|
gdk_draw_line (window, style->light_gc[state_type],
|
1999-01-15 18:41:43 +00:00
|
|
|
x + 1, y + half_height,
|
|
|
|
x + half_width, y + height - 1);
|
1999-01-11 18:49:54 +00:00
|
|
|
gdk_draw_line (window, style->light_gc[state_type],
|
1999-01-15 18:41:43 +00:00
|
|
|
x + half_width, y + height - 1,
|
|
|
|
x + width - 1, y + half_height);
|
1999-01-11 18:49:54 +00:00
|
|
|
gdk_draw_line (window, style->light_gc[state_type],
|
1999-01-15 18:41:43 +00:00
|
|
|
x, y + half_height,
|
|
|
|
x + half_width, y + height);
|
1999-01-11 18:49:54 +00:00
|
|
|
gdk_draw_line (window, style->light_gc[state_type],
|
1999-01-15 18:41:43 +00:00
|
|
|
x + half_width, y + height,
|
1998-11-06 22:05:02 +00:00
|
|
|
x + width, y + half_height);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
|
|
|
gdk_draw_line (window, style->black_gc,
|
1999-01-15 18:41:43 +00:00
|
|
|
x + 2, y + half_height,
|
|
|
|
x + half_width, y + 2);
|
1999-01-11 18:49:54 +00:00
|
|
|
gdk_draw_line (window, style->black_gc,
|
1999-01-15 18:41:43 +00:00
|
|
|
x + half_width, y + 2,
|
|
|
|
x + width - 2, y + half_height);
|
1999-01-11 18:49:54 +00:00
|
|
|
gdk_draw_line (window, style->dark_gc[state_type],
|
1999-01-15 18:41:43 +00:00
|
|
|
x + 1, y + half_height,
|
1998-11-06 22:05:02 +00:00
|
|
|
x + half_width, y + 1);
|
1999-01-11 18:49:54 +00:00
|
|
|
gdk_draw_line (window, style->dark_gc[state_type],
|
1999-01-15 18:41:43 +00:00
|
|
|
x + half_width, y + 1,
|
|
|
|
x + width - 1, y + half_height);
|
1999-01-11 18:49:54 +00:00
|
|
|
gdk_draw_line (window, style->dark_gc[state_type],
|
1999-01-15 18:41:43 +00:00
|
|
|
x, y + half_height,
|
|
|
|
x + half_width, y);
|
1999-01-11 18:49:54 +00:00
|
|
|
gdk_draw_line (window, style->dark_gc[state_type],
|
1999-01-15 18:41:43 +00:00
|
|
|
x + half_width, y,
|
|
|
|
x + width, y + half_height);
|
1999-01-11 18:49:54 +00:00
|
|
|
break;
|
|
|
|
case GTK_SHADOW_OUT:
|
|
|
|
gdk_draw_line (window, style->dark_gc[state_type],
|
1999-01-15 18:41:43 +00:00
|
|
|
x + 2, y + half_height,
|
|
|
|
x + half_width, y + height - 2);
|
1999-01-11 18:49:54 +00:00
|
|
|
gdk_draw_line (window, style->dark_gc[state_type],
|
1999-01-15 18:41:43 +00:00
|
|
|
x + half_width, y + height - 2,
|
|
|
|
x + width - 2, y + half_height);
|
1999-01-11 18:49:54 +00:00
|
|
|
gdk_draw_line (window, style->dark_gc[state_type],
|
1999-01-15 18:41:43 +00:00
|
|
|
x + 1, y + half_height,
|
|
|
|
x + half_width, y + height - 1);
|
1999-01-11 18:49:54 +00:00
|
|
|
gdk_draw_line (window, style->dark_gc[state_type],
|
1999-01-15 18:41:43 +00:00
|
|
|
x + half_width, y + height - 1,
|
|
|
|
x + width - 1, y + half_height);
|
1999-01-11 18:49:54 +00:00
|
|
|
gdk_draw_line (window, style->black_gc,
|
1999-01-15 18:41:43 +00:00
|
|
|
x, y + half_height,
|
|
|
|
x + half_width, y + height);
|
1999-01-11 18:49:54 +00:00
|
|
|
gdk_draw_line (window, style->black_gc,
|
1999-01-15 18:41:43 +00:00
|
|
|
x + half_width, y + height,
|
|
|
|
x + width, y + half_height);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
|
|
|
gdk_draw_line (window, style->bg_gc[state_type],
|
1999-01-15 18:41:43 +00:00
|
|
|
x + 2, y + half_height,
|
|
|
|
x + half_width, y + 2);
|
1999-01-11 18:49:54 +00:00
|
|
|
gdk_draw_line (window, style->bg_gc[state_type],
|
1999-01-15 18:41:43 +00:00
|
|
|
x + half_width, y + 2,
|
|
|
|
x + width - 2, y + half_height);
|
1999-01-11 18:49:54 +00:00
|
|
|
gdk_draw_line (window, style->light_gc[state_type],
|
1999-01-15 18:41:43 +00:00
|
|
|
x + 1, y + half_height,
|
|
|
|
x + half_width, y + 1);
|
1999-01-11 18:49:54 +00:00
|
|
|
gdk_draw_line (window, style->light_gc[state_type],
|
1999-01-15 18:41:43 +00:00
|
|
|
x + half_width, y + 1,
|
1998-11-06 22:05:02 +00:00
|
|
|
x + width - 1, y + half_height);
|
1999-01-11 18:49:54 +00:00
|
|
|
gdk_draw_line (window, style->light_gc[state_type],
|
1999-01-15 18:41:43 +00:00
|
|
|
x, y + half_height,
|
|
|
|
x + half_width, y);
|
1999-01-11 18:49:54 +00:00
|
|
|
gdk_draw_line (window, style->light_gc[state_type],
|
1999-01-15 18:41:43 +00:00
|
|
|
x + half_width, y,
|
|
|
|
x + width, y + half_height);
|
1999-01-11 18:49:54 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (area)
|
|
|
|
{
|
|
|
|
gdk_gc_set_clip_rectangle (style->light_gc[state_type], NULL);
|
|
|
|
gdk_gc_set_clip_rectangle (style->bg_gc[state_type], NULL);
|
|
|
|
gdk_gc_set_clip_rectangle (style->dark_gc[state_type], NULL);
|
|
|
|
gdk_gc_set_clip_rectangle (style->black_gc, NULL);
|
|
|
|
}
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
static void
|
|
|
|
gtk_default_draw_oval (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (window != NULL);
|
1999-01-15 18:41:43 +00:00
|
|
|
|
|
|
|
g_warning ("gtk_default_draw_oval(): FIXME, this function is currently unimplemented");
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
static void
|
|
|
|
gtk_default_draw_string (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
const gchar *string)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (window != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
|
|
|
if (area)
|
|
|
|
{
|
|
|
|
gdk_gc_set_clip_rectangle (style->white_gc, area);
|
|
|
|
gdk_gc_set_clip_rectangle (style->fg_gc[state_type], area);
|
|
|
|
}
|
1999-01-15 18:41:43 +00:00
|
|
|
|
1999-01-11 18:49:54 +00:00
|
|
|
if (state_type == GTK_STATE_INSENSITIVE)
|
|
|
|
gdk_draw_string (window, style->font, style->white_gc, x + 1, y + 1, string);
|
1999-01-15 18:41:43 +00:00
|
|
|
|
1999-01-11 18:49:54 +00:00
|
|
|
gdk_draw_string (window, style->font, style->fg_gc[state_type], x, y, string);
|
1999-01-15 18:41:43 +00:00
|
|
|
|
1999-01-11 18:49:54 +00:00
|
|
|
if (area)
|
|
|
|
{
|
|
|
|
gdk_gc_set_clip_rectangle (style->white_gc, NULL);
|
|
|
|
gdk_gc_set_clip_rectangle (style->fg_gc[state_type], NULL);
|
|
|
|
}
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1999-01-15 18:41:43 +00:00
|
|
|
gtk_default_draw_box (GtkStyle *style,
|
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
1999-01-11 18:49:54 +00:00
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
if (width == -1 && height == -1)
|
1999-01-11 18:49:54 +00:00
|
|
|
gdk_window_get_size (window, &width, &height);
|
|
|
|
else if (width == -1)
|
|
|
|
gdk_window_get_size (window, &width, NULL);
|
|
|
|
else if (height == -1)
|
|
|
|
gdk_window_get_size (window, NULL, &height);
|
|
|
|
|
|
|
|
if (!style->bg_pixmap[state_type] ||
|
|
|
|
gdk_window_get_type (window) == GDK_WINDOW_PIXMAP)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
|
|
|
if (area)
|
1999-01-15 18:41:43 +00:00
|
|
|
gdk_gc_set_clip_rectangle (style->bg_gc[state_type], area);
|
|
|
|
|
1999-01-11 18:49:54 +00:00
|
|
|
gdk_draw_rectangle (window, style->bg_gc[state_type], TRUE,
|
1999-01-15 18:41:43 +00:00
|
|
|
x, y, width, height);
|
1998-11-06 22:05:02 +00:00
|
|
|
if (area)
|
1999-01-15 18:41:43 +00:00
|
|
|
gdk_gc_set_clip_rectangle (style->bg_gc[state_type], NULL);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
|
|
|
else
|
1999-01-12 15:12:14 +00:00
|
|
|
gtk_style_apply_default_background (style, window,
|
1999-01-15 18:41:43 +00:00
|
|
|
widget && !GTK_WIDGET_NO_WINDOW (widget),
|
|
|
|
state_type, area, x, y, width, height);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
gtk_paint_shadow (style, window, state_type, shadow_type, area, widget, detail,
|
1999-01-15 18:41:43 +00:00
|
|
|
x, y, width, height);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_default_draw_flat_box (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
|
|
|
GdkGC *gc1;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (window != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
if (width == -1 && height == -1)
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_window_get_size (window, &width, &height);
|
|
|
|
else if (width == -1)
|
|
|
|
gdk_window_get_size (window, &width, NULL);
|
|
|
|
else if (height == -1)
|
|
|
|
gdk_window_get_size (window, NULL, &height);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
if (detail)
|
|
|
|
{
|
|
|
|
if (!strcmp ("text", detail) && state_type == GTK_STATE_SELECTED)
|
|
|
|
gc1 = style->bg_gc[GTK_STATE_SELECTED];
|
|
|
|
else if (!strcmp ("viewportbin", detail))
|
|
|
|
gc1 = style->bg_gc[GTK_STATE_NORMAL];
|
|
|
|
else if (!strcmp ("entry_bg", detail))
|
|
|
|
gc1 = style->base_gc[state_type];
|
|
|
|
else
|
|
|
|
gc1 = style->bg_gc[state_type];
|
|
|
|
}
|
1998-11-06 22:05:02 +00:00
|
|
|
else
|
|
|
|
gc1 = style->bg_gc[state_type];
|
1999-01-11 18:49:54 +00:00
|
|
|
|
|
|
|
if (!style->bg_pixmap[state_type] || gc1 != style->bg_gc[state_type] ||
|
|
|
|
gdk_window_get_type (window) == GDK_WINDOW_PIXMAP)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-11-06 22:05:02 +00:00
|
|
|
if (area)
|
1999-01-15 18:41:43 +00:00
|
|
|
gdk_gc_set_clip_rectangle (gc1, area);
|
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
gdk_draw_rectangle (window, gc1, TRUE,
|
1999-01-15 18:41:43 +00:00
|
|
|
x, y, width, height);
|
|
|
|
|
|
|
|
if (detail && !strcmp ("tooltip", detail))
|
|
|
|
gdk_draw_rectangle (window, style->black_gc, FALSE,
|
|
|
|
x, y, width - 1, height - 1);
|
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
if (area)
|
1999-01-15 18:41:43 +00:00
|
|
|
gdk_gc_set_clip_rectangle (gc1, NULL);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
|
|
|
else
|
1999-01-12 15:12:14 +00:00
|
|
|
gtk_style_apply_default_background (style, window,
|
1999-01-15 18:41:43 +00:00
|
|
|
widget && !GTK_WIDGET_NO_WINDOW (widget),
|
|
|
|
state_type, area, x, y, width, height);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
static void
|
1999-01-15 18:41:43 +00:00
|
|
|
gtk_default_draw_check (GtkStyle *style,
|
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
1999-01-11 18:49:54 +00:00
|
|
|
gtk_paint_box (style, window, state_type, shadow_type, area, widget, detail,
|
1999-01-15 18:41:43 +00:00
|
|
|
x, y, width, height);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1999-01-15 18:41:43 +00:00
|
|
|
gtk_default_draw_option (GtkStyle *style,
|
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
1999-01-11 18:49:54 +00:00
|
|
|
gtk_paint_diamond (style, window, state_type, shadow_type, area, widget,
|
1999-01-15 18:41:43 +00:00
|
|
|
detail, x, y, width, height);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1999-01-15 18:41:43 +00:00
|
|
|
gtk_default_draw_cross (GtkStyle *style,
|
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
1999-01-11 18:49:54 +00:00
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (window != NULL);
|
1999-01-15 18:41:43 +00:00
|
|
|
|
|
|
|
g_warning ("gtk_default_draw_cross(): FIXME, this function is currently unimplemented");
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_default_draw_ramp (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
GtkArrowType arrow_type,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
1999-01-11 18:49:54 +00:00
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (window != NULL);
|
1999-01-15 18:41:43 +00:00
|
|
|
|
|
|
|
g_warning ("gtk_default_draw_ramp(): FIXME, this function is currently unimplemented");
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
static void
|
|
|
|
gtk_default_draw_tab (GtkStyle *style,
|
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
1999-01-11 18:49:54 +00:00
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
|
|
|
|
gtk_paint_box (style, window, state_type, shadow_type, area, widget, detail,
|
1999-01-15 18:41:43 +00:00
|
|
|
x, y, width, height);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_default_draw_shadow_gap (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GtkPositionType gap_side,
|
|
|
|
gint gap_x,
|
|
|
|
gint gap_width)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
|
|
|
GdkGC *gc1 = NULL;
|
|
|
|
GdkGC *gc2 = NULL;
|
|
|
|
GdkGC *gc3 = NULL;
|
|
|
|
GdkGC *gc4 = NULL;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (window != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
if (width == -1 && height == -1)
|
1998-11-06 22:05:02 +00:00
|
|
|
gdk_window_get_size (window, &width, &height);
|
|
|
|
else if (width == -1)
|
|
|
|
gdk_window_get_size (window, &width, NULL);
|
|
|
|
else if (height == -1)
|
|
|
|
gdk_window_get_size (window, NULL, &height);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
switch (shadow_type)
|
|
|
|
{
|
1999-01-11 18:49:54 +00:00
|
|
|
case GTK_SHADOW_NONE:
|
1998-11-06 22:05:02 +00:00
|
|
|
return;
|
1999-01-11 18:49:54 +00:00
|
|
|
case GTK_SHADOW_IN:
|
1998-11-06 22:05:02 +00:00
|
|
|
gc1 = style->dark_gc[state_type];
|
|
|
|
gc2 = style->black_gc;
|
|
|
|
gc3 = style->bg_gc[state_type];
|
|
|
|
gc4 = style->light_gc[state_type];
|
|
|
|
break;
|
1999-01-11 18:49:54 +00:00
|
|
|
case GTK_SHADOW_ETCHED_IN:
|
1998-11-06 22:05:02 +00:00
|
|
|
gc1 = style->dark_gc[state_type];
|
|
|
|
gc2 = style->light_gc[state_type];
|
|
|
|
gc3 = style->dark_gc[state_type];
|
|
|
|
gc4 = style->light_gc[state_type];
|
|
|
|
break;
|
1999-01-11 18:49:54 +00:00
|
|
|
case GTK_SHADOW_OUT:
|
1998-11-06 22:05:02 +00:00
|
|
|
gc1 = style->light_gc[state_type];
|
|
|
|
gc2 = style->bg_gc[state_type];
|
|
|
|
gc3 = style->dark_gc[state_type];
|
|
|
|
gc4 = style->black_gc;
|
|
|
|
break;
|
1999-01-11 18:49:54 +00:00
|
|
|
case GTK_SHADOW_ETCHED_OUT:
|
1998-11-06 22:05:02 +00:00
|
|
|
gc1 = style->light_gc[state_type];
|
|
|
|
gc2 = style->dark_gc[state_type];
|
|
|
|
gc3 = style->light_gc[state_type];
|
|
|
|
gc4 = style->dark_gc[state_type];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (area)
|
|
|
|
{
|
|
|
|
gdk_gc_set_clip_rectangle (gc1, area);
|
|
|
|
gdk_gc_set_clip_rectangle (gc2, area);
|
|
|
|
gdk_gc_set_clip_rectangle (gc3, area);
|
|
|
|
gdk_gc_set_clip_rectangle (gc4, area);
|
|
|
|
}
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
switch (shadow_type)
|
|
|
|
{
|
|
|
|
case GTK_SHADOW_NONE:
|
|
|
|
case GTK_SHADOW_IN:
|
|
|
|
case GTK_SHADOW_OUT:
|
|
|
|
case GTK_SHADOW_ETCHED_IN:
|
|
|
|
case GTK_SHADOW_ETCHED_OUT:
|
|
|
|
switch (gap_side)
|
1999-01-15 18:41:43 +00:00
|
|
|
{
|
|
|
|
case GTK_POS_TOP:
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x, y, x, y + height - 1);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + 1, y, x + 1, y + height - 2);
|
|
|
|
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x + 1, y + height - 2, x + width - 2, y + height - 2);
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x + width - 2, y, x + width - 2, y + height - 2);
|
|
|
|
gdk_draw_line (window, gc4,
|
|
|
|
x, y + height - 1, x + width - 1, y + height - 1);
|
|
|
|
gdk_draw_line (window, gc4,
|
|
|
|
x + width - 1, y, x + width - 1, y + height - 1);
|
|
|
|
if (gap_x > 0)
|
|
|
|
{
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x, y, x + gap_x - 1, y);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + 1, y + 1, x + gap_x - 1, y + 1);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + gap_x, y, x + gap_x, y);
|
|
|
|
}
|
|
|
|
if ((width - (gap_x + gap_width)) > 0)
|
|
|
|
{
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x + gap_x + gap_width, y, x + width - 2, y);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + gap_x + gap_width, y + 1, x + width - 2, y + 1);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + gap_x + gap_width - 1, y, x + gap_x + gap_width - 1, y);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GTK_POS_BOTTOM:
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x, y, x + width - 1, y);
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x, y, x, y + height - 1);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + 1, y + 1, x + width - 2, y + 1);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + 1, y + 1, x + 1, y + height - 1);
|
|
|
|
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x + width - 2, y + 1, x + width - 2, y + height - 1);
|
|
|
|
gdk_draw_line (window, gc4,
|
|
|
|
x + width - 1, y, x + width - 1, y + height - 1);
|
|
|
|
if (gap_x > 0)
|
|
|
|
{
|
|
|
|
gdk_draw_line (window, gc4,
|
|
|
|
x, y + height - 1, x + gap_x - 1, y + height - 1);
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x + 1, y + height - 2, x + gap_x - 1, y + height - 2);
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x + gap_x, y + height - 1, x + gap_x, y + height - 1);
|
|
|
|
}
|
|
|
|
if ((width - (gap_x + gap_width)) > 0)
|
|
|
|
{
|
|
|
|
gdk_draw_line (window, gc4,
|
|
|
|
x + gap_x + gap_width, y + height - 1, x + width - 2, y + height - 1);
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x + gap_x + gap_width, y + height - 2, x + width - 2, y + height - 2);
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x + gap_x + gap_width - 1, y + height - 1, x + gap_x + gap_width - 1, y + height - 1);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GTK_POS_LEFT:
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x, y, x + width - 1, y);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x, y + 1, x + width - 2, y + 1);
|
|
|
|
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x, y + height - 2, x + width - 2, y + height - 2);
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x + width - 2, y + 1, x + width - 2, y + height - 2);
|
|
|
|
gdk_draw_line (window, gc4,
|
|
|
|
x, y + height - 1, x + width - 1, y + height - 1);
|
|
|
|
gdk_draw_line (window, gc4,
|
|
|
|
x + width - 1, y, x + width - 1, y + height - 1);
|
|
|
|
if (gap_x > 0)
|
|
|
|
{
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x, y, x, y + gap_x - 1);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + 1, y + 1, x + 1, y + gap_x - 1);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x, y + gap_x, x, y + gap_x);
|
|
|
|
}
|
|
|
|
if ((width - (gap_x + gap_width)) > 0)
|
|
|
|
{
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x, y + gap_x + gap_width, x, y + height - 2);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + 1, y + gap_x + gap_width, x + 1, y + height - 2);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x, y + gap_x + gap_width - 1, x, y + gap_x + gap_width - 1);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GTK_POS_RIGHT:
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x, y, x + width - 1, y);
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x, y, x, y + height - 1);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + 1, y + 1, x + width - 1, y + 1);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + 1, y + 1, x + 1, y + height - 2);
|
|
|
|
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x + 1, y + height - 2, x + width - 1, y + height - 2);
|
|
|
|
gdk_draw_line (window, gc4,
|
|
|
|
x, y + height - 1, x + width - 1, y + height - 1);
|
|
|
|
if (gap_x > 0)
|
|
|
|
{
|
|
|
|
gdk_draw_line (window, gc4,
|
|
|
|
x + width - 1, y, x + width - 1, y + gap_x - 1);
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x + width - 2, y + 1, x + width - 2, y + gap_x - 1);
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x + width - 1, y + gap_x, x + width - 1, y + gap_x);
|
|
|
|
}
|
|
|
|
if ((width - (gap_x + gap_width)) > 0)
|
|
|
|
{
|
|
|
|
gdk_draw_line (window, gc4,
|
|
|
|
x + width - 1, y + gap_x + gap_width, x + width - 1, y + height - 2);
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x + width - 2, y + gap_x + gap_width, x + width - 2, y + height - 2);
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x + width - 1, y + gap_x + gap_width - 1, x + width - 1, y + gap_x + gap_width - 1);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
1999-01-15 18:41:43 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
if (area)
|
|
|
|
{
|
|
|
|
gdk_gc_set_clip_rectangle (gc1, NULL);
|
|
|
|
gdk_gc_set_clip_rectangle (gc2, NULL);
|
|
|
|
gdk_gc_set_clip_rectangle (gc3, NULL);
|
|
|
|
gdk_gc_set_clip_rectangle (gc4, NULL);
|
|
|
|
}
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
static void
|
|
|
|
gtk_default_draw_box_gap (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GtkPositionType gap_side,
|
|
|
|
gint gap_x,
|
|
|
|
gint gap_width)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
|
|
|
GdkGC *gc1 = NULL;
|
|
|
|
GdkGC *gc2 = NULL;
|
|
|
|
GdkGC *gc3 = NULL;
|
|
|
|
GdkGC *gc4 = NULL;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (window != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-12 15:12:14 +00:00
|
|
|
gtk_style_apply_default_background (style, window,
|
1999-01-15 18:41:43 +00:00
|
|
|
widget && !GTK_WIDGET_NO_WINDOW (widget),
|
|
|
|
state_type, area, x, y, width, height);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
if (width == -1 && height == -1)
|
1998-11-06 22:05:02 +00:00
|
|
|
gdk_window_get_size (window, &width, &height);
|
|
|
|
else if (width == -1)
|
|
|
|
gdk_window_get_size (window, &width, NULL);
|
|
|
|
else if (height == -1)
|
|
|
|
gdk_window_get_size (window, NULL, &height);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
switch (shadow_type)
|
|
|
|
{
|
1999-01-11 18:49:54 +00:00
|
|
|
case GTK_SHADOW_NONE:
|
1998-11-06 22:05:02 +00:00
|
|
|
return;
|
1999-01-11 18:49:54 +00:00
|
|
|
case GTK_SHADOW_IN:
|
1998-11-06 22:05:02 +00:00
|
|
|
gc1 = style->dark_gc[state_type];
|
|
|
|
gc2 = style->black_gc;
|
|
|
|
gc3 = style->bg_gc[state_type];
|
|
|
|
gc4 = style->light_gc[state_type];
|
1997-11-24 22:37:52 +00:00
|
|
|
break;
|
1999-01-11 18:49:54 +00:00
|
|
|
case GTK_SHADOW_ETCHED_IN:
|
1998-11-06 22:05:02 +00:00
|
|
|
gc1 = style->dark_gc[state_type];
|
|
|
|
gc2 = style->light_gc[state_type];
|
|
|
|
gc3 = style->dark_gc[state_type];
|
|
|
|
gc4 = style->light_gc[state_type];
|
|
|
|
break;
|
1999-01-11 18:49:54 +00:00
|
|
|
case GTK_SHADOW_OUT:
|
1998-11-06 22:05:02 +00:00
|
|
|
gc1 = style->light_gc[state_type];
|
|
|
|
gc2 = style->bg_gc[state_type];
|
|
|
|
gc3 = style->dark_gc[state_type];
|
|
|
|
gc4 = style->black_gc;
|
|
|
|
break;
|
1999-01-11 18:49:54 +00:00
|
|
|
case GTK_SHADOW_ETCHED_OUT:
|
1998-11-06 22:05:02 +00:00
|
|
|
gc1 = style->light_gc[state_type];
|
|
|
|
gc2 = style->dark_gc[state_type];
|
|
|
|
gc3 = style->light_gc[state_type];
|
|
|
|
gc4 = style->dark_gc[state_type];
|
|
|
|
break;
|
|
|
|
}
|
1999-01-15 18:41:43 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
if (area)
|
|
|
|
{
|
|
|
|
gdk_gc_set_clip_rectangle (gc1, area);
|
|
|
|
gdk_gc_set_clip_rectangle (gc2, area);
|
|
|
|
gdk_gc_set_clip_rectangle (gc3, area);
|
|
|
|
gdk_gc_set_clip_rectangle (gc4, area);
|
|
|
|
}
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
switch (shadow_type)
|
|
|
|
{
|
|
|
|
case GTK_SHADOW_NONE:
|
|
|
|
case GTK_SHADOW_IN:
|
|
|
|
case GTK_SHADOW_OUT:
|
|
|
|
case GTK_SHADOW_ETCHED_IN:
|
|
|
|
case GTK_SHADOW_ETCHED_OUT:
|
1998-11-11 23:40:17 +00:00
|
|
|
switch (gap_side)
|
1999-01-15 18:41:43 +00:00
|
|
|
{
|
|
|
|
case GTK_POS_TOP:
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x, y, x, y + height - 1);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + 1, y, x + 1, y + height - 2);
|
|
|
|
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x + 1, y + height - 2, x + width - 2, y + height - 2);
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x + width - 2, y, x + width - 2, y + height - 2);
|
|
|
|
gdk_draw_line (window, gc4,
|
|
|
|
x, y + height - 1, x + width - 1, y + height - 1);
|
|
|
|
gdk_draw_line (window, gc4,
|
|
|
|
x + width - 1, y, x + width - 1, y + height - 1);
|
|
|
|
if (gap_x > 0)
|
|
|
|
{
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x, y, x + gap_x - 1, y);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + 1, y + 1, x + gap_x - 1, y + 1);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + gap_x, y, x + gap_x, y);
|
|
|
|
}
|
|
|
|
if ((width - (gap_x + gap_width)) > 0)
|
|
|
|
{
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x + gap_x + gap_width, y, x + width - 2, y);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + gap_x + gap_width, y + 1, x + width - 2, y + 1);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + gap_x + gap_width - 1, y, x + gap_x + gap_width - 1, y);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GTK_POS_BOTTOM:
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x, y, x + width - 1, y);
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x, y, x, y + height - 1);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + 1, y + 1, x + width - 2, y + 1);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + 1, y + 1, x + 1, y + height - 1);
|
|
|
|
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x + width - 2, y + 1, x + width - 2, y + height - 1);
|
|
|
|
gdk_draw_line (window, gc4,
|
|
|
|
x + width - 1, y, x + width - 1, y + height - 1);
|
|
|
|
if (gap_x > 0)
|
|
|
|
{
|
|
|
|
gdk_draw_line (window, gc4,
|
|
|
|
x, y + height - 1, x + gap_x - 1, y + height - 1);
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x + 1, y + height - 2, x + gap_x - 1, y + height - 2);
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x + gap_x, y + height - 1, x + gap_x, y + height - 1);
|
|
|
|
}
|
|
|
|
if ((width - (gap_x + gap_width)) > 0)
|
|
|
|
{
|
|
|
|
gdk_draw_line (window, gc4,
|
|
|
|
x + gap_x + gap_width, y + height - 1, x + width - 2, y + height - 1);
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x + gap_x + gap_width, y + height - 2, x + width - 2, y + height - 2);
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x + gap_x + gap_width - 1, y + height - 1, x + gap_x + gap_width - 1, y + height - 1);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GTK_POS_LEFT:
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x, y, x + width - 1, y);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x, y + 1, x + width - 2, y + 1);
|
|
|
|
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x, y + height - 2, x + width - 2, y + height - 2);
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x + width - 2, y + 1, x + width - 2, y + height - 2);
|
|
|
|
gdk_draw_line (window, gc4,
|
|
|
|
x, y + height - 1, x + width - 1, y + height - 1);
|
|
|
|
gdk_draw_line (window, gc4,
|
|
|
|
x + width - 1, y, x + width - 1, y + height - 1);
|
|
|
|
if (gap_x > 0)
|
|
|
|
{
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x, y, x, y + gap_x - 1);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + 1, y + 1, x + 1, y + gap_x - 1);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x, y + gap_x, x, y + gap_x);
|
|
|
|
}
|
|
|
|
if ((width - (gap_x + gap_width)) > 0)
|
|
|
|
{
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x, y + gap_x + gap_width, x, y + height - 2);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + 1, y + gap_x + gap_width, x + 1, y + height - 2);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x, y + gap_x + gap_width - 1, x, y + gap_x + gap_width - 1);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GTK_POS_RIGHT:
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x, y, x + width - 1, y);
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x, y, x, y + height - 1);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + 1, y + 1, x + width - 1, y + 1);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + 1, y + 1, x + 1, y + height - 2);
|
|
|
|
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x + 1, y + height - 2, x + width - 1, y + height - 2);
|
|
|
|
gdk_draw_line (window, gc4,
|
|
|
|
x, y + height - 1, x + width - 1, y + height - 1);
|
|
|
|
if (gap_x > 0)
|
|
|
|
{
|
|
|
|
gdk_draw_line (window, gc4,
|
|
|
|
x + width - 1, y, x + width - 1, y + gap_x - 1);
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x + width - 2, y + 1, x + width - 2, y + gap_x - 1);
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x + width - 1, y + gap_x, x + width - 1, y + gap_x);
|
|
|
|
}
|
|
|
|
if ((width - (gap_x + gap_width)) > 0)
|
|
|
|
{
|
|
|
|
gdk_draw_line (window, gc4,
|
|
|
|
x + width - 1, y + gap_x + gap_width, x + width - 1, y + height - 2);
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x + width - 2, y + gap_x + gap_width, x + width - 2, y + height - 2);
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x + width - 1, y + gap_x + gap_width - 1, x + width - 1, y + gap_x + gap_width - 1);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
1999-01-15 18:41:43 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
if (area)
|
|
|
|
{
|
|
|
|
gdk_gc_set_clip_rectangle (gc1, NULL);
|
|
|
|
gdk_gc_set_clip_rectangle (gc2, NULL);
|
|
|
|
gdk_gc_set_clip_rectangle (gc3, NULL);
|
|
|
|
gdk_gc_set_clip_rectangle (gc4, NULL);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
static void
|
|
|
|
gtk_default_draw_extension (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GtkPositionType gap_side)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-11-06 22:05:02 +00:00
|
|
|
GdkGC *gc1 = NULL;
|
|
|
|
GdkGC *gc2 = NULL;
|
|
|
|
GdkGC *gc3 = NULL;
|
|
|
|
GdkGC *gc4 = NULL;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (window != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-12 15:12:14 +00:00
|
|
|
gtk_style_apply_default_background (style, window,
|
1999-01-15 18:41:43 +00:00
|
|
|
widget && !GTK_WIDGET_NO_WINDOW (widget),
|
|
|
|
GTK_STATE_NORMAL, area, x, y, width, height);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
if (width == -1 && height == -1)
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_window_get_size (window, &width, &height);
|
|
|
|
else if (width == -1)
|
|
|
|
gdk_window_get_size (window, &width, NULL);
|
|
|
|
else if (height == -1)
|
|
|
|
gdk_window_get_size (window, NULL, &height);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
switch (shadow_type)
|
|
|
|
{
|
1999-01-11 18:49:54 +00:00
|
|
|
case GTK_SHADOW_NONE:
|
1998-11-06 22:05:02 +00:00
|
|
|
return;
|
1999-01-11 18:49:54 +00:00
|
|
|
case GTK_SHADOW_IN:
|
1998-11-06 22:05:02 +00:00
|
|
|
gc1 = style->dark_gc[state_type];
|
|
|
|
gc2 = style->black_gc;
|
|
|
|
gc3 = style->bg_gc[state_type];
|
|
|
|
gc4 = style->light_gc[state_type];
|
1997-11-24 22:37:52 +00:00
|
|
|
break;
|
1999-01-11 18:49:54 +00:00
|
|
|
case GTK_SHADOW_ETCHED_IN:
|
1998-11-06 22:05:02 +00:00
|
|
|
gc1 = style->dark_gc[state_type];
|
|
|
|
gc2 = style->light_gc[state_type];
|
|
|
|
gc3 = style->dark_gc[state_type];
|
|
|
|
gc4 = style->light_gc[state_type];
|
1997-11-24 22:37:52 +00:00
|
|
|
break;
|
1999-01-11 18:49:54 +00:00
|
|
|
case GTK_SHADOW_OUT:
|
1998-11-06 22:05:02 +00:00
|
|
|
gc1 = style->light_gc[state_type];
|
|
|
|
gc2 = style->bg_gc[state_type];
|
|
|
|
gc3 = style->dark_gc[state_type];
|
|
|
|
gc4 = style->black_gc;
|
|
|
|
break;
|
1999-01-11 18:49:54 +00:00
|
|
|
case GTK_SHADOW_ETCHED_OUT:
|
1998-11-06 22:05:02 +00:00
|
|
|
gc1 = style->light_gc[state_type];
|
|
|
|
gc2 = style->dark_gc[state_type];
|
|
|
|
gc3 = style->light_gc[state_type];
|
|
|
|
gc4 = style->dark_gc[state_type];
|
1997-11-24 22:37:52 +00:00
|
|
|
break;
|
|
|
|
}
|
1999-01-15 18:41:43 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
if (area)
|
|
|
|
{
|
|
|
|
gdk_gc_set_clip_rectangle (gc1, area);
|
|
|
|
gdk_gc_set_clip_rectangle (gc2, area);
|
|
|
|
gdk_gc_set_clip_rectangle (gc3, area);
|
|
|
|
gdk_gc_set_clip_rectangle (gc4, area);
|
|
|
|
}
|
1999-01-15 18:41:43 +00:00
|
|
|
|
1999-01-11 18:49:54 +00:00
|
|
|
switch (shadow_type)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
|
|
|
case GTK_SHADOW_NONE:
|
|
|
|
case GTK_SHADOW_IN:
|
|
|
|
case GTK_SHADOW_OUT:
|
|
|
|
case GTK_SHADOW_ETCHED_IN:
|
|
|
|
case GTK_SHADOW_ETCHED_OUT:
|
|
|
|
switch (gap_side)
|
1999-01-15 18:41:43 +00:00
|
|
|
{
|
|
|
|
case GTK_POS_TOP:
|
|
|
|
gtk_style_apply_default_background (style, window,
|
|
|
|
widget && !GTK_WIDGET_NO_WINDOW (widget),
|
|
|
|
state_type, area,
|
|
|
|
x + style->klass->xthickness,
|
|
|
|
y,
|
|
|
|
width - (2 * style->klass->xthickness),
|
|
|
|
height - (style->klass->ythickness));
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x, y, x, y + height - 2);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + 1, y, x + 1, y + height - 2);
|
|
|
|
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x + 2, y + height - 2, x + width - 2, y + height - 2);
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x + width - 2, y, x + width - 2, y + height - 2);
|
|
|
|
gdk_draw_line (window, gc4,
|
|
|
|
x + 1, y + height - 1, x + width - 2, y + height - 1);
|
|
|
|
gdk_draw_line (window, gc4,
|
|
|
|
x + width - 1, y, x + width - 1, y + height - 2);
|
|
|
|
break;
|
|
|
|
case GTK_POS_BOTTOM:
|
|
|
|
gtk_style_apply_default_background (style, window,
|
|
|
|
widget && !GTK_WIDGET_NO_WINDOW (widget),
|
|
|
|
state_type, area,
|
|
|
|
x + style->klass->xthickness,
|
|
|
|
y + style->klass->ythickness,
|
|
|
|
width - (2 * style->klass->xthickness),
|
|
|
|
height - (style->klass->ythickness));
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x + 1, y, x + width - 2, y);
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x, y + 1, x, y + height - 1);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + 1, y + 1, x + width - 2, y + 1);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + 1, y + 1, x + 1, y + height - 1);
|
|
|
|
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x + width - 2, y + 2, x + width - 2, y + height - 1);
|
|
|
|
gdk_draw_line (window, gc4,
|
|
|
|
x + width - 1, y + 1, x + width - 1, y + height - 1);
|
|
|
|
break;
|
|
|
|
case GTK_POS_LEFT:
|
|
|
|
gtk_style_apply_default_background (style, window,
|
|
|
|
widget && !GTK_WIDGET_NO_WINDOW (widget),
|
|
|
|
state_type, area,
|
|
|
|
x,
|
|
|
|
y + style->klass->ythickness,
|
|
|
|
width - (style->klass->xthickness),
|
|
|
|
height - (2 * style->klass->ythickness));
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x, y, x + width - 2, y);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + 1, y + 1, x + width - 2, y + 1);
|
|
|
|
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x, y + height - 2, x + width - 2, y + height - 2);
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x + width - 2, y + 2, x + width - 2, y + height - 2);
|
|
|
|
gdk_draw_line (window, gc4,
|
|
|
|
x, y + height - 1, x + width - 2, y + height - 1);
|
|
|
|
gdk_draw_line (window, gc4,
|
|
|
|
x + width - 1, y + 1, x + width - 1, y + height - 2);
|
|
|
|
break;
|
|
|
|
case GTK_POS_RIGHT:
|
|
|
|
gtk_style_apply_default_background (style, window,
|
|
|
|
widget && !GTK_WIDGET_NO_WINDOW (widget),
|
|
|
|
state_type, area,
|
|
|
|
x + style->klass->xthickness,
|
|
|
|
y + style->klass->ythickness,
|
|
|
|
width - (style->klass->xthickness),
|
|
|
|
height - (2 * style->klass->ythickness));
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x + 1, y, x + width - 1, y);
|
|
|
|
gdk_draw_line (window, gc1,
|
|
|
|
x, y + 1, x, y + height - 2);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + 1, y + 1, x + width - 1, y + 1);
|
|
|
|
gdk_draw_line (window, gc2,
|
|
|
|
x + 1, y + 1, x + 1, y + height - 2);
|
|
|
|
|
|
|
|
gdk_draw_line (window, gc3,
|
|
|
|
x + 2, y + height - 2, x + width - 1, y + height - 2);
|
|
|
|
gdk_draw_line (window, gc4,
|
|
|
|
x + 1, y + height - 1, x + width - 1, y + height - 1);
|
|
|
|
break;
|
|
|
|
}
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
1999-01-15 18:41:43 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
if (area)
|
|
|
|
{
|
|
|
|
gdk_gc_set_clip_rectangle (gc1, NULL);
|
|
|
|
gdk_gc_set_clip_rectangle (gc2, NULL);
|
|
|
|
gdk_gc_set_clip_rectangle (gc3, NULL);
|
|
|
|
gdk_gc_set_clip_rectangle (gc4, NULL);
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
static void
|
|
|
|
gtk_default_draw_focus (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1999-01-11 18:49:54 +00:00
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
if (width == -1 && height == -1)
|
1999-01-11 18:49:54 +00:00
|
|
|
{
|
|
|
|
gdk_window_get_size (window, &width, &height);
|
|
|
|
width -= 1;
|
|
|
|
height -= 1;
|
|
|
|
}
|
|
|
|
else if (width == -1)
|
|
|
|
{
|
|
|
|
gdk_window_get_size (window, &width, NULL);
|
|
|
|
width -= 1;
|
|
|
|
}
|
|
|
|
else if (height == -1)
|
|
|
|
{
|
|
|
|
gdk_window_get_size (window, NULL, &height);
|
|
|
|
height -= 1;
|
|
|
|
}
|
1999-01-15 18:41:43 +00:00
|
|
|
|
1999-01-11 18:49:54 +00:00
|
|
|
if (area)
|
1999-01-15 18:41:43 +00:00
|
|
|
gdk_gc_set_clip_rectangle (style->black_gc, area);
|
|
|
|
|
1999-01-11 18:49:54 +00:00
|
|
|
if (detail && !strcmp (detail, "add-mode"))
|
|
|
|
{
|
|
|
|
gdk_gc_set_line_attributes (style->black_gc, 1, GDK_LINE_ON_OFF_DASH, 0, 0);
|
|
|
|
gdk_gc_set_dashes (style->black_gc, 0, "\4\4", 2);
|
|
|
|
|
|
|
|
gdk_draw_rectangle (window,
|
1999-01-15 18:41:43 +00:00
|
|
|
style->black_gc, FALSE,
|
|
|
|
x, y, width, height);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
|
|
|
gdk_gc_set_line_attributes (style->black_gc, 1, GDK_LINE_SOLID, 0, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gdk_draw_rectangle (window,
|
1999-01-15 18:41:43 +00:00
|
|
|
style->black_gc, FALSE,
|
|
|
|
x, y, width, height);
|
1999-01-11 18:49:54 +00:00
|
|
|
}
|
1999-01-15 18:41:43 +00:00
|
|
|
|
1999-01-11 18:49:54 +00:00
|
|
|
if (area)
|
1999-01-15 18:41:43 +00:00
|
|
|
gdk_gc_set_clip_rectangle (style->black_gc, NULL);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
static void
|
|
|
|
gtk_default_draw_slider (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GtkOrientation orientation)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1999-01-11 18:49:54 +00:00
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
if (width == -1 && height == -1)
|
1999-01-11 18:49:54 +00:00
|
|
|
gdk_window_get_size (window, &width, &height);
|
|
|
|
else if (width == -1)
|
|
|
|
gdk_window_get_size (window, &width, NULL);
|
|
|
|
else if (height == -1)
|
|
|
|
gdk_window_get_size (window, NULL, &height);
|
|
|
|
|
|
|
|
gtk_paint_box (style, window, state_type, shadow_type,
|
1999-01-15 18:41:43 +00:00
|
|
|
area, widget, detail, x, y, width, height);
|
|
|
|
|
1999-01-11 18:49:54 +00:00
|
|
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
|
|
|
gtk_paint_vline (style, window, state_type, area, widget, detail,
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->ythickness,
|
|
|
|
height - style->klass->ythickness - 1, width / 2);
|
1999-01-11 18:49:54 +00:00
|
|
|
else
|
|
|
|
gtk_paint_hline (style, window, state_type, area, widget, detail,
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->xthickness,
|
|
|
|
width - style->klass->xthickness - 1, height / 2);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
static void
|
1999-01-15 18:41:43 +00:00
|
|
|
gtk_default_draw_handle (GtkStyle *style,
|
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GtkOrientation orientation)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
1999-01-11 18:49:54 +00:00
|
|
|
gint xx, yy;
|
|
|
|
gint xthick, ythick;
|
|
|
|
GdkGC *light_gc, *dark_gc;
|
1999-03-09 21:26:57 +00:00
|
|
|
GdkRectangle rect;
|
1999-01-11 18:49:54 +00:00
|
|
|
GdkRectangle dest;
|
1999-03-09 21:26:57 +00:00
|
|
|
gint intersect;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
if (width == -1 && height == -1)
|
1999-01-11 18:49:54 +00:00
|
|
|
gdk_window_get_size (window, &width, &height);
|
|
|
|
else if (width == -1)
|
|
|
|
gdk_window_get_size (window, &width, NULL);
|
|
|
|
else if (height == -1)
|
|
|
|
gdk_window_get_size (window, NULL, &height);
|
|
|
|
|
|
|
|
gtk_paint_box (style, window, state_type, shadow_type, area, widget,
|
1999-01-15 18:41:43 +00:00
|
|
|
detail, x, y, width, height);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
|
|
|
light_gc = style->light_gc[state_type];
|
|
|
|
dark_gc = style->dark_gc[state_type];
|
|
|
|
|
|
|
|
xthick = style->klass->xthickness;
|
|
|
|
ythick = style->klass->ythickness;
|
|
|
|
|
1999-03-09 21:26:57 +00:00
|
|
|
rect.x = x + xthick;
|
|
|
|
rect.y = y + ythick;
|
|
|
|
rect.width = width - (xthick * 2);
|
|
|
|
rect.height = height - (ythick * 2);
|
|
|
|
|
|
|
|
if (area)
|
|
|
|
intersect = gdk_rectangle_intersect (area, &rect, &dest);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
intersect = TRUE;
|
|
|
|
dest = rect;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!intersect)
|
|
|
|
return;
|
|
|
|
|
|
|
|
#define DRAW_POINT(w, gc, clip, xx, yy) \
|
|
|
|
{ \
|
|
|
|
if ((xx) >= (clip).x \
|
|
|
|
&& (yy) >= (clip).y \
|
|
|
|
&& (xx) < (clip).x + (clip).width \
|
|
|
|
&& (yy) < (clip).y + (clip).height) \
|
|
|
|
gdk_draw_point ((w), (gc), (xx), (yy)); \
|
|
|
|
}
|
|
|
|
|
1999-01-11 18:49:54 +00:00
|
|
|
for (yy = y + ythick; yy < (y + height - ythick); yy += 3)
|
|
|
|
for (xx = x + xthick; xx < (x + width - xthick); xx += 6)
|
|
|
|
{
|
1999-03-09 21:26:57 +00:00
|
|
|
DRAW_POINT (window, light_gc, dest, xx, yy);
|
|
|
|
DRAW_POINT (window, dark_gc, dest, xx + 1, yy + 1);
|
|
|
|
|
|
|
|
DRAW_POINT (window, light_gc, dest, xx + 3, yy + 1);
|
|
|
|
DRAW_POINT (window, dark_gc, dest, xx + 4, yy + 2);
|
1999-01-11 18:49:54 +00:00
|
|
|
}
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_style_shade (GdkColor *a,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkColor *b,
|
|
|
|
gdouble k)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
gdouble red;
|
|
|
|
gdouble green;
|
|
|
|
gdouble blue;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
red = (gdouble) a->red / 65535.0;
|
|
|
|
green = (gdouble) a->green / 65535.0;
|
|
|
|
blue = (gdouble) a->blue / 65535.0;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
rgb_to_hls (&red, &green, &blue);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
green *= k;
|
|
|
|
if (green > 1.0)
|
|
|
|
green = 1.0;
|
|
|
|
else if (green < 0.0)
|
|
|
|
green = 0.0;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
blue *= k;
|
|
|
|
if (blue > 1.0)
|
|
|
|
blue = 1.0;
|
|
|
|
else if (blue < 0.0)
|
|
|
|
blue = 0.0;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
hls_to_rgb (&red, &green, &blue);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
b->red = red * 65535.0;
|
|
|
|
b->green = green * 65535.0;
|
|
|
|
b->blue = blue * 65535.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
rgb_to_hls (gdouble *r,
|
1999-01-15 18:41:43 +00:00
|
|
|
gdouble *g,
|
|
|
|
gdouble *b)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
gdouble min;
|
|
|
|
gdouble max;
|
|
|
|
gdouble red;
|
|
|
|
gdouble green;
|
|
|
|
gdouble blue;
|
|
|
|
gdouble h, l, s;
|
|
|
|
gdouble delta;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
red = *r;
|
|
|
|
green = *g;
|
|
|
|
blue = *b;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (red > green)
|
|
|
|
{
|
|
|
|
if (red > blue)
|
1999-01-15 18:41:43 +00:00
|
|
|
max = red;
|
1997-11-24 22:37:52 +00:00
|
|
|
else
|
1999-01-15 18:41:43 +00:00
|
|
|
max = blue;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (green < blue)
|
1999-01-15 18:41:43 +00:00
|
|
|
min = green;
|
1997-11-24 22:37:52 +00:00
|
|
|
else
|
1999-01-15 18:41:43 +00:00
|
|
|
min = blue;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (green > blue)
|
1999-01-15 18:41:43 +00:00
|
|
|
max = green;
|
1997-11-24 22:37:52 +00:00
|
|
|
else
|
1999-01-15 18:41:43 +00:00
|
|
|
max = blue;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (red < blue)
|
1999-01-15 18:41:43 +00:00
|
|
|
min = red;
|
1997-11-24 22:37:52 +00:00
|
|
|
else
|
1999-01-15 18:41:43 +00:00
|
|
|
min = blue;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
l = (max + min) / 2;
|
|
|
|
s = 0;
|
|
|
|
h = 0;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (max != min)
|
|
|
|
{
|
|
|
|
if (l <= 0.5)
|
1999-01-15 18:41:43 +00:00
|
|
|
s = (max - min) / (max + min);
|
1997-11-24 22:37:52 +00:00
|
|
|
else
|
1999-01-15 18:41:43 +00:00
|
|
|
s = (max - min) / (2 - max - min);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
delta = max -min;
|
|
|
|
if (red == max)
|
1999-01-15 18:41:43 +00:00
|
|
|
h = (green - blue) / delta;
|
1997-11-24 22:37:52 +00:00
|
|
|
else if (green == max)
|
1999-01-15 18:41:43 +00:00
|
|
|
h = 2 + (blue - red) / delta;
|
1997-11-24 22:37:52 +00:00
|
|
|
else if (blue == max)
|
1999-01-15 18:41:43 +00:00
|
|
|
h = 4 + (red - green) / delta;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
h *= 60;
|
|
|
|
if (h < 0.0)
|
1999-01-15 18:41:43 +00:00
|
|
|
h += 360;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
*r = h;
|
|
|
|
*g = l;
|
|
|
|
*b = s;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
hls_to_rgb (gdouble *h,
|
1999-01-15 18:41:43 +00:00
|
|
|
gdouble *l,
|
|
|
|
gdouble *s)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
gdouble hue;
|
|
|
|
gdouble lightness;
|
|
|
|
gdouble saturation;
|
|
|
|
gdouble m1, m2;
|
|
|
|
gdouble r, g, b;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
lightness = *l;
|
|
|
|
saturation = *s;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (lightness <= 0.5)
|
|
|
|
m2 = lightness * (1 + saturation);
|
|
|
|
else
|
|
|
|
m2 = lightness + saturation - lightness * saturation;
|
|
|
|
m1 = 2 * lightness - m2;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (saturation == 0)
|
|
|
|
{
|
|
|
|
*h = lightness;
|
|
|
|
*l = lightness;
|
|
|
|
*s = lightness;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
hue = *h + 120;
|
|
|
|
while (hue > 360)
|
1999-01-15 18:41:43 +00:00
|
|
|
hue -= 360;
|
1997-11-24 22:37:52 +00:00
|
|
|
while (hue < 0)
|
1999-01-15 18:41:43 +00:00
|
|
|
hue += 360;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (hue < 60)
|
1999-01-15 18:41:43 +00:00
|
|
|
r = m1 + (m2 - m1) * hue / 60;
|
1997-11-24 22:37:52 +00:00
|
|
|
else if (hue < 180)
|
1999-01-15 18:41:43 +00:00
|
|
|
r = m2;
|
1997-11-24 22:37:52 +00:00
|
|
|
else if (hue < 240)
|
1999-01-15 18:41:43 +00:00
|
|
|
r = m1 + (m2 - m1) * (240 - hue) / 60;
|
1997-11-24 22:37:52 +00:00
|
|
|
else
|
1999-01-15 18:41:43 +00:00
|
|
|
r = m1;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
hue = *h;
|
|
|
|
while (hue > 360)
|
1999-01-15 18:41:43 +00:00
|
|
|
hue -= 360;
|
1997-11-24 22:37:52 +00:00
|
|
|
while (hue < 0)
|
1999-01-15 18:41:43 +00:00
|
|
|
hue += 360;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (hue < 60)
|
1999-01-15 18:41:43 +00:00
|
|
|
g = m1 + (m2 - m1) * hue / 60;
|
1997-11-24 22:37:52 +00:00
|
|
|
else if (hue < 180)
|
1999-01-15 18:41:43 +00:00
|
|
|
g = m2;
|
1997-11-24 22:37:52 +00:00
|
|
|
else if (hue < 240)
|
1999-01-15 18:41:43 +00:00
|
|
|
g = m1 + (m2 - m1) * (240 - hue) / 60;
|
1997-11-24 22:37:52 +00:00
|
|
|
else
|
1999-01-15 18:41:43 +00:00
|
|
|
g = m1;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
hue = *h - 120;
|
|
|
|
while (hue > 360)
|
1999-01-15 18:41:43 +00:00
|
|
|
hue -= 360;
|
1997-11-24 22:37:52 +00:00
|
|
|
while (hue < 0)
|
1999-01-15 18:41:43 +00:00
|
|
|
hue += 360;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (hue < 60)
|
1999-01-15 18:41:43 +00:00
|
|
|
b = m1 + (m2 - m1) * hue / 60;
|
1997-11-24 22:37:52 +00:00
|
|
|
else if (hue < 180)
|
1999-01-15 18:41:43 +00:00
|
|
|
b = m2;
|
1997-11-24 22:37:52 +00:00
|
|
|
else if (hue < 240)
|
1999-01-15 18:41:43 +00:00
|
|
|
b = m1 + (m2 - m1) * (240 - hue) / 60;
|
1997-11-24 22:37:52 +00:00
|
|
|
else
|
1999-01-15 18:41:43 +00:00
|
|
|
b = m1;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
*h = r;
|
|
|
|
*l = g;
|
|
|
|
*s = b;
|
|
|
|
}
|
|
|
|
}
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
void
|
|
|
|
gtk_paint_hline (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x1,
|
|
|
|
gint x2,
|
|
|
|
gint y)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_hline != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_hline (style, window, state_type, area, widget, detail, x1, x2, y);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_paint_vline (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint y1,
|
|
|
|
gint y2,
|
|
|
|
gint x)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_vline != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_vline (style, window, state_type, area, widget, detail, y1, y2, x);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_paint_shadow (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_shadow != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_shadow (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_paint_polygon (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
GdkPoint *points,
|
|
|
|
gint npoints,
|
|
|
|
gboolean fill)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_shadow != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_polygon (style, window, state_type, shadow_type, area, widget, detail, points, npoints, fill);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_paint_arrow (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
GtkArrowType arrow_type,
|
|
|
|
gboolean fill,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_arrow != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_arrow (style, window, state_type, shadow_type, area, widget, detail, arrow_type, fill, x, y, width, height);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_paint_diamond (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_diamond != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_diamond (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_paint_oval (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_oval != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_oval (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_paint_string (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
const gchar *string)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
1999-01-15 18:41:43 +00:00
|
|
|
g_return_if_fail (style->klass->draw_string != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_string (style, window, state_type, area, widget, detail, x, y, string);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_paint_box (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_box != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_paint_flat_box (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_flat_box != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_flat_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_paint_check (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_check != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_check (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_paint_option (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_option != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_option (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_paint_cross (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_cross != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_cross (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_paint_ramp (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
GtkArrowType arrow_type,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_ramp != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_ramp (style, window, state_type, shadow_type, area, widget, detail, arrow_type, x, y, width, height);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_paint_tab (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_tab != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_tab (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_paint_shadow_gap (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GtkPositionType gap_side,
|
|
|
|
gint gap_x,
|
|
|
|
gint gap_width)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_shadow_gap != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_shadow_gap (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side, gap_x, gap_width);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_paint_box_gap (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GtkPositionType gap_side,
|
|
|
|
gint gap_x,
|
|
|
|
gint gap_width)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_box_gap != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_box_gap (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side, gap_x, gap_width);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_paint_extension (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GtkPositionType gap_side)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_extension != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_extension (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_paint_focus (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_focus != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_focus (style, window, area, widget, detail, x, y, width, height);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_paint_slider (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GtkOrientation orientation)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_slider != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_slider (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, orientation);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_paint_handle (GtkStyle *style,
|
1999-01-15 18:41:43 +00:00
|
|
|
GdkWindow *window,
|
|
|
|
GtkStateType state_type,
|
|
|
|
GtkShadowType shadow_type,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GtkOrientation orientation)
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->klass != NULL);
|
|
|
|
g_return_if_fail (style->klass->draw_handle != NULL);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1999-01-15 18:41:43 +00:00
|
|
|
style->klass->draw_handle (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, orientation);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|