Esempio n. 1
0
/* Draw Function For Boxes Traditionally Either Without Borders, 
		or With A Single Pixel Line */
void
hc_draw_flat_box (GtkStyle	*style,
                  cairo_t  	*cr,
                  GtkStateType	 state_type,
                  GtkShadowType	 shadow_type,
                  GtkWidget	*widget,
                  const gchar	*detail,
                  gint		 x,
                  gint		 y,
                  gint		 width,
                  gint		 height)
{
	if (detail && !strcmp ("tooltip", detail))
	{
		hc_draw_box (style, cr, state_type, shadow_type,
				widget, detail, x, y, width, height);
	}
	else
	{
		GtkStyleClass *hc_parent_class;
		hc_parent_class = GTK_STYLE_CLASS (g_type_class_peek_parent (G_OBJECT_GET_CLASS(style)));
		hc_parent_class->draw_flat_box (style, cr, state_type, shadow_type,
							widget, detail, x, y, width, height);
	}
}
Esempio n. 2
0
static void
sapwood_style_class_init (SapwoodStyleClass *klass)
{
  GtkStyleClass *style_class = GTK_STYLE_CLASS (klass);

  style_class->draw_hline = draw_hline;
  style_class->draw_vline = draw_vline;
  style_class->draw_shadow = draw_shadow;
  style_class->draw_arrow = draw_arrow;
  style_class->draw_diamond = draw_diamond;
#if !GTK_CHECK_VERSION(2,90,1)
  style_class->draw_string = draw_string;
#endif
  style_class->draw_box = draw_box;
  style_class->draw_flat_box = draw_flat_box;
  style_class->draw_check = draw_check;
  style_class->draw_option = draw_option;
  style_class->draw_tab = draw_tab;
  style_class->draw_shadow_gap = draw_shadow_gap;
  style_class->draw_box_gap = draw_box_gap;
  style_class->draw_extension = draw_extension;
  style_class->draw_focus = draw_focus;
  style_class->draw_slider = draw_slider;
  style_class->draw_handle = draw_handle;
  style_class->render_icon = render_icon;
  style_class->draw_expander = draw_expander;
  style_class->draw_layout = draw_layout;
}
Esempio n. 3
0
static void
pixbuf_style_class_init (PixbufStyleClass *klass)
{
  GtkStyleClass *style_class = GTK_STYLE_CLASS (klass);

  parent_class = g_type_class_peek_parent (klass);

  style_class->draw_hline = draw_hline;
  style_class->draw_vline = draw_vline;
  style_class->draw_shadow = draw_shadow;
  style_class->draw_arrow = draw_arrow;
  style_class->draw_diamond = draw_diamond;
  style_class->draw_box = draw_box;
  style_class->draw_flat_box = draw_flat_box;
  style_class->draw_check = draw_check;
  style_class->draw_option = draw_option;
  style_class->draw_tab = draw_tab;
  style_class->draw_shadow_gap = draw_shadow_gap;
  style_class->draw_box_gap = draw_box_gap;
  style_class->draw_extension = draw_extension;
  style_class->draw_focus = draw_focus;
  style_class->draw_slider = draw_slider;
  style_class->draw_handle = draw_handle;
  style_class->draw_expander = draw_expander;
  style_class->draw_resize_grip = draw_resize_grip;
}
void
adwaita_draw_flat_box (GtkStyle      *style,
                       GdkWindow     *window,
                       GtkStateType   state_type,
                       GtkShadowType  shadow_type,
                       GdkRectangle  *area,
                       GtkWidget     *widget,
                       const gchar   *detail,
                       gint           x,
                       gint	      y,
                       gint	      width,
                       gint	      height)
{
  const gchar *app_name;

  GTK_STYLE_CLASS (adwaita_style_parent_class)->draw_flat_box (style, window, state_type, shadow_type,
                                                               area, widget, detail,
                                                               x, y, width, height);

  /* HACK: this is totally awful, but I don't see a better way to "tag" the OO.o hierarchy */
  if (!GTK_IS_WINDOW (widget) ||
      (gtk_window_get_window_type (GTK_WINDOW (widget)) != GTK_WINDOW_TOPLEVEL))
    return;

  app_name = g_get_application_name ();
  if (g_str_has_prefix (app_name, "OpenOffice.org"))
    do_toplevel_hack (widget, "openoffice-toplevel");
  else if (g_str_has_prefix (app_name, "LibreOffice"))
    do_toplevel_hack (widget, "libreoffice-toplevel");
}
static void
adwaita_draw_box (GtkStyle * style,
                  GdkWindow * window,
                  GtkStateType state_type,
                  GtkShadowType shadow_type,
                  GdkRectangle * area,
                  GtkWidget * widget,
                  const gchar * detail,
                  gint x,
                  gint y,
                  gint width,
                  gint height)
{
  if (GTK_IS_MENU (widget) &&
      g_strcmp0 (detail, "menu") == 0 &&
      wm_is_fallback ())
    {
      cairo_t *cr = drawable_to_cairo (window, area);
      cairo_set_source_rgb (cr, 0.34, 0.34, 0.33);
      cairo_rectangle (cr, x, y, width, height);
      cairo_stroke (cr);

      cairo_destroy (cr);
    }
  else
    {
      GTK_STYLE_CLASS (adwaita_style_parent_class)->draw_box (style, window, state_type, shadow_type,
                                                              area, widget, detail,
                                                              x, y, width, height);
    }
}
static void
moblin_netbook_style_class_init (MoblinNetbookStyleClass *klass)
{
  GtkStyleClass *style_class = GTK_STYLE_CLASS (klass);
  const gchar *debug;

  /* Set debugging if required. We only need to do this once per instance, so
   * it is safe to do in the class-init */
  debug = getenv ("MOBLIN_NETBOOK_ENGINE_DEBUG");
  if (debug)
    do_debug = atoi (debug);


  style_class->init_from_rc = moblin_netbook_init_from_rc;
  style_class->copy = moblin_netbook_style_copy;

  style_class->draw_shadow = moblin_netbook_draw_shadow;
  style_class->draw_box = moblin_netbook_draw_box;
  style_class->draw_check = moblin_netbook_draw_check;
  style_class->draw_option = moblin_netbook_draw_option;
  style_class->draw_box_gap = moblin_netbook_draw_box_gap;
  style_class->draw_shadow_gap = moblin_netbook_draw_box_gap;
  style_class->draw_extension = moblin_netbook_draw_extension;
  style_class->draw_hline = moblin_netbook_draw_hline;
  style_class->draw_vline = moblin_netbook_draw_vline;
  style_class->draw_focus = moblin_netbook_draw_focus;
  style_class->draw_arrow = moblin_netbook_draw_arrow;
  style_class->draw_handle = moblin_netbook_draw_handle;
  style_class->draw_resize_grip = moblin_netbook_draw_resize_grip;
  style_class->draw_layout = moblin_netbook_draw_layout;
  style_class->render_icon = moblin_netbook_render_icon;
  style_class->draw_expander = moblin_netbook_draw_expander;
}
Esempio n. 7
0
static void
draw_focus (GtkStyle     *style,
	    GdkWindow    *window,
	    GtkStateType  state,
	    GdkRectangle *area,
	    GtkWidget    *widget,
	    const gchar  *detail,
	    gint          x,
	    gint          y,
	    gint          width,
	    gint          height)
{
  ThemeMatchData match_data;

  g_return_if_fail (style != NULL);
  g_return_if_fail (window != NULL);

  /* FIXME: memory leak */
  LOG ("widget=%s, primitive=focus, state=%s, detail='%s', name='%s'",
        G_OBJECT_TYPE_NAME (widget),
        enum_value_to_string (gtk_state_type_get_type (), state),
        detail,
        gtk_widget_get_name (widget));

  match_data.function = TOKEN_D_FOCUS;
  match_data.detail = (gchar *)detail;
  match_data.flags = THEME_MATCH_STATE;
  match_data.state = state;

  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE,
			  x, y, width, height))
    GTK_STYLE_CLASS (sapwood_style_parent_class)->draw_focus (
      style, window, state, area, widget, detail, x, y, width, height);
}
Esempio n. 8
0
static void
rsvg_style_class_init (RsvgStyleClass *klass)
{
  GtkStyleClass *style_class = GTK_STYLE_CLASS (klass);

  parent_class = g_type_class_peek_parent (klass);

  style_class->draw_hline = draw_hline;
  style_class->draw_vline = draw_vline;
  style_class->draw_shadow = draw_shadow;
  style_class->draw_arrow = draw_arrow;
  style_class->draw_diamond = draw_diamond;
#if ! (GTK_CHECK_VERSION(2,90,0))
  style_class->draw_string = draw_string;
#endif
  style_class->draw_box = draw_box;
  style_class->draw_flat_box = draw_flat_box;
  style_class->draw_check = draw_check;
  style_class->draw_option = draw_option;
  style_class->draw_tab = draw_tab;
  style_class->draw_shadow_gap = draw_shadow_gap;
  style_class->draw_box_gap = draw_box_gap;
  style_class->draw_extension = draw_extension;
  style_class->draw_focus = draw_focus;
  style_class->draw_slider = draw_slider;
  style_class->draw_handle = draw_handle;
}
static void
adwaita_style_class_init (AdwaitaStyleClass * klass)
{
  GtkStyleClass *style_class = GTK_STYLE_CLASS (klass);

  style_class->draw_box = adwaita_draw_box;
  style_class->draw_flat_box = adwaita_draw_flat_box;
}
Esempio n. 10
0
static void
draw_expander (GtkStyle        *style,
               GdkWindow       *window,
               GtkStateType     state,
               GdkRectangle    *area,
               GtkWidget       *widget,
               const gchar     *detail,
               gint             center_x,
               gint             center_y,
               GtkExpanderStyle expander_style)
{
  ThemeMatchData match_data;
  gint expander_size = 10;

  g_return_if_fail (style != NULL);
  g_return_if_fail (window != NULL);

  /* FIXME: memory leak */
  LOG ("widget=%s, primitive=expander, state=%s, detail='%s', name='%s'",
        G_OBJECT_TYPE_NAME (widget),
        enum_value_to_string (gtk_state_type_get_type (), state),
        detail,
        gtk_widget_get_name (widget));

  /* Reusing the arrow theming here as it's flexible enough (almost, we do lose
   * the intermediate states.) It also allows us to use existing gtkrc.
   * XXX Might want to introduce proper keywords for expanders some day.
   */

  if (widget)
    gtk_widget_style_get (widget, "expander-size", &expander_size, NULL);

  match_data.function = TOKEN_D_ARROW;
  match_data.detail = (gchar *)detail;
  match_data.flags = THEME_MATCH_STATE | THEME_MATCH_ARROW_DIRECTION;
  match_data.state = state;

  switch (expander_style)
    {
    case GTK_EXPANDER_COLLAPSED:
    case GTK_EXPANDER_SEMI_COLLAPSED:
      match_data.arrow_direction = GTK_ARROW_RIGHT;
      break;
    case GTK_EXPANDER_EXPANDED:
    case GTK_EXPANDER_SEMI_EXPANDED:
      match_data.arrow_direction = GTK_ARROW_DOWN;
      break;
    default:
      g_return_if_reached ();
    }

  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE,
                          center_x - expander_size/2, center_y - expander_size/2, expander_size, expander_size))
    GTK_STYLE_CLASS (sapwood_style_parent_class)->draw_expander (
      style, window, state, area, widget, detail,
      center_x, center_y, expander_style);
}
Esempio n. 11
0
static void
thinice_style_realize (GtkStyle * style)
{
  ThiniceStyle *thinice_style = THINICE_STYLE (style);
 
  GTK_STYLE_CLASS (thinice_style_parent_class)->realize (style);
 
  ge_gtk_style_to_cairo_color_cube (style, &thinice_style->color_cube);
}
Esempio n. 12
0
static void
draw_flat_box (GtkStyle     *style,
	       GdkWindow    *window,
	       GtkStateType  state,
	       GtkShadowType shadow,
	       GdkRectangle *area,
	       GtkWidget    *widget,
	       const gchar  *detail,
	       gint          x,
	       gint          y,
	       gint          width,
	       gint          height)
{
  ThemeMatchData match_data;

  g_return_if_fail (style != NULL);
  g_return_if_fail (window != NULL);

  /* FIXME: memory leak */
  LOG ("widget=%s, primitive=flat_box, state=%s, shadow=%s, detail='%s', name='%s'",
        G_OBJECT_TYPE_NAME (widget),
        enum_value_to_string (gtk_state_type_get_type (), state),
        enum_value_to_string (gtk_shadow_type_get_type (), shadow),
        detail,
        gtk_widget_get_name (widget));

  /* Hack because Gtk doesn't give us the correct widget state */
  if (widget && GTK_IS_ENTRY(widget))
  {
    if (!gtk_widget_is_sensitive (widget))
      state = GTK_STATE_INSENSITIVE;

    if (gtk_widget_has_focus (widget))
      state = GTK_STATE_ACTIVE;
  }

  match_data.function = TOKEN_D_FLAT_BOX;
  match_data.detail = (gchar *)detail;
  match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
  match_data.shadow = shadow;
  match_data.state = state;

  /* Special handling for treeview cursor row */
  if (GTK_IS_TREE_VIEW (widget))
    maybe_check_cursor_position (GTK_TREE_VIEW (widget), x, y, width, height, &match_data);

  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE,
			  x, y, width, height))
    GTK_STYLE_CLASS (sapwood_style_parent_class)->draw_flat_box (
      style, window, state, shadow, area, widget, detail, x, y, width, height);
}
Esempio n. 13
0
static void
draw_box (GtkStyle     *style,
          GdkWindow    *window,
          GtkStateType  state,
          GtkShadowType shadow,
          GdkRectangle *area,
          GtkWidget    *widget,
          const gchar  *detail,
          gint          x,
          gint          y,
          gint          width,
          gint          height)
{
  ThemeMatchData match_data;

  g_return_if_fail (style != NULL);
  g_return_if_fail (window != NULL);

  /* FIXME: memory leak */
  LOG ("widget=%s, primitive=box, state=%s, shadow=%s, detail='%s', name='%s'",
        G_OBJECT_TYPE_NAME (widget),
        enum_value_to_string (gtk_state_type_get_type (), state),
        enum_value_to_string (gtk_shadow_type_get_type (), shadow),
        detail,
        gtk_widget_get_name (widget));

  if (detail &&
      (strcmp (detail, "hscrollbar") == 0 || strcmp (detail, "vscrollbar") == 0))
    {
      /* We handle this in draw_arrow */
      return;
    }

  match_data.function = TOKEN_D_BOX;
  match_data.detail = (gchar *)detail;
  match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
  match_data.shadow = shadow;
  match_data.state = state;

  if (GTK_IS_MENU_ITEM (widget))
    maybe_check_submenu_state (GTK_MENU_ITEM (widget), &match_data);

  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE,
			  x, y, width, height)) {
    GTK_STYLE_CLASS (sapwood_style_parent_class)->draw_box (
      style, window, state, shadow, area, widget, detail, x, y, width, height);
  }
}
static void
moblin_netbook_style_copy (GtkStyle *dest,
                           GtkStyle *src)
{
  int i;
  MoblinNetbookStyle *mb_dest = MOBLIN_NETBOOK_STYLE (dest);
  MoblinNetbookStyle *mb_src = MOBLIN_NETBOOK_STYLE (src);

  mb_dest->radius = mb_src->radius;

  for (i = 0; i < 5; i++)
    mb_dest->border_color[i] = mb_src->border_color[i];

  mb_dest->shadow = mb_src->shadow;

  GTK_STYLE_CLASS (moblin_netbook_style_parent_class)->copy (dest, src);
}
Esempio n. 15
0
static void
draw_check (GtkStyle     *style,
	    GdkWindow    *window,
	    GtkStateType  state,
	    GtkShadowType shadow,
	    GdkRectangle *area,
	    GtkWidget    *widget,
	    const gchar  *detail,
	    gint          x,
	    gint          y,
	    gint          width,
	    gint          height)
{
  ThemeMatchData match_data;

  g_return_if_fail (style != NULL);
  g_return_if_fail (window != NULL);

  /* FIXME: memory leak */
  LOG ("widget=%s, primitive=check, state=%s, shadow=%s, detail='%s', name='%s'",
        G_OBJECT_TYPE_NAME (widget),
        enum_value_to_string (gtk_state_type_get_type (), state),
        enum_value_to_string (gtk_shadow_type_get_type (), shadow),
        detail,
        gtk_widget_get_name (widget));

  match_data.function = TOKEN_D_CHECK;
  match_data.detail = (gchar *)detail;
  match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
  match_data.shadow = shadow;
  match_data.state = state;

  /* Special casing for GtkCheckButton: We want to set the widget state to
   * ACTIVE to get the correct graphics used in the RC files. Ideally we'd
   * use the FOCUS rules, but this is not possible due to technical limitations
   * in how focus is drawn in sapwood */
  if (GTK_IS_CHECK_BUTTON (widget) &&
      gtk_widget_has_focus (widget))
    match_data.state = GTK_STATE_ACTIVE;

  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE,
			  x, y, width, height))
    GTK_STYLE_CLASS (sapwood_style_parent_class)->draw_check (
      style, window, state, shadow, area, widget, detail, x, y, width, height);
}
Esempio n. 16
0
static void
draw_vline (GtkStyle     *style,
	    GdkWindow    *window,
	    GtkStateType  state,
	    GdkRectangle *area,
	    GtkWidget    *widget,
	    const gchar  *detail,
	    gint          y1,
	    gint          y2,
	    gint          x)
{
  ThemeImage    *image;
  ThemeMatchData match_data;

  g_return_if_fail (style != NULL);
  g_return_if_fail (window != NULL);

  /* FIXME: memory leak */
  LOG ("widget=%s, primitive=vline, state=%s, detail='%s', name='%s'",
        G_OBJECT_TYPE_NAME (widget),
        enum_value_to_string (gtk_state_type_get_type (), state),
        detail,
        gtk_widget_get_name (widget));

  match_data.function = TOKEN_D_VLINE;
  match_data.detail = (gchar *)detail;
  match_data.flags = THEME_MATCH_ORIENTATION | THEME_MATCH_STATE;
  match_data.state = state;
  match_data.orientation = GTK_ORIENTATION_VERTICAL;

  image = match_theme_image (style, &match_data);
  if (image)
    {
      if (image->background)
        theme_pixbuf_render (image->background, G_OBJECT_TYPE (widget),
			     window, NULL, area, COMPONENT_ALL, FALSE,
			     x, y1, 2, (y2 - y1) + 1);
    }
  else
    GTK_STYLE_CLASS (sapwood_style_parent_class)->draw_vline (
      style, window, state, area, widget, detail, y1, y2, x);
}
Esempio n. 17
0
static void
draw_handle (GtkStyle      *style,
	     GdkWindow     *window,
	     GtkStateType   state,
	     GtkShadowType  shadow,
	     GdkRectangle  *area,
	     GtkWidget     *widget,
	     const gchar   *detail,
	     gint           x,
	     gint           y,
	     gint           width,
	     gint           height,
	     GtkOrientation orientation)
{
  ThemeMatchData match_data;

  g_return_if_fail (style != NULL);
  g_return_if_fail (window != NULL);

  /* FIXME: memory leak */
  LOG ("widget=%s, primitive=handle, state=%s, shadow=%s, detail='%s', name='%s'",
        G_OBJECT_TYPE_NAME (widget),
        enum_value_to_string (gtk_state_type_get_type (), state),
        enum_value_to_string (gtk_shadow_type_get_type (), shadow),
        detail,
        gtk_widget_get_name (widget));

  match_data.function = TOKEN_D_HANDLE;
  match_data.detail = (gchar *)detail;
  match_data.flags = (THEME_MATCH_SHADOW | 
		      THEME_MATCH_STATE | 
		      THEME_MATCH_ORIENTATION);
  match_data.shadow = shadow;
  match_data.state = state;
  match_data.orientation = orientation;

  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE,
			  x, y, width, height))
    GTK_STYLE_CLASS (sapwood_style_parent_class)->draw_handle (
      style, window, state, shadow, area, widget, detail,
      x, y, width, height, orientation);
}
Esempio n. 18
0
static void
draw_box_gap (GtkStyle       *style,
	      GdkWindow      *window,
	      GtkStateType    state,
	      GtkShadowType   shadow,
	      GdkRectangle   *area,
	      GtkWidget      *widget,
	      const gchar    *detail,
	      gint            x,
	      gint            y,
	      gint            width,
	      gint            height,
	      GtkPositionType gap_side,
	      gint            gap_x,
	      gint            gap_width)
{
  ThemeMatchData match_data;

  /* FIXME: memory leak */
  LOG ("widget=%s, primitive=box_gap, state=%s, shadow=%s, detail='%s', name='%s'",
        G_OBJECT_TYPE_NAME (widget),
        enum_value_to_string (gtk_state_type_get_type (), state),
        enum_value_to_string (gtk_shadow_type_get_type (), shadow),
        detail,
        gtk_widget_get_name (widget));

  match_data.function = TOKEN_D_BOX_GAP;
  match_data.detail = (gchar *)detail;
  match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
  match_data.flags = (THEME_MATCH_SHADOW | 
		      THEME_MATCH_STATE | 
		      THEME_MATCH_ORIENTATION);
  match_data.shadow = shadow;
  match_data.state = state;

  if (!draw_gap_image (style, window, area, widget, &match_data, TRUE,
		       x, y, width, height, gap_side, gap_x, gap_width))
    GTK_STYLE_CLASS (sapwood_style_parent_class)->draw_box_gap (
      style, window, state, shadow, area, widget, detail,
      x, y, width, height, gap_side, gap_x, gap_width);
}
static void
moblin_netbook_init_from_rc (GtkStyle   *style,
                             GtkRcStyle *rc_style)
{
  int i;
  MoblinNetbookStyle *mb_style;
  MoblinNetbookRcStyle *mb_rc_style;

  GTK_STYLE_CLASS (moblin_netbook_style_parent_class)->init_from_rc (style,
                                                                     rc_style);

  mb_rc_style = MOBLIN_NETBOOK_RC_STYLE (rc_style);
  mb_style = MOBLIN_NETBOOK_STYLE (style);

  mb_style->radius = mb_rc_style->radius;

  for (i = 0; i < 5; i++)
    mb_style->border_color[i] = mb_rc_style->border_color[i];

  mb_style->shadow = mb_rc_style->shadow;
}
Esempio n. 20
0
static void
clearlooks_style_class_init (ClearlooksStyleClass * klass)
{
	GtkStyleClass *style_class = GTK_STYLE_CLASS (klass);

	clearlooks_style_class = CLEARLOOKS_STYLE_CLASS (klass);
	clearlooks_parent_class = g_type_class_peek_parent (klass);

	style_class->copy             = clearlooks_style_copy;
	style_class->realize          = clearlooks_style_realize;
	style_class->unrealize        = clearlooks_style_unrealize;
	style_class->init_from_rc     = clearlooks_style_init_from_rc;
	style_class->draw_handle      = clearlooks_style_draw_handle;
	style_class->draw_slider      = clearlooks_style_draw_slider;
	style_class->draw_shadow_gap  = clearlooks_style_draw_shadow_gap;
	style_class->draw_focus       = clearlooks_style_draw_focus;
	style_class->draw_box         = clearlooks_style_draw_box;
	style_class->draw_shadow      = clearlooks_style_draw_shadow;
	style_class->draw_box_gap     = clearlooks_style_draw_box_gap;
	style_class->draw_extension   = clearlooks_style_draw_extension;
	style_class->draw_option      = clearlooks_style_draw_option;
	style_class->draw_check       = clearlooks_style_draw_check;
	style_class->draw_flat_box    = clearlooks_style_draw_flat_box;
	style_class->draw_vline       = clearlooks_style_draw_vline;
	style_class->draw_hline       = clearlooks_style_draw_hline;
	style_class->draw_resize_grip = clearlooks_style_draw_resize_grip;
	style_class->draw_tab         = clearlooks_style_draw_tab;
	style_class->draw_arrow       = clearlooks_style_draw_arrow;
	style_class->draw_layout      = clearlooks_style_draw_layout;
	style_class->render_icon      = clearlooks_style_draw_render_icon;

	clearlooks_register_style_classic (&clearlooks_style_class->style_functions[CL_STYLE_CLASSIC]);
	clearlooks_style_class->style_functions[CL_STYLE_GLOSSY] = clearlooks_style_class->style_functions[CL_STYLE_CLASSIC];
	clearlooks_register_style_glossy (&clearlooks_style_class->style_functions[CL_STYLE_GLOSSY]);
	clearlooks_style_class->style_functions[CL_STYLE_INVERTED] = clearlooks_style_class->style_functions[CL_STYLE_CLASSIC];
	clearlooks_register_style_inverted (&clearlooks_style_class->style_functions[CL_STYLE_INVERTED]);
	clearlooks_style_class->style_functions[CL_STYLE_GUMMY] = clearlooks_style_class->style_functions[CL_STYLE_CLASSIC];
	clearlooks_register_style_gummy (&clearlooks_style_class->style_functions[CL_STYLE_GUMMY]);
}
Esempio n. 21
0
static void
thinice_style_class_init (ThiniceStyleClass *klass)
{
  GtkStyleClass *style_class = GTK_STYLE_CLASS (klass);

  style_class->realize = thinice_style_realize;

  style_class->draw_hline = thinice_style_draw_hline;
  style_class->draw_vline = thinice_style_draw_vline;
  style_class->draw_shadow = thinice_style_draw_shadow;
  style_class->draw_arrow = thinice_style_draw_arrow;
  style_class->draw_diamond = thinice_style_draw_diamond;
  style_class->draw_box = thinice_style_draw_box;
  style_class->draw_tab = thinice_style_draw_box;

  style_class->draw_check = thinice_style_draw_check;
  style_class->draw_option = thinice_style_draw_option;
  style_class->draw_shadow_gap = thinice_style_draw_shadow_gap;
  style_class->draw_box_gap = thinice_style_draw_box_gap;
  style_class->draw_extension = thinice_style_draw_extension;
  style_class->draw_slider = thinice_style_draw_slider;
  style_class->draw_handle = thinice_style_draw_handle;
}
Esempio n. 22
0
static void
draw_arrow (GtkStyle     *style,
	    GdkWindow    *window,
	    GtkStateType  state,
	    GtkShadowType shadow,
	    GdkRectangle *area,
	    GtkWidget    *widget,
	    const gchar  *detail,
	    GtkArrowType  arrow_direction,
	    gint          fill,
	    gint          x,
	    gint          y,
	    gint          width,
	    gint          height)
{
  ThemeMatchData match_data;

  g_return_if_fail (style != NULL);
  g_return_if_fail (window != NULL);

  /* FIXME: memory leak */
  LOG ("widget=%s, primitive=arrow, state=%s, shadow=%s, detail='%s', name='%s'",
        G_OBJECT_TYPE_NAME (widget),
        enum_value_to_string (gtk_state_type_get_type (), state),
        enum_value_to_string (gtk_state_type_get_type (), state),
        detail,
        gtk_widget_get_name (widget));

  if (detail &&
      (strcmp (detail, "hscrollbar") == 0 || strcmp (detail, "vscrollbar") == 0))
    {
      /* This is a hack to work around the fact that scrollbar steppers are drawn
       * as a box + arrow, so we never have
       *
       *   The full bounding box of the scrollbar 
       *   The arrow direction
       *
       * At the same time. We simulate an extra paint function, "STEPPER", by doing
       * nothing for the box, and then here, reverse engineering the box that
       * was passed to draw box and using that
       */
      gint box_x = x;
      gint box_y = y;
      gint box_width = width;
      gint box_height = height;

      reverse_engineer_stepper_box (widget, arrow_direction,
				    &box_x, &box_y, &box_width, &box_height);

      match_data.function = TOKEN_D_STEPPER;
      match_data.detail = (gchar *)detail;
      match_data.flags = (THEME_MATCH_SHADOW | 
			  THEME_MATCH_STATE | 
			  THEME_MATCH_ARROW_DIRECTION);
      match_data.shadow = shadow;
      match_data.state = state;
      match_data.arrow_direction = arrow_direction;

      if (draw_simple_image (style, window, area, widget, &match_data, TRUE,
			     box_x, box_y, box_width, box_height))
	{
	  /* The theme included stepper images, we're done */
	  return;
	}

      /* Otherwise, draw the full box, and fall through to draw the arrow
       */
      match_data.function = TOKEN_D_BOX;
      match_data.detail = (gchar *)detail;
      match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
      match_data.shadow = shadow;
      match_data.state = state;

      if (!draw_simple_image (style, window, area, widget, &match_data, TRUE,
			      box_x, box_y, box_width, box_height))
	GTK_STYLE_CLASS (sapwood_style_parent_class)->draw_box (
          style, window, state, shadow, area, widget, detail,
          box_x, box_y, box_width, box_height);
    }

#if GTK_CHECK_VERSION(2,9,2)
  if (arrow_direction == GTK_ARROW_NONE)
    return;
#endif

  match_data.function = TOKEN_D_ARROW;
  match_data.detail = (gchar *)detail;
  match_data.flags = (THEME_MATCH_SHADOW | 
		      THEME_MATCH_STATE | 
		      THEME_MATCH_ARROW_DIRECTION);
  match_data.shadow = shadow;
  match_data.state = state;
  match_data.arrow_direction = arrow_direction;

  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE,
			  x, y, width, height))
    GTK_STYLE_CLASS (sapwood_style_parent_class)->draw_arrow (
      style, window, state, shadow, area, widget, detail,
      arrow_direction, fill, x, y, width, height);
}