year-view: initial GtkWidget::size_allocate impl
This impl uses internals structures from GcalSubscriber
This commit is contained in:
@@ -52,6 +52,14 @@ enum
|
|||||||
PROP_MANAGER //manager inherited property
|
PROP_MANAGER //manager inherited property
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static gboolean get_widget_parts (gint first_cell,
|
||||||
|
gint last_cell,
|
||||||
|
gint natural_height,
|
||||||
|
gdouble vertical_cell_space,
|
||||||
|
gdouble *size_left,
|
||||||
|
GArray *cells,
|
||||||
|
GArray *lengths);
|
||||||
|
|
||||||
static gboolean get_widget_parts (gint first_cell,
|
static gboolean get_widget_parts (gint first_cell,
|
||||||
gint last_cell,
|
gint last_cell,
|
||||||
gint natural_height,
|
gint natural_height,
|
||||||
@@ -121,6 +129,53 @@ G_DEFINE_TYPE_WITH_CODE (GcalYearView, gcal_year_view, GCAL_TYPE_SUBSCRIBER_VIEW
|
|||||||
G_IMPLEMENT_INTERFACE (GCAL_TYPE_VIEW,gcal_view_interface_init));
|
G_IMPLEMENT_INTERFACE (GCAL_TYPE_VIEW,gcal_view_interface_init));
|
||||||
|
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
get_widget_parts (gint first_cell,
|
||||||
|
gint last_cell,
|
||||||
|
gint natural_height,
|
||||||
|
gdouble vertical_cell_space,
|
||||||
|
gdouble *size_left,
|
||||||
|
GArray *cells,
|
||||||
|
GArray *lengths)
|
||||||
|
{
|
||||||
|
gint i;
|
||||||
|
gint current_part_length;
|
||||||
|
gdouble y, old_y = - 1.0;
|
||||||
|
|
||||||
|
if (last_cell < first_cell)
|
||||||
|
{
|
||||||
|
gint swap = last_cell;
|
||||||
|
last_cell = first_cell;
|
||||||
|
first_cell = swap;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = first_cell; i <= last_cell; i++)
|
||||||
|
{
|
||||||
|
if (size_left[i] < natural_height)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
y = vertical_cell_space - size_left[i];
|
||||||
|
if (y != old_y)
|
||||||
|
{
|
||||||
|
current_part_length = 1;
|
||||||
|
g_array_append_val (cells, i);
|
||||||
|
g_array_append_val (lengths, current_part_length);
|
||||||
|
old_y = y;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
current_part_length++;
|
||||||
|
g_array_index (lengths, gint, lengths->len - 1) = current_part_length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
get_widget_parts (gint first_cell,
|
get_widget_parts (gint first_cell,
|
||||||
gint last_cell,
|
gint last_cell,
|
||||||
|
|||||||
Reference in New Issue
Block a user