Changeset 271 for trunk/gtk


Ignore:
Timestamp:
Jun 1, 2006, 6:08:45 PM (16 years ago)
Author:
joshe
Message:

Try harder to use the right color for the progress bar text.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/tr_cell_renderer_torrent.c

    r261 r271  
    248248  gboolean rtl;
    249249  GtkStyle *style;
     250  GtkCellRendererState textstate;
    250251
    251252  /* try to use the style for GtkProgressBar */
     
    292293    text.x += text.width - trect.width;
    293294
     295  /* determine the state to render the text as */
     296  if(GTK_CELL_RENDERER_INSENSITIVE & flags || !cell->sensitive)
     297    textstate = GTK_STATE_INSENSITIVE;
     298  else if(GTK_CELL_RENDERER_SELECTED & flags)
     299    textstate = (GTK_WIDGET_HAS_FOCUS(widget) ?
     300                 GTK_STATE_SELECTED : GTK_STATE_ACTIVE);
     301  else if(GTK_CELL_RENDERER_PRELIT & flags &&
     302          GTK_STATE_PRELIGHT == GTK_WIDGET_STATE(widget))
     303    textstate = GTK_STATE_PRELIGHT;
     304  else if(GTK_STATE_INSENSITIVE == GTK_WIDGET_STATE(widget))
     305    textstate = GTK_STATE_INSENSITIVE;
     306  else
     307    textstate = GTK_STATE_NORMAL;
     308
    294309  /* draw the background of the bar */
    295310  if(complete.width < bar.width)
     
    303318
    304319  /* draw the text under the bar */
    305   gtk_paint_layout(widget->style, window, (GTK_CELL_RENDERER_SELECTED & flags ?
    306                    GTK_STATE_SELECTED : GTK_STATE_NORMAL), FALSE, &text,
     320  gtk_paint_layout(widget->style, window, textstate, TRUE, &text,
    307321                   widget, "cellrenderertext", text.x, text.y, tlayout);
    308322
Note: See TracChangeset for help on using the changeset viewer.