month-cell: Move day label to top, split from overflow
This commit is contained in:
@@ -32,6 +32,7 @@ struct _GcalMonthCell
|
||||
guint n_overflow;
|
||||
|
||||
GtkLabel *day_label;
|
||||
GtkWidget *header_box;
|
||||
GtkWidget *overflow_button;
|
||||
GtkWidget *overflow_label;
|
||||
GtkWidget *overlay;
|
||||
@@ -422,6 +423,7 @@ gcal_month_cell_class_init (GcalMonthCellClass *klass)
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/calendar/month-cell.ui");
|
||||
|
||||
gtk_widget_class_bind_template_child (widget_class, GcalMonthCell, day_label);
|
||||
gtk_widget_class_bind_template_child (widget_class, GcalMonthCell, header_box);
|
||||
gtk_widget_class_bind_template_child (widget_class, GcalMonthCell, overflow_button);
|
||||
gtk_widget_class_bind_template_child (widget_class, GcalMonthCell, overflow_label);
|
||||
gtk_widget_class_bind_template_child (widget_class, GcalMonthCell, overlay);
|
||||
@@ -580,10 +582,19 @@ gcal_month_cell_get_real_height (GcalMonthCell *self)
|
||||
|
||||
return gtk_widget_get_allocated_height (GTK_WIDGET (self)) -
|
||||
gtk_widget_get_allocated_height (self->overflow_button) -
|
||||
gtk_widget_get_allocated_height (self->header_box) -
|
||||
padding.top - padding.bottom -
|
||||
border.top - border.bottom;
|
||||
}
|
||||
|
||||
gint
|
||||
gcal_month_cell_get_header_height (GcalMonthCell *self)
|
||||
{
|
||||
g_return_val_if_fail (GCAL_IS_MONTH_CELL (self), -1);
|
||||
|
||||
return gtk_widget_get_allocated_height (self->header_box);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gcal_month_cell_get_selected (GcalMonthCell *self)
|
||||
{
|
||||
|
||||
@@ -53,6 +53,8 @@ void gcal_month_cell_set_overflow (GcalMonthCell
|
||||
|
||||
gint gcal_month_cell_get_real_height (GcalMonthCell *self);
|
||||
|
||||
gint gcal_month_cell_get_header_height (GcalMonthCell *self);
|
||||
|
||||
gboolean gcal_month_cell_get_selected (GcalMonthCell *self);
|
||||
|
||||
void gcal_month_cell_set_selected (GcalMonthCell *self,
|
||||
|
||||
@@ -1398,16 +1398,19 @@ remove_cell_border_and_padding (GtkWidget *cell,
|
||||
GtkStyleContext *cell_context;
|
||||
GtkBorder cell_padding;
|
||||
GtkBorder cell_border;
|
||||
gint header_height;
|
||||
|
||||
cell_context = gtk_widget_get_style_context (cell);
|
||||
gtk_style_context_get_border (cell_context, gtk_style_context_get_state (cell_context), &cell_border);
|
||||
gtk_style_context_get_padding (cell_context, gtk_style_context_get_state (cell_context), &cell_padding);
|
||||
|
||||
header_height = gcal_month_cell_get_header_height (GCAL_MONTH_CELL (cell));
|
||||
|
||||
if (x)
|
||||
*x += cell_border.left + cell_padding.left;
|
||||
|
||||
if (y)
|
||||
*y += cell_border.top + cell_padding.top;
|
||||
*y += cell_border.top + cell_padding.top + header_height;
|
||||
|
||||
if (width)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user