Lines Matching refs:clist

63 #define ROW_TOP_YPIXEL(clist, row) (((clist)->row_height * (row)) + \  argument
65 (clist)->voffset)
69 #define ROW_FROM_YPIXEL(clist, y) (((y) - (clist)->voffset) / \ argument
70 ((clist)->row_height + CELL_SPACING))
74 #define COLUMN_LEFT_XPIXEL(clist, colnum) ((clist)->column[(colnum)].area.x + \ argument
75 (clist)->hoffset)
80 COLUMN_FROM_XPIXEL (GtkCMCList * clist, in COLUMN_FROM_XPIXEL() argument
85 for (i = 0; i < clist->columns; i++) in COLUMN_FROM_XPIXEL()
86 if (clist->column[i].visible) in COLUMN_FROM_XPIXEL()
88 cx = clist->column[i].area.x + clist->hoffset; in COLUMN_FROM_XPIXEL()
91 x <= (cx + clist->column[i].area.width + COLUMN_INSET)) in COLUMN_FROM_XPIXEL()
101 #define ROW_TOP(clist, row) (((clist)->row_height + CELL_SPACING) * (row)) argument
105 #define COLUMN_LEFT(clist, colnum) ((clist)->column[(colnum)].area.x) argument
108 #define LIST_HEIGHT(clist) (((clist)->row_height * ((clist)->rows)) + \ argument
109 (CELL_SPACING * ((clist)->rows + 1)))
114 LIST_WIDTH (GtkCMCList * clist) in LIST_WIDTH() argument
118 for (last_column = clist->columns - 1; in LIST_WIDTH()
119 last_column >= 0 && !clist->column[last_column].visible; last_column--); in LIST_WIDTH()
122 return (clist->column[last_column].area.x + in LIST_WIDTH()
123 clist->column[last_column].area.width + in LIST_WIDTH()
129 #define ROW_ELEMENT(clist, row) (((row) == (clist)->rows - 1) ? \ argument
130 (clist)->row_list_end : \
131 g_list_nth ((clist)->row_list, (row)))
135 #define CLIST_UNFROZEN(clist) (((GtkCMCList*) (clist))->freeze_count == 0) argument
136 #define CLIST_REFRESH(clist) G_STMT_START { \ argument
137 if (CLIST_UNFROZEN (clist)) \
138 GTK_CMCLIST_GET_CLASS (clist)->refresh ((GtkCMCList*) (clist)); \
182 static void gtk_cmclist_init (GtkCMCList *clist);
200 static void gtk_cmclist_set_scroll_adjustments (GtkCMCList *clist,
268 static void toggle_row (GtkCMCList *clist,
272 static void real_select_row (GtkCMCList *clist,
276 static void real_unselect_row (GtkCMCList *clist,
280 static void update_extended_selection (GtkCMCList *clist,
282 static GList *selection_find (GtkCMCList *clist,
285 static void real_select_all (GtkCMCList *clist);
286 static void real_unselect_all (GtkCMCList *clist);
287 static void move_vertical (GtkCMCList *clist,
290 static void move_horizontal (GtkCMCList *clist,
292 static void real_undo_selection (GtkCMCList *clist);
293 static void fake_unselect_all (GtkCMCList *clist,
295 static void fake_toggle_row (GtkCMCList *clist,
297 static void resync_selection (GtkCMCList *clist,
299 static void sync_selection (GtkCMCList *clist,
302 static void set_anchor (GtkCMCList *clist,
306 static void start_selection (GtkCMCList *clist);
307 static void end_selection (GtkCMCList *clist);
308 static void toggle_add_mode (GtkCMCList *clist);
309 static void toggle_focus_row (GtkCMCList *clist);
310 static void extend_selection (GtkCMCList *clist,
314 static gint get_selection_info (GtkCMCList *clist,
321 static void move_focus_row (GtkCMCList *clist,
324 static void scroll_horizontal (GtkCMCList *clist,
327 static void scroll_vertical (GtkCMCList *clist,
330 static void move_horizontal (GtkCMCList *clist,
332 static void move_vertical (GtkCMCList *clist,
335 static gint horizontal_timeout (GtkCMCList *clist);
336 static gint vertical_timeout (GtkCMCList *clist);
337 static void remove_grab (GtkCMCList *clist);
341 static void draw_xor_line (GtkCMCList *clist);
342 static gint new_column_width (GtkCMCList *clist,
345 static void column_auto_resize (GtkCMCList *clist,
349 static void real_resize_column (GtkCMCList *clist,
352 static void abort_column_resize (GtkCMCList *clist);
353 static void cell_size_request (GtkCMCList *clist,
359 static void column_button_create (GtkCMCList *clist,
365 static void adjust_adjustments (GtkCMCList *clist,
373 static void get_cell_style (GtkCMCList *clist,
386 static void draw_row (GtkCMCList *clist,
390 static void draw_rows (GtkCMCList *clist,
392 static void clist_refresh (GtkCMCList *clist);
395 static void size_allocate_title_buttons (GtkCMCList *clist);
396 static void size_allocate_columns (GtkCMCList *clist,
398 static gint list_requisition_width (GtkCMCList *clist);
401 static GtkCMCListColumn *columns_new (GtkCMCList *clist);
402 static void column_title_new (GtkCMCList *clist,
405 static void columns_delete (GtkCMCList *clist);
406 static GtkCMCListRow *row_new (GtkCMCList *clist);
407 static void row_delete (GtkCMCList *clist,
409 static void set_cell_contents (GtkCMCList *clist,
416 static gint real_insert_row (GtkCMCList *clist,
419 static void real_remove_row (GtkCMCList *clist,
421 static void real_clear (GtkCMCList *clist);
424 static gint default_compare (GtkCMCList *clist,
427 static void real_sort_list (GtkCMCList *clist);
428 static GList *gtk_cmclist_merge (GtkCMCList *clist,
431 static GList *gtk_cmclist_mergesort (GtkCMCList *clist,
435 static gboolean title_focus_in (GtkCMCList *clist,
437 static gboolean title_focus_move (GtkCMCList *clist,
440 static void real_row_move (GtkCMCList *clist,
446 static void drag_dest_cell (GtkCMCList *clist,
956 GtkCMCList *clist; in gtk_cmclist_set_arg() local
958 clist = GTK_CMCLIST (object); in gtk_cmclist_set_arg()
963 clist->columns = MAX (1, g_value_get_uint (value)); in gtk_cmclist_set_arg()
966 gtk_cmclist_set_shadow_type (clist, g_value_get_enum (value)); in gtk_cmclist_set_arg()
969 gtk_cmclist_set_selection_mode (clist, g_value_get_enum (value)); in gtk_cmclist_set_arg()
972 gtk_cmclist_set_row_height (clist, g_value_get_uint (value)); in gtk_cmclist_set_arg()
975 gtk_cmclist_set_reorderable (clist, g_value_get_boolean (value)); in gtk_cmclist_set_arg()
979 gtk_cmclist_column_titles_active (clist); in gtk_cmclist_set_arg()
981 gtk_cmclist_column_titles_passive (clist); in gtk_cmclist_set_arg()
984 gtk_cmclist_set_use_drag_icons (clist, g_value_get_boolean (value)); in gtk_cmclist_set_arg()
987 gtk_cmclist_set_sort_type (clist, g_value_get_enum (value)); in gtk_cmclist_set_arg()
998 GtkCMCList *clist; in gtk_cmclist_get_arg() local
1000 clist = GTK_CMCLIST (object); in gtk_cmclist_get_arg()
1007 g_value_set_uint(value, clist->columns); in gtk_cmclist_get_arg()
1010 g_value_set_enum(value, clist->shadow_type); in gtk_cmclist_get_arg()
1013 g_value_set_enum(value, clist->selection_mode); in gtk_cmclist_get_arg()
1016 g_value_set_uint(value, GTK_CMCLIST_ROW_HEIGHT_SET(clist) ? clist->row_height : 0); in gtk_cmclist_get_arg()
1019 g_value_set_boolean(value, GTK_CMCLIST_REORDERABLE (clist)); in gtk_cmclist_get_arg()
1023 for (i = 0; i < clist->columns; i++) in gtk_cmclist_get_arg()
1024 if (clist->column[i].button && in gtk_cmclist_get_arg()
1025 !gtk_widget_get_sensitive (clist->column[i].button)) in gtk_cmclist_get_arg()
1032 g_value_set_boolean(value, GTK_CMCLIST_USE_DRAG_ICONS (clist)); in gtk_cmclist_get_arg()
1035 g_value_set_enum(value, clist->sort_type); in gtk_cmclist_get_arg()
1044 gtk_cmclist_init (GtkCMCList *clist) in gtk_cmclist_init() argument
1046 clist->flags = 0; in gtk_cmclist_init()
1048 gtk_widget_set_has_window (GTK_WIDGET(clist), TRUE); in gtk_cmclist_init()
1049 gtk_widget_set_can_focus (GTK_WIDGET(clist), TRUE); in gtk_cmclist_init()
1050 GTK_CMCLIST_SET_FLAG (clist, CMCLIST_DRAW_DRAG_LINE); in gtk_cmclist_init()
1051 GTK_CMCLIST_SET_FLAG (clist, CMCLIST_USE_DRAG_ICONS); in gtk_cmclist_init()
1053 clist->freeze_count = 0; in gtk_cmclist_init()
1055 clist->rows = 0; in gtk_cmclist_init()
1056 clist->row_height = 0; in gtk_cmclist_init()
1057 clist->row_list = NULL; in gtk_cmclist_init()
1058 clist->row_list_end = NULL; in gtk_cmclist_init()
1060 clist->columns = 0; in gtk_cmclist_init()
1062 clist->title_window = NULL; in gtk_cmclist_init()
1063 clist->column_title_area.x = 0; in gtk_cmclist_init()
1064 clist->column_title_area.y = 0; in gtk_cmclist_init()
1065 clist->column_title_area.width = 1; in gtk_cmclist_init()
1066 clist->column_title_area.height = 1; in gtk_cmclist_init()
1068 clist->clist_window = NULL; in gtk_cmclist_init()
1069 clist->clist_window_width = 1; in gtk_cmclist_init()
1070 clist->clist_window_height = 1; in gtk_cmclist_init()
1072 clist->hoffset = 0; in gtk_cmclist_init()
1073 clist->voffset = 0; in gtk_cmclist_init()
1075 clist->shadow_type = GTK_SHADOW_IN; in gtk_cmclist_init()
1076 clist->vadjustment = NULL; in gtk_cmclist_init()
1077 clist->hadjustment = NULL; in gtk_cmclist_init()
1079 clist->button_actions[0] = GTK_CMBUTTON_SELECTS | GTK_CMBUTTON_DRAGS; in gtk_cmclist_init()
1080 clist->button_actions[1] = GTK_CMBUTTON_IGNORED; in gtk_cmclist_init()
1081 clist->button_actions[2] = GTK_CMBUTTON_IGNORED; in gtk_cmclist_init()
1082 clist->button_actions[3] = GTK_CMBUTTON_IGNORED; in gtk_cmclist_init()
1083 clist->button_actions[4] = GTK_CMBUTTON_IGNORED; in gtk_cmclist_init()
1085 clist->cursor_drag = NULL; in gtk_cmclist_init()
1086 clist->x_drag = 0; in gtk_cmclist_init()
1088 clist->selection_mode = GTK_SELECTION_SINGLE; in gtk_cmclist_init()
1089 clist->selection = NULL; in gtk_cmclist_init()
1090 clist->selection_end = NULL; in gtk_cmclist_init()
1091 clist->undo_selection = NULL; in gtk_cmclist_init()
1092 clist->undo_unselection = NULL; in gtk_cmclist_init()
1094 clist->focus_row = -1; in gtk_cmclist_init()
1095 clist->focus_header_column = -1; in gtk_cmclist_init()
1096 clist->undo_anchor = -1; in gtk_cmclist_init()
1098 clist->anchor = -1; in gtk_cmclist_init()
1099 clist->anchor_state = GTK_STATE_SELECTED; in gtk_cmclist_init()
1100 clist->drag_pos = -1; in gtk_cmclist_init()
1101 clist->htimer = 0; in gtk_cmclist_init()
1102 clist->vtimer = 0; in gtk_cmclist_init()
1104 clist->click_cell.row = -1; in gtk_cmclist_init()
1105 clist->click_cell.column = -1; in gtk_cmclist_init()
1107 clist->compare = default_compare; in gtk_cmclist_init()
1108 clist->sort_type = GTK_SORT_ASCENDING; in gtk_cmclist_init()
1109 clist->sort_column = 0; in gtk_cmclist_init()
1111 clist->drag_highlight_row = -1; in gtk_cmclist_init()
1123 GtkCMCList *clist = GTK_CMCLIST (object); in gtk_cmclist_constructor() local
1126 clist->column = columns_new (clist); in gtk_cmclist_constructor()
1132 column_button_create (clist, 0); in gtk_cmclist_constructor()
1159 GtkCMCList *clist; in gtk_cmclist_new_with_titles() local
1161 clist = g_object_new (GTK_TYPE_CMCLIST, in gtk_cmclist_new_with_titles()
1168 for (i = 0; i < clist->columns; i++) in gtk_cmclist_new_with_titles()
1169 gtk_cmclist_set_column_title (clist, i, titles[i]); in gtk_cmclist_new_with_titles()
1170 gtk_cmclist_column_titles_show (clist); in gtk_cmclist_new_with_titles()
1173 gtk_cmclist_column_titles_hide (clist); in gtk_cmclist_new_with_titles()
1175 return GTK_WIDGET (clist); in gtk_cmclist_new_with_titles()
1179 gtk_cmclist_set_hadjustment (GtkCMCList *clist, in gtk_cmclist_set_hadjustment() argument
1184 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_set_hadjustment()
1188 if (clist->hadjustment == adjustment) in gtk_cmclist_set_hadjustment()
1191 old_adjustment = clist->hadjustment; in gtk_cmclist_set_hadjustment()
1193 if (clist->hadjustment) in gtk_cmclist_set_hadjustment()
1195 g_signal_handlers_disconnect_matched(G_OBJECT (clist->hadjustment), G_SIGNAL_MATCH_DATA, in gtk_cmclist_set_hadjustment()
1196 0, 0, 0, 0, clist); in gtk_cmclist_set_hadjustment()
1198 g_object_unref (G_OBJECT (clist->hadjustment)); in gtk_cmclist_set_hadjustment()
1201 clist->hadjustment = adjustment; in gtk_cmclist_set_hadjustment()
1203 if (clist->hadjustment) in gtk_cmclist_set_hadjustment()
1205 g_object_ref_sink (clist->hadjustment); in gtk_cmclist_set_hadjustment()
1206 g_signal_connect (G_OBJECT (clist->hadjustment), "value_changed", in gtk_cmclist_set_hadjustment()
1208 (gpointer) clist); in gtk_cmclist_set_hadjustment()
1211 if (!clist->hadjustment || !old_adjustment) in gtk_cmclist_set_hadjustment()
1212 gtk_widget_queue_resize (GTK_WIDGET (clist)); in gtk_cmclist_set_hadjustment()
1216 gtk_cmclist_get_hadjustment (GtkCMCList *clist) in gtk_cmclist_get_hadjustment() argument
1218 cm_return_val_if_fail (GTK_IS_CMCLIST (clist), NULL); in gtk_cmclist_get_hadjustment()
1220 return clist->hadjustment; in gtk_cmclist_get_hadjustment()
1224 gtk_cmclist_set_vadjustment (GtkCMCList *clist, in gtk_cmclist_set_vadjustment() argument
1229 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_set_vadjustment()
1233 if (clist->vadjustment == adjustment) in gtk_cmclist_set_vadjustment()
1236 old_adjustment = clist->vadjustment; in gtk_cmclist_set_vadjustment()
1238 if (clist->vadjustment) in gtk_cmclist_set_vadjustment()
1240 g_signal_handlers_disconnect_matched(G_OBJECT (clist->vadjustment), G_SIGNAL_MATCH_DATA, in gtk_cmclist_set_vadjustment()
1241 0, 0, 0, 0, clist); in gtk_cmclist_set_vadjustment()
1242 g_object_unref (G_OBJECT (clist->vadjustment)); in gtk_cmclist_set_vadjustment()
1245 clist->vadjustment = adjustment; in gtk_cmclist_set_vadjustment()
1247 if (clist->vadjustment) in gtk_cmclist_set_vadjustment()
1249 g_object_ref_sink (clist->vadjustment); in gtk_cmclist_set_vadjustment()
1251 g_signal_connect (G_OBJECT (clist->vadjustment), "value_changed", in gtk_cmclist_set_vadjustment()
1253 (gpointer) clist); in gtk_cmclist_set_vadjustment()
1256 if (!clist->vadjustment || !old_adjustment) in gtk_cmclist_set_vadjustment()
1257 gtk_widget_queue_resize (GTK_WIDGET (clist)); in gtk_cmclist_set_vadjustment()
1261 gtk_cmclist_get_vadjustment (GtkCMCList *clist) in gtk_cmclist_get_vadjustment() argument
1263 cm_return_val_if_fail (GTK_IS_CMCLIST (clist), NULL); in gtk_cmclist_get_vadjustment()
1265 return clist->vadjustment; in gtk_cmclist_get_vadjustment()
1269 gtk_cmclist_set_scroll_adjustments (GtkCMCList *clist, in gtk_cmclist_set_scroll_adjustments() argument
1273 if (clist->hadjustment != hadjustment) in gtk_cmclist_set_scroll_adjustments()
1274 gtk_cmclist_set_hadjustment (clist, hadjustment); in gtk_cmclist_set_scroll_adjustments()
1275 if (clist->vadjustment != vadjustment) in gtk_cmclist_set_scroll_adjustments()
1276 gtk_cmclist_set_vadjustment (clist, vadjustment); in gtk_cmclist_set_scroll_adjustments()
1280 gtk_cmclist_set_shadow_type (GtkCMCList *clist, in gtk_cmclist_set_shadow_type() argument
1283 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_set_shadow_type()
1285 clist->shadow_type = type; in gtk_cmclist_set_shadow_type()
1287 if (gtk_widget_get_visible (GTK_WIDGET(clist))) in gtk_cmclist_set_shadow_type()
1288 gtk_widget_queue_resize (GTK_WIDGET (clist)); in gtk_cmclist_set_shadow_type()
1292 gtk_cmclist_set_selection_mode (GtkCMCList *clist, in gtk_cmclist_set_selection_mode() argument
1295 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_set_selection_mode()
1298 if (mode == clist->selection_mode) in gtk_cmclist_set_selection_mode()
1301 clist->selection_mode = mode; in gtk_cmclist_set_selection_mode()
1302 clist->anchor = -1; in gtk_cmclist_set_selection_mode()
1303 clist->anchor_state = GTK_STATE_SELECTED; in gtk_cmclist_set_selection_mode()
1304 clist->drag_pos = -1; in gtk_cmclist_set_selection_mode()
1305 clist->undo_anchor = clist->focus_row; in gtk_cmclist_set_selection_mode()
1307 g_list_free (clist->undo_selection); in gtk_cmclist_set_selection_mode()
1308 g_list_free (clist->undo_unselection); in gtk_cmclist_set_selection_mode()
1309 clist->undo_selection = NULL; in gtk_cmclist_set_selection_mode()
1310 clist->undo_unselection = NULL; in gtk_cmclist_set_selection_mode()
1318 gtk_cmclist_unselect_all (clist); in gtk_cmclist_set_selection_mode()
1327 gtk_cmclist_freeze (GtkCMCList *clist) in gtk_cmclist_freeze() argument
1329 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_freeze()
1331 clist->freeze_count++; in gtk_cmclist_freeze()
1335 gtk_cmclist_thaw (GtkCMCList *clist) in gtk_cmclist_thaw() argument
1337 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_thaw()
1339 if (clist->freeze_count) in gtk_cmclist_thaw()
1341 clist->freeze_count--; in gtk_cmclist_thaw()
1342 CLIST_REFRESH (clist); in gtk_cmclist_thaw()
1366 gtk_cmclist_column_titles_show (GtkCMCList *clist) in gtk_cmclist_column_titles_show() argument
1368 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_column_titles_show()
1370 if (!GTK_CMCLIST_SHOW_TITLES(clist)) in gtk_cmclist_column_titles_show()
1372 GTK_CMCLIST_SET_FLAG (clist, CMCLIST_SHOW_TITLES); in gtk_cmclist_column_titles_show()
1373 if (clist->title_window) in gtk_cmclist_column_titles_show()
1374 gdk_window_show (clist->title_window); in gtk_cmclist_column_titles_show()
1375 gtk_widget_queue_resize (GTK_WIDGET (clist)); in gtk_cmclist_column_titles_show()
1380 gtk_cmclist_column_titles_hide (GtkCMCList *clist) in gtk_cmclist_column_titles_hide() argument
1382 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_column_titles_hide()
1384 if (GTK_CMCLIST_SHOW_TITLES(clist)) in gtk_cmclist_column_titles_hide()
1386 GTK_CMCLIST_UNSET_FLAG (clist, CMCLIST_SHOW_TITLES); in gtk_cmclist_column_titles_hide()
1387 if (clist->title_window) in gtk_cmclist_column_titles_hide()
1388 gdk_window_hide (clist->title_window); in gtk_cmclist_column_titles_hide()
1389 gtk_widget_queue_resize (GTK_WIDGET (clist)); in gtk_cmclist_column_titles_hide()
1394 gtk_cmclist_column_title_active (GtkCMCList *clist, in gtk_cmclist_column_title_active() argument
1397 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_column_title_active()
1399 if (column < 0 || column >= clist->columns) in gtk_cmclist_column_title_active()
1401 if (!clist->column[column].button || !clist->column[column].button_passive) in gtk_cmclist_column_title_active()
1404 clist->column[column].button_passive = FALSE; in gtk_cmclist_column_title_active()
1406 g_signal_handlers_disconnect_matched(G_OBJECT (clist->column[column].button), G_SIGNAL_MATCH_FUNC, in gtk_cmclist_column_title_active()
1409 gtk_widget_set_can_focus (clist->column[column].button, TRUE); in gtk_cmclist_column_title_active()
1410 if (gtk_widget_get_visible (GTK_WIDGET(clist))) in gtk_cmclist_column_title_active()
1411 gtk_widget_queue_draw (clist->column[column].button); in gtk_cmclist_column_title_active()
1415 gtk_cmclist_column_title_passive (GtkCMCList *clist, in gtk_cmclist_column_title_passive() argument
1420 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_column_title_passive()
1422 if (column < 0 || column >= clist->columns) in gtk_cmclist_column_title_passive()
1424 if (!clist->column[column].button || clist->column[column].button_passive) in gtk_cmclist_column_title_passive()
1427 button = GTK_TOGGLE_BUTTON (clist->column[column].button); in gtk_cmclist_column_title_passive()
1429 clist->column[column].button_passive = TRUE; in gtk_cmclist_column_title_passive()
1432 g_signal_connect(G_OBJECT (clist->column[column].button), in gtk_cmclist_column_title_passive()
1437 g_signal_connect(G_OBJECT (clist->column[column].button), in gtk_cmclist_column_title_passive()
1442 g_signal_connect (G_OBJECT (clist->column[column].button), "event", in gtk_cmclist_column_title_passive()
1445 gtk_widget_set_can_focus (clist->column[column].button, FALSE); in gtk_cmclist_column_title_passive()
1446 if (gtk_widget_get_visible (GTK_WIDGET(clist))) in gtk_cmclist_column_title_passive()
1447 gtk_widget_queue_draw (clist->column[column].button); in gtk_cmclist_column_title_passive()
1451 gtk_cmclist_column_titles_active (GtkCMCList *clist) in gtk_cmclist_column_titles_active() argument
1455 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_column_titles_active()
1457 for (i = 0; i < clist->columns; i++) in gtk_cmclist_column_titles_active()
1458 gtk_cmclist_column_title_active (clist, i); in gtk_cmclist_column_titles_active()
1462 gtk_cmclist_column_titles_passive (GtkCMCList *clist) in gtk_cmclist_column_titles_passive() argument
1466 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_column_titles_passive()
1468 for (i = 0; i < clist->columns; i++) in gtk_cmclist_column_titles_passive()
1469 gtk_cmclist_column_title_passive (clist, i); in gtk_cmclist_column_titles_passive()
1473 gtk_cmclist_set_column_title (GtkCMCList *clist, in gtk_cmclist_set_column_title() argument
1482 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_set_column_title()
1484 if (column < 0 || column >= clist->columns) in gtk_cmclist_set_column_title()
1489 if (!clist->column[column].button) in gtk_cmclist_set_column_title()
1491 column_button_create (clist, column); in gtk_cmclist_set_column_title()
1495 column_title_new (clist, column, title); in gtk_cmclist_set_column_title()
1498 old_widget = gtk_bin_get_child (GTK_BIN (clist->column[column].button)); in gtk_cmclist_set_column_title()
1500 gtk_container_remove (GTK_CONTAINER (clist->column[column].button), old_widget); in gtk_cmclist_set_column_title()
1503 switch (clist->column[column].justification) in gtk_cmclist_set_column_title()
1523 label = gtk_label_new (clist->column[column].title); in gtk_cmclist_set_column_title()
1526 gtk_container_add (GTK_CONTAINER (clist->column[column].button), alignment); in gtk_cmclist_set_column_title()
1532 if (gtk_widget_get_visible (GTK_WIDGET(clist)) && new_button) in gtk_cmclist_set_column_title()
1533 size_allocate_title_buttons (clist); in gtk_cmclist_set_column_title()
1537 gtk_cmclist_get_column_title (GtkCMCList *clist, in gtk_cmclist_get_column_title() argument
1540 cm_return_val_if_fail (GTK_IS_CMCLIST (clist), NULL); in gtk_cmclist_get_column_title()
1542 if (column < 0 || column >= clist->columns) in gtk_cmclist_get_column_title()
1545 return clist->column[column].title; in gtk_cmclist_get_column_title()
1549 gtk_cmclist_set_column_widget (GtkCMCList *clist, in gtk_cmclist_set_column_widget() argument
1556 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_set_column_widget()
1558 if (column < 0 || column >= clist->columns) in gtk_cmclist_set_column_widget()
1563 if (!clist->column[column].button) in gtk_cmclist_set_column_widget()
1565 column_button_create (clist, column); in gtk_cmclist_set_column_widget()
1569 column_title_new (clist, column, NULL); in gtk_cmclist_set_column_widget()
1572 old_widget = gtk_bin_get_child (GTK_BIN (clist->column[column].button)); in gtk_cmclist_set_column_widget()
1574 gtk_container_remove (GTK_CONTAINER (clist->column[column].button), in gtk_cmclist_set_column_widget()
1580 gtk_container_add (GTK_CONTAINER (clist->column[column].button), widget); in gtk_cmclist_set_column_widget()
1586 if (gtk_widget_get_visible (GTK_WIDGET(clist)) && new_button) in gtk_cmclist_set_column_widget()
1587 size_allocate_title_buttons (clist); in gtk_cmclist_set_column_widget()
1591 gtk_cmclist_get_column_widget (GtkCMCList *clist, in gtk_cmclist_get_column_widget() argument
1594 cm_return_val_if_fail (GTK_IS_CMCLIST (clist), NULL); in gtk_cmclist_get_column_widget()
1596 if (column < 0 || column >= clist->columns) in gtk_cmclist_get_column_widget()
1599 if (clist->column[column].button) in gtk_cmclist_get_column_widget()
1600 return gtk_bin_get_child (GTK_BIN (clist->column[column].button)); in gtk_cmclist_get_column_widget()
1606 gtk_cmclist_set_column_justification (GtkCMCList *clist, in gtk_cmclist_set_column_justification() argument
1612 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_set_column_justification()
1614 if (column < 0 || column >= clist->columns) in gtk_cmclist_set_column_justification()
1617 clist->column[column].justification = justification; in gtk_cmclist_set_column_justification()
1621 if (clist->column[column].title) in gtk_cmclist_set_column_justification()
1623 alignment = gtk_bin_get_child (GTK_BIN (clist->column[column].button)); in gtk_cmclist_set_column_justification()
1625 switch (clist->column[column].justification) in gtk_cmclist_set_column_justification()
1648 if (CLIST_UNFROZEN (clist)) in gtk_cmclist_set_column_justification()
1649 draw_rows (clist, NULL); in gtk_cmclist_set_column_justification()
1653 gtk_cmclist_set_column_visibility (GtkCMCList *clist, in gtk_cmclist_set_column_visibility() argument
1657 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_set_column_visibility()
1659 if (column < 0 || column >= clist->columns) in gtk_cmclist_set_column_visibility()
1661 if (clist->column[column].visible == visible) in gtk_cmclist_set_column_visibility()
1670 for (i = 0, vis_columns = 0; i < clist->columns && vis_columns < 2; i++) in gtk_cmclist_set_column_visibility()
1671 if (clist->column[i].visible) in gtk_cmclist_set_column_visibility()
1678 clist->column[column].visible = visible; in gtk_cmclist_set_column_visibility()
1680 if (clist->column[column].button) in gtk_cmclist_set_column_visibility()
1683 gtk_widget_show (clist->column[column].button); in gtk_cmclist_set_column_visibility()
1685 gtk_widget_hide (clist->column[column].button); in gtk_cmclist_set_column_visibility()
1688 gtk_widget_queue_resize (GTK_WIDGET(clist)); in gtk_cmclist_set_column_visibility()
1692 gtk_cmclist_set_column_resizeable (GtkCMCList *clist, in gtk_cmclist_set_column_resizeable() argument
1696 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_set_column_resizeable()
1698 if (column < 0 || column >= clist->columns) in gtk_cmclist_set_column_resizeable()
1700 if (clist->column[column].resizeable == resizeable) in gtk_cmclist_set_column_resizeable()
1703 clist->column[column].resizeable = resizeable; in gtk_cmclist_set_column_resizeable()
1705 clist->column[column].auto_resize = FALSE; in gtk_cmclist_set_column_resizeable()
1707 if (gtk_widget_get_visible (GTK_WIDGET(clist))) in gtk_cmclist_set_column_resizeable()
1708 size_allocate_title_buttons (clist); in gtk_cmclist_set_column_resizeable()
1712 gtk_cmclist_set_column_auto_resize (GtkCMCList *clist, in gtk_cmclist_set_column_auto_resize() argument
1716 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_set_column_auto_resize()
1718 if (column < 0 || column >= clist->columns) in gtk_cmclist_set_column_auto_resize()
1720 if (clist->column[column].auto_resize == auto_resize) in gtk_cmclist_set_column_auto_resize()
1723 clist->column[column].auto_resize = auto_resize; in gtk_cmclist_set_column_auto_resize()
1726 clist->column[column].resizeable = FALSE; in gtk_cmclist_set_column_auto_resize()
1727 if (!GTK_CMCLIST_AUTO_RESIZE_BLOCKED (clist)) in gtk_cmclist_set_column_auto_resize()
1731 width = gtk_cmclist_optimal_column_width (clist, column); in gtk_cmclist_set_column_auto_resize()
1732 gtk_cmclist_set_column_width (clist, column, width); in gtk_cmclist_set_column_auto_resize()
1736 if (gtk_widget_get_visible (GTK_WIDGET(clist))) in gtk_cmclist_set_column_auto_resize()
1737 size_allocate_title_buttons (clist); in gtk_cmclist_set_column_auto_resize()
1741 gtk_cmclist_columns_autosize (GtkCMCList *clist) in gtk_cmclist_columns_autosize() argument
1746 cm_return_val_if_fail (GTK_IS_CMCLIST (clist), 0); in gtk_cmclist_columns_autosize()
1748 gtk_cmclist_freeze (clist); in gtk_cmclist_columns_autosize()
1750 for (i = 0; i < clist->columns; i++) in gtk_cmclist_columns_autosize()
1752 gtk_cmclist_set_column_width (clist, i, in gtk_cmclist_columns_autosize()
1753 gtk_cmclist_optimal_column_width (clist, i)); in gtk_cmclist_columns_autosize()
1755 width += clist->column[i].width; in gtk_cmclist_columns_autosize()
1758 gtk_cmclist_thaw (clist); in gtk_cmclist_columns_autosize()
1763 gtk_cmclist_optimal_column_width (GtkCMCList *clist, in gtk_cmclist_optimal_column_width() argument
1770 cm_return_val_if_fail (GTK_CMCLIST (clist), 0); in gtk_cmclist_optimal_column_width()
1772 if (column < 0 || column >= clist->columns) in gtk_cmclist_optimal_column_width()
1775 if (GTK_CMCLIST_SHOW_TITLES(clist) && clist->column[column].button) in gtk_cmclist_optimal_column_width()
1777 gtk_widget_get_requisition (clist->column[column].button, &requisition); in gtk_cmclist_optimal_column_width()
1787 for (list = clist->row_list; list; list = list->next) in gtk_cmclist_optimal_column_width()
1789 GTK_CMCLIST_GET_CLASS (clist)->cell_size_request in gtk_cmclist_optimal_column_width()
1790 (clist, GTK_CMCLIST_ROW (list), column, &requisition); in gtk_cmclist_optimal_column_width()
1798 gtk_cmclist_set_column_width (GtkCMCList *clist, in gtk_cmclist_set_column_width() argument
1802 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_set_column_width()
1804 if (column < 0 || column >= clist->columns) in gtk_cmclist_set_column_width()
1807 g_signal_emit (G_OBJECT (clist), clist_signals[RESIZE_COLUMN], 0, in gtk_cmclist_set_column_width()
1812 gtk_cmclist_set_column_min_width (GtkCMCList *clist, in gtk_cmclist_set_column_min_width() argument
1816 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_set_column_min_width()
1818 if (column < 0 || column >= clist->columns) in gtk_cmclist_set_column_min_width()
1820 if (clist->column[column].min_width == min_width) in gtk_cmclist_set_column_min_width()
1823 if (clist->column[column].max_width >= 0 && in gtk_cmclist_set_column_min_width()
1824 clist->column[column].max_width < min_width) in gtk_cmclist_set_column_min_width()
1825 clist->column[column].min_width = clist->column[column].max_width; in gtk_cmclist_set_column_min_width()
1827 clist->column[column].min_width = min_width; in gtk_cmclist_set_column_min_width()
1829 if (clist->column[column].area.width < clist->column[column].min_width) in gtk_cmclist_set_column_min_width()
1830 gtk_cmclist_set_column_width (clist, column,clist->column[column].min_width); in gtk_cmclist_set_column_min_width()
1834 gtk_cmclist_set_column_max_width (GtkCMCList *clist, in gtk_cmclist_set_column_max_width() argument
1838 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_set_column_max_width()
1840 if (column < 0 || column >= clist->columns) in gtk_cmclist_set_column_max_width()
1842 if (clist->column[column].max_width == max_width) in gtk_cmclist_set_column_max_width()
1845 if (clist->column[column].min_width >= 0 && max_width >= 0 && in gtk_cmclist_set_column_max_width()
1846 clist->column[column].min_width > max_width) in gtk_cmclist_set_column_max_width()
1847 clist->column[column].max_width = clist->column[column].min_width; in gtk_cmclist_set_column_max_width()
1849 clist->column[column].max_width = max_width; in gtk_cmclist_set_column_max_width()
1851 if (clist->column[column].area.width > clist->column[column].max_width) in gtk_cmclist_set_column_max_width()
1852 gtk_cmclist_set_column_width (clist, column,clist->column[column].max_width); in gtk_cmclist_set_column_max_width()
1868 column_auto_resize (GtkCMCList *clist, in column_auto_resize() argument
1876 if (!clist->column[column].auto_resize || in column_auto_resize()
1877 GTK_CMCLIST_AUTO_RESIZE_BLOCKED (clist)) in column_auto_resize()
1881 GTK_CMCLIST_GET_CLASS (clist)->cell_size_request (clist, clist_row, in column_auto_resize()
1886 if (requisition.width > clist->column[column].width) in column_auto_resize()
1887 gtk_cmclist_set_column_width (clist, column, requisition.width); in column_auto_resize()
1889 old_width == clist->column[column].width) in column_auto_resize()
1896 if (GTK_CMCLIST_SHOW_TITLES(clist) && clist->column[column].button) in column_auto_resize()
1898 gtk_widget_get_requisition (clist->column[column].button, &requisition); in column_auto_resize()
1905 for (list = clist->row_list; list; list = list->next) in column_auto_resize()
1907 GTK_CMCLIST_GET_CLASS (clist)->cell_size_request in column_auto_resize()
1908 (clist, GTK_CMCLIST_ROW (list), column, &requisition); in column_auto_resize()
1910 if (new_width == clist->column[column].width) in column_auto_resize()
1913 if (new_width < clist->column[column].width) in column_auto_resize()
1915 (clist, column, MAX (new_width, clist->column[column].min_width)); in column_auto_resize()
1920 real_resize_column (GtkCMCList *clist, in real_resize_column() argument
1924 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in real_resize_column()
1926 if (column < 0 || column >= clist->columns) in real_resize_column()
1929 if (width < MAX (COLUMN_MIN_WIDTH, clist->column[column].min_width)) in real_resize_column()
1930 width = MAX (COLUMN_MIN_WIDTH, clist->column[column].min_width); in real_resize_column()
1931 if (clist->column[column].max_width >= 0 && in real_resize_column()
1932 width > clist->column[column].max_width) in real_resize_column()
1933 width = clist->column[column].max_width; in real_resize_column()
1935 clist->column[column].width = width; in real_resize_column()
1936 clist->column[column].width_set = TRUE; in real_resize_column()
1942 size_allocate_columns (clist, TRUE); in real_resize_column()
1943 size_allocate_title_buttons (clist); in real_resize_column()
1945 CLIST_REFRESH (clist); in real_resize_column()
1949 abort_column_resize (GtkCMCList *clist) in abort_column_resize() argument
1951 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in abort_column_resize()
1953 if (!GTK_CMCLIST_IN_DRAG(clist)) in abort_column_resize()
1956 GTK_CMCLIST_UNSET_FLAG (clist, CMCLIST_IN_DRAG); in abort_column_resize()
1957 gtk_grab_remove (GTK_WIDGET (clist)); in abort_column_resize()
1958 gdk_display_pointer_ungrab (gtk_widget_get_display (GTK_WIDGET (clist)), in abort_column_resize()
1960 clist->drag_pos = -1; in abort_column_resize()
1962 if (clist->x_drag >= 0 && clist->x_drag <= clist->clist_window_width - 1) in abort_column_resize()
1963 clist_refresh(clist); in abort_column_resize()
1967 size_allocate_title_buttons (GtkCMCList *clist) in size_allocate_title_buttons() argument
1974 if (!gtk_widget_get_realized (GTK_WIDGET(clist))) in size_allocate_title_buttons()
1977 button_allocation.x = clist->hoffset; in size_allocate_title_buttons()
1980 button_allocation.height = clist->column_title_area.height; in size_allocate_title_buttons()
1983 for (last_column = clist->columns - 1; last_column >= 0; last_column--) in size_allocate_title_buttons()
1984 if (clist->column[last_column].visible) in size_allocate_title_buttons()
1989 if (!clist->column[i].visible) in size_allocate_title_buttons()
1992 gdk_window_hide (clist->column[i].window); in size_allocate_title_buttons()
1996 button_allocation.width += (clist->column[i].area.width + in size_allocate_title_buttons()
1999 if (!clist->column[i + 1].button) in size_allocate_title_buttons()
2001 gdk_window_hide (clist->column[i].window); in size_allocate_title_buttons()
2005 gtk_widget_size_allocate (clist->column[last_button].button, in size_allocate_title_buttons()
2010 if (clist->column[last_button].resizeable) in size_allocate_title_buttons()
2012 gdk_window_show (clist->column[last_button].window); in size_allocate_title_buttons()
2013 gdk_window_move_resize (clist->column[last_button].window, in size_allocate_title_buttons()
2016 clist->column_title_area.height); in size_allocate_title_buttons()
2019 gdk_window_hide (clist->column[last_button].window); in size_allocate_title_buttons()
2024 button_allocation.width += (clist->column[last_column].area.width + in size_allocate_title_buttons()
2026 gtk_widget_size_allocate (clist->column[last_button].button, in size_allocate_title_buttons()
2029 if (clist->column[last_button].resizeable) in size_allocate_title_buttons()
2033 gdk_window_show (clist->column[last_button].window); in size_allocate_title_buttons()
2034 gdk_window_move_resize (clist->column[last_button].window, in size_allocate_title_buttons()
2036 0, DRAG_WIDTH, clist->column_title_area.height); in size_allocate_title_buttons()
2039 gdk_window_hide (clist->column[last_button].window); in size_allocate_title_buttons()
2043 size_allocate_columns (GtkCMCList *clist, in size_allocate_columns() argument
2052 for (last_column = clist->columns - 1; in size_allocate_columns()
2053 last_column >= 0 && !clist->column[last_column].visible; last_column--); in size_allocate_columns()
2060 if (!clist->column[i].visible) in size_allocate_columns()
2062 clist->column[i].area.x = xoffset; in size_allocate_columns()
2063 if (clist->column[i].width_set) in size_allocate_columns()
2065 if (!block_resize && GTK_CMCLIST_SHOW_TITLES(clist) && in size_allocate_columns()
2066 clist->column[i].auto_resize && clist->column[i].button) in size_allocate_columns()
2070 gtk_widget_get_requisition (clist->column[i].button, &requisition); in size_allocate_columns()
2074 if (width > clist->column[i].width) in size_allocate_columns()
2075 gtk_cmclist_set_column_width (clist, i, width); in size_allocate_columns()
2078 clist->column[i].area.width = clist->column[i].width; in size_allocate_columns()
2079 xoffset += clist->column[i].width + CELL_SPACING + (2* COLUMN_INSET); in size_allocate_columns()
2081 else if (GTK_CMCLIST_SHOW_TITLES(clist) && clist->column[i].button) in size_allocate_columns()
2083 gtk_widget_get_requisition (clist->column[i].button, &requisition); in size_allocate_columns()
2084 clist->column[i].area.width = in size_allocate_columns()
2091 clist->column[last_column].area.width = clist->column[last_column].area.width in size_allocate_columns()
2092 + MAX (0, clist->clist_window_width + COLUMN_INSET - xoffset); in size_allocate_columns()
2096 list_requisition_width (GtkCMCList *clist) in list_requisition_width() argument
2102 for (i = clist->columns - 1; i >= 0; i--) in list_requisition_width()
2104 if (!clist->column[i].visible) in list_requisition_width()
2107 if (clist->column[i].width_set) in list_requisition_width()
2108 width += clist->column[i].width + CELL_SPACING + (2 * COLUMN_INSET); in list_requisition_width()
2109 else if (GTK_CMCLIST_SHOW_TITLES(clist) && clist->column[i].button) in list_requisition_width()
2111 gtk_widget_get_requisition (clist->column[i].button, &requisition); in list_requisition_width()
2123 new_column_width (GtkCMCList *clist, in new_column_width() argument
2127 gint xthickness = gtk_widget_get_style (GTK_WIDGET (clist))->xthickness; in new_column_width()
2137 for (last_column = clist->columns - 1; in new_column_width()
2138 last_column >= 0 && !clist->column[last_column].visible; last_column--); in new_column_width()
2142 dx = (COLUMN_LEFT_XPIXEL (clist, column) + COLUMN_INSET + in new_column_width()
2146 if (width < MAX (COLUMN_MIN_WIDTH, clist->column[column].min_width)) in new_column_width()
2148 width = MAX (COLUMN_MIN_WIDTH, clist->column[column].min_width); in new_column_width()
2152 else if (clist->column[column].max_width >= COLUMN_MIN_WIDTH && in new_column_width()
2153 width > clist->column[column].max_width) in new_column_width()
2155 width = clist->column[column].max_width; in new_column_width()
2156 cx = dx + clist->column[column].max_width; in new_column_width()
2160 if (cx < 0 || cx > clist->clist_window_width) in new_column_width()
2167 column_button_create (GtkCMCList *clist, in column_button_create() argument
2173 button = clist->column[column].button = gtk_button_new (); in column_button_create()
2176 gtk_widget_modify_style(clist->column[column].button, style); in column_button_create()
2181 if (gtk_widget_get_realized (GTK_WIDGET(clist)) && clist->title_window) in column_button_create()
2182 gtk_widget_set_parent_window (clist->column[column].button, in column_button_create()
2183 clist->title_window); in column_button_create()
2184 gtk_widget_set_parent (button, GTK_WIDGET (clist)); in column_button_create()
2188 (gpointer) clist); in column_button_create()
2197 GtkCMCList *clist; in column_button_clicked() local
2202 clist = GTK_CMCLIST (data); in column_button_clicked()
2205 for (i = 0; i < clist->columns; i++) in column_button_clicked()
2206 if (clist->column[i].button == widget) in column_button_clicked()
2209 g_signal_emit (G_OBJECT (clist), clist_signals[CLICK_COLUMN], 0, i); in column_button_clicked()
2247 gtk_cmclist_get_cell_type (GtkCMCList *clist, in gtk_cmclist_get_cell_type() argument
2253 cm_return_val_if_fail (GTK_IS_CMCLIST (clist), -1); in gtk_cmclist_get_cell_type()
2255 if (row < 0 || row >= clist->rows) in gtk_cmclist_get_cell_type()
2257 if (column < 0 || column >= clist->columns) in gtk_cmclist_get_cell_type()
2260 clist_row = ROW_ELEMENT (clist, row)->data; in gtk_cmclist_get_cell_type()
2266 gtk_cmclist_set_text (GtkCMCList *clist, in gtk_cmclist_set_text() argument
2273 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_set_text()
2275 if (row < 0 || row >= clist->rows) in gtk_cmclist_set_text()
2277 if (column < 0 || column >= clist->columns) in gtk_cmclist_set_text()
2280 clist_row = ROW_ELEMENT (clist, row)->data; in gtk_cmclist_set_text()
2283 GTK_CMCLIST_GET_CLASS (clist)->set_cell_contents in gtk_cmclist_set_text()
2284 (clist, clist_row, column, GTK_CMCELL_TEXT, text, 0, NULL); in gtk_cmclist_set_text()
2287 if (CLIST_UNFROZEN (clist)) in gtk_cmclist_set_text()
2289 if (gtk_cmclist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE) in gtk_cmclist_set_text()
2290 GTK_CMCLIST_GET_CLASS (clist)->draw_row (clist, NULL, row, clist_row); in gtk_cmclist_set_text()
2295 gtk_cmclist_get_text (GtkCMCList *clist, in gtk_cmclist_get_text() argument
2302 cm_return_val_if_fail (GTK_IS_CMCLIST (clist), 0); in gtk_cmclist_get_text()
2304 if (row < 0 || row >= clist->rows) in gtk_cmclist_get_text()
2306 if (column < 0 || column >= clist->columns) in gtk_cmclist_get_text()
2309 clist_row = ROW_ELEMENT (clist, row)->data; in gtk_cmclist_get_text()
2321 gtk_cmclist_set_pixbuf (GtkCMCList *clist, in gtk_cmclist_set_pixbuf() argument
2328 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_set_pixbuf()
2330 if (row < 0 || row >= clist->rows) in gtk_cmclist_set_pixbuf()
2332 if (column < 0 || column >= clist->columns) in gtk_cmclist_set_pixbuf()
2335 clist_row = ROW_ELEMENT (clist, row)->data; in gtk_cmclist_set_pixbuf()
2339 GTK_CMCLIST_GET_CLASS (clist)->set_cell_contents in gtk_cmclist_set_pixbuf()
2340 (clist, clist_row, column, GTK_CMCELL_PIXBUF, NULL, 0, pixbuf); in gtk_cmclist_set_pixbuf()
2343 if (CLIST_UNFROZEN (clist)) in gtk_cmclist_set_pixbuf()
2345 if (gtk_cmclist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE) in gtk_cmclist_set_pixbuf()
2346 GTK_CMCLIST_GET_CLASS (clist)->draw_row (clist, NULL, row, clist_row); in gtk_cmclist_set_pixbuf()
2351 gtk_cmclist_get_pixbuf (GtkCMCList *clist, in gtk_cmclist_get_pixbuf() argument
2358 cm_return_val_if_fail (GTK_IS_CMCLIST (clist), 0); in gtk_cmclist_get_pixbuf()
2360 if (row < 0 || row >= clist->rows) in gtk_cmclist_get_pixbuf()
2362 if (column < 0 || column >= clist->columns) in gtk_cmclist_get_pixbuf()
2365 clist_row = ROW_ELEMENT (clist, row)->data; in gtk_cmclist_get_pixbuf()
2379 gtk_cmclist_set_pixtext (GtkCMCList *clist, in gtk_cmclist_set_pixtext() argument
2388 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_set_pixtext()
2390 if (row < 0 || row >= clist->rows) in gtk_cmclist_set_pixtext()
2392 if (column < 0 || column >= clist->columns) in gtk_cmclist_set_pixtext()
2395 clist_row = ROW_ELEMENT (clist, row)->data; in gtk_cmclist_set_pixtext()
2398 GTK_CMCLIST_GET_CLASS (clist)->set_cell_contents in gtk_cmclist_set_pixtext()
2399 (clist, clist_row, column, GTK_CMCELL_PIXTEXT, text, spacing, pixbuf); in gtk_cmclist_set_pixtext()
2402 if (CLIST_UNFROZEN (clist)) in gtk_cmclist_set_pixtext()
2404 if (gtk_cmclist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE) in gtk_cmclist_set_pixtext()
2405 GTK_CMCLIST_GET_CLASS (clist)->draw_row (clist, NULL, row, clist_row); in gtk_cmclist_set_pixtext()
2410 gtk_cmclist_get_pixtext (GtkCMCList *clist, in gtk_cmclist_get_pixtext() argument
2419 cm_return_val_if_fail (GTK_IS_CMCLIST (clist), 0); in gtk_cmclist_get_pixtext()
2421 if (row < 0 || row >= clist->rows) in gtk_cmclist_get_pixtext()
2423 if (column < 0 || column >= clist->columns) in gtk_cmclist_get_pixtext()
2426 clist_row = ROW_ELEMENT (clist, row)->data; in gtk_cmclist_get_pixtext()
2442 gtk_cmclist_set_shift (GtkCMCList *clist, in gtk_cmclist_set_shift() argument
2451 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_set_shift()
2453 if (row < 0 || row >= clist->rows) in gtk_cmclist_set_shift()
2455 if (column < 0 || column >= clist->columns) in gtk_cmclist_set_shift()
2458 clist_row = ROW_ELEMENT (clist, row)->data; in gtk_cmclist_set_shift()
2460 if (clist->column[column].auto_resize && in gtk_cmclist_set_shift()
2461 !GTK_CMCLIST_AUTO_RESIZE_BLOCKED (clist)) in gtk_cmclist_set_shift()
2462 GTK_CMCLIST_GET_CLASS (clist)->cell_size_request (clist, clist_row, in gtk_cmclist_set_shift()
2468 column_auto_resize (clist, clist_row, column, requisition.width); in gtk_cmclist_set_shift()
2470 if (CLIST_UNFROZEN (clist) && gtk_cmclist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE) in gtk_cmclist_set_shift()
2471 GTK_CMCLIST_GET_CLASS (clist)->draw_row (clist, NULL, row, clist_row); in gtk_cmclist_set_shift()
2479 set_cell_contents (GtkCMCList *clist, in set_cell_contents() argument
2491 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in set_cell_contents()
2494 if (clist->column[column].auto_resize && in set_cell_contents()
2495 !GTK_CMCLIST_AUTO_RESIZE_BLOCKED (clist)) in set_cell_contents()
2496 GTK_CMCLIST_GET_CLASS (clist)->cell_size_request (clist, clist_row, in set_cell_contents()
2553 if (clist->column[column].auto_resize && in set_cell_contents()
2554 !GTK_CMCLIST_AUTO_RESIZE_BLOCKED (clist)) in set_cell_contents()
2555 column_auto_resize (clist, clist_row, column, requisition.width); in set_cell_contents()
2563 _gtk_cmclist_create_cell_layout (GtkCMCList *clist, in _gtk_cmclist_create_cell_layout() argument
2572 get_cell_style (clist, clist_row, GTK_STATE_NORMAL, column, &style); in _gtk_cmclist_create_cell_layout()
2587 layout = gtk_widget_create_pango_layout (GTK_WIDGET (clist), in _gtk_cmclist_create_cell_layout()
2601 cell_size_request (GtkCMCList *clist, in cell_size_request() argument
2611 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in cell_size_request()
2614 layout = _gtk_cmclist_create_cell_layout (clist, clist_row, column); in cell_size_request()
2664 gtk_cmclist_prepend (GtkCMCList *clist, in gtk_cmclist_prepend() argument
2667 cm_return_val_if_fail (GTK_IS_CMCLIST (clist), -1); in gtk_cmclist_prepend()
2670 return GTK_CMCLIST_GET_CLASS (clist)->insert_row (clist, 0, text); in gtk_cmclist_prepend()
2674 gtk_cmclist_append (GtkCMCList *clist, in gtk_cmclist_append() argument
2677 cm_return_val_if_fail (GTK_IS_CMCLIST (clist), -1); in gtk_cmclist_append()
2680 return GTK_CMCLIST_GET_CLASS (clist)->insert_row (clist, clist->rows, text); in gtk_cmclist_append()
2684 gtk_cmclist_insert (GtkCMCList *clist, in gtk_cmclist_insert() argument
2688 cm_return_val_if_fail (GTK_IS_CMCLIST (clist), -1); in gtk_cmclist_insert()
2691 if (row < 0 || row > clist->rows) in gtk_cmclist_insert()
2692 row = clist->rows; in gtk_cmclist_insert()
2694 return GTK_CMCLIST_GET_CLASS (clist)->insert_row (clist, row, text); in gtk_cmclist_insert()
2698 gtk_cmclist_remove (GtkCMCList *clist, in gtk_cmclist_remove() argument
2701 GTK_CMCLIST_GET_CLASS (clist)->remove_row (clist, row); in gtk_cmclist_remove()
2705 gtk_cmclist_clear (GtkCMCList *clist) in gtk_cmclist_clear() argument
2707 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_clear()
2709 GTK_CMCLIST_GET_CLASS (clist)->clear (clist); in gtk_cmclist_clear()
2719 real_insert_row (GtkCMCList *clist, in real_insert_row() argument
2726 cm_return_val_if_fail (GTK_IS_CMCLIST (clist), -1); in real_insert_row()
2730 if (row < 0 || row > clist->rows) in real_insert_row()
2734 clist_row = row_new (clist); in real_insert_row()
2737 for (i = 0; i < clist->columns; i++) in real_insert_row()
2739 GTK_CMCLIST_GET_CLASS (clist)->set_cell_contents in real_insert_row()
2740 (clist, clist_row, i, GTK_CMCELL_TEXT, text[i], 0, NULL); in real_insert_row()
2742 if (!clist->rows) in real_insert_row()
2744 clist->row_list = g_list_append (clist->row_list, clist_row); in real_insert_row()
2745 clist->row_list_end = clist->row_list; in real_insert_row()
2749 if (GTK_CMCLIST_AUTO_SORT(clist)) /* override insertion pos */ in real_insert_row()
2754 work = clist->row_list; in real_insert_row()
2756 if (clist->sort_type == GTK_SORT_ASCENDING) in real_insert_row()
2758 while (row < clist->rows && in real_insert_row()
2759 clist->compare (clist, clist_row, in real_insert_row()
2768 while (row < clist->rows && in real_insert_row()
2769 clist->compare (clist, clist_row, in real_insert_row()
2779 if (row == clist->rows) in real_insert_row()
2780 clist->row_list_end = (g_list_append (clist->row_list_end, in real_insert_row()
2783 clist->row_list = g_list_insert (clist->row_list, clist_row, row); in real_insert_row()
2786 clist->rows++; in real_insert_row()
2788 if (row < ROW_FROM_YPIXEL (clist, 0)) in real_insert_row()
2789 clist->voffset -= (clist->row_height + CELL_SPACING); in real_insert_row()
2792 sync_selection (clist, row, SYNC_INSERT); in real_insert_row()
2794 if (clist->rows == 1) in real_insert_row()
2796 clist->focus_row = 0; in real_insert_row()
2797 if (clist->selection_mode == GTK_SELECTION_BROWSE) in real_insert_row()
2798 gtk_cmclist_select_row (clist, 0, -1); in real_insert_row()
2802 if (CLIST_UNFROZEN (clist)) in real_insert_row()
2804 adjust_adjustments (clist, FALSE); in real_insert_row()
2806 if (gtk_cmclist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE) in real_insert_row()
2807 draw_rows (clist, NULL); in real_insert_row()
2814 real_remove_row (GtkCMCList *clist, in real_remove_row() argument
2821 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in real_remove_row()
2824 if (row < 0 || row > (clist->rows - 1)) in real_remove_row()
2827 was_visible = (gtk_cmclist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE); in real_remove_row()
2830 list = ROW_ELEMENT (clist, row); in real_remove_row()
2839 g_signal_emit (G_OBJECT (clist), clist_signals[UNSELECT_ROW], 0, in real_remove_row()
2842 sync_selection (clist, row, SYNC_REMOVE); in real_remove_row()
2845 clist->rows--; in real_remove_row()
2846 if (clist->row_list == list) in real_remove_row()
2847 clist->row_list = g_list_next (list); in real_remove_row()
2848 if (clist->row_list_end == list) in real_remove_row()
2849 clist->row_list_end = g_list_previous (list); in real_remove_row()
2852 if (row < ROW_FROM_YPIXEL (clist, 0)) in real_remove_row()
2853 clist->voffset += clist->row_height + CELL_SPACING; in real_remove_row()
2855 if (clist->selection_mode == GTK_SELECTION_BROWSE && !clist->selection && in real_remove_row()
2856 clist->focus_row >= 0) in real_remove_row()
2857 g_signal_emit (G_OBJECT (clist), clist_signals[SELECT_ROW], 0, in real_remove_row()
2858 clist->focus_row, -1, NULL); in real_remove_row()
2861 row_delete (clist, clist_row); in real_remove_row()
2864 if (CLIST_UNFROZEN (clist)) in real_remove_row()
2866 adjust_adjustments (clist, FALSE); in real_remove_row()
2869 draw_rows (clist, NULL); in real_remove_row()
2874 real_clear (GtkCMCList *clist) in real_clear() argument
2881 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in real_clear()
2884 g_list_free (clist->selection); in real_clear()
2885 g_list_free (clist->undo_selection); in real_clear()
2886 g_list_free (clist->undo_unselection); in real_clear()
2888 clist->selection = NULL; in real_clear()
2889 clist->selection_end = NULL; in real_clear()
2890 clist->undo_selection = NULL; in real_clear()
2891 clist->undo_unselection = NULL; in real_clear()
2892 clist->voffset = 0; in real_clear()
2893 clist->focus_row = -1; in real_clear()
2894 clist->anchor = -1; in real_clear()
2895 clist->undo_anchor = -1; in real_clear()
2896 clist->anchor_state = GTK_STATE_SELECTED; in real_clear()
2897 clist->drag_pos = -1; in real_clear()
2900 GTK_CMCLIST_SET_FLAG (clist, CMCLIST_AUTO_RESIZE_BLOCKED); in real_clear()
2901 free_list = clist->row_list; in real_clear()
2902 clist->row_list = NULL; in real_clear()
2903 clist->row_list_end = NULL; in real_clear()
2904 clist->rows = 0; in real_clear()
2906 row_delete (clist, GTK_CMCLIST_ROW (list)); in real_clear()
2908 GTK_CMCLIST_UNSET_FLAG (clist, CMCLIST_AUTO_RESIZE_BLOCKED); in real_clear()
2909 for (i = 0; i < clist->columns; i++) in real_clear()
2910 if (clist->column[i].auto_resize) in real_clear()
2912 if (GTK_CMCLIST_SHOW_TITLES(clist) && clist->column[i].button) in real_clear()
2914 gtk_widget_get_requisition (clist->column[i].button, &requisition); in real_clear()
2916 (clist, i, (requisition.width - in real_clear()
2920 gtk_cmclist_set_column_width (clist, i, 0); in real_clear()
2923 if (clist->vadjustment) in real_clear()
2925 gtk_adjustment_set_value (clist->vadjustment, 0.0); in real_clear()
2926 CLIST_REFRESH (clist); in real_clear()
2929 gtk_widget_queue_resize (GTK_WIDGET (clist)); in real_clear()
2933 real_row_move (GtkCMCList *clist, in real_row_move() argument
2942 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in real_row_move()
2944 if (GTK_CMCLIST_AUTO_SORT(clist)) in real_row_move()
2947 if (source_row < 0 || source_row >= clist->rows || in real_row_move()
2948 dest_row < 0 || dest_row >= clist->rows || in real_row_move()
2952 gtk_cmclist_freeze (clist); in real_row_move()
2955 clist_row = ROW_ELEMENT (clist, source_row)->data; in real_row_move()
2956 if (source_row == clist->rows - 1) in real_row_move()
2957 clist->row_list_end = clist->row_list_end->prev; in real_row_move()
2958 clist->row_list = g_list_remove (clist->row_list, clist_row); in real_row_move()
2959 clist->rows--; in real_row_move()
2962 clist->row_list = g_list_insert (clist->row_list, clist_row, dest_row); in real_row_move()
2963 if (dest_row == clist->rows) in real_row_move()
2964 clist->row_list_end = clist->row_list_end->next; in real_row_move()
2965 clist->rows++; in real_row_move()
2981 for (list = clist->selection; list; list = list->next) in real_row_move()
2990 if (clist->focus_row == source_row) in real_row_move()
2991 clist->focus_row = dest_row; in real_row_move()
2992 else if (clist->focus_row > first) in real_row_move()
2993 clist->focus_row += d; in real_row_move()
2995 gtk_cmclist_thaw (clist); in real_row_move()
3012 gtk_cmclist_moveto (GtkCMCList *clist, in gtk_cmclist_moveto() argument
3018 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_moveto()
3020 if (row < -1 || row >= clist->rows) in gtk_cmclist_moveto()
3022 if (column < -1 || column >= clist->columns) in gtk_cmclist_moveto()
3029 if (clist->hadjustment && column >= 0) in gtk_cmclist_moveto()
3033 x = (COLUMN_LEFT (clist, column) - CELL_SPACING - COLUMN_INSET - in gtk_cmclist_moveto()
3034 (col_align * (clist->clist_window_width - 2 * COLUMN_INSET - in gtk_cmclist_moveto()
3035 CELL_SPACING - clist->column[column].area.width))); in gtk_cmclist_moveto()
3037 gtk_adjustment_set_value (clist->hadjustment, 0.0); in gtk_cmclist_moveto()
3038 else if (x > LIST_WIDTH (clist) - clist->clist_window_width) in gtk_cmclist_moveto()
3040 (clist->hadjustment, LIST_WIDTH (clist) - clist->clist_window_width); in gtk_cmclist_moveto()
3042 gtk_adjustment_set_value (clist->hadjustment, x); in gtk_cmclist_moveto()
3046 if (clist->vadjustment && row >= 0) in gtk_cmclist_moveto()
3047 move_vertical (clist, row, row_align); in gtk_cmclist_moveto()
3051 gtk_cmclist_set_row_height (GtkCMCList *clist, in gtk_cmclist_set_row_height() argument
3057 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_set_row_height()
3059 widget = GTK_WIDGET (clist); in gtk_cmclist_set_row_height()
3065 clist->row_height = height; in gtk_cmclist_set_row_height()
3066 GTK_CMCLIST_SET_FLAG (clist, CMCLIST_ROW_HEIGHT_SET); in gtk_cmclist_set_row_height()
3070 GTK_CMCLIST_UNSET_FLAG (clist, CMCLIST_ROW_HEIGHT_SET); in gtk_cmclist_set_row_height()
3071 clist->row_height = 0; in gtk_cmclist_set_row_height()
3083 if (!GTK_CMCLIST_ROW_HEIGHT_SET(clist)) in gtk_cmclist_set_row_height()
3085 clist->row_height = (pango_font_metrics_get_ascent (metrics) + in gtk_cmclist_set_row_height()
3087 clist->row_height = PANGO_PIXELS (clist->row_height) + 1; in gtk_cmclist_set_row_height()
3093 CLIST_REFRESH (clist); in gtk_cmclist_set_row_height()
3097 gtk_cmclist_set_row_data (GtkCMCList *clist, in gtk_cmclist_set_row_data() argument
3101 gtk_cmclist_set_row_data_full (clist, row, data, NULL); in gtk_cmclist_set_row_data()
3105 gtk_cmclist_set_row_data_full (GtkCMCList *clist, in gtk_cmclist_set_row_data_full() argument
3112 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_set_row_data_full()
3114 if (row < 0 || row > (clist->rows - 1)) in gtk_cmclist_set_row_data_full()
3117 clist_row = ROW_ELEMENT (clist, row)->data; in gtk_cmclist_set_row_data_full()
3127 gtk_cmclist_get_row_data (GtkCMCList *clist, in gtk_cmclist_get_row_data() argument
3132 cm_return_val_if_fail (GTK_IS_CMCLIST (clist), NULL); in gtk_cmclist_get_row_data()
3134 if (row < 0 || row > (clist->rows - 1)) in gtk_cmclist_get_row_data()
3137 clist_row = ROW_ELEMENT (clist, row)->data; in gtk_cmclist_get_row_data()
3142 gtk_cmclist_find_row_from_data (GtkCMCList *clist, in gtk_cmclist_find_row_from_data() argument
3148 cm_return_val_if_fail (GTK_IS_CMCLIST (clist), -1); in gtk_cmclist_find_row_from_data()
3150 for (n = 0, list = clist->row_list; list; n++, list = list->next) in gtk_cmclist_find_row_from_data()
3158 gtk_cmclist_swap_rows (GtkCMCList *clist, in gtk_cmclist_swap_rows() argument
3164 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_swap_rows()
3167 if (GTK_CMCLIST_AUTO_SORT(clist)) in gtk_cmclist_swap_rows()
3170 gtk_cmclist_freeze (clist); in gtk_cmclist_swap_rows()
3175 gtk_cmclist_row_move (clist, last, first); in gtk_cmclist_swap_rows()
3176 gtk_cmclist_row_move (clist, first + 1, last); in gtk_cmclist_swap_rows()
3178 gtk_cmclist_thaw (clist); in gtk_cmclist_swap_rows()
3182 gtk_cmclist_row_move (GtkCMCList *clist, in gtk_cmclist_row_move() argument
3186 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_row_move()
3188 if (GTK_CMCLIST_AUTO_SORT(clist)) in gtk_cmclist_row_move()
3191 if (source_row < 0 || source_row >= clist->rows || in gtk_cmclist_row_move()
3192 dest_row < 0 || dest_row >= clist->rows || in gtk_cmclist_row_move()
3196 g_signal_emit (G_OBJECT (clist), clist_signals[ROW_MOVE], 0, in gtk_cmclist_row_move()
3201 gtk_cmclist_row_is_visible (GtkCMCList *clist, in gtk_cmclist_row_is_visible() argument
3206 cm_return_val_if_fail (GTK_IS_CMCLIST (clist), 0); in gtk_cmclist_row_is_visible()
3208 if (row < 0 || row >= clist->rows) in gtk_cmclist_row_is_visible()
3211 if (clist->row_height == 0) in gtk_cmclist_row_is_visible()
3214 if (row < ROW_FROM_YPIXEL (clist, 0)) in gtk_cmclist_row_is_visible()
3217 if (row > ROW_FROM_YPIXEL (clist, clist->clist_window_height)) in gtk_cmclist_row_is_visible()
3220 top = ROW_TOP_YPIXEL (clist, row); in gtk_cmclist_row_is_visible()
3223 || ((top + clist->row_height) >= clist->clist_window_height)) in gtk_cmclist_row_is_visible()
3230 gtk_cmclist_row_is_above_viewport (GtkCMCList *clist, in gtk_cmclist_row_is_above_viewport() argument
3233 cm_return_val_if_fail(GTK_IS_CMCLIST (clist), 0); in gtk_cmclist_row_is_above_viewport()
3235 if (row < 0 || row >= clist->rows) in gtk_cmclist_row_is_above_viewport()
3238 if (clist->row_height == 0) in gtk_cmclist_row_is_above_viewport()
3241 if (row < ROW_FROM_YPIXEL (clist, 0)) in gtk_cmclist_row_is_above_viewport()
3248 gtk_cmclist_row_is_below_viewport (GtkCMCList *clist, in gtk_cmclist_row_is_below_viewport() argument
3251 cm_return_val_if_fail(GTK_IS_CMCLIST (clist), 0); in gtk_cmclist_row_is_below_viewport()
3253 if (row < 0 || row >= clist->rows) in gtk_cmclist_row_is_below_viewport()
3256 if (clist->row_height == 0) in gtk_cmclist_row_is_below_viewport()
3259 if (row > ROW_FROM_YPIXEL (clist, clist->clist_window_height)) in gtk_cmclist_row_is_below_viewport()
3266 gtk_cmclist_set_foreground (GtkCMCList *clist, in gtk_cmclist_set_foreground() argument
3272 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_set_foreground()
3274 if (row < 0 || row >= clist->rows) in gtk_cmclist_set_foreground()
3277 clist_row = ROW_ELEMENT (clist, row)->data; in gtk_cmclist_set_foreground()
3283 if (gtk_widget_get_realized (GTK_WIDGET(clist))) in gtk_cmclist_set_foreground()
3284 gdk_colormap_alloc_color (gtk_widget_get_colormap (GTK_WIDGET (clist)), in gtk_cmclist_set_foreground()
3290 if (CLIST_UNFROZEN (clist) && gtk_cmclist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE) in gtk_cmclist_set_foreground()
3291 GTK_CMCLIST_GET_CLASS (clist)->draw_row (clist, NULL, row, clist_row); in gtk_cmclist_set_foreground()
3295 gtk_cmclist_set_background (GtkCMCList *clist, in gtk_cmclist_set_background() argument
3301 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_set_background()
3303 if (row < 0 || row >= clist->rows) in gtk_cmclist_set_background()
3306 clist_row = ROW_ELEMENT (clist, row)->data; in gtk_cmclist_set_background()
3312 if (gtk_widget_get_realized (GTK_WIDGET(clist))) in gtk_cmclist_set_background()
3313 gdk_colormap_alloc_color (gtk_widget_get_colormap (GTK_WIDGET (clist)), in gtk_cmclist_set_background()
3319 if (CLIST_UNFROZEN (clist) in gtk_cmclist_set_background()
3320 && (gtk_cmclist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE)) in gtk_cmclist_set_background()
3321 GTK_CMCLIST_GET_CLASS (clist)->draw_row (clist, NULL, row, clist_row); in gtk_cmclist_set_background()
3331 gtk_cmclist_set_cell_style (GtkCMCList *clist, in gtk_cmclist_set_cell_style() argument
3339 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_set_cell_style()
3341 if (row < 0 || row >= clist->rows) in gtk_cmclist_set_cell_style()
3343 if (column < 0 || column >= clist->columns) in gtk_cmclist_set_cell_style()
3346 clist_row = ROW_ELEMENT (clist, row)->data; in gtk_cmclist_set_cell_style()
3351 if (clist->column[column].auto_resize && in gtk_cmclist_set_cell_style()
3352 !GTK_CMCLIST_AUTO_RESIZE_BLOCKED (clist)) in gtk_cmclist_set_cell_style()
3353 GTK_CMCLIST_GET_CLASS (clist)->cell_size_request (clist, clist_row, in gtk_cmclist_set_cell_style()
3358 if (gtk_widget_get_realized (GTK_WIDGET(clist))) in gtk_cmclist_set_cell_style()
3369 if (gtk_widget_get_realized (GTK_WIDGET(clist))) in gtk_cmclist_set_cell_style()
3372 clist->clist_window); in gtk_cmclist_set_cell_style()
3375 column_auto_resize (clist, clist_row, column, requisition.width); in gtk_cmclist_set_cell_style()
3378 if (CLIST_UNFROZEN (clist)) in gtk_cmclist_set_cell_style()
3380 if (gtk_cmclist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE) in gtk_cmclist_set_cell_style()
3381 GTK_CMCLIST_GET_CLASS (clist)->draw_row (clist, NULL, row, clist_row); in gtk_cmclist_set_cell_style()
3386 gtk_cmclist_get_cell_style (GtkCMCList *clist, in gtk_cmclist_get_cell_style() argument
3392 cm_return_val_if_fail (GTK_IS_CMCLIST (clist), NULL); in gtk_cmclist_get_cell_style()
3394 if (row < 0 || row >= clist->rows || column < 0 || column >= clist->columns) in gtk_cmclist_get_cell_style()
3397 clist_row = ROW_ELEMENT (clist, row)->data; in gtk_cmclist_get_cell_style()
3403 gtk_cmclist_set_row_style (GtkCMCList *clist, in gtk_cmclist_set_row_style() argument
3412 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_set_row_style()
3414 if (row < 0 || row >= clist->rows) in gtk_cmclist_set_row_style()
3417 clist_row = ROW_ELEMENT (clist, row)->data; in gtk_cmclist_set_row_style()
3422 old_width = g_new (gint, clist->columns); in gtk_cmclist_set_row_style()
3424 if (!GTK_CMCLIST_AUTO_RESIZE_BLOCKED (clist)) in gtk_cmclist_set_row_style()
3426 for (i = 0; i < clist->columns; i++) in gtk_cmclist_set_row_style()
3427 if (clist->column[i].auto_resize) in gtk_cmclist_set_row_style()
3429 GTK_CMCLIST_GET_CLASS (clist)->cell_size_request (clist, clist_row, in gtk_cmclist_set_row_style()
3437 if (gtk_widget_get_realized (GTK_WIDGET(clist))) in gtk_cmclist_set_row_style()
3448 if (gtk_widget_get_realized (GTK_WIDGET(clist))) in gtk_cmclist_set_row_style()
3450 clist->clist_window); in gtk_cmclist_set_row_style()
3453 if (GTK_CMCLIST_AUTO_RESIZE_BLOCKED (clist)) in gtk_cmclist_set_row_style()
3454 for (i = 0; i < clist->columns; i++) in gtk_cmclist_set_row_style()
3455 column_auto_resize (clist, clist_row, i, old_width[i]); in gtk_cmclist_set_row_style()
3460 if (CLIST_UNFROZEN (clist)) in gtk_cmclist_set_row_style()
3462 if (gtk_cmclist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE) in gtk_cmclist_set_row_style()
3463 GTK_CMCLIST_GET_CLASS (clist)->draw_row (clist, NULL, row, clist_row); in gtk_cmclist_set_row_style()
3468 gtk_cmclist_get_row_style (GtkCMCList *clist, in gtk_cmclist_get_row_style() argument
3473 cm_return_val_if_fail (GTK_IS_CMCLIST (clist), NULL); in gtk_cmclist_get_row_style()
3475 if (row < 0 || row >= clist->rows) in gtk_cmclist_get_row_style()
3478 clist_row = ROW_ELEMENT (clist, row)->data; in gtk_cmclist_get_row_style()
3493 gtk_cmclist_set_selectable (GtkCMCList *clist, in gtk_cmclist_set_selectable() argument
3499 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_set_selectable()
3501 if (row < 0 || row >= clist->rows) in gtk_cmclist_set_selectable()
3504 clist_row = ROW_ELEMENT (clist, row)->data; in gtk_cmclist_set_selectable()
3513 if (clist->anchor >= 0 && in gtk_cmclist_set_selectable()
3514 clist->selection_mode == GTK_SELECTION_MULTIPLE) in gtk_cmclist_set_selectable()
3516 clist->drag_button = 0; in gtk_cmclist_set_selectable()
3517 remove_grab (clist); in gtk_cmclist_set_selectable()
3518 GTK_CMCLIST_GET_CLASS (clist)->resync_selection (clist, NULL); in gtk_cmclist_set_selectable()
3520 g_signal_emit (G_OBJECT (clist), clist_signals[UNSELECT_ROW], 0, in gtk_cmclist_set_selectable()
3526 gtk_cmclist_get_selectable (GtkCMCList *clist, in gtk_cmclist_get_selectable() argument
3529 cm_return_val_if_fail (GTK_IS_CMCLIST (clist), FALSE); in gtk_cmclist_get_selectable()
3531 if (row < 0 || row >= clist->rows) in gtk_cmclist_get_selectable()
3534 return GTK_CMCLIST_ROW (ROW_ELEMENT (clist, row))->selectable; in gtk_cmclist_get_selectable()
3538 gtk_cmclist_select_row (GtkCMCList *clist, in gtk_cmclist_select_row() argument
3542 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_select_row()
3544 if (row < 0 || row >= clist->rows) in gtk_cmclist_select_row()
3546 if (column < -1 || column >= clist->columns) in gtk_cmclist_select_row()
3549 g_signal_emit (G_OBJECT (clist), clist_signals[SELECT_ROW], 0, in gtk_cmclist_select_row()
3554 gtk_cmclist_unselect_row (GtkCMCList *clist, in gtk_cmclist_unselect_row() argument
3558 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_unselect_row()
3560 if (row < 0 || row >= clist->rows) in gtk_cmclist_unselect_row()
3562 if (column < -1 || column >= clist->columns) in gtk_cmclist_unselect_row()
3565 g_signal_emit (G_OBJECT (clist), clist_signals[UNSELECT_ROW], 0, in gtk_cmclist_unselect_row()
3570 gtk_cmclist_select_all (GtkCMCList *clist) in gtk_cmclist_select_all() argument
3572 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_select_all()
3574 GTK_CMCLIST_GET_CLASS (clist)->select_all (clist); in gtk_cmclist_select_all()
3578 gtk_cmclist_unselect_all (GtkCMCList *clist) in gtk_cmclist_unselect_all() argument
3580 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_unselect_all()
3582 GTK_CMCLIST_GET_CLASS (clist)->unselect_all (clist); in gtk_cmclist_unselect_all()
3586 gtk_cmclist_undo_selection (GtkCMCList *clist) in gtk_cmclist_undo_selection() argument
3588 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_undo_selection()
3590 if (clist->selection_mode == GTK_SELECTION_MULTIPLE && in gtk_cmclist_undo_selection()
3591 (clist->undo_selection || clist->undo_unselection)) in gtk_cmclist_undo_selection()
3592 g_signal_emit (G_OBJECT (clist), clist_signals[UNDO_SELECTION], 0); in gtk_cmclist_undo_selection()
3616 selection_find (GtkCMCList *clist, in selection_find() argument
3620 return g_list_find (clist->selection, GINT_TO_POINTER (row_number)); in selection_find()
3624 toggle_row (GtkCMCList *clist, in toggle_row() argument
3631 switch (clist->selection_mode) in toggle_row()
3635 clist_row = ROW_ELEMENT (clist, row)->data; in toggle_row()
3642 g_signal_emit (G_OBJECT (clist), clist_signals[UNSELECT_ROW], 0, in toggle_row()
3648 g_signal_emit (G_OBJECT (clist), clist_signals[SELECT_ROW], 0, in toggle_row()
3657 fake_toggle_row (GtkCMCList *clist, in fake_toggle_row() argument
3662 work = ROW_ELEMENT (clist, row); in fake_toggle_row()
3668 clist->anchor_state = GTK_CMCLIST_ROW (work)->state = GTK_STATE_SELECTED; in fake_toggle_row()
3670 clist->anchor_state = GTK_CMCLIST_ROW (work)->state = GTK_STATE_NORMAL; in fake_toggle_row()
3672 if (CLIST_UNFROZEN (clist) && in fake_toggle_row()
3673 gtk_cmclist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE) in fake_toggle_row()
3674 GTK_CMCLIST_GET_CLASS (clist)->draw_row (clist, NULL, row, in fake_toggle_row()
3679 clist_has_grab (GtkCMCList *clist) in clist_has_grab() argument
3681 return (gtk_widget_has_grab (GTK_WIDGET(clist)) && in clist_has_grab()
3682 gdk_display_pointer_is_grabbed (gtk_widget_get_display (GTK_WIDGET (clist)))); in clist_has_grab()
3686 toggle_focus_row (GtkCMCList *clist) in toggle_focus_row() argument
3688 cm_return_if_fail (clist != 0); in toggle_focus_row()
3689 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in toggle_focus_row()
3691 if (clist_has_grab (clist) || in toggle_focus_row()
3692 clist->focus_row < 0 || clist->focus_row >= clist->rows) in toggle_focus_row()
3695 switch (clist->selection_mode) in toggle_focus_row()
3698 toggle_row (clist, clist->focus_row, 0, NULL); in toggle_focus_row()
3701 g_list_free (clist->undo_selection); in toggle_focus_row()
3702 g_list_free (clist->undo_unselection); in toggle_focus_row()
3703 clist->undo_selection = NULL; in toggle_focus_row()
3704 clist->undo_unselection = NULL; in toggle_focus_row()
3706 clist->anchor = clist->focus_row; in toggle_focus_row()
3707 clist->drag_pos = clist->focus_row; in toggle_focus_row()
3708 clist->undo_anchor = clist->focus_row; in toggle_focus_row()
3710 if (GTK_CMCLIST_ADD_MODE(clist)) in toggle_focus_row()
3711 fake_toggle_row (clist, clist->focus_row); in toggle_focus_row()
3713 GTK_CMCLIST_GET_CLASS (clist)->fake_unselect_all (clist,clist->focus_row); in toggle_focus_row()
3715 GTK_CMCLIST_GET_CLASS (clist)->resync_selection (clist, NULL); in toggle_focus_row()
3723 toggle_add_mode (GtkCMCList *clist) in toggle_add_mode() argument
3725 cm_return_if_fail (clist != 0); in toggle_add_mode()
3726 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in toggle_add_mode()
3728 if (clist_has_grab (clist) || in toggle_add_mode()
3729 clist->selection_mode != GTK_SELECTION_MULTIPLE) in toggle_add_mode()
3732 gtk_cmclist_undraw_focus (GTK_WIDGET (clist)); in toggle_add_mode()
3733 if (!GTK_CMCLIST_ADD_MODE(clist)) in toggle_add_mode()
3735 GTK_CMCLIST_SET_FLAG (clist, CMCLIST_ADD_MODE); in toggle_add_mode()
3739 GTK_CMCLIST_UNSET_FLAG (clist, CMCLIST_ADD_MODE); in toggle_add_mode()
3740 clist->anchor_state = GTK_STATE_SELECTED; in toggle_add_mode()
3742 gtk_cmclist_draw_focus (GTK_WIDGET (clist)); in toggle_add_mode()
3746 real_select_row (GtkCMCList *clist, in real_select_row() argument
3756 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in real_select_row()
3758 if (row < 0 || row > (clist->rows - 1)) in real_select_row()
3761 switch (clist->selection_mode) in real_select_row()
3767 list = clist->selection; in real_select_row()
3777 g_signal_emit (G_OBJECT (clist), clist_signals[UNSELECT_ROW], 0, in real_select_row()
3788 clist_row = ROW_ELEMENT (clist, row)->data; in real_select_row()
3794 if (!clist->selection) in real_select_row()
3796 clist->selection = g_list_append (clist->selection, in real_select_row()
3798 clist->selection_end = clist->selection; in real_select_row()
3801 clist->selection_end = in real_select_row()
3802 g_list_append (clist->selection_end, GINT_TO_POINTER (row))->next; in real_select_row()
3804 if (CLIST_UNFROZEN (clist) in real_select_row()
3805 && (gtk_cmclist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE)) in real_select_row()
3806 GTK_CMCLIST_GET_CLASS (clist)->draw_row (clist, NULL, row, clist_row); in real_select_row()
3810 real_unselect_row (GtkCMCList *clist, in real_unselect_row() argument
3817 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in real_unselect_row()
3819 if (row < 0 || row > (clist->rows - 1)) in real_unselect_row()
3822 clist_row = ROW_ELEMENT (clist, row)->data; in real_unselect_row()
3828 if (clist->selection_end && in real_unselect_row()
3829 clist->selection_end->data == GINT_TO_POINTER (row)) in real_unselect_row()
3830 clist->selection_end = clist->selection_end->prev; in real_unselect_row()
3832 clist->selection = g_list_remove (clist->selection, in real_unselect_row()
3835 if (CLIST_UNFROZEN (clist) in real_unselect_row()
3836 && (gtk_cmclist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE)) in real_unselect_row()
3837 GTK_CMCLIST_GET_CLASS (clist)->draw_row (clist, NULL, row, clist_row); in real_unselect_row()
3842 real_select_all (GtkCMCList *clist) in real_select_all() argument
3844 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in real_select_all()
3846 if (clist_has_grab (clist)) in real_select_all()
3849 switch (clist->selection_mode) in real_select_all()
3856 g_list_free (clist->undo_selection); in real_select_all()
3857 g_list_free (clist->undo_unselection); in real_select_all()
3858 clist->undo_selection = NULL; in real_select_all()
3859 clist->undo_unselection = NULL; in real_select_all()
3861 if (clist->rows && in real_select_all()
3862 ((GtkCMCListRow *) (clist->row_list->data))->state != in real_select_all()
3864 fake_toggle_row (clist, 0); in real_select_all()
3866 clist->anchor_state = GTK_STATE_SELECTED; in real_select_all()
3867 clist->anchor = 0; in real_select_all()
3868 clist->drag_pos = 0; in real_select_all()
3869 clist->undo_anchor = clist->focus_row; in real_select_all()
3870 update_extended_selection (clist, clist->rows); in real_select_all()
3871 GTK_CMCLIST_GET_CLASS (clist)->resync_selection (clist, NULL); in real_select_all()
3879 real_unselect_all (GtkCMCList *clist) in real_unselect_all() argument
3884 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in real_unselect_all()
3886 if (clist_has_grab (clist)) in real_unselect_all()
3889 switch (clist->selection_mode) in real_unselect_all()
3892 if (clist->focus_row >= 0) in real_unselect_all()
3894 g_signal_emit (G_OBJECT (clist), in real_unselect_all()
3896 clist->focus_row, -1, NULL); in real_unselect_all()
3901 g_list_free (clist->undo_selection); in real_unselect_all()
3902 g_list_free (clist->undo_unselection); in real_unselect_all()
3903 clist->undo_selection = NULL; in real_unselect_all()
3904 clist->undo_unselection = NULL; in real_unselect_all()
3906 clist->anchor = -1; in real_unselect_all()
3907 clist->drag_pos = -1; in real_unselect_all()
3908 clist->undo_anchor = clist->focus_row; in real_unselect_all()
3914 list = clist->selection; in real_unselect_all()
3919 g_signal_emit (G_OBJECT (clist), in real_unselect_all()
3925 fake_unselect_all (GtkCMCList *clist, in fake_unselect_all() argument
3932 if (row >= 0 && (work = ROW_ELEMENT (clist, row))) in fake_unselect_all()
3939 if (CLIST_UNFROZEN (clist) && in fake_unselect_all()
3940 gtk_cmclist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE) in fake_unselect_all()
3941 GTK_CMCLIST_GET_CLASS (clist)->draw_row (clist, NULL, row, in fake_unselect_all()
3946 clist->undo_selection = clist->selection; in fake_unselect_all()
3947 clist->selection = NULL; in fake_unselect_all()
3948 clist->selection_end = NULL; in fake_unselect_all()
3950 for (list = clist->undo_selection; list; list = list->next) in fake_unselect_all()
3953 !(work = g_list_nth (clist->row_list, i))) in fake_unselect_all()
3957 if (CLIST_UNFROZEN (clist) && in fake_unselect_all()
3958 gtk_cmclist_row_is_visible (clist, i) != GTK_VISIBILITY_NONE) in fake_unselect_all()
3959 GTK_CMCLIST_GET_CLASS (clist)->draw_row (clist, NULL, i, in fake_unselect_all()
3965 real_undo_selection (GtkCMCList *clist) in real_undo_selection() argument
3969 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in real_undo_selection()
3971 if (clist_has_grab (clist) || in real_undo_selection()
3972 clist->selection_mode != GTK_SELECTION_MULTIPLE) in real_undo_selection()
3975 GTK_CMCLIST_GET_CLASS (clist)->resync_selection (clist, NULL); in real_undo_selection()
3977 if (!(clist->undo_selection || clist->undo_unselection)) in real_undo_selection()
3979 gtk_cmclist_unselect_all (clist); in real_undo_selection()
3983 for (work = clist->undo_selection; work; work = work->next) in real_undo_selection()
3984 g_signal_emit (G_OBJECT (clist), clist_signals[SELECT_ROW], 0, in real_undo_selection()
3987 for (work = clist->undo_unselection; work; work = work->next) in real_undo_selection()
3990 g_signal_emit (G_OBJECT (clist), clist_signals[UNSELECT_ROW], 0, in real_undo_selection()
3994 if (gtk_widget_has_focus(GTK_WIDGET(clist)) && clist->focus_row != clist->undo_anchor) in real_undo_selection()
3996 gtk_cmclist_undraw_focus (GTK_WIDGET (clist)); in real_undo_selection()
3997 clist->focus_row = clist->undo_anchor; in real_undo_selection()
3998 gtk_cmclist_draw_focus (GTK_WIDGET (clist)); in real_undo_selection()
4001 clist->focus_row = clist->undo_anchor; in real_undo_selection()
4003 clist->undo_anchor = -1; in real_undo_selection()
4005 g_list_free (clist->undo_selection); in real_undo_selection()
4006 g_list_free (clist->undo_unselection); in real_undo_selection()
4007 clist->undo_selection = NULL; in real_undo_selection()
4008 clist->undo_unselection = NULL; in real_undo_selection()
4010 if (ROW_TOP_YPIXEL (clist, clist->focus_row) + clist->row_height > in real_undo_selection()
4011 clist->clist_window_height) in real_undo_selection()
4012 gtk_cmclist_moveto (clist, clist->focus_row, -1, 1, 0); in real_undo_selection()
4013 else if (ROW_TOP_YPIXEL (clist, clist->focus_row) < 0) in real_undo_selection()
4014 gtk_cmclist_moveto (clist, clist->focus_row, -1, 0, 0); in real_undo_selection()
4018 set_anchor (GtkCMCList *clist, in set_anchor() argument
4023 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in set_anchor()
4025 if (clist->selection_mode != GTK_SELECTION_MULTIPLE || clist->anchor >= 0) in set_anchor()
4028 g_list_free (clist->undo_selection); in set_anchor()
4029 g_list_free (clist->undo_unselection); in set_anchor()
4030 clist->undo_selection = NULL; in set_anchor()
4031 clist->undo_unselection = NULL; in set_anchor()
4034 fake_toggle_row (clist, anchor); in set_anchor()
4037 GTK_CMCLIST_GET_CLASS (clist)->fake_unselect_all (clist, anchor); in set_anchor()
4038 clist->anchor_state = GTK_STATE_SELECTED; in set_anchor()
4041 clist->anchor = anchor; in set_anchor()
4042 clist->drag_pos = anchor; in set_anchor()
4043 clist->undo_anchor = undo_anchor; in set_anchor()
4047 resync_selection (GtkCMCList *clist, in resync_selection() argument
4056 if (clist->selection_mode != GTK_SELECTION_MULTIPLE) in resync_selection()
4059 if (clist->anchor < 0 || clist->drag_pos < 0) in resync_selection()
4062 gtk_cmclist_freeze (clist); in resync_selection()
4064 i = MIN (clist->anchor, clist->drag_pos); in resync_selection()
4065 e = MAX (clist->anchor, clist->drag_pos); in resync_selection()
4067 if (clist->undo_selection) in resync_selection()
4069 list = clist->selection; in resync_selection()
4070 clist->selection = clist->undo_selection; in resync_selection()
4071 clist->selection_end = g_list_last (clist->selection); in resync_selection()
4072 clist->undo_selection = list; in resync_selection()
4073 list = clist->selection; in resync_selection()
4080 clist_row = g_list_nth (clist->row_list, row)->data; in resync_selection()
4084 g_signal_emit (G_OBJECT (clist), in resync_selection()
4087 clist->undo_selection = g_list_prepend in resync_selection()
4088 (clist->undo_selection, GINT_TO_POINTER (row)); in resync_selection()
4094 if (clist->anchor < clist->drag_pos) in resync_selection()
4096 for (list = g_list_nth (clist->row_list, i); i <= e; in resync_selection()
4100 if (g_list_find (clist->selection, GINT_TO_POINTER(i))) in resync_selection()
4105 g_signal_emit (G_OBJECT (clist), in resync_selection()
4108 clist->undo_selection = in resync_selection()
4109 g_list_prepend (clist->undo_selection, in resync_selection()
4116 clist->undo_unselection = in resync_selection()
4117 g_list_prepend (clist->undo_unselection, in resync_selection()
4124 for (list = g_list_nth (clist->row_list, e); i <= e; in resync_selection()
4128 if (g_list_find (clist->selection, GINT_TO_POINTER(e))) in resync_selection()
4133 g_signal_emit (G_OBJECT (clist), in resync_selection()
4136 clist->undo_selection = in resync_selection()
4137 g_list_prepend (clist->undo_selection, in resync_selection()
4144 clist->undo_unselection = in resync_selection()
4145 g_list_prepend (clist->undo_unselection, in resync_selection()
4151 clist->undo_unselection = g_list_reverse (clist->undo_unselection); in resync_selection()
4152 for (list = clist->undo_unselection; list; list = list->next) in resync_selection()
4153 g_signal_emit (G_OBJECT (clist), clist_signals[SELECT_ROW], 0, in resync_selection()
4156 clist->anchor = -1; in resync_selection()
4157 clist->drag_pos = -1; in resync_selection()
4159 gtk_cmclist_thaw (clist); in resync_selection()
4163 update_extended_selection (GtkCMCList *clist, in update_extended_selection() argument
4173 gint y1 = clist->clist_window_height; in update_extended_selection()
4174 gint y2 = clist->clist_window_height; in update_extended_selection()
4179 if (clist->selection_mode != GTK_SELECTION_MULTIPLE || clist->anchor == -1) in update_extended_selection()
4184 if (row >= clist->rows) in update_extended_selection()
4185 row = clist->rows - 1; in update_extended_selection()
4188 if (row > clist->drag_pos && clist->anchor <= clist->drag_pos) in update_extended_selection()
4190 s2 = clist->drag_pos + 1; in update_extended_selection()
4194 else if (row < clist->drag_pos && clist->anchor >= clist->drag_pos) in update_extended_selection()
4197 e2 = clist->drag_pos - 1; in update_extended_selection()
4199 else if (row < clist->drag_pos && clist->anchor < clist->drag_pos) in update_extended_selection()
4201 e1 = clist->drag_pos; in update_extended_selection()
4205 if (row < clist->anchor) in update_extended_selection()
4207 s1 = clist->anchor + 1; in update_extended_selection()
4209 e2 = clist->anchor - 1; in update_extended_selection()
4215 else if (row > clist->drag_pos && clist->anchor > clist->drag_pos) in update_extended_selection()
4217 s1 = clist->drag_pos; in update_extended_selection()
4221 if (row > clist->anchor) in update_extended_selection()
4223 e1 = clist->anchor - 1; in update_extended_selection()
4224 s2 = clist->anchor + 1; in update_extended_selection()
4232 clist->drag_pos = row; in update_extended_selection()
4235 area.width = clist->clist_window_width; in update_extended_selection()
4240 for (i = s1, list = g_list_nth (clist->row_list, i); i <= e1; in update_extended_selection()
4244 if (GTK_CMCLIST_GET_CLASS (clist)->selection_find (clist, i, list)) in update_extended_selection()
4250 top = ROW_TOP_YPIXEL (clist, clist->focus_row); in update_extended_selection()
4252 if (top + clist->row_height <= 0) in update_extended_selection()
4255 area.height = ROW_TOP_YPIXEL (clist, e1) + clist->row_height; in update_extended_selection()
4256 draw_rows (clist, &area); in update_extended_selection()
4257 gtk_cmclist_moveto (clist, clist->focus_row, -1, 0, 0); in update_extended_selection()
4259 else if (top >= clist->clist_window_height) in update_extended_selection()
4261 area.y = ROW_TOP_YPIXEL (clist, s1) - 1; in update_extended_selection()
4262 area.height = clist->clist_window_height - area.y; in update_extended_selection()
4263 draw_rows (clist, &area); in update_extended_selection()
4264 gtk_cmclist_moveto (clist, clist->focus_row, -1, 1, 0); in update_extended_selection()
4267 gtk_cmclist_moveto (clist, clist->focus_row, -1, 0, 0); in update_extended_selection()
4268 else if (top + clist->row_height > clist->clist_window_height) in update_extended_selection()
4269 gtk_cmclist_moveto (clist, clist->focus_row, -1, 1, 0); in update_extended_selection()
4271 y1 = ROW_TOP_YPIXEL (clist, s1) - 1; in update_extended_selection()
4272 h1 = (e1 - s1 + 1) * (clist->row_height + CELL_SPACING); in update_extended_selection()
4278 for (i = s2, list = g_list_nth (clist->row_list, i); i <= e2; in update_extended_selection()
4281 GTK_CMCLIST_ROW (list)->state != clist->anchor_state) in update_extended_selection()
4282 GTK_CMCLIST_ROW (list)->state = clist->anchor_state; in update_extended_selection()
4284 top = ROW_TOP_YPIXEL (clist, clist->focus_row); in update_extended_selection()
4286 if (top + clist->row_height <= 0) in update_extended_selection()
4289 area.height = ROW_TOP_YPIXEL (clist, e2) + clist->row_height; in update_extended_selection()
4290 draw_rows (clist, &area); in update_extended_selection()
4291 gtk_cmclist_moveto (clist, clist->focus_row, -1, 0, 0); in update_extended_selection()
4293 else if (top >= clist->clist_window_height) in update_extended_selection()
4295 area.y = ROW_TOP_YPIXEL (clist, s2) - 1; in update_extended_selection()
4296 area.height = clist->clist_window_height - area.y; in update_extended_selection()
4297 draw_rows (clist, &area); in update_extended_selection()
4298 gtk_cmclist_moveto (clist, clist->focus_row, -1, 1, 0); in update_extended_selection()
4301 gtk_cmclist_moveto (clist, clist->focus_row, -1, 0, 0); in update_extended_selection()
4302 else if (top + clist->row_height > clist->clist_window_height) in update_extended_selection()
4303 gtk_cmclist_moveto (clist, clist->focus_row, -1, 1, 0); in update_extended_selection()
4305 y2 = ROW_TOP_YPIXEL (clist, s2) - 1; in update_extended_selection()
4306 h2 = (e2 - s2 + 1) * (clist->row_height + CELL_SPACING); in update_extended_selection()
4310 if (area.y > clist->clist_window_height) in update_extended_selection()
4312 area.height = MIN (clist->clist_window_height, h1 + h2); in update_extended_selection()
4314 area.height += (clist->row_height + CELL_SPACING); in update_extended_selection()
4315 draw_rows (clist, &area); in update_extended_selection()
4319 start_selection (GtkCMCList *clist) in start_selection() argument
4321 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in start_selection()
4323 if (clist_has_grab (clist)) in start_selection()
4326 set_anchor (clist, GTK_CMCLIST_ADD_MODE(clist), clist->focus_row, in start_selection()
4327 clist->focus_row); in start_selection()
4331 end_selection (GtkCMCList *clist) in end_selection() argument
4333 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in end_selection()
4335 if (gdk_display_pointer_is_grabbed (gtk_widget_get_display (GTK_WIDGET (clist))) && in end_selection()
4336 gtk_widget_has_focus (GTK_WIDGET(clist))) in end_selection()
4339 GTK_CMCLIST_GET_CLASS (clist)->resync_selection (clist, NULL); in end_selection()
4343 extend_selection (GtkCMCList *clist, in extend_selection() argument
4348 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in extend_selection()
4350 if (clist_has_grab (clist) || in extend_selection()
4351 clist->selection_mode != GTK_SELECTION_MULTIPLE) in extend_selection()
4355 set_anchor (clist, GTK_CMCLIST_ADD_MODE(clist), clist->focus_row, in extend_selection()
4356 clist->focus_row); in extend_selection()
4357 else if (clist->anchor == -1) in extend_selection()
4360 move_focus_row (clist, scroll_type, position); in extend_selection()
4362 if (ROW_TOP_YPIXEL (clist, clist->focus_row) + clist->row_height > in extend_selection()
4363 clist->clist_window_height) in extend_selection()
4364 gtk_cmclist_moveto (clist, clist->focus_row, -1, 1, 0); in extend_selection()
4365 else if (ROW_TOP_YPIXEL (clist, clist->focus_row) < 0) in extend_selection()
4366 gtk_cmclist_moveto (clist, clist->focus_row, -1, 0, 0); in extend_selection()
4368 update_extended_selection (clist, clist->focus_row); in extend_selection()
4372 sync_selection (GtkCMCList *clist, in sync_selection() argument
4384 if (clist->focus_row >= row) in sync_selection()
4386 if (d > 0 || clist->focus_row > row) in sync_selection()
4387 clist->focus_row += d; in sync_selection()
4388 if (clist->focus_row == -1 && clist->rows >= 1) in sync_selection()
4389 clist->focus_row = 0; in sync_selection()
4390 else if (d < 0 && clist->focus_row >= clist->rows - 1) in sync_selection()
4391 clist->focus_row = clist->rows - 2; in sync_selection()
4392 else if (clist->focus_row >= clist->rows) /* Paranoia */ in sync_selection()
4393 clist->focus_row = clist->rows - 1; in sync_selection()
4396 GTK_CMCLIST_GET_CLASS (clist)->resync_selection (clist, NULL); in sync_selection()
4398 g_list_free (clist->undo_selection); in sync_selection()
4399 g_list_free (clist->undo_unselection); in sync_selection()
4400 clist->undo_selection = NULL; in sync_selection()
4401 clist->undo_unselection = NULL; in sync_selection()
4403 clist->anchor = -1; in sync_selection()
4404 clist->drag_pos = -1; in sync_selection()
4405 clist->undo_anchor = clist->focus_row; in sync_selection()
4407 list = clist->selection; in sync_selection()
4425 GtkCMCList *clist; in gtk_cmclist_destroy() local
4429 clist = GTK_CMCLIST (object); in gtk_cmclist_destroy()
4432 clist->freeze_count++; in gtk_cmclist_destroy()
4435 gtk_cmclist_clear (clist); in gtk_cmclist_destroy()
4445 if (clist->hadjustment) in gtk_cmclist_destroy()
4447 g_signal_handlers_disconnect_matched(G_OBJECT (clist->hadjustment), G_SIGNAL_MATCH_DATA, in gtk_cmclist_destroy()
4448 0, 0, 0, 0, clist); in gtk_cmclist_destroy()
4449 g_object_unref (G_OBJECT (clist->hadjustment)); in gtk_cmclist_destroy()
4450 clist->hadjustment = NULL; in gtk_cmclist_destroy()
4452 if (clist->vadjustment) in gtk_cmclist_destroy()
4454 g_signal_handlers_disconnect_matched(G_OBJECT (clist->vadjustment), G_SIGNAL_MATCH_DATA, in gtk_cmclist_destroy()
4455 0, 0, 0, 0, clist); in gtk_cmclist_destroy()
4456 g_object_unref (G_OBJECT (clist->vadjustment)); in gtk_cmclist_destroy()
4457 clist->vadjustment = NULL; in gtk_cmclist_destroy()
4460 remove_grab (clist); in gtk_cmclist_destroy()
4463 for (i = 0; i < clist->columns; i++) in gtk_cmclist_destroy()
4464 if (clist->column[i].button) in gtk_cmclist_destroy()
4466 gtk_widget_unparent (clist->column[i].button); in gtk_cmclist_destroy()
4467 clist->column[i].button = NULL; in gtk_cmclist_destroy()
4477 GtkCMCList *clist; in gtk_cmclist_finalize() local
4481 clist = GTK_CMCLIST (object); in gtk_cmclist_finalize()
4483 columns_delete (clist); in gtk_cmclist_finalize()
4505 GtkCMCList *clist; in gtk_cmclist_realize() local
4518 clist = GTK_CMCLIST (widget); in gtk_cmclist_realize()
4544 gdk_window_set_user_data (window, clist); in gtk_cmclist_realize()
4558 attributes.x = clist->column_title_area.x; in gtk_cmclist_realize()
4559 attributes.y = clist->column_title_area.y; in gtk_cmclist_realize()
4560 attributes.width = clist->column_title_area.width; in gtk_cmclist_realize()
4561 attributes.height = clist->column_title_area.height; in gtk_cmclist_realize()
4563 clist->title_window = gdk_window_new (window, &attributes, in gtk_cmclist_realize()
4565 gdk_window_set_user_data (clist->title_window, clist); in gtk_cmclist_realize()
4567 gtk_style_set_background (style, clist->title_window, in gtk_cmclist_realize()
4569 gdk_window_show (clist->title_window); in gtk_cmclist_realize()
4572 for (i = 0; i < clist->columns; i++) in gtk_cmclist_realize()
4573 if (clist->column[i].button) in gtk_cmclist_realize()
4574 gtk_widget_set_parent_window (clist->column[i].button, in gtk_cmclist_realize()
4575 clist->title_window); in gtk_cmclist_realize()
4578 attributes.x = (clist->internal_allocation.x + in gtk_cmclist_realize()
4580 attributes.y = (clist->internal_allocation.y + in gtk_cmclist_realize()
4582 clist->column_title_area.height); in gtk_cmclist_realize()
4583 attributes.width = clist->clist_window_width; in gtk_cmclist_realize()
4584 attributes.height = clist->clist_window_height; in gtk_cmclist_realize()
4586 clist->clist_window = gdk_window_new (window, &attributes, in gtk_cmclist_realize()
4588 gdk_window_set_user_data (clist->clist_window, clist); in gtk_cmclist_realize()
4590 gdk_window_set_background (clist->clist_window, in gtk_cmclist_realize()
4592 gdk_window_show (clist->clist_window); in gtk_cmclist_realize()
4593 clist->clist_window_width = gdk_window_get_width(clist->clist_window); in gtk_cmclist_realize()
4594 clist->clist_window_height = gdk_window_get_height(clist->clist_window); in gtk_cmclist_realize()
4605 clist->cursor_drag = attributes.cursor; in gtk_cmclist_realize()
4607 attributes.x = LIST_WIDTH (clist) + 1; in gtk_cmclist_realize()
4612 for (i = 0; i < clist->columns; i++) in gtk_cmclist_realize()
4614 clist->column[i].window = gdk_window_new (clist->title_window, in gtk_cmclist_realize()
4616 gdk_window_set_user_data (clist->column[i].window, clist); in gtk_cmclist_realize()
4622 size_allocate_title_buttons (clist); in gtk_cmclist_realize()
4625 list = clist->row_list; in gtk_cmclist_realize()
4626 for (i = 0; i < clist->rows; i++) in gtk_cmclist_realize()
4633 clist->clist_window); in gtk_cmclist_realize()
4646 for (j = 0; j < clist->columns; j++) in gtk_cmclist_realize()
4649 gtk_style_attach (clist_row->cell[j].style, clist->clist_window); in gtk_cmclist_realize()
4657 GtkCMCList *clist; in gtk_cmclist_unrealize() local
4661 clist = GTK_CMCLIST (widget); in gtk_cmclist_unrealize()
4664 clist->freeze_count++; in gtk_cmclist_unrealize()
4678 list = clist->row_list; in gtk_cmclist_unrealize()
4679 for (i = 0; i < clist->rows; i++) in gtk_cmclist_unrealize()
4686 for (j = 0; j < clist->columns; j++) in gtk_cmclist_unrealize()
4692 gdk_cursor_unref (clist->cursor_drag); in gtk_cmclist_unrealize()
4694 for (i = 0; i < clist->columns; i++) in gtk_cmclist_unrealize()
4696 if (clist->column[i].button) in gtk_cmclist_unrealize()
4697 gtk_widget_unrealize (clist->column[i].button); in gtk_cmclist_unrealize()
4698 if (clist->column[i].window) in gtk_cmclist_unrealize()
4700 gdk_window_set_user_data (clist->column[i].window, NULL); in gtk_cmclist_unrealize()
4701 gdk_window_destroy (clist->column[i].window); in gtk_cmclist_unrealize()
4702 clist->column[i].window = NULL; in gtk_cmclist_unrealize()
4706 gdk_window_set_user_data (clist->clist_window, NULL); in gtk_cmclist_unrealize()
4707 gdk_window_destroy (clist->clist_window); in gtk_cmclist_unrealize()
4708 clist->clist_window = NULL; in gtk_cmclist_unrealize()
4710 gdk_window_set_user_data (clist->title_window, NULL); in gtk_cmclist_unrealize()
4711 gdk_window_destroy (clist->title_window); in gtk_cmclist_unrealize()
4712 clist->title_window = NULL; in gtk_cmclist_unrealize()
4714 clist->cursor_drag = NULL; in gtk_cmclist_unrealize()
4724 GtkCMCList *clist; in gtk_cmclist_map() local
4728 clist = GTK_CMCLIST (widget); in gtk_cmclist_map()
4735 for (i = 0; i < clist->columns; i++) in gtk_cmclist_map()
4737 if (clist->column[i].button && in gtk_cmclist_map()
4738 gtk_widget_get_visible (clist->column[i].button) && in gtk_cmclist_map()
4739 !gtk_widget_get_mapped (clist->column[i].button)) in gtk_cmclist_map()
4740 gtk_widget_map (clist->column[i].button); in gtk_cmclist_map()
4743 for (i = 0; i < clist->columns; i++) in gtk_cmclist_map()
4744 if (clist->column[i].window && clist->column[i].button) in gtk_cmclist_map()
4746 gdk_window_raise (clist->column[i].window); in gtk_cmclist_map()
4747 gdk_window_show (clist->column[i].window); in gtk_cmclist_map()
4750 gdk_window_show (clist->title_window); in gtk_cmclist_map()
4751 gdk_window_show (clist->clist_window); in gtk_cmclist_map()
4755 clist->freeze_count = 0; in gtk_cmclist_map()
4763 GtkCMCList *clist; in gtk_cmclist_unmap() local
4767 clist = GTK_CMCLIST (widget); in gtk_cmclist_unmap()
4773 if (clist_has_grab (clist)) in gtk_cmclist_unmap()
4775 remove_grab (clist); in gtk_cmclist_unmap()
4777 GTK_CMCLIST_GET_CLASS (widget)->resync_selection (clist, NULL); in gtk_cmclist_unmap()
4779 clist->click_cell.row = -1; in gtk_cmclist_unmap()
4780 clist->click_cell.column = -1; in gtk_cmclist_unmap()
4781 clist->drag_button = 0; in gtk_cmclist_unmap()
4783 if (GTK_CMCLIST_IN_DRAG(clist)) in gtk_cmclist_unmap()
4787 GTK_CMCLIST_UNSET_FLAG (clist, CMCLIST_IN_DRAG); in gtk_cmclist_unmap()
4788 drag_data = g_object_get_data (G_OBJECT (clist), in gtk_cmclist_unmap()
4791 g_signal_handlers_unblock_matched(G_OBJECT(clist), G_SIGNAL_MATCH_DATA, in gtk_cmclist_unmap()
4796 for (i = 0; i < clist->columns; i++) in gtk_cmclist_unmap()
4797 if (clist->column[i].window) in gtk_cmclist_unmap()
4798 gdk_window_hide (clist->column[i].window); in gtk_cmclist_unmap()
4800 gdk_window_hide (clist->clist_window); in gtk_cmclist_unmap()
4801 gdk_window_hide (clist->title_window); in gtk_cmclist_unmap()
4805 for (i = 0; i < clist->columns; i++) in gtk_cmclist_unmap()
4806 if (clist->column[i].button && in gtk_cmclist_unmap()
4807 gtk_widget_get_mapped (clist->column[i].button)) in gtk_cmclist_unmap()
4808 gtk_widget_unmap (clist->column[i].button); in gtk_cmclist_unmap()
4811 clist->freeze_count++; in gtk_cmclist_unmap()
4819 GtkCMCList *clist; in gtk_cmclist_expose() local
4826 clist = GTK_CMCLIST (widget); in gtk_cmclist_expose()
4829 if (event->window == clist->clist_window) in gtk_cmclist_expose()
4830 draw_rows (clist, &event->area); in gtk_cmclist_expose()
4832 if (event->window == clist->title_window) in gtk_cmclist_expose()
4836 for (i = 0; i < clist->columns; i++) in gtk_cmclist_expose()
4838 if (clist->column[i].button) { in gtk_cmclist_expose()
4839 gtk_container_propagate_expose (GTK_CONTAINER (clist), in gtk_cmclist_expose()
4840 clist->column[i].button, in gtk_cmclist_expose()
4854 GtkCMCList *clist; in gtk_cmclist_style_set() local
4862 clist = GTK_CMCLIST (widget); in gtk_cmclist_style_set()
4869 gtk_style_set_background (style, clist->title_window, GTK_STATE_NORMAL); in gtk_cmclist_style_set()
4870 gdk_window_set_background (clist->clist_window, &style->base[GTK_STATE_NORMAL]); in gtk_cmclist_style_set()
4876 if (!GTK_CMCLIST_ROW_HEIGHT_SET(clist)) in gtk_cmclist_style_set()
4878 gtk_cmclist_set_row_height (clist, 0); in gtk_cmclist_style_set()
4881 if (!GTK_CMCLIST_AUTO_RESIZE_BLOCKED (clist)) in gtk_cmclist_style_set()
4886 for (i = 0; i < clist->columns; i++) in gtk_cmclist_style_set()
4887 if (clist->column[i].auto_resize) in gtk_cmclist_style_set()
4889 width = gtk_cmclist_optimal_column_width (clist, i); in gtk_cmclist_style_set()
4890 if (width != clist->column[i].width) in gtk_cmclist_style_set()
4891 gtk_cmclist_set_column_width (clist, i, width); in gtk_cmclist_style_set()
4901 GtkCMCList *clist; in gtk_cmclist_button_press() local
4911 clist = GTK_CMCLIST (widget); in gtk_cmclist_button_press()
4913 button_actions = clist->button_actions[event->button - 1]; in gtk_cmclist_button_press()
4919 if (event->window == clist->clist_window) in gtk_cmclist_button_press()
4924 if (get_selection_info (clist, x, y, &row, &column)) in gtk_cmclist_button_press()
4926 gint old_row = clist->focus_row; in gtk_cmclist_button_press()
4928 if (clist->focus_row == -1) in gtk_cmclist_button_press()
4937 if (gdk_pointer_grab (clist->clist_window, FALSE, mask, in gtk_cmclist_button_press()
4942 clist->click_cell.row = row; in gtk_cmclist_button_press()
4943 clist->click_cell.column = column; in gtk_cmclist_button_press()
4944 clist->drag_button = event->button; in gtk_cmclist_button_press()
4948 clist->click_cell.row = -1; in gtk_cmclist_button_press()
4949 clist->click_cell.column = -1; in gtk_cmclist_button_press()
4951 clist->drag_button = 0; in gtk_cmclist_button_press()
4952 remove_grab (clist); in gtk_cmclist_button_press()
4957 if (GTK_CMCLIST_ADD_MODE(clist)) in gtk_cmclist_button_press()
4959 GTK_CMCLIST_UNSET_FLAG (clist, CMCLIST_ADD_MODE); in gtk_cmclist_button_press()
4963 clist->focus_row = row; in gtk_cmclist_button_press()
4968 clist->focus_row = row; in gtk_cmclist_button_press()
4971 else if (row != clist->focus_row) in gtk_cmclist_button_press()
4976 clist->focus_row = row; in gtk_cmclist_button_press()
4980 clist->focus_row = row; in gtk_cmclist_button_press()
4989 switch (clist->selection_mode) in gtk_cmclist_button_press()
4994 g_signal_emit (G_OBJECT (clist), in gtk_cmclist_button_press()
4997 clist->anchor = -1; in gtk_cmclist_button_press()
5000 clist->anchor = row; in gtk_cmclist_button_press()
5003 g_signal_emit (G_OBJECT (clist), in gtk_cmclist_button_press()
5010 if (clist->anchor != -1) in gtk_cmclist_button_press()
5012 update_extended_selection (clist, clist->focus_row); in gtk_cmclist_button_press()
5013 GTK_CMCLIST_GET_CLASS (clist)->resync_selection in gtk_cmclist_button_press()
5014 (clist, (GdkEvent *) event); in gtk_cmclist_button_press()
5016 g_signal_emit (G_OBJECT (clist), in gtk_cmclist_button_press()
5026 if (clist->anchor < 0) in gtk_cmclist_button_press()
5028 g_list_free (clist->undo_selection); in gtk_cmclist_button_press()
5029 g_list_free (clist->undo_unselection); in gtk_cmclist_button_press()
5030 clist->undo_selection = NULL; in gtk_cmclist_button_press()
5031 clist->undo_unselection = NULL; in gtk_cmclist_button_press()
5032 clist->anchor = old_row; in gtk_cmclist_button_press()
5033 clist->drag_pos = old_row; in gtk_cmclist_button_press()
5034 clist->undo_anchor = old_row; in gtk_cmclist_button_press()
5036 update_extended_selection (clist, clist->focus_row); in gtk_cmclist_button_press()
5040 if (clist->anchor == -1) in gtk_cmclist_button_press()
5041 set_anchor (clist, TRUE, row, old_row); in gtk_cmclist_button_press()
5043 update_extended_selection (clist, in gtk_cmclist_button_press()
5044 clist->focus_row); in gtk_cmclist_button_press()
5051 set_anchor (clist, FALSE, old_row, old_row); in gtk_cmclist_button_press()
5052 update_extended_selection (clist, clist->focus_row); in gtk_cmclist_button_press()
5056 if (clist->anchor == -1) in gtk_cmclist_button_press()
5057 set_anchor (clist, FALSE, row, old_row); in gtk_cmclist_button_press()
5059 update_extended_selection (clist, clist->focus_row); in gtk_cmclist_button_press()
5070 for (i = 0; i < clist->columns; i++) in gtk_cmclist_button_press()
5071 if (clist->column[i].resizeable && clist->column[i].window && in gtk_cmclist_button_press()
5072 event->window == clist->column[i].window) in gtk_cmclist_button_press()
5076 if (gdk_pointer_grab (clist->column[i].window, FALSE, in gtk_cmclist_button_press()
5084 GTK_CMCLIST_SET_FLAG (clist, CMCLIST_IN_DRAG); in gtk_cmclist_button_press()
5087 drag_data = g_object_get_data (G_OBJECT (clist), "gtk-site-data"); in gtk_cmclist_button_press()
5089 g_signal_handlers_block_matched(G_OBJECT(clist), G_SIGNAL_MATCH_DATA, in gtk_cmclist_button_press()
5095 clist->drag_pos = i; in gtk_cmclist_button_press()
5096 clist->x_drag = (COLUMN_LEFT_XPIXEL(clist, i) + COLUMN_INSET + in gtk_cmclist_button_press()
5097 clist->column[i].area.width + CELL_SPACING); in gtk_cmclist_button_press()
5109 GtkCMCList *clist; in gtk_cmclist_button_release() local
5115 clist = GTK_CMCLIST (widget); in gtk_cmclist_button_release()
5117 button_actions = clist->button_actions[event->button - 1]; in gtk_cmclist_button_release()
5122 if (GTK_CMCLIST_IN_DRAG(clist)) in gtk_cmclist_button_release()
5129 i = clist->drag_pos; in gtk_cmclist_button_release()
5130 clist->drag_pos = -1; in gtk_cmclist_button_release()
5133 drag_data = g_object_get_data (G_OBJECT (clist), "gtk-site-data"); in gtk_cmclist_button_release()
5135 g_signal_handlers_unblock_matched(G_OBJECT(clist), G_SIGNAL_MATCH_DATA, in gtk_cmclist_button_release()
5138 GTK_CMCLIST_UNSET_FLAG (clist, CMCLIST_IN_DRAG); in gtk_cmclist_button_release()
5143 if (clist->x_drag >= 0) in gtk_cmclist_button_release()
5144 clist_refresh(clist); in gtk_cmclist_button_release()
5146 width = new_column_width (clist, i, &x); in gtk_cmclist_button_release()
5147 gtk_cmclist_set_column_width (clist, i, width); in gtk_cmclist_button_release()
5152 if (clist->drag_button == event->button) in gtk_cmclist_button_release()
5157 clist->drag_button = 0; in gtk_cmclist_button_release()
5158 clist->click_cell.row = -1; in gtk_cmclist_button_release()
5159 clist->click_cell.column = -1; in gtk_cmclist_button_release()
5161 remove_grab (clist); in gtk_cmclist_button_release()
5165 switch (clist->selection_mode) in gtk_cmclist_button_release()
5170 event->x < 0 || event->x >= clist->clist_window_width || in gtk_cmclist_button_release()
5171 event->y < 0 || event->y >= clist->clist_window_height) in gtk_cmclist_button_release()
5172 GTK_CMCLIST_GET_CLASS (clist)->resync_selection in gtk_cmclist_button_release()
5173 (clist, (GdkEvent *) event); in gtk_cmclist_button_release()
5176 if (get_selection_info (clist, event->x, event->y, in gtk_cmclist_button_release()
5179 if (row >= 0 && row < clist->rows && clist->anchor == row) in gtk_cmclist_button_release()
5180 toggle_row (clist, row, column, (GdkEvent *) event); in gtk_cmclist_button_release()
5182 clist->anchor = -1; in gtk_cmclist_button_release()
5199 GtkCMCList *clist; in gtk_cmclist_motion() local
5209 clist = GTK_CMCLIST (widget); in gtk_cmclist_motion()
5210 if (!clist_has_grab (clist)) in gtk_cmclist_motion()
5213 if (clist->drag_button > 0) in gtk_cmclist_motion()
5214 button_actions = clist->button_actions[clist->drag_button - 1]; in gtk_cmclist_motion()
5216 if (GTK_CMCLIST_IN_DRAG(clist)) in gtk_cmclist_motion()
5223 new_width = new_column_width (clist, clist->drag_pos, &x); in gtk_cmclist_motion()
5224 if (x != clist->x_drag) in gtk_cmclist_motion()
5227 if (clist->x_drag >= 0) in gtk_cmclist_motion()
5228 clist_refresh(clist); in gtk_cmclist_motion()
5230 clist->x_drag = x; in gtk_cmclist_motion()
5232 if (clist->x_drag >= 0) in gtk_cmclist_motion()
5233 draw_xor_line (clist); in gtk_cmclist_motion()
5237 clist->column[clist->drag_pos].min_width + 1)) in gtk_cmclist_motion()
5239 if (COLUMN_LEFT_XPIXEL (clist, clist->drag_pos) < 0 && x < 0) in gtk_cmclist_motion()
5240 gtk_cmclist_moveto (clist, -1, clist->drag_pos, 0, 0); in gtk_cmclist_motion()
5243 if (clist->column[clist->drag_pos].max_width >= COLUMN_MIN_WIDTH && in gtk_cmclist_motion()
5244 new_width >= clist->column[clist->drag_pos].max_width) in gtk_cmclist_motion()
5246 if (COLUMN_LEFT_XPIXEL (clist, clist->drag_pos) + new_width > in gtk_cmclist_motion()
5247 clist->clist_window_width && x < 0) in gtk_cmclist_motion()
5248 move_horizontal (clist, in gtk_cmclist_motion()
5249 COLUMN_LEFT_XPIXEL (clist, clist->drag_pos) + in gtk_cmclist_motion()
5250 new_width - clist->clist_window_width + in gtk_cmclist_motion()
5256 if (event->is_hint || event->window != clist->clist_window) in gtk_cmclist_motion()
5257 gdk_window_get_pointer (clist->clist_window, &x, &y, NULL); in gtk_cmclist_motion()
5264 if (GTK_CMCLIST_REORDERABLE(clist) && button_actions & GTK_CMBUTTON_DRAGS) in gtk_cmclist_motion()
5267 if (event->window == clist->clist_window && in gtk_cmclist_motion()
5268 clist->click_cell.row >= 0 && clist->click_cell.column >= 0 && in gtk_cmclist_motion()
5269 (y < 0 || y >= clist->clist_window_height || in gtk_cmclist_motion()
5270 x < 0 || x >= clist->clist_window_width || in gtk_cmclist_motion()
5271 y < ROW_TOP_YPIXEL (clist, clist->click_cell.row) || in gtk_cmclist_motion()
5272 y >= (ROW_TOP_YPIXEL (clist, clist->click_cell.row) + in gtk_cmclist_motion()
5273 clist->row_height) || in gtk_cmclist_motion()
5274 x < COLUMN_LEFT_XPIXEL (clist, clist->click_cell.column) || in gtk_cmclist_motion()
5275 x >= (COLUMN_LEFT_XPIXEL(clist, clist->click_cell.column) + in gtk_cmclist_motion()
5276 clist->column[clist->click_cell.column].area.width))) in gtk_cmclist_motion()
5282 clist->drag_button, (GdkEvent *)event); in gtk_cmclist_motion()
5289 if (clist->hadjustment && LIST_WIDTH (clist) > clist->clist_window_width && in gtk_cmclist_motion()
5290 (x < 0 || x >= clist->clist_window_width)) in gtk_cmclist_motion()
5292 if (clist->htimer) in gtk_cmclist_motion()
5295 clist->htimer = gdk_threads_add_timeout in gtk_cmclist_motion()
5296 (SCROLL_TIME, (GSourceFunc) horizontal_timeout, clist); in gtk_cmclist_motion()
5297 value = gtk_adjustment_get_value (clist->hadjustment); in gtk_cmclist_motion()
5299 (x >= clist->clist_window_width && in gtk_cmclist_motion()
5301 LIST_WIDTH (clist) - clist->clist_window_width))) in gtk_cmclist_motion()
5304 move_horizontal (clist, -1 + (x/2)); in gtk_cmclist_motion()
5306 move_horizontal (clist, 1 + (x - clist->clist_window_width) / 2); in gtk_cmclist_motion()
5310 if (GTK_CMCLIST_IN_DRAG(clist)) in gtk_cmclist_motion()
5314 row = ROW_FROM_YPIXEL (clist, y); in gtk_cmclist_motion()
5317 if (y == clist->clist_window_height - 1 && in gtk_cmclist_motion()
5318 y == ROW_TOP_YPIXEL (clist, row-1) + clist->row_height) in gtk_cmclist_motion()
5321 if (LIST_HEIGHT (clist) > clist->clist_window_height && in gtk_cmclist_motion()
5322 (y < 0 || y >= clist->clist_window_height)) in gtk_cmclist_motion()
5324 if (clist->vtimer) in gtk_cmclist_motion()
5326 clist->vtimer = gdk_threads_add_timeout (SCROLL_TIME, in gtk_cmclist_motion()
5327 (GSourceFunc) vertical_timeout, clist); in gtk_cmclist_motion()
5328 if (clist->drag_button && in gtk_cmclist_motion()
5329 ((y < 0 && clist->focus_row == 0) || in gtk_cmclist_motion()
5330 (y >= clist->clist_window_height && in gtk_cmclist_motion()
5331 clist->focus_row == clist->rows - 1))) in gtk_cmclist_motion()
5335 row = CLAMP (row, 0, clist->rows - 1); in gtk_cmclist_motion()
5340 if (row == clist->focus_row) in gtk_cmclist_motion()
5344 clist->focus_row = row; in gtk_cmclist_motion()
5347 switch (clist->selection_mode) in gtk_cmclist_motion()
5350 g_signal_emit (G_OBJECT (clist), clist_signals[SELECT_ROW], 0, in gtk_cmclist_motion()
5351 clist->focus_row, -1, event); in gtk_cmclist_motion()
5354 update_extended_selection (clist, clist->focus_row); in gtk_cmclist_motion()
5361 if (ROW_TOP_YPIXEL(clist, row) < 0) in gtk_cmclist_motion()
5362 move_vertical (clist, row, 0); in gtk_cmclist_motion()
5363 else if (ROW_TOP_YPIXEL(clist, row) + clist->row_height > in gtk_cmclist_motion()
5364 clist->clist_window_height) in gtk_cmclist_motion()
5365 move_vertical (clist, row, 1); in gtk_cmclist_motion()
5374 GtkCMCList *clist; in gtk_cmclist_size_request() local
5381 clist = GTK_CMCLIST (widget); in gtk_cmclist_size_request()
5388 clist->column_title_area.height = 0; in gtk_cmclist_size_request()
5389 if (GTK_CMCLIST_SHOW_TITLES(clist)) { in gtk_cmclist_size_request()
5390 for (i = 0; i < clist->columns; i++) in gtk_cmclist_size_request()
5391 if (clist->column[i].button) in gtk_cmclist_size_request()
5395 gtk_widget_size_request (clist->column[i].button, in gtk_cmclist_size_request()
5397 clist->column_title_area.height = in gtk_cmclist_size_request()
5398 MAX (clist->column_title_area.height, in gtk_cmclist_size_request()
5406 requisition->height += (clist->column_title_area.height + in gtk_cmclist_size_request()
5411 requisition->width += list_requisition_width (clist); in gtk_cmclist_size_request()
5413 requisition->height += LIST_HEIGHT (clist); in gtk_cmclist_size_request()
5421 GtkCMCList *clist; in gtk_cmclist_size_allocate() local
5429 clist = GTK_CMCLIST (widget); in gtk_cmclist_size_allocate()
5445 clist->internal_allocation.x = 0; in gtk_cmclist_size_allocate()
5446 clist->internal_allocation.y = 0; in gtk_cmclist_size_allocate()
5447 clist->internal_allocation.width = MAX (1, (gint)allocation->width - in gtk_cmclist_size_allocate()
5449 clist->internal_allocation.height = MAX (1, (gint)allocation->height - in gtk_cmclist_size_allocate()
5453 clist_allocation.x = (clist->internal_allocation.x + in gtk_cmclist_size_allocate()
5455 clist_allocation.y = (clist->internal_allocation.y + in gtk_cmclist_size_allocate()
5457 clist->column_title_area.height); in gtk_cmclist_size_allocate()
5458 clist_allocation.width = MAX (1, (gint)clist->internal_allocation.width - in gtk_cmclist_size_allocate()
5460 clist_allocation.height = MAX (1, (gint)clist->internal_allocation.height - in gtk_cmclist_size_allocate()
5462 (gint)clist->column_title_area.height); in gtk_cmclist_size_allocate()
5464 clist->clist_window_width = clist_allocation.width; in gtk_cmclist_size_allocate()
5465 clist->clist_window_height = clist_allocation.height; in gtk_cmclist_size_allocate()
5469 gdk_window_move_resize (clist->clist_window, in gtk_cmclist_size_allocate()
5477 clist->column_title_area.x = style->xthickness; in gtk_cmclist_size_allocate()
5478 clist->column_title_area.y = style->ythickness; in gtk_cmclist_size_allocate()
5479 clist->column_title_area.width = clist_allocation.width; in gtk_cmclist_size_allocate()
5483 gdk_window_move_resize (clist->title_window, in gtk_cmclist_size_allocate()
5484 clist->column_title_area.x, in gtk_cmclist_size_allocate()
5485 clist->column_title_area.y, in gtk_cmclist_size_allocate()
5486 clist->column_title_area.width, in gtk_cmclist_size_allocate()
5487 clist->column_title_area.height); in gtk_cmclist_size_allocate()
5491 size_allocate_columns (clist, FALSE); in gtk_cmclist_size_allocate()
5492 size_allocate_title_buttons (clist); in gtk_cmclist_size_allocate()
5494 adjust_adjustments (clist, TRUE); in gtk_cmclist_size_allocate()
5506 GtkCMCList *clist; in gtk_cmclist_forall() local
5515 clist = GTK_CMCLIST (container); in gtk_cmclist_forall()
5518 for (i = 0; i < clist->columns; i++) in gtk_cmclist_forall()
5519 if (clist->column[i].button) in gtk_cmclist_forall()
5520 (*callback) (clist->column[i].button, callback_data); in gtk_cmclist_forall()
5532 get_cell_style (GtkCMCList *clist, in get_cell_style() argument
5552 gtkstyle = gtk_widget_get_style (GTK_WIDGET (clist)); in get_cell_style()
5599 static void cairo_dash_from_add_mode(GtkCMCList *clist, cairo_t *cr) in cairo_dash_from_add_mode() argument
5602 if (GTK_CMCLIST_ADD_MODE(clist)) in cairo_dash_from_add_mode()
5609 draw_row (GtkCMCList *clist, in draw_row() argument
5625 cm_return_if_fail (clist != NULL); in draw_row()
5628 if (!gtk_widget_is_drawable (GTK_WIDGET(clist)) || row < 0 || row >= clist->rows) in draw_row()
5631 widget = GTK_WIDGET (clist); in draw_row()
5636 clist_row = ROW_ELEMENT (clist, row)->data; in draw_row()
5642 row_rectangle.y = ROW_TOP_YPIXEL (clist, row); in draw_row()
5643 row_rectangle.width = clist->clist_window_width; in draw_row()
5644 row_rectangle.height = clist->row_height; in draw_row()
5660 cr = gdk_cairo_create(clist->clist_window); in draw_row()
5674 if (clist_row == clist->row_list_end->data) in draw_row()
5676 cell_rectangle.y += clist->row_height + CELL_SPACING; in draw_row()
5698 if (clist_row == clist->row_list_end->data) in draw_row()
5700 cell_rectangle.y += clist->row_height + CELL_SPACING; in draw_row()
5707 for (last_column = clist->columns - 1; in draw_row()
5708 last_column >= 0 && !clist->column[last_column].visible; last_column--) in draw_row()
5712 for (i = 0; i < clist->columns; i++) in draw_row()
5723 if (!clist->column[i].visible) in draw_row()
5726 get_cell_style (clist, clist_row, state, i, &style); in draw_row()
5728 clip_rectangle.x = clist->column[i].area.x + clist->hoffset; in draw_row()
5729 clip_rectangle.width = clist->column[i].area.width; in draw_row()
5751 layout = _gtk_cmclist_create_cell_layout (clist, clist_row, i); in draw_row()
5779 switch (clist->column[i].justification) in draw_row()
5799 draw_cell_pixbuf (clist->clist_window, &clip_rectangle, cr, in draw_row()
5808 draw_cell_pixbuf (clist->clist_window, &clip_rectangle, cr, in draw_row()
5820 gint row_center_offset = (clist->row_height - logical_rect.height - 1) / 2; in draw_row()
5833 cairo_dash_from_add_mode(clist, cr); in draw_row()
5836 if (clist->focus_row == row && in draw_row()
5859 draw_rows (GtkCMCList *clist, in draw_rows() argument
5868 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in draw_rows()
5870 if (clist->row_height == 0 || in draw_rows()
5871 !gtk_widget_is_drawable (GTK_WIDGET(clist))) in draw_rows()
5876 first_row = ROW_FROM_YPIXEL (clist, area->y); in draw_rows()
5877 last_row = ROW_FROM_YPIXEL (clist, area->y + area->height); in draw_rows()
5881 first_row = ROW_FROM_YPIXEL (clist, 0); in draw_rows()
5882 last_row = ROW_FROM_YPIXEL (clist, clist->clist_window_height); in draw_rows()
5889 if (clist->rows == first_row) in draw_rows()
5892 list = ROW_ELEMENT (clist, first_row); in draw_rows()
5902 GTK_CMCLIST_GET_CLASS (clist)->draw_row (clist, area, i, clist_row); in draw_rows()
5909 w = gdk_window_get_width(clist->clist_window); in draw_rows()
5910 h = gdk_window_get_height(clist->clist_window); in draw_rows()
5911 cr = gdk_cairo_create(clist->clist_window); in draw_rows()
5912 y = ROW_TOP_YPIXEL (clist, i); in draw_rows()
5913 … gdk_cairo_set_source_color(cr, &gtk_widget_get_style(GTK_WIDGET(clist))->base[GTK_STATE_NORMAL]); in draw_rows()
5921 draw_xor_line (GtkCMCList *clist) in draw_xor_line() argument
5924 cr = gdk_cairo_create(clist->clist_window); in draw_xor_line()
5926 cairo_move_to(cr, clist->x_drag, in draw_xor_line()
5927 gtk_widget_get_style (GTK_WIDGET(clist))->ythickness); in draw_xor_line()
5928 cairo_line_to(cr, clist->x_drag, in draw_xor_line()
5929 clist->column_title_area.height + in draw_xor_line()
5930 clist->clist_window_height + 1); in draw_xor_line()
5936 clist_refresh (GtkCMCList *clist) in clist_refresh() argument
5938 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in clist_refresh()
5940 if (CLIST_UNFROZEN (clist)) in clist_refresh()
5942 adjust_adjustments (clist, FALSE); in clist_refresh()
5943 draw_rows (clist, NULL); in clist_refresh()
5952 get_selection_info (GtkCMCList *clist, in get_selection_info() argument
5960 cm_return_val_if_fail (GTK_IS_CMCLIST (clist), 0); in get_selection_info()
5964 trow = ROW_FROM_YPIXEL (clist, y); in get_selection_info()
5965 if (trow >= clist->rows) in get_selection_info()
5971 tcol = COLUMN_FROM_XPIXEL (clist, x); in get_selection_info()
5972 if (tcol >= clist->columns) in get_selection_info()
5982 gtk_cmclist_get_selection_info (GtkCMCList *clist, in gtk_cmclist_get_selection_info() argument
5988 cm_return_val_if_fail (GTK_IS_CMCLIST (clist), 0); in gtk_cmclist_get_selection_info()
5989 return get_selection_info (clist, x, y, row, column); in gtk_cmclist_get_selection_info()
6001 adjust_adjustments (GtkCMCList *clist, in adjust_adjustments() argument
6004 if (clist->vadjustment) in adjust_adjustments()
6006 gtk_adjustment_set_page_size (clist->vadjustment, clist->clist_window_height); in adjust_adjustments()
6007 gtk_adjustment_set_step_increment (clist->vadjustment, clist->row_height); in adjust_adjustments()
6008 gtk_adjustment_set_page_increment (clist->vadjustment, in adjust_adjustments()
6009 MAX (clist->clist_window_height - clist->row_height, in adjust_adjustments()
6010 clist->clist_window_height / 2)); in adjust_adjustments()
6011 gtk_adjustment_set_lower (clist->vadjustment, 0); in adjust_adjustments()
6012 gtk_adjustment_set_upper (clist->vadjustment, LIST_HEIGHT (clist)); in adjust_adjustments()
6014 if ((clist->clist_window_height - clist->voffset) > LIST_HEIGHT (clist) || in adjust_adjustments()
6015 (clist->voffset + (gint)gtk_adjustment_get_value (clist->vadjustment)) != 0) in adjust_adjustments()
6017 gtk_adjustment_set_value (clist->vadjustment, in adjust_adjustments()
6018 MAX (0, (LIST_HEIGHT (clist) - clist->clist_window_height))); in adjust_adjustments()
6019 g_signal_emit_by_name (G_OBJECT (clist->vadjustment), in adjust_adjustments()
6022 g_signal_emit_by_name (G_OBJECT (clist->vadjustment), "changed"); in adjust_adjustments()
6025 if (clist->hadjustment) in adjust_adjustments()
6027 gtk_adjustment_set_page_size (clist->hadjustment, clist->clist_window_width); in adjust_adjustments()
6028 gtk_adjustment_set_step_increment (clist->hadjustment, 10); in adjust_adjustments()
6029 gtk_adjustment_set_page_increment (clist->hadjustment, in adjust_adjustments()
6030 MAX (clist->clist_window_width - in adjust_adjustments()
6031 gtk_adjustment_get_step_increment (clist->hadjustment), in adjust_adjustments()
6032 clist->clist_window_width / 2)); in adjust_adjustments()
6033 gtk_adjustment_set_lower (clist->hadjustment, 0); in adjust_adjustments()
6034 gtk_adjustment_set_upper (clist->hadjustment, LIST_WIDTH (clist)); in adjust_adjustments()
6036 if ((clist->clist_window_width - clist->hoffset) > LIST_WIDTH (clist) || in adjust_adjustments()
6037 (clist->hoffset + (gint)gtk_adjustment_get_value (clist->hadjustment)) != 0) in adjust_adjustments()
6039 gtk_adjustment_set_value (clist->hadjustment, MAX (0, (LIST_WIDTH (clist) - in adjust_adjustments()
6040 clist->clist_window_width))); in adjust_adjustments()
6041 g_signal_emit_by_name (G_OBJECT (clist->hadjustment), in adjust_adjustments()
6044 g_signal_emit_by_name (G_OBJECT (clist->hadjustment), "changed"); in adjust_adjustments()
6047 if (!block_resize && (!clist->vadjustment || !clist->hadjustment)) in adjust_adjustments()
6053 widget = GTK_WIDGET (clist); in adjust_adjustments()
6057 if ((!clist->hadjustment && in adjust_adjustments()
6059 (!clist->vadjustment && in adjust_adjustments()
6069 GtkCMCList *clist; in vadjustment_value_changed() local
6075 clist = GTK_CMCLIST (data); in vadjustment_value_changed()
6077 if (adjustment != clist->vadjustment) in vadjustment_value_changed()
6081 dy = value - clist->voffset; in vadjustment_value_changed()
6082 clist->voffset = value; in vadjustment_value_changed()
6084 if (gtk_widget_is_drawable (GTK_WIDGET(clist))) in vadjustment_value_changed()
6086 gdk_window_scroll (clist->clist_window, 0, dy); in vadjustment_value_changed()
6087 gdk_window_process_updates (clist->clist_window, FALSE); in vadjustment_value_changed()
6159 GtkCMCList *clist; in hadjustment_value_changed() local
6170 clist = GTK_CMCLIST (data); in hadjustment_value_changed()
6173 if (adjustment != clist->hadjustment) in hadjustment_value_changed()
6178 dx = -value - clist->hoffset; in hadjustment_value_changed()
6180 if (gtk_widget_get_realized (GTK_WIDGET(clist))) in hadjustment_value_changed()
6181 gdk_window_scroll (clist->title_window, dx, 0); in hadjustment_value_changed()
6184 for (i = 0; i < clist->columns; i++) in hadjustment_value_changed()
6185 if (clist->column[i].button) in hadjustment_value_changed()
6186 adjust_allocation (clist->column[i].button, dx); in hadjustment_value_changed()
6188 clist->hoffset = -value; in hadjustment_value_changed()
6190 cr = gdk_cairo_create(clist->clist_window); in hadjustment_value_changed()
6191 cairo_dash_from_add_mode(clist, cr); in hadjustment_value_changed()
6194 if (gtk_widget_is_drawable (GTK_WIDGET(clist))) in hadjustment_value_changed()
6198 gdk_window_scroll (clist->clist_window, dx, 0); in hadjustment_value_changed()
6199 gdk_window_process_updates (clist->clist_window, FALSE); in hadjustment_value_changed()
6201 if (gtk_widget_get_can_focus(GTK_WIDGET(clist)) && in hadjustment_value_changed()
6202 gtk_widget_has_focus(GTK_WIDGET(clist)) && in hadjustment_value_changed()
6203 !focus_child && GTK_CMCLIST_ADD_MODE(clist)) in hadjustment_value_changed()
6205 y = ROW_TOP_YPIXEL (clist, clist->focus_row); in hadjustment_value_changed()
6206 cairo_rectangle(cr, 0, y, clist->clist_window_width + 1, in hadjustment_value_changed()
6207 clist->row_height); in hadjustment_value_changed()
6211 if (gtk_widget_get_can_focus(GTK_WIDGET(clist)) && in hadjustment_value_changed()
6212 gtk_widget_has_focus(GTK_WIDGET(clist)) && in hadjustment_value_changed()
6215 if (GTK_CMCLIST_ADD_MODE(clist)) in hadjustment_value_changed()
6219 focus_row = clist->focus_row; in hadjustment_value_changed()
6220 clist->focus_row = -1; in hadjustment_value_changed()
6221 draw_rows (clist, NULL); in hadjustment_value_changed()
6222 clist->focus_row = focus_row; in hadjustment_value_changed()
6224 cairo_rectangle(cr, 0, y, clist->clist_window_width + 1, in hadjustment_value_changed()
6225 clist->row_height); in hadjustment_value_changed()
6245 columns_new (GtkCMCList *clist) in columns_new() argument
6250 column = g_new (GtkCMCListColumn, clist->columns); in columns_new()
6252 for (i = 0; i < clist->columns; i++) in columns_new()
6276 column_title_new (GtkCMCList *clist, in column_title_new() argument
6280 g_free (clist->column[column].title); in column_title_new()
6282 clist->column[column].title = g_strdup (title); in column_title_new()
6286 columns_delete (GtkCMCList *clist) in columns_delete() argument
6290 for (i = 0; i < clist->columns; i++) in columns_delete()
6291 g_free (clist->column[i].title); in columns_delete()
6293 g_free (clist->column); in columns_delete()
6297 row_new (GtkCMCList *clist) in row_new() argument
6303 clist_row->cell = g_slice_alloc (sizeof (GtkCMCell) * clist->columns); in row_new()
6305 for (i = 0; i < clist->columns; i++) in row_new()
6325 row_delete (GtkCMCList *clist, in row_delete() argument
6330 for (i = 0; i < clist->columns; i++) in row_delete()
6332 GTK_CMCLIST_GET_CLASS (clist)->set_cell_contents in row_delete()
6333 (clist, clist_row, i, GTK_CMCELL_EMPTY, NULL, 0, NULL); in row_delete()
6336 if (gtk_widget_get_realized (GTK_WIDGET(clist))) in row_delete()
6344 if (gtk_widget_get_realized (GTK_WIDGET(clist))) in row_delete()
6352 g_slice_free1 (sizeof (GtkCMCell) * clist->columns, clist_row->cell); in row_delete()
6365 gtk_cmclist_focus_content_area (GtkCMCList *clist) in gtk_cmclist_focus_content_area() argument
6367 if (clist->focus_row < 0) in gtk_cmclist_focus_content_area()
6369 clist->focus_row = 0; in gtk_cmclist_focus_content_area()
6371 if ((clist->selection_mode == GTK_SELECTION_BROWSE || in gtk_cmclist_focus_content_area()
6372 clist->selection_mode == GTK_SELECTION_MULTIPLE) && in gtk_cmclist_focus_content_area()
6373 !clist->selection) in gtk_cmclist_focus_content_area()
6374 g_signal_emit (G_OBJECT (clist), in gtk_cmclist_focus_content_area()
6376 clist->focus_row, -1, NULL); in gtk_cmclist_focus_content_area()
6378 gtk_widget_grab_focus (GTK_WIDGET (clist)); in gtk_cmclist_focus_content_area()
6385 GtkCMCList *clist = GTK_CMCLIST (widget); in gtk_cmclist_focus() local
6394 is_current_focus = gtk_widget_is_focus (GTK_WIDGET (clist)); in gtk_cmclist_focus()
6406 if (title_focus_move (clist, direction)) in gtk_cmclist_focus()
6411 gtk_cmclist_focus_content_area (clist); in gtk_cmclist_focus()
6419 if (title_focus_in (clist, direction)) in gtk_cmclist_focus()
6423 if (!is_current_focus && clist->rows) in gtk_cmclist_focus()
6425 gtk_cmclist_focus_content_area (clist); in gtk_cmclist_focus()
6433 if (title_focus_in (clist, direction)) in gtk_cmclist_focus()
6437 if (!is_current_focus && !focus_child && clist->rows) in gtk_cmclist_focus()
6439 gtk_cmclist_focus_content_area (clist); in gtk_cmclist_focus()
6454 GtkCMCList *clist = GTK_CMCLIST (container); in gtk_cmclist_set_focus_child() local
6457 for (i = 0; i < clist->columns; i++) in gtk_cmclist_set_focus_child()
6458 if (clist->column[i].button == child) in gtk_cmclist_set_focus_child()
6459 clist->focus_header_column = i; in gtk_cmclist_set_focus_child()
6468 GtkCMCList *clist; in gtk_cmclist_draw_focus() local
6476 clist = GTK_CMCLIST (widget); in gtk_cmclist_draw_focus()
6477 if (clist->focus_row >= 0) { in gtk_cmclist_draw_focus()
6478 cr = gdk_cairo_create(clist->clist_window); in gtk_cmclist_draw_focus()
6479 cairo_dash_from_add_mode(clist, cr); in gtk_cmclist_draw_focus()
6482 cairo_rectangle(cr, 0, ROW_TOP_YPIXEL(clist, clist->focus_row) + 0.5, in gtk_cmclist_draw_focus()
6483 clist->clist_window_width + 1, in gtk_cmclist_draw_focus()
6484 clist->row_height - 0.5); in gtk_cmclist_draw_focus()
6493 GtkCMCList *clist; in gtk_cmclist_undraw_focus() local
6497 clist = GTK_CMCLIST(widget); in gtk_cmclist_undraw_focus()
6499 if (clist->focus_row < 0) in gtk_cmclist_undraw_focus()
6505 clist = GTK_CMCLIST (widget); in gtk_cmclist_undraw_focus()
6506 if (clist->focus_row >= 0) { in gtk_cmclist_undraw_focus()
6507 cairo_t *cr = gdk_cairo_create(clist->clist_window); in gtk_cmclist_undraw_focus()
6511 cairo_rectangle(cr, 0, ROW_TOP_YPIXEL(clist, clist->focus_row) + 0.5, in gtk_cmclist_undraw_focus()
6512 clist->clist_window_width + 1, in gtk_cmclist_undraw_focus()
6513 clist->row_height - 0.5); in gtk_cmclist_undraw_focus()
6518 row = clist->focus_row; in gtk_cmclist_undraw_focus()
6519 …GTK_CMCLIST_GET_CLASS(GTK_CMCLIST(widget))->draw_row(clist, NULL, row, ROW_ELEMENT (clist, row)->d… in gtk_cmclist_undraw_focus()
6526 GtkCMCList *clist = GTK_CMCLIST (widget); in gtk_cmclist_focus_in() local
6528 if (clist->selection_mode == GTK_SELECTION_BROWSE && in gtk_cmclist_focus_in()
6529 clist->selection == NULL && clist->focus_row > -1) in gtk_cmclist_focus_in()
6533 list = g_list_nth (clist->row_list, clist->focus_row); in gtk_cmclist_focus_in()
6535 g_signal_emit (G_OBJECT (clist), clist_signals[SELECT_ROW], 0, in gtk_cmclist_focus_in()
6536 clist->focus_row, -1, event); in gtk_cmclist_focus_in()
6550 GtkCMCList *clist = GTK_CMCLIST (widget); in gtk_cmclist_focus_out() local
6554 GTK_CMCLIST_GET_CLASS (widget)->resync_selection (clist, (GdkEvent *) event); in gtk_cmclist_focus_out()
6560 focus_column (GtkCMCList *clist, gint column, gint dir) in focus_column() argument
6562 GtkWidget *child = clist->column[column].button; in focus_column()
6581 title_focus_in (GtkCMCList *clist, gint dir) in title_focus_in() argument
6586 if (!GTK_CMCLIST_SHOW_TITLES (clist)) in title_focus_in()
6590 if (clist->focus_header_column != -1) in title_focus_in()
6592 i = clist->focus_header_column; in title_focus_in()
6594 left = COLUMN_LEFT_XPIXEL (clist, i); in title_focus_in()
6595 right = left + clist->column[i].area.width; in title_focus_in()
6597 if (left >= 0 && right <= clist->clist_window_width) in title_focus_in()
6599 if (focus_column (clist, i, dir)) in title_focus_in()
6605 for (i = 0 ; i < clist->columns ; i++) in title_focus_in()
6607 left = COLUMN_LEFT_XPIXEL (clist, i); in title_focus_in()
6608 right = left + clist->column[i].area.width; in title_focus_in()
6610 if (left >= 0 && right <= clist->clist_window_width) in title_focus_in()
6612 if (focus_column (clist, i, dir)) in title_focus_in()
6618 for (i = 0 ; i < clist->columns ; i++) in title_focus_in()
6620 left = COLUMN_LEFT_XPIXEL (clist, i); in title_focus_in()
6621 right = left + clist->column[i].area.width; in title_focus_in()
6624 (left < clist->clist_window_width && right > clist->clist_window_width)) in title_focus_in()
6626 if (focus_column (clist, i, dir)) in title_focus_in()
6638 title_focus_move (GtkCMCList *clist, in title_focus_move() argument
6647 if (!GTK_CMCLIST_SHOW_TITLES(clist)) in title_focus_move()
6650 focus_child = gtk_container_get_focus_child (GTK_CONTAINER (clist)); in title_focus_move()
6665 for (i = 0; i < clist->columns; i++) in title_focus_move()
6666 if (clist->column[i].button == focus_child) in title_focus_move()
6672 while (!return_val && j >= 0 && j < clist->columns) in title_focus_move()
6674 if (clist->column[j].button && in title_focus_move()
6675 gtk_widget_get_visible (clist->column[j].button)) in title_focus_move()
6677 if (focus_column (clist, j, dir)) in title_focus_move()
6690 j = d > 0 ? 0 : clist->columns - 1; in title_focus_move()
6694 if (clist->column[j].button && in title_focus_move()
6695 gtk_widget_get_visible (clist->column[j].button)) in title_focus_move()
6697 if (focus_column (clist, j, dir)) in title_focus_move()
6711 if (COLUMN_LEFT_XPIXEL (clist, j) < CELL_SPACING + COLUMN_INSET) in title_focus_move()
6712 gtk_cmclist_moveto (clist, -1, j, 0, 0); in title_focus_move()
6713 else if (COLUMN_LEFT_XPIXEL(clist, j) + clist->column[j].area.width > in title_focus_move()
6714 clist->clist_window_width) in title_focus_move()
6718 for (last_column = clist->columns - 1; in title_focus_move()
6719 last_column >= 0 && !clist->column[last_column].visible; last_column--); in title_focus_move()
6722 gtk_cmclist_moveto (clist, -1, j, 0, 0); in title_focus_move()
6724 gtk_cmclist_moveto (clist, -1, j, 0, 1); in title_focus_move()
6743 move_focus_row (GtkCMCList *clist, in move_focus_row() argument
6749 cm_return_if_fail (clist != 0); in move_focus_row()
6750 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in move_focus_row()
6752 widget = GTK_WIDGET (clist); in move_focus_row()
6758 if (clist->focus_row <= 0) in move_focus_row()
6761 clist->focus_row--; in move_focus_row()
6767 if (clist->focus_row >= clist->rows - 1) in move_focus_row()
6770 clist->focus_row++; in move_focus_row()
6775 if (clist->focus_row <= 0) in move_focus_row()
6778 clist->focus_row = MAX (0, clist->focus_row - in move_focus_row()
6779 (2 * clist->clist_window_height - in move_focus_row()
6780 clist->row_height - CELL_SPACING) / in move_focus_row()
6781 (2 * (clist->row_height + CELL_SPACING))); in move_focus_row()
6786 if (clist->focus_row >= clist->rows - 1) in move_focus_row()
6789 clist->focus_row = MIN (clist->rows - 1, clist->focus_row + in move_focus_row()
6790 (2 * clist->clist_window_height - in move_focus_row()
6791 clist->row_height - CELL_SPACING) / in move_focus_row()
6792 (2 * (clist->row_height + CELL_SPACING))); in move_focus_row()
6798 gint row = position * (clist->rows - 1); in move_focus_row()
6800 if (row == clist->focus_row) in move_focus_row()
6804 clist->focus_row = row; in move_focus_row()
6814 scroll_horizontal (GtkCMCList *clist, in scroll_horizontal() argument
6821 cm_return_if_fail (clist != 0); in scroll_horizontal()
6822 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in scroll_horizontal()
6824 if (clist_has_grab (clist)) in scroll_horizontal()
6827 for (last_column = clist->columns - 1; in scroll_horizontal()
6828 last_column >= 0 && !clist->column[last_column].visible; last_column--) in scroll_horizontal()
6834 column = COLUMN_FROM_XPIXEL (clist, 0); in scroll_horizontal()
6835 if (COLUMN_LEFT_XPIXEL (clist, column) - CELL_SPACING - COLUMN_INSET >= 0 in scroll_horizontal()
6840 column = COLUMN_FROM_XPIXEL (clist, clist->clist_window_width); in scroll_horizontal()
6843 if (COLUMN_LEFT_XPIXEL (clist, column) + in scroll_horizontal()
6844 clist->column[column].area.width + in scroll_horizontal()
6845 CELL_SPACING + COLUMN_INSET - 1 <= clist->clist_window_width && in scroll_horizontal()
6859 if (clist->column[i].visible) in scroll_horizontal()
6865 if (clist->column[i].visible) in scroll_horizontal()
6877 if (COLUMN_LEFT_XPIXEL (clist, column) < CELL_SPACING + COLUMN_INSET) in scroll_horizontal()
6878 gtk_cmclist_moveto (clist, -1, column, 0, 0); in scroll_horizontal()
6879 else if (COLUMN_LEFT_XPIXEL (clist, column) + CELL_SPACING + COLUMN_INSET - 1 in scroll_horizontal()
6880 + clist->column[column].area.width > clist->clist_window_width) in scroll_horizontal()
6883 gtk_cmclist_moveto (clist, -1, column, 0, 0); in scroll_horizontal()
6885 gtk_cmclist_moveto (clist, -1, column, 0, 1); in scroll_horizontal()
6890 scroll_vertical (GtkCMCList *clist, in scroll_vertical() argument
6896 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in scroll_vertical()
6898 if (clist_has_grab (clist)) in scroll_vertical()
6901 switch (clist->selection_mode) in scroll_vertical()
6904 if (clist->anchor >= 0) in scroll_vertical()
6908 old_focus_row = clist->focus_row; in scroll_vertical()
6909 move_focus_row (clist, scroll_type, position); in scroll_vertical()
6911 if (old_focus_row != clist->focus_row) in scroll_vertical()
6913 if (clist->selection_mode == GTK_SELECTION_BROWSE) in scroll_vertical()
6914 g_signal_emit (G_OBJECT (clist), clist_signals[UNSELECT_ROW], 0, in scroll_vertical()
6916 else if (!GTK_CMCLIST_ADD_MODE(clist)) in scroll_vertical()
6918 gtk_cmclist_unselect_all (clist); in scroll_vertical()
6919 clist->undo_anchor = old_focus_row; in scroll_vertical()
6923 switch (gtk_cmclist_row_is_visible (clist, clist->focus_row)) in scroll_vertical()
6926 if (old_focus_row != clist->focus_row && in scroll_vertical()
6927 !(clist->selection_mode == GTK_SELECTION_MULTIPLE && in scroll_vertical()
6928 GTK_CMCLIST_ADD_MODE(clist))) in scroll_vertical()
6929 g_signal_emit (G_OBJECT (clist), clist_signals[SELECT_ROW], 0, in scroll_vertical()
6930 clist->focus_row, -1, NULL); in scroll_vertical()
6937 gtk_cmclist_moveto (clist, clist->focus_row, -1, 0, 0); in scroll_vertical()
6943 gtk_cmclist_moveto (clist, clist->focus_row, -1, 1, 0); in scroll_vertical()
6946 gtk_cmclist_moveto (clist, clist->focus_row, -1, 0.5, 0); in scroll_vertical()
6957 gtk_cmclist_moveto (clist, clist->focus_row, -1, 0, 0); in scroll_vertical()
6961 gtk_cmclist_moveto (clist, clist->focus_row, -1, 1, 0); in scroll_vertical()
6964 gtk_cmclist_moveto (clist, clist->focus_row, -1, 0.5, 0); in scroll_vertical()
6971 if (old_focus_row != clist->focus_row && in scroll_vertical()
6972 !(clist->selection_mode == GTK_SELECTION_MULTIPLE && in scroll_vertical()
6973 GTK_CMCLIST_ADD_MODE(clist))) in scroll_vertical()
6974 g_signal_emit (G_OBJECT (clist), clist_signals[SELECT_ROW], 0, in scroll_vertical()
6975 clist->focus_row, -1, NULL); in scroll_vertical()
6980 move_focus_row (clist, scroll_type, position); in scroll_vertical()
6982 if (ROW_TOP_YPIXEL (clist, clist->focus_row) + clist->row_height > in scroll_vertical()
6983 clist->clist_window_height) in scroll_vertical()
6984 gtk_cmclist_moveto (clist, clist->focus_row, -1, 1, 0); in scroll_vertical()
6985 else if (ROW_TOP_YPIXEL (clist, clist->focus_row) < 0) in scroll_vertical()
6986 gtk_cmclist_moveto (clist, clist->focus_row, -1, 0, 0); in scroll_vertical()
6992 move_horizontal (GtkCMCList *clist, in move_horizontal() argument
6997 if (!clist->hadjustment) in move_horizontal()
7000 value = CLAMP (gtk_adjustment_get_value (clist->hadjustment) + diff, 0.0, in move_horizontal()
7001 gtk_adjustment_get_upper (clist->hadjustment) - in move_horizontal()
7002 gtk_adjustment_get_page_size (clist->hadjustment)); in move_horizontal()
7003 gtk_adjustment_set_value (clist->hadjustment, value); in move_horizontal()
7007 move_vertical (GtkCMCList *clist, in move_vertical() argument
7015 if (!clist->vadjustment) in move_vertical()
7018 value = (ROW_TOP_YPIXEL (clist, row) - clist->voffset - in move_vertical()
7019 align * (clist->clist_window_height - clist->row_height) + in move_vertical()
7022 upper = gtk_adjustment_get_upper (clist->vadjustment); in move_vertical()
7023 page_size = gtk_adjustment_get_page_size (clist->vadjustment); in move_vertical()
7027 gtk_adjustment_set_value (clist->vadjustment, value); in move_vertical()
7042 horizontal_timeout (GtkCMCList *clist) in horizontal_timeout() argument
7044 clist->htimer = 0; in horizontal_timeout()
7045 do_fake_motion (GTK_WIDGET (clist)); in horizontal_timeout()
7051 vertical_timeout (GtkCMCList *clist) in vertical_timeout() argument
7053 clist->vtimer = 0; in vertical_timeout()
7054 do_fake_motion (GTK_WIDGET (clist)); in vertical_timeout()
7060 remove_grab (GtkCMCList *clist) in remove_grab() argument
7062 GtkWidget *widget = GTK_WIDGET (clist); in remove_grab()
7073 if (clist->htimer) in remove_grab()
7075 g_source_remove (clist->htimer); in remove_grab()
7076 clist->htimer = 0; in remove_grab()
7079 if (clist->vtimer) in remove_grab()
7081 g_source_remove (clist->vtimer); in remove_grab()
7082 clist->vtimer = 0; in remove_grab()
7094 gtk_cmclist_sort (GtkCMCList *clist) in gtk_cmclist_sort() argument
7096 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_sort()
7098 GTK_CMCLIST_GET_CLASS (clist)->sort_list (clist); in gtk_cmclist_sort()
7102 gtk_cmclist_set_compare_func (GtkCMCList *clist, in gtk_cmclist_set_compare_func() argument
7105 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_set_compare_func()
7107 clist->compare = (cmp_func) ? cmp_func : default_compare; in gtk_cmclist_set_compare_func()
7111 gtk_cmclist_set_auto_sort (GtkCMCList *clist, in gtk_cmclist_set_auto_sort() argument
7114 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_set_auto_sort()
7116 if (GTK_CMCLIST_AUTO_SORT(clist) && !auto_sort) in gtk_cmclist_set_auto_sort()
7117 GTK_CMCLIST_UNSET_FLAG (clist, CMCLIST_AUTO_SORT); in gtk_cmclist_set_auto_sort()
7118 else if (!GTK_CMCLIST_AUTO_SORT(clist) && auto_sort) in gtk_cmclist_set_auto_sort()
7120 GTK_CMCLIST_SET_FLAG (clist, CMCLIST_AUTO_SORT); in gtk_cmclist_set_auto_sort()
7121 gtk_cmclist_sort (clist); in gtk_cmclist_set_auto_sort()
7126 gtk_cmclist_set_sort_type (GtkCMCList *clist, in gtk_cmclist_set_sort_type() argument
7129 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_set_sort_type()
7131 clist->sort_type = sort_type; in gtk_cmclist_set_sort_type()
7135 gtk_cmclist_set_sort_column (GtkCMCList *clist, in gtk_cmclist_set_sort_column() argument
7138 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_set_sort_column()
7140 if (column < 0 || column >= clist->columns) in gtk_cmclist_set_sort_column()
7143 clist->sort_column = column; in gtk_cmclist_set_sort_column()
7153 default_compare (GtkCMCList *clist, in default_compare() argument
7163 switch (row1->cell[clist->sort_column].type) in default_compare()
7166 text1 = GTK_CMCELL_TEXT (row1->cell[clist->sort_column])->text; in default_compare()
7169 text1 = GTK_CMCELL_PIXTEXT (row1->cell[clist->sort_column])->text; in default_compare()
7175 switch (row2->cell[clist->sort_column].type) in default_compare()
7178 text2 = GTK_CMCELL_TEXT (row2->cell[clist->sort_column])->text; in default_compare()
7181 text2 = GTK_CMCELL_PIXTEXT (row2->cell[clist->sort_column])->text; in default_compare()
7197 real_sort_list (GtkCMCList *clist) in real_sort_list() argument
7203 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in real_sort_list()
7205 if (clist->rows <= 1) in real_sort_list()
7208 if (clist_has_grab (clist)) in real_sort_list()
7211 gtk_cmclist_freeze (clist); in real_sort_list()
7213 if (clist->anchor != -1 && clist->selection_mode == GTK_SELECTION_MULTIPLE) in real_sort_list()
7215 GTK_CMCLIST_GET_CLASS (clist)->resync_selection (clist, NULL); in real_sort_list()
7216 g_list_free (clist->undo_selection); in real_sort_list()
7217 g_list_free (clist->undo_unselection); in real_sort_list()
7218 clist->undo_selection = NULL; in real_sort_list()
7219 clist->undo_unselection = NULL; in real_sort_list()
7222 clist->row_list = gtk_cmclist_mergesort (clist, clist->row_list, clist->rows); in real_sort_list()
7224 work = clist->selection; in real_sort_list()
7226 for (i = 0, list = clist->row_list; i < clist->rows; i++, list = list->next) in real_sort_list()
7234 if (i == clist->rows - 1) in real_sort_list()
7235 clist->row_list_end = list; in real_sort_list()
7238 gtk_cmclist_thaw (clist); in real_sort_list()
7242 gtk_cmclist_merge (GtkCMCList *clist, in gtk_cmclist_merge() argument
7275 cmp = clist->compare (clist, GTK_CMCLIST_ROW (a), GTK_CMCLIST_ROW (b)); in gtk_cmclist_merge()
7276 if ((cmp >= 0 && clist->sort_type == GTK_SORT_DESCENDING) || in gtk_cmclist_merge()
7277 (cmp <= 0 && clist->sort_type == GTK_SORT_ASCENDING)) in gtk_cmclist_merge()
7301 gtk_cmclist_mergesort (GtkCMCList *clist, in gtk_cmclist_mergesort() argument
7324 return gtk_cmclist_merge (clist, in gtk_cmclist_mergesort()
7325 gtk_cmclist_mergesort (clist, list, num / 2), in gtk_cmclist_mergesort()
7326 gtk_cmclist_mergesort (clist, half, num - num / 2)); in gtk_cmclist_mergesort()
7349 drag_dest_cell (GtkCMCList *clist, in drag_dest_cell() argument
7358 widget = GTK_WIDGET (clist); in drag_dest_cell()
7366 clist->column_title_area.height); in drag_dest_cell()
7368 dest_info->cell.row = ROW_FROM_YPIXEL (clist, y); in drag_dest_cell()
7369 if (dest_info->cell.row >= clist->rows) in drag_dest_cell()
7371 dest_info->cell.row = clist->rows - 1; in drag_dest_cell()
7372 y = ROW_TOP_YPIXEL (clist, dest_info->cell.row) + clist->row_height; in drag_dest_cell()
7379 dest_info->cell.column = COLUMN_FROM_XPIXEL (clist, x); in drag_dest_cell()
7386 y_delta = y - ROW_TOP_YPIXEL (clist, dest_info->cell.row); in drag_dest_cell()
7388 if (GTK_CMCLIST_DRAW_DRAG_RECT(clist)) in drag_dest_cell()
7391 h = clist->row_height / 4; in drag_dest_cell()
7393 else if (GTK_CMCLIST_DRAW_DRAG_LINE(clist)) in drag_dest_cell()
7396 h = clist->row_height / 2; in drag_dest_cell()
7399 if (GTK_CMCLIST_DRAW_DRAG_LINE(clist)) in drag_dest_cell()
7403 else if (clist->row_height - y_delta < h) in drag_dest_cell()
7413 GtkCMCList *clist; in gtk_cmclist_drag_begin() local
7419 clist = GTK_CMCLIST (widget); in gtk_cmclist_drag_begin()
7421 clist->drag_button = 0; in gtk_cmclist_drag_begin()
7422 remove_grab (clist); in gtk_cmclist_drag_begin()
7424 switch (clist->selection_mode) in gtk_cmclist_drag_begin()
7427 update_extended_selection (clist, clist->focus_row); in gtk_cmclist_drag_begin()
7428 GTK_CMCLIST_GET_CLASS (clist)->resync_selection (clist, NULL); in gtk_cmclist_drag_begin()
7431 clist->anchor = -1; in gtk_cmclist_drag_begin()
7444 if (clist->click_cell.row < 0) in gtk_cmclist_drag_begin()
7445 clist->click_cell.row = 0; in gtk_cmclist_drag_begin()
7446 else if (clist->click_cell.row >= clist->rows) in gtk_cmclist_drag_begin()
7447 clist->click_cell.row = clist->rows - 1; in gtk_cmclist_drag_begin()
7448 info->row = clist->click_cell.row; in gtk_cmclist_drag_begin()
7449 info->column = clist->click_cell.column; in gtk_cmclist_drag_begin()
7455 if (GTK_CMCLIST_USE_DRAG_ICONS (clist)) in gtk_cmclist_drag_begin()
7463 GtkCMCList *clist; in gtk_cmclist_drag_end() local
7468 clist = GTK_CMCLIST (widget); in gtk_cmclist_drag_end()
7470 clist->click_cell.row = -1; in gtk_cmclist_drag_end()
7471 clist->click_cell.column = -1; in gtk_cmclist_drag_end()
7479 GtkCMCList *clist; in gtk_cmclist_drag_leave() local
7485 clist = GTK_CMCLIST (widget); in gtk_cmclist_drag_leave()
7492 GTK_CMCLIST_REORDERABLE(clist) && in gtk_cmclist_drag_leave()
7500 clist->drag_highlight_row = -1; in gtk_cmclist_drag_leave()
7514 GtkCMCList *clist; in gtk_cmclist_drag_motion() local
7520 clist = GTK_CMCLIST (widget); in gtk_cmclist_drag_motion()
7536 drag_dest_cell (clist, x, y, &new_info); in gtk_cmclist_drag_motion()
7538 if (GTK_CMCLIST_REORDERABLE (clist)) in gtk_cmclist_drag_motion()
7547 new_info.cell.row == clist->click_cell.row || in gtk_cmclist_drag_motion()
7548 (new_info.cell.row == clist->click_cell.row - 1 && in gtk_cmclist_drag_motion()
7550 (new_info.cell.row == clist->click_cell.row + 1 && in gtk_cmclist_drag_motion()
7570 clist->drag_highlight_row = dest_info->cell.row; in gtk_cmclist_drag_motion()
7571 clist->drag_highlight_pos = dest_info->insert_pos; in gtk_cmclist_drag_motion()
7617 GtkCMCList *clist; in gtk_cmclist_drag_data_received() local
7623 clist = GTK_CMCLIST (widget); in gtk_cmclist_drag_data_received()
7625 if (GTK_CMCLIST_REORDERABLE (clist) && in gtk_cmclist_drag_data_received()
7639 drag_dest_cell (clist, x, y, &dest_info); in gtk_cmclist_drag_data_received()
7646 gtk_cmclist_row_move (clist, source_info->row, dest_info.cell.row); in gtk_cmclist_drag_data_received()
7687 gtk_cmclist_set_reorderable (GtkCMCList *clist, in gtk_cmclist_set_reorderable() argument
7692 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_set_reorderable()
7694 if ((GTK_CMCLIST_REORDERABLE(clist) != 0) == reorderable) in gtk_cmclist_set_reorderable()
7697 widget = GTK_WIDGET (clist); in gtk_cmclist_set_reorderable()
7701 GTK_CMCLIST_SET_FLAG (clist, CMCLIST_REORDERABLE); in gtk_cmclist_set_reorderable()
7708 GTK_CMCLIST_UNSET_FLAG (clist, CMCLIST_REORDERABLE); in gtk_cmclist_set_reorderable()
7709 gtk_drag_dest_unset (GTK_WIDGET (clist)); in gtk_cmclist_set_reorderable()
7714 gtk_cmclist_set_use_drag_icons (GtkCMCList *clist, in gtk_cmclist_set_use_drag_icons() argument
7717 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_set_use_drag_icons()
7720 GTK_CMCLIST_SET_FLAG (clist, CMCLIST_USE_DRAG_ICONS); in gtk_cmclist_set_use_drag_icons()
7722 GTK_CMCLIST_UNSET_FLAG (clist, CMCLIST_USE_DRAG_ICONS); in gtk_cmclist_set_use_drag_icons()
7726 gtk_cmclist_set_button_actions (GtkCMCList *clist, in gtk_cmclist_set_button_actions() argument
7730 cm_return_if_fail (GTK_IS_CMCLIST (clist)); in gtk_cmclist_set_button_actions()
7734 if (gdk_display_pointer_is_grabbed (gtk_widget_get_display (GTK_WIDGET (clist))) || in gtk_cmclist_set_button_actions()
7735 gtk_widget_has_grab (GTK_WIDGET(clist))) in gtk_cmclist_set_button_actions()
7737 remove_grab (clist); in gtk_cmclist_set_button_actions()
7738 clist->drag_button = 0; in gtk_cmclist_set_button_actions()
7741 GTK_CMCLIST_GET_CLASS (clist)->resync_selection (clist, NULL); in gtk_cmclist_set_button_actions()
7743 clist->button_actions[button] = button_actions; in gtk_cmclist_set_button_actions()