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