1 /* GTK - The GIMP Toolkit 2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball, Josh MacDonald 3 * Copyright (C) 1997-1998 Jay Painter <jpaint@serv.net><jpaint@gimp.org> 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public 16 * License along with this library; if not, write to the 17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 * Boston, MA 02111-1307, USA. 19 */ 20 21 /* 22 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS 23 * file for a list of people on the GTK+ Team. See the ChangeLog 24 * files for a list of changes. These files are distributed with 25 * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 26 */ 27 28 #ifndef __GTK_CMCLIST_H__ 29 #define __GTK_CMCLIST_H__ 30 31 #include <gdk/gdk.h> 32 #include <gtk/gtk.h> 33 34 35 G_BEGIN_DECLS 36 37 /* clist flags */ 38 enum { 39 GTK_CMCLIST_IN_DRAG = 1 << 0, 40 GTK_CMCLIST_ROW_HEIGHT_SET = 1 << 1, 41 GTK_CMCLIST_SHOW_TITLES = 1 << 2, 42 /* Unused */ 43 GTK_CMCLIST_ADD_MODE = 1 << 4, 44 GTK_CMCLIST_AUTO_SORT = 1 << 5, 45 GTK_CMCLIST_AUTO_RESIZE_BLOCKED = 1 << 6, 46 GTK_CMCLIST_REORDERABLE = 1 << 7, 47 GTK_CMCLIST_USE_DRAG_ICONS = 1 << 8, 48 GTK_CMCLIST_DRAW_DRAG_LINE = 1 << 9, 49 GTK_CMCLIST_DRAW_DRAG_RECT = 1 << 10 50 }; 51 52 /* cell types */ 53 typedef enum 54 { 55 GTK_CMCELL_EMPTY, 56 GTK_CMCELL_TEXT, 57 GTK_CMCELL_PIXBUF, 58 GTK_CMCELL_PIXTEXT, 59 GTK_CMCELL_WIDGET 60 } GtkCMCellType; 61 62 typedef enum 63 { 64 GTK_CMCLIST_DRAG_NONE, 65 GTK_CMCLIST_DRAG_BEFORE, 66 GTK_CMCLIST_DRAG_INTO, 67 GTK_CMCLIST_DRAG_AFTER 68 } GtkCMCListDragPos; 69 70 typedef enum 71 { 72 GTK_CMBUTTON_IGNORED = 0, 73 GTK_CMBUTTON_SELECTS = 1 << 0, 74 GTK_CMBUTTON_DRAGS = 1 << 1, 75 GTK_CMBUTTON_EXPANDS = 1 << 2 76 } GtkCMButtonAction; 77 78 #define GTK_TYPE_CMCLIST (gtk_cmclist_get_type ()) 79 #define GTK_CMCLIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CMCLIST, GtkCMCList)) 80 #define GTK_CMCLIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CMCLIST, GtkCMCListClass)) 81 #define GTK_IS_CMCLIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CMCLIST)) 82 #define GTK_IS_CMCLIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CMCLIST)) 83 #define GTK_CMCLIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CMCLIST, GtkCMCListClass)) 84 85 86 #define GTK_CMCLIST_FLAGS(clist) (GTK_CMCLIST (clist)->flags) 87 #define GTK_CMCLIST_SET_FLAG(clist,flag) (GTK_CMCLIST_FLAGS (clist) |= (GTK_ ## flag)) 88 #define GTK_CMCLIST_UNSET_FLAG(clist,flag) (GTK_CMCLIST_FLAGS (clist) &= ~(GTK_ ## flag)) 89 90 #define GTK_CMCLIST_IN_DRAG(clist) (GTK_CMCLIST_FLAGS (clist) & GTK_CMCLIST_IN_DRAG) 91 #define GTK_CMCLIST_ROW_HEIGHT_SET(clist) (GTK_CMCLIST_FLAGS (clist) & GTK_CMCLIST_ROW_HEIGHT_SET) 92 #define GTK_CMCLIST_SHOW_TITLES(clist) (GTK_CMCLIST_FLAGS (clist) & GTK_CMCLIST_SHOW_TITLES) 93 #define GTK_CMCLIST_ADD_MODE(clist) (GTK_CMCLIST_FLAGS (clist) & GTK_CMCLIST_ADD_MODE) 94 #define GTK_CMCLIST_AUTO_SORT(clist) (GTK_CMCLIST_FLAGS (clist) & GTK_CMCLIST_AUTO_SORT) 95 #define GTK_CMCLIST_AUTO_RESIZE_BLOCKED(clist) (GTK_CMCLIST_FLAGS (clist) & GTK_CMCLIST_AUTO_RESIZE_BLOCKED) 96 #define GTK_CMCLIST_REORDERABLE(clist) (GTK_CMCLIST_FLAGS (clist) & GTK_CMCLIST_REORDERABLE) 97 #define GTK_CMCLIST_USE_DRAG_ICONS(clist) (GTK_CMCLIST_FLAGS (clist) & GTK_CMCLIST_USE_DRAG_ICONS) 98 #define GTK_CMCLIST_DRAW_DRAG_LINE(clist) (GTK_CMCLIST_FLAGS (clist) & GTK_CMCLIST_DRAW_DRAG_LINE) 99 #define GTK_CMCLIST_DRAW_DRAG_RECT(clist) (GTK_CMCLIST_FLAGS (clist) & GTK_CMCLIST_DRAW_DRAG_RECT) 100 101 #define GTK_CMCLIST_ROW(_glist_) ((GtkCMCListRow *)((_glist_)->data)) 102 103 /* pointer casting for cells */ 104 #define GTK_CMCELL_TEXT(cell) (((GtkCMCellText *) &(cell))) 105 #define GTK_CMCELL_PIXBUF(cell) (((GtkCMCellPixbuf *) &(cell))) 106 #define GTK_CMCELL_PIXTEXT(cell) (((GtkCMCellPixText *) &(cell))) 107 #define GTK_CMCELL_WIDGET(cell) (((GtkCMCellWidget *) &(cell))) 108 109 typedef struct _GtkCMCList GtkCMCList; 110 typedef struct _GtkCMCListClass GtkCMCListClass; 111 typedef struct _GtkCMCListColumn GtkCMCListColumn; 112 typedef struct _GtkCMCListRow GtkCMCListRow; 113 114 typedef struct _GtkCMCell GtkCMCell; 115 typedef struct _GtkCMCellText GtkCMCellText; 116 typedef struct _GtkCMCellPixbuf GtkCMCellPixbuf; 117 typedef struct _GtkCMCellPixText GtkCMCellPixText; 118 typedef struct _GtkCMCellWidget GtkCMCellWidget; 119 120 typedef gint (*GtkCMCListCompareFunc) (GtkCMCList *clist, 121 gconstpointer ptr1, 122 gconstpointer ptr2); 123 124 typedef struct _GtkCMCListCellInfo GtkCMCListCellInfo; 125 typedef struct _GtkCMCListDestInfo GtkCMCListDestInfo; 126 127 struct _GtkCMCListCellInfo 128 { 129 gint row; 130 gint column; 131 }; 132 133 struct _GtkCMCListDestInfo 134 { 135 GtkCMCListCellInfo cell; 136 GtkCMCListDragPos insert_pos; 137 }; 138 139 struct _GtkCMCList 140 { 141 GtkContainer container; 142 143 guint16 flags; 144 145 gpointer reserved1; 146 gpointer reserved2; 147 guint freeze_count; 148 149 /* allocation rectangle after the conatiner_border_width 150 * and the width of the shadow border */ 151 GdkRectangle internal_allocation; 152 153 /* rows */ 154 gint rows; 155 gint row_height; 156 GList *row_list; 157 GList *row_list_end; 158 159 /* columns */ 160 gint columns; 161 GdkRectangle column_title_area; 162 GdkWindow *title_window; 163 164 /* dynamicly allocated array of column structures */ 165 GtkCMCListColumn *column; 166 167 /* the scrolling window and its height and width to 168 * make things a little speedier */ 169 GdkWindow *clist_window; 170 gint clist_window_width; 171 gint clist_window_height; 172 173 /* offsets for scrolling */ 174 gint hoffset; 175 gint voffset; 176 177 /* border shadow style */ 178 GtkShadowType shadow_type; 179 180 /* the list's selection mode (gtkenums.h) */ 181 GtkSelectionMode selection_mode; 182 183 /* list of selected rows */ 184 GList *selection; 185 GList *selection_end; 186 187 GList *undo_selection; 188 GList *undo_unselection; 189 gint undo_anchor; 190 191 /* mouse buttons */ 192 guint8 button_actions[5]; 193 194 guint8 drag_button; 195 196 /* dnd */ 197 GtkCMCListCellInfo click_cell; 198 199 /* scroll adjustments */ 200 GtkAdjustment *hadjustment; 201 GtkAdjustment *vadjustment; 202 203 gint dash_mode; 204 205 /* cursor used to indicate dragging */ 206 GdkCursor *cursor_drag; 207 208 /* the current x-pixel location of the xor-drag line */ 209 gint x_drag; 210 211 /* focus handling */ 212 gint focus_row; 213 214 gint focus_header_column; 215 216 /* dragging the selection */ 217 gint anchor; 218 GtkStateType anchor_state; 219 gint drag_pos; 220 gint htimer; 221 gint vtimer; 222 223 GtkSortType sort_type; 224 GtkCMCListCompareFunc compare; 225 gint sort_column; 226 227 gint drag_highlight_row; 228 GtkCMCListDragPos drag_highlight_pos; 229 }; 230 231 struct _GtkCMCListClass 232 { 233 GtkContainerClass parent_class; 234 235 void (*set_scroll_adjustments) (GtkCMCList *clist, 236 GtkAdjustment *hadjustment, 237 GtkAdjustment *vadjustment); 238 void (*refresh) (GtkCMCList *clist); 239 void (*select_row) (GtkCMCList *clist, 240 gint row, 241 gint column, 242 GdkEvent *event); 243 void (*unselect_row) (GtkCMCList *clist, 244 gint row, 245 gint column, 246 GdkEvent *event); 247 void (*row_move) (GtkCMCList *clist, 248 gint source_row, 249 gint dest_row); 250 void (*click_column) (GtkCMCList *clist, 251 gint column); 252 void (*resize_column) (GtkCMCList *clist, 253 gint column, 254 gint width); 255 void (*toggle_focus_row) (GtkCMCList *clist); 256 void (*select_all) (GtkCMCList *clist); 257 void (*unselect_all) (GtkCMCList *clist); 258 void (*undo_selection) (GtkCMCList *clist); 259 void (*start_selection) (GtkCMCList *clist); 260 void (*end_selection) (GtkCMCList *clist); 261 void (*extend_selection) (GtkCMCList *clist, 262 GtkScrollType scroll_type, 263 gfloat position, 264 gboolean auto_start_selection); 265 void (*scroll_horizontal) (GtkCMCList *clist, 266 GtkScrollType scroll_type, 267 gfloat position); 268 void (*scroll_vertical) (GtkCMCList *clist, 269 GtkScrollType scroll_type, 270 gfloat position); 271 void (*toggle_add_mode) (GtkCMCList *clist); 272 void (*abort_column_resize) (GtkCMCList *clist); 273 void (*resync_selection) (GtkCMCList *clist, 274 GdkEvent *event); 275 GList* (*selection_find) (GtkCMCList *clist, 276 gint row_number, 277 GList *row_list_element); 278 void (*draw_row) (GtkCMCList *clist, 279 GdkRectangle *area, 280 gint row, 281 GtkCMCListRow *clist_row); 282 void (*clear) (GtkCMCList *clist); 283 void (*fake_unselect_all) (GtkCMCList *clist, 284 gint row); 285 void (*sort_list) (GtkCMCList *clist); 286 gint (*insert_row) (GtkCMCList *clist, 287 gint row, 288 gchar *text[]); 289 void (*remove_row) (GtkCMCList *clist, 290 gint row); 291 void (*set_cell_contents) (GtkCMCList *clist, 292 GtkCMCListRow *clist_row, 293 gint column, 294 GtkCMCellType type, 295 const gchar *text, 296 guint8 spacing, 297 GdkPixbuf *pixbuf); 298 void (*cell_size_request) (GtkCMCList *clist, 299 GtkCMCListRow *clist_row, 300 gint column, 301 GtkRequisition *requisition); 302 303 }; 304 305 struct _GtkCMCListColumn 306 { 307 gchar *title; 308 GdkRectangle area; 309 310 GtkWidget *button; 311 GdkWindow *window; 312 313 gint width; 314 gint min_width; 315 gint max_width; 316 GtkJustification justification; 317 318 guint visible : 1; 319 guint width_set : 1; 320 guint resizeable : 1; 321 guint auto_resize : 1; 322 guint button_passive : 1; 323 }; 324 325 struct _GtkCMCListRow 326 { 327 GtkCMCell *cell; 328 GtkStateType state; 329 330 GdkColor foreground; 331 GdkColor background; 332 333 GtkStyle *style; 334 335 gpointer data; 336 GDestroyNotify destroy; 337 338 guint fg_set : 1; 339 guint bg_set : 1; 340 guint selectable : 1; 341 }; 342 343 /* Cell Structures */ 344 struct _GtkCMCellText 345 { 346 GtkCMCellType type; 347 348 gint16 vertical; 349 gint16 horizontal; 350 351 GtkStyle *style; 352 353 gchar *text; 354 }; 355 356 struct _GtkCMCellPixbuf 357 { 358 GtkCMCellType type; 359 360 gint16 vertical; 361 gint16 horizontal; 362 363 GtkStyle *style; 364 365 GdkPixbuf *pixbuf; 366 }; 367 368 struct _GtkCMCellPixText 369 { 370 GtkCMCellType type; 371 372 gint16 vertical; 373 gint16 horizontal; 374 375 GtkStyle *style; 376 377 gchar *text; 378 guint8 spacing; 379 GdkPixbuf *pixbuf; 380 }; 381 382 struct _GtkCMCellWidget 383 { 384 GtkCMCellType type; 385 386 gint16 vertical; 387 gint16 horizontal; 388 389 GtkStyle *style; 390 391 GtkWidget *widget; 392 }; 393 394 struct _GtkCMCell 395 { 396 GtkCMCellType type; 397 398 gint16 vertical; 399 gint16 horizontal; 400 401 GtkStyle *style; 402 403 union { 404 gchar *text; 405 406 struct { 407 GdkPixbuf *pixbuf; 408 } pm; 409 410 struct { 411 gchar *text; 412 guint8 spacing; 413 GdkPixbuf *pixbuf; 414 } pt; 415 416 GtkWidget *widget; 417 } u; 418 }; 419 420 GType gtk_cmclist_get_type (void); 421 422 /* create a new GtkCMCList */ 423 GtkWidget* gtk_cmclist_new (gint columns); 424 GtkWidget* gtk_cmclist_new_with_titles (gint columns, 425 gchar *titles[]); 426 427 /* set adjustments of clist */ 428 void gtk_cmclist_set_hadjustment (GtkCMCList *clist, 429 GtkAdjustment *adjustment); 430 void gtk_cmclist_set_vadjustment (GtkCMCList *clist, 431 GtkAdjustment *adjustment); 432 433 /* get adjustments of clist */ 434 GtkAdjustment* gtk_cmclist_get_hadjustment (GtkCMCList *clist); 435 GtkAdjustment* gtk_cmclist_get_vadjustment (GtkCMCList *clist); 436 437 /* set the border style of the clist */ 438 void gtk_cmclist_set_shadow_type (GtkCMCList *clist, 439 GtkShadowType type); 440 441 /* set the clist's selection mode */ 442 void gtk_cmclist_set_selection_mode (GtkCMCList *clist, 443 GtkSelectionMode mode); 444 445 /* enable clists reorder ability */ 446 void gtk_cmclist_set_reorderable (GtkCMCList *clist, 447 gboolean reorderable); 448 void gtk_cmclist_set_use_drag_icons (GtkCMCList *clist, 449 gboolean use_icons); 450 void gtk_cmclist_set_button_actions (GtkCMCList *clist, 451 guint button, 452 guint8 button_actions); 453 454 /* freeze all visual updates of the list, and then thaw the list after 455 * you have made a number of changes and the updates wil occure in a 456 * more efficent mannor than if you made them on a unfrozen list 457 */ 458 void gtk_cmclist_freeze (GtkCMCList *clist); 459 void gtk_cmclist_thaw (GtkCMCList *clist); 460 461 /* show and hide the column title buttons */ 462 void gtk_cmclist_column_titles_show (GtkCMCList *clist); 463 void gtk_cmclist_column_titles_hide (GtkCMCList *clist); 464 465 /* set the column title to be a active title (responds to button presses, 466 * prelights, and grabs keyboard focus), or passive where it acts as just 467 * a title 468 */ 469 void gtk_cmclist_column_title_active (GtkCMCList *clist, 470 gint column); 471 void gtk_cmclist_column_title_passive (GtkCMCList *clist, 472 gint column); 473 void gtk_cmclist_column_titles_active (GtkCMCList *clist); 474 void gtk_cmclist_column_titles_passive (GtkCMCList *clist); 475 476 /* set the title in the column title button */ 477 void gtk_cmclist_set_column_title (GtkCMCList *clist, 478 gint column, 479 const gchar *title); 480 481 /* returns the title of column. Returns NULL if title is not set */ 482 gchar * gtk_cmclist_get_column_title (GtkCMCList *clist, 483 gint column); 484 485 /* set a widget instead of a title for the column title button */ 486 void gtk_cmclist_set_column_widget (GtkCMCList *clist, 487 gint column, 488 GtkWidget *widget); 489 490 /* returns the column widget */ 491 GtkWidget * gtk_cmclist_get_column_widget (GtkCMCList *clist, 492 gint column); 493 494 /* set the justification on a column */ 495 void gtk_cmclist_set_column_justification (GtkCMCList *clist, 496 gint column, 497 GtkJustification justification); 498 499 /* set visibility of a column */ 500 void gtk_cmclist_set_column_visibility (GtkCMCList *clist, 501 gint column, 502 gboolean visible); 503 504 /* enable/disable column resize operations by mouse */ 505 void gtk_cmclist_set_column_resizeable (GtkCMCList *clist, 506 gint column, 507 gboolean resizeable); 508 509 /* resize column automatically to its optimal width */ 510 void gtk_cmclist_set_column_auto_resize (GtkCMCList *clist, 511 gint column, 512 gboolean auto_resize); 513 514 gint gtk_cmclist_columns_autosize (GtkCMCList *clist); 515 516 /* return the optimal column width, i.e. maximum of all cell widths */ 517 gint gtk_cmclist_optimal_column_width (GtkCMCList *clist, 518 gint column); 519 520 /* set the pixel width of a column; this is a necessary step in 521 * creating a CList because otherwise the column width is chozen from 522 * the width of the column title, which will never be right 523 */ 524 void gtk_cmclist_set_column_width (GtkCMCList *clist, 525 gint column, 526 gint width); 527 528 /* set column minimum/maximum width. min/max_width < 0 => no restriction */ 529 void gtk_cmclist_set_column_min_width (GtkCMCList *clist, 530 gint column, 531 gint min_width); 532 void gtk_cmclist_set_column_max_width (GtkCMCList *clist, 533 gint column, 534 gint max_width); 535 536 /* change the height of the rows, the default (height=0) is 537 * the hight of the current font. 538 */ 539 void gtk_cmclist_set_row_height (GtkCMCList *clist, 540 guint height); 541 542 /* scroll the viewing area of the list to the given column and row; 543 * row_align and col_align are between 0-1 representing the location the 544 * row should appear on the screnn, 0.0 being top or left, 1.0 being 545 * bottom or right; if row or column is -1 then then there is no change 546 */ 547 void gtk_cmclist_moveto (GtkCMCList *clist, 548 gint row, 549 gint column, 550 gfloat row_align, 551 gfloat col_align); 552 553 /* returns whether the row is visible */ 554 GtkVisibility gtk_cmclist_row_is_visible (GtkCMCList *clist, 555 gint row); 556 557 /* returns whether the row is above or below current viewport */ 558 gboolean gtk_cmclist_row_is_above_viewport (GtkCMCList *clist, 559 gint row); 560 gboolean gtk_cmclist_row_is_below_viewport (GtkCMCList *clist, 561 gint row); 562 563 /* returns the cell type */ 564 GtkCMCellType gtk_cmclist_get_cell_type (GtkCMCList *clist, 565 gint row, 566 gint column); 567 568 /* sets a given cell's text, replacing its current contents */ 569 void gtk_cmclist_set_text (GtkCMCList *clist, 570 gint row, 571 gint column, 572 const gchar *text); 573 574 /* for the "get" functions, any of the return pointer can be 575 * NULL if you are not interested 576 */ 577 gint gtk_cmclist_get_text (GtkCMCList *clist, 578 gint row, 579 gint column, 580 gchar **text); 581 582 /* sets a given cell's pixbuf, replacing its current contents */ 583 void gtk_cmclist_set_pixbuf (GtkCMCList *clist, 584 gint row, 585 gint column, 586 GdkPixbuf *pixbuf); 587 588 gint gtk_cmclist_get_pixbuf (GtkCMCList *clist, 589 gint row, 590 gint column, 591 GdkPixbuf **pixbuf); 592 593 /* sets a given cell's pixbuf and text, replacing its current contents */ 594 void gtk_cmclist_set_pixtext (GtkCMCList *clist, 595 gint row, 596 gint column, 597 const gchar *text, 598 guint8 spacing, 599 GdkPixbuf *pixbuf); 600 601 gint gtk_cmclist_get_pixtext (GtkCMCList *clist, 602 gint row, 603 gint column, 604 gchar **text, 605 guint8 *spacing, 606 GdkPixbuf **pixbuf); 607 608 /* sets the foreground color of a row, the color must already 609 * be allocated 610 */ 611 void gtk_cmclist_set_foreground (GtkCMCList *clist, 612 gint row, 613 const GdkColor *color); 614 615 /* sets the background color of a row, the color must already 616 * be allocated 617 */ 618 void gtk_cmclist_set_background (GtkCMCList *clist, 619 gint row, 620 const GdkColor *color); 621 622 /* set / get cell styles */ 623 void gtk_cmclist_set_cell_style (GtkCMCList *clist, 624 gint row, 625 gint column, 626 GtkStyle *style); 627 628 GtkStyle *gtk_cmclist_get_cell_style (GtkCMCList *clist, 629 gint row, 630 gint column); 631 632 void gtk_cmclist_set_row_style (GtkCMCList *clist, 633 gint row, 634 GtkStyle *style); 635 636 GtkStyle *gtk_cmclist_get_row_style (GtkCMCList *clist, 637 gint row); 638 639 /* this sets a horizontal and vertical shift for drawing 640 * the contents of a cell; it can be positive or negitive; 641 * this is particulary useful for indenting items in a column 642 */ 643 void gtk_cmclist_set_shift (GtkCMCList *clist, 644 gint row, 645 gint column, 646 gint vertical, 647 gint horizontal); 648 649 /* set/get selectable flag of a single row */ 650 void gtk_cmclist_set_selectable (GtkCMCList *clist, 651 gint row, 652 gboolean selectable); 653 gboolean gtk_cmclist_get_selectable (GtkCMCList *clist, 654 gint row); 655 656 /* prepend/append returns the index of the row you just added, 657 * making it easier to append and modify a row 658 */ 659 gint gtk_cmclist_prepend (GtkCMCList *clist, 660 gchar *text[]); 661 gint gtk_cmclist_append (GtkCMCList *clist, 662 gchar *text[]); 663 664 /* inserts a row at index row and returns the row where it was 665 * actually inserted (may be different from "row" in auto_sort mode) 666 */ 667 gint gtk_cmclist_insert (GtkCMCList *clist, 668 gint row, 669 gchar *text[]); 670 671 /* removes row at index row */ 672 void gtk_cmclist_remove (GtkCMCList *clist, 673 gint row); 674 675 /* sets a arbitrary data pointer for a given row */ 676 void gtk_cmclist_set_row_data (GtkCMCList *clist, 677 gint row, 678 gpointer data); 679 680 /* sets a data pointer for a given row with destroy notification */ 681 void gtk_cmclist_set_row_data_full (GtkCMCList *clist, 682 gint row, 683 gpointer data, 684 GDestroyNotify destroy); 685 686 /* returns the data set for a row */ 687 gpointer gtk_cmclist_get_row_data (GtkCMCList *clist, 688 gint row); 689 690 /* givin a data pointer, find the first (and hopefully only!) 691 * row that points to that data, or -1 if none do 692 */ 693 gint gtk_cmclist_find_row_from_data (GtkCMCList *clist, 694 gpointer data); 695 696 /* force selection of a row */ 697 void gtk_cmclist_select_row (GtkCMCList *clist, 698 gint row, 699 gint column); 700 701 /* force unselection of a row */ 702 void gtk_cmclist_unselect_row (GtkCMCList *clist, 703 gint row, 704 gint column); 705 706 /* undo the last select/unselect operation */ 707 void gtk_cmclist_undo_selection (GtkCMCList *clist); 708 709 /* clear the entire list -- this is much faster than removing 710 * each item with gtk_cmclist_remove 711 */ 712 void gtk_cmclist_clear (GtkCMCList *clist); 713 714 /* return the row column corresponding to the x and y coordinates, 715 * the returned values are only valid if the x and y coordinates 716 * are respectively to a window == clist->clist_window 717 */ 718 gint gtk_cmclist_get_selection_info (GtkCMCList *clist, 719 gint x, 720 gint y, 721 gint *row, 722 gint *column); 723 724 /* in multiple or extended mode, select all rows */ 725 void gtk_cmclist_select_all (GtkCMCList *clist); 726 727 /* in all modes except browse mode, deselect all rows */ 728 void gtk_cmclist_unselect_all (GtkCMCList *clist); 729 730 /* swap the position of two rows */ 731 void gtk_cmclist_swap_rows (GtkCMCList *clist, 732 gint row1, 733 gint row2); 734 735 /* move row from source_row position to dest_row position */ 736 void gtk_cmclist_row_move (GtkCMCList *clist, 737 gint source_row, 738 gint dest_row); 739 740 /* sets a compare function different to the default */ 741 void gtk_cmclist_set_compare_func (GtkCMCList *clist, 742 GtkCMCListCompareFunc cmp_func); 743 744 /* the column to sort by */ 745 void gtk_cmclist_set_sort_column (GtkCMCList *clist, 746 gint column); 747 748 /* how to sort : ascending or descending */ 749 void gtk_cmclist_set_sort_type (GtkCMCList *clist, 750 GtkSortType sort_type); 751 752 /* sort the list with the current compare function */ 753 void gtk_cmclist_sort (GtkCMCList *clist); 754 755 /* Automatically sort upon insertion */ 756 void gtk_cmclist_set_auto_sort (GtkCMCList *clist, 757 gboolean auto_sort); 758 759 /* Private function for clist, ctree */ 760 761 PangoLayout *_gtk_cmclist_create_cell_layout (GtkCMCList *clist, 762 GtkCMCListRow *clist_row, 763 gint column); 764 765 766 G_END_DECLS 767 768 769 #endif /* __GTK_CMCLIST_H__ */ 770