summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtkclist.c51
-rw-r--r--gtk/gtkclist.h6
-rw-r--r--gtk/gtkenums.h8
3 files changed, 43 insertions, 22 deletions
diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c
index 64b7cdfe9..de6fd5226 100644
--- a/gtk/gtkclist.c
+++ b/gtk/gtkclist.c
@@ -960,7 +960,7 @@ gtk_clist_set_text (GtkCList * clist,
/* redraw the list if it's not frozen */
if (!GTK_CLIST_FROZEN (clist))
{
- if (gtk_clist_row_is_visible (clist, row))
+ if (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE)
draw_row (clist, NULL, row, clist_row);
}
}
@@ -1018,7 +1018,7 @@ gtk_clist_set_pixmap (GtkCList * clist,
/* redraw the list if it's not frozen */
if (!GTK_CLIST_FROZEN (clist))
{
- if (gtk_clist_row_is_visible (clist, row))
+ if (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE)
draw_row (clist, NULL, row, clist_row);
}
}
@@ -1081,7 +1081,7 @@ gtk_clist_set_pixtext (GtkCList * clist,
/* redraw the list if it's not frozen */
if (!GTK_CLIST_FROZEN (clist))
{
- if (gtk_clist_row_is_visible (clist, row))
+ if (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE)
draw_row (clist, NULL, row, clist_row);
}
}
@@ -1144,7 +1144,8 @@ gtk_clist_set_foreground (GtkCList * clist,
else
clist_row->fg_set = FALSE;
- if (!GTK_CLIST_FROZEN (clist) && gtk_clist_row_is_visible (clist, row))
+ if (!GTK_CLIST_FROZEN (clist)
+ && (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE))
draw_row (clist, NULL, row, clist_row);
}
@@ -1170,7 +1171,8 @@ gtk_clist_set_background (GtkCList * clist,
else
clist_row->bg_set = FALSE;
- if (!GTK_CLIST_FROZEN (clist) && gtk_clist_row_is_visible (clist, row))
+ if (!GTK_CLIST_FROZEN (clist)
+ && (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE))
draw_row (clist, NULL, row, clist_row);
}
@@ -1195,7 +1197,8 @@ gtk_clist_set_shift (GtkCList * clist,
clist_row->cell[column].vertical = vertical;
clist_row->cell[column].horizontal = horizontal;
- if (!GTK_CLIST_FROZEN (clist) && gtk_clist_row_is_visible (clist, row))
+ if (!GTK_CLIST_FROZEN (clist)
+ && (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE))
draw_row (clist, NULL, row, clist_row);
}
@@ -1244,7 +1247,7 @@ gtk_clist_append (GtkCList * clist,
{
adjust_scrollbars (clist);
- if (gtk_clist_row_is_visible (clist, clist->rows - 1))
+ if (gtk_clist_row_is_visible (clist, clist->rows - 1) != GTK_VISIBILITY_NONE)
draw_rows (clist, NULL);
}
@@ -1298,7 +1301,7 @@ gtk_clist_insert (GtkCList * clist,
{
adjust_scrollbars (clist);
- if (gtk_clist_row_is_visible (clist, row))
+ if (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE)
draw_rows (clist, NULL);
}
}
@@ -1317,7 +1320,7 @@ gtk_clist_remove (GtkCList * clist,
if (row < 0 || row > (clist->rows - 1))
return;
- was_visible = gtk_clist_row_is_visible (clist, row);
+ was_visible = (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE);
was_selected = 0;
/* get the row we're going to delete */
@@ -1564,25 +1567,33 @@ gtk_clist_unselect_row (GtkCList * clist,
unselect_row (clist, row, column, NULL);
}
-gint
+GtkVisibility
gtk_clist_row_is_visible (GtkCList * clist,
- gint row)
+ gint row)
{
+ gint top;
+
g_return_val_if_fail (clist != NULL, 0);
if (row < 0 || row >= clist->rows)
- return 0;
+ return GTK_VISIBILITY_NONE;
if (clist->row_height == 0)
- return 0;
+ return GTK_VISIBILITY_NONE;
if (row < ROW_FROM_YPIXEL (clist, 0))
- return 0;
+ return GTK_VISIBILITY_NONE;
if (row > ROW_FROM_YPIXEL (clist, clist->clist_window_height))
- return 0;
+ return GTK_VISIBILITY_NONE;
- return 1;
+ top = ROW_TOP_YPIXEL (clist, row);
+
+ if ((top < 0)
+ || ((top + clist->row_height) >= clist->clist_window_height))
+ return GTK_VISIBILITY_PARTIAL;
+
+ return GTK_VISIBILITY_FULL;
}
GtkAdjustment *
@@ -2481,7 +2492,7 @@ draw_row (GtkCList * clist,
intersect_rectangle.y,
intersect_rectangle.width,
intersect_rectangle.height);
- }
+ }
if (!gdk_rectangle_intersect (area, &row_rectangle, &intersect_rectangle))
return;
@@ -3023,7 +3034,8 @@ real_select_row (GtkCList * clist,
clist_row->state = GTK_STATE_SELECTED;
clist->selection = g_list_append (clist->selection, (gpointer) row);
- if (!GTK_CLIST_FROZEN (clist) && gtk_clist_row_is_visible (clist, row))
+ if (!GTK_CLIST_FROZEN (clist)
+ && (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE))
draw_row (clist, NULL, row, clist_row);
}
}
@@ -3048,7 +3060,8 @@ real_unselect_row (GtkCList * clist,
clist_row->state = GTK_STATE_NORMAL;
clist->selection = g_list_remove (clist->selection, (gpointer) row);
- if (!GTK_CLIST_FROZEN (clist) && gtk_clist_row_is_visible (clist, row))
+ if (!GTK_CLIST_FROZEN (clist)
+ && (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE))
draw_row (clist, NULL, row, clist_row);
}
}
diff --git a/gtk/gtkclist.h b/gtk/gtkclist.h
index 73518468d..fcfd49bcc 100644
--- a/gtk/gtkclist.h
+++ b/gtk/gtkclist.h
@@ -352,9 +352,9 @@ void gtk_clist_moveto (GtkCList * clist,
gfloat row_align,
gfloat col_align);
-/* returns true if the row is visible */
-gint gtk_clist_row_is_visible (GtkCList * clist,
- gint row);
+/* returns whether the row is visible */
+GtkVisibility gtk_clist_row_is_visible (GtkCList * clist,
+ gint row);
/* returns the cell type */
GtkCellType gtk_clist_get_cell_type (GtkCList * clist,
diff --git a/gtk/gtkenums.h b/gtk/gtkenums.h
index 357fec132..79d347dcb 100644
--- a/gtk/gtkenums.h
+++ b/gtk/gtkenums.h
@@ -208,6 +208,14 @@ typedef enum
GTK_TOOLBAR_BOTH
} GtkToolbarStyle;
+/* Generic visibility flags */
+typedef enum
+{
+ GTK_VISIBILITY_NONE,
+ GTK_VISIBILITY_PARTIAL,
+ GTK_VISIBILITY_FULL
+} GtkVisibility;
+
#ifdef __cplusplus
}
#endif /* __cplusplus */