[gtk+/wip/unfocused-fixes: 6/27] calendar: Use the widget state flags as a base for drawing days
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/unfocused-fixes: 6/27] calendar: Use the widget state flags as a base for drawing days
- Date: Mon, 19 Dec 2011 16:24:57 +0000 (UTC)
commit 5d285ee8be1a5308e8f3e5ac4c539313a345d6d7
Author: Rui Matos <tiagomatos gmail com>
Date: Thu Dec 15 01:39:00 2011 +0000
calendar: Use the widget state flags as a base for drawing days
Instead of building a set of state flags specifically for drawing days, base
it on the underlying widget state flags.
gtk/gtkcalendar.c | 33 ++++++++++++++-------------------
1 files changed, 14 insertions(+), 19 deletions(-)
---
diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c
index cff79bf..345d7ed 100644
--- a/gtk/gtkcalendar.c
+++ b/gtk/gtkcalendar.c
@@ -2590,6 +2590,7 @@ calendar_paint_day (GtkCalendar *calendar,
g_return_if_fail (col < 7);
context = gtk_widget_get_style_context (widget);
+ state = gtk_widget_get_state_flags (widget);
day = priv->day[row][col];
show_details = (priv->display_flags & GTK_CALENDAR_SHOW_DETAILS);
@@ -2598,30 +2599,24 @@ calendar_paint_day (GtkCalendar *calendar,
gtk_style_context_save (context);
- if (!gtk_widget_get_sensitive (widget))
- state |= GTK_STATE_FLAG_INSENSITIVE;
+ state &= ~(GTK_STATE_FLAG_INCONSISTENT | GTK_STATE_FLAG_ACTIVE | GTK_STATE_FLAG_SELECTED);
+
+ if (priv->day_month[row][col] == MONTH_PREV ||
+ priv->day_month[row][col] == MONTH_NEXT)
+ state |= GTK_STATE_FLAG_INCONSISTENT;
else
{
- if (gtk_widget_has_focus (widget))
- state |= GTK_STATE_FLAG_FOCUSED;
+ if (priv->marked_date[day-1])
+ state |= GTK_STATE_FLAG_ACTIVE;
- if (priv->day_month[row][col] == MONTH_PREV ||
- priv->day_month[row][col] == MONTH_NEXT)
- state |= GTK_STATE_FLAG_INCONSISTENT;
- else
+ if (priv->selected_day == day)
{
- if (priv->marked_date[day-1])
- state |= GTK_STATE_FLAG_ACTIVE;
+ state |= GTK_STATE_FLAG_SELECTED;
- if (priv->selected_day == day)
- {
- state |= GTK_STATE_FLAG_SELECTED;
-
- gtk_style_context_set_state (context, state);
- gtk_render_background (context, cr,
- day_rect.x, day_rect.y,
- day_rect.width, day_rect.height);
- }
+ gtk_style_context_set_state (context, state);
+ gtk_render_background (context, cr,
+ day_rect.x, day_rect.y,
+ day_rect.width, day_rect.height);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]