gtkclist.h 22.2 KB
Newer Older
1 2 3 4 5
/* GTK - The GIMP Toolkit
 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball, Josh MacDonald
 * Copyright (C) 1997-1998 Jay Painter <jpaint@serv.net><jpaint@gimp.org>
 *
 * This library is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU Lesser General Public
7 8 9 10 11 12
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * 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 17 18
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
19
 */
20 21

/*
22
 * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
23 24 25 26 27
 * file for a list of people on the GTK+ Team.  See the ChangeLog
 * files for a list of changes.  These files are distributed with
 * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
 */

28 29
#ifndef GTK_DISABLE_DEPRECATED

30 31 32 33 34 35 36 37 38 39
#ifndef __GTK_CLIST_H__
#define __GTK_CLIST_H__

#include <gdk/gdk.h>
#include <gtk/gtksignal.h>
#include <gtk/gtkalignment.h>
#include <gtk/gtklabel.h>
#include <gtk/gtkbutton.h>
#include <gtk/gtkhscrollbar.h>
#include <gtk/gtkvscrollbar.h>
40
#include <gtk/gtkenums.h>
41

42 43 44

G_BEGIN_DECLS

45 46

/* clist flags */
47
enum {
48 49 50
  GTK_CLIST_IN_DRAG             = 1 <<  0,
  GTK_CLIST_ROW_HEIGHT_SET      = 1 <<  1,
  GTK_CLIST_SHOW_TITLES         = 1 <<  2,
51
  /* Unused */
52 53 54 55 56 57 58
  GTK_CLIST_ADD_MODE            = 1 <<  4,
  GTK_CLIST_AUTO_SORT           = 1 <<  5,
  GTK_CLIST_AUTO_RESIZE_BLOCKED = 1 <<  6,
  GTK_CLIST_REORDERABLE         = 1 <<  7,
  GTK_CLIST_USE_DRAG_ICONS      = 1 <<  8,
  GTK_CLIST_DRAW_DRAG_LINE      = 1 <<  9,
  GTK_CLIST_DRAW_DRAG_RECT      = 1 << 10
59 60 61 62 63 64 65 66 67 68 69 70
}; 

/* cell types */
typedef enum
{
  GTK_CELL_EMPTY,
  GTK_CELL_TEXT,
  GTK_CELL_PIXMAP,
  GTK_CELL_PIXTEXT,
  GTK_CELL_WIDGET
} GtkCellType;

71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
typedef enum
{
  GTK_CLIST_DRAG_NONE,
  GTK_CLIST_DRAG_BEFORE,
  GTK_CLIST_DRAG_INTO,
  GTK_CLIST_DRAG_AFTER
} GtkCListDragPos;

typedef enum
{
  GTK_BUTTON_IGNORED = 0,
  GTK_BUTTON_SELECTS = 1 << 0,
  GTK_BUTTON_DRAGS   = 1 << 1,
  GTK_BUTTON_EXPANDS = 1 << 2
} GtkButtonAction;

87 88 89 90 91
#define GTK_TYPE_CLIST            (gtk_clist_get_type ())
#define GTK_CLIST(obj)            (GTK_CHECK_CAST ((obj), GTK_TYPE_CLIST, GtkCList))
#define GTK_CLIST_CLASS(klass)    (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_CLIST, GtkCListClass))
#define GTK_IS_CLIST(obj)         (GTK_CHECK_TYPE ((obj), GTK_TYPE_CLIST))
#define GTK_IS_CLIST_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CLIST))
Tim Janik's avatar
Tim Janik committed
92 93
#define GTK_CLIST_GET_CLASS(obj)  (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_CLIST, GtkCListClass))

94

95 96 97
#define GTK_CLIST_FLAGS(clist)             (GTK_CLIST (clist)->flags)
#define GTK_CLIST_SET_FLAG(clist,flag)     (GTK_CLIST_FLAGS (clist) |= (GTK_ ## flag))
#define GTK_CLIST_UNSET_FLAG(clist,flag)   (GTK_CLIST_FLAGS (clist) &= ~(GTK_ ## flag))
98

99 100 101
#define GTK_CLIST_IN_DRAG(clist)           (GTK_CLIST_FLAGS (clist) & GTK_CLIST_IN_DRAG)
#define GTK_CLIST_ROW_HEIGHT_SET(clist)    (GTK_CLIST_FLAGS (clist) & GTK_CLIST_ROW_HEIGHT_SET)
#define GTK_CLIST_SHOW_TITLES(clist)       (GTK_CLIST_FLAGS (clist) & GTK_CLIST_SHOW_TITLES)
102
#define GTK_CLIST_ADD_MODE(clist)          (GTK_CLIST_FLAGS (clist) & GTK_CLIST_ADD_MODE)
Stefan Jeske's avatar
Stefan Jeske committed
103
#define GTK_CLIST_AUTO_SORT(clist)         (GTK_CLIST_FLAGS (clist) & GTK_CLIST_AUTO_SORT)
104
#define GTK_CLIST_AUTO_RESIZE_BLOCKED(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_AUTO_RESIZE_BLOCKED)
105 106 107 108
#define GTK_CLIST_REORDERABLE(clist)       (GTK_CLIST_FLAGS (clist) & GTK_CLIST_REORDERABLE)
#define GTK_CLIST_USE_DRAG_ICONS(clist)    (GTK_CLIST_FLAGS (clist) & GTK_CLIST_USE_DRAG_ICONS)
#define GTK_CLIST_DRAW_DRAG_LINE(clist)    (GTK_CLIST_FLAGS (clist) & GTK_CLIST_DRAW_DRAG_LINE)
#define GTK_CLIST_DRAW_DRAG_RECT(clist)    (GTK_CLIST_FLAGS (clist) & GTK_CLIST_DRAW_DRAG_RECT)
109 110

#define GTK_CLIST_ROW(_glist_) ((GtkCListRow *)((_glist_)->data))
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128

/* pointer casting for cells */
#define GTK_CELL_TEXT(cell)     (((GtkCellText *) &(cell)))
#define GTK_CELL_PIXMAP(cell)   (((GtkCellPixmap *) &(cell)))
#define GTK_CELL_PIXTEXT(cell)  (((GtkCellPixText *) &(cell)))
#define GTK_CELL_WIDGET(cell)   (((GtkCellWidget *) &(cell)))

typedef struct _GtkCList GtkCList;
typedef struct _GtkCListClass GtkCListClass;
typedef struct _GtkCListColumn GtkCListColumn;
typedef struct _GtkCListRow GtkCListRow;

typedef struct _GtkCell GtkCell;
typedef struct _GtkCellText GtkCellText;
typedef struct _GtkCellPixmap GtkCellPixmap;
typedef struct _GtkCellPixText GtkCellPixText;
typedef struct _GtkCellWidget GtkCellWidget;

Stefan Jeske's avatar
Stefan Jeske committed
129 130 131 132
typedef gint (*GtkCListCompareFunc) (GtkCList     *clist,
				     gconstpointer ptr1,
				     gconstpointer ptr2);

133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
typedef struct _GtkCListCellInfo GtkCListCellInfo;
typedef struct _GtkCListDestInfo GtkCListDestInfo;

struct _GtkCListCellInfo
{
  gint row;
  gint column;
};

struct _GtkCListDestInfo
{
  GtkCListCellInfo cell;
  GtkCListDragPos  insert_pos;
};

148 149 150 151
struct _GtkCList
{
  GtkContainer container;
  
152
  guint16 flags;
Tim Janik's avatar
Tim Janik committed
153
  
154 155
  gpointer reserved1;
  gpointer reserved2;
156 157

  guint freeze_count;
Tim Janik's avatar
Tim Janik committed
158
  
159 160 161
  /* allocation rectangle after the conatiner_border_width
   * and the width of the shadow border */
  GdkRectangle internal_allocation;
Tim Janik's avatar
Tim Janik committed
162
  
163 164 165 166 167 168 169 170 171 172 173 174 175 176
  /* rows */
  gint rows;
  gint row_height;
  GList *row_list;
  GList *row_list_end;
  
  /* columns */
  gint columns;
  GdkRectangle column_title_area;
  GdkWindow *title_window;
  
  /* dynamicly allocated array of column structures */
  GtkCListColumn *column;
  
177
  /* the scrolling window and its height and width to
178 179 180 181 182 183 184 185 186 187 188 189 190 191
   * make things a little speedier */
  GdkWindow *clist_window;
  gint clist_window_width;
  gint clist_window_height;
  
  /* offsets for scrolling */
  gint hoffset;
  gint voffset;
  
  /* border shadow style */
  GtkShadowType shadow_type;
  
  /* the list's selection mode (gtkenums.h) */
  GtkSelectionMode selection_mode;
Tim Janik's avatar
Tim Janik committed
192
  
193 194
  /* list of selected rows */
  GList *selection;
195
  GList *selection_end;
Tim Janik's avatar
Tim Janik committed
196
  
197 198 199
  GList *undo_selection;
  GList *undo_unselection;
  gint undo_anchor;
Tim Janik's avatar
Tim Janik committed
200
  
201 202 203 204 205 206 207 208
  /* mouse buttons */
  guint8 button_actions[5];

  guint8 drag_button;

  /* dnd */
  GtkCListCellInfo click_cell;

209
  /* scroll adjustments */
210 211
  GtkAdjustment *hadjustment;
  GtkAdjustment *vadjustment;
Tim Janik's avatar
Tim Janik committed
212
  
213
  /* xor GC for the vertical drag line */
214
  GdkGC *xor_gc;
Tim Janik's avatar
Tim Janik committed
215
  
216 217 218
  /* gc for drawing unselected cells */
  GdkGC *fg_gc;
  GdkGC *bg_gc;
Tim Janik's avatar
Tim Janik committed
219
  
220 221
  /* cursor used to indicate dragging */
  GdkCursor *cursor_drag;
Tim Janik's avatar
Tim Janik committed
222
  
223 224
  /* the current x-pixel location of the xor-drag line */
  gint x_drag;
Tim Janik's avatar
Tim Janik committed
225
  
226 227
  /* focus handling */
  gint focus_row;
228 229

  gint focus_header_column;
Tim Janik's avatar
Tim Janik committed
230
  
231 232 233 234 235 236
  /* dragging the selection */
  gint anchor;
  GtkStateType anchor_state;
  gint drag_pos;
  gint htimer;
  gint vtimer;
Tim Janik's avatar
Tim Janik committed
237
  
Stefan Jeske's avatar
Stefan Jeske committed
238 239 240
  GtkSortType sort_type;
  GtkCListCompareFunc compare;
  gint sort_column;
241 242 243

  gint drag_highlight_row;
  GtkCListDragPos drag_highlight_pos;
244 245 246 247 248 249
};

struct _GtkCListClass
{
  GtkContainerClass parent_class;
  
250 251 252
  void  (*set_scroll_adjustments) (GtkCList       *clist,
				   GtkAdjustment  *hadjustment,
				   GtkAdjustment  *vadjustment);
253
  void   (*refresh)             (GtkCList       *clist);
254 255 256 257 258 259 260 261
  void   (*select_row)          (GtkCList       *clist,
				 gint            row,
				 gint            column,
				 GdkEvent       *event);
  void   (*unselect_row)        (GtkCList       *clist,
				 gint            row,
				 gint            column,
				 GdkEvent       *event);
262 263 264
  void   (*row_move)            (GtkCList       *clist,
				 gint            source_row,
				 gint            dest_row);
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296
  void   (*click_column)        (GtkCList       *clist,
				 gint            column);
  void   (*resize_column)       (GtkCList       *clist,
				 gint            column,
                                 gint            width);
  void   (*toggle_focus_row)    (GtkCList       *clist);
  void   (*select_all)          (GtkCList       *clist);
  void   (*unselect_all)        (GtkCList       *clist);
  void   (*undo_selection)      (GtkCList       *clist);
  void   (*start_selection)     (GtkCList       *clist);
  void   (*end_selection)       (GtkCList       *clist);
  void   (*extend_selection)    (GtkCList       *clist,
				 GtkScrollType   scroll_type,
				 gfloat          position,
				 gboolean        auto_start_selection);
  void   (*scroll_horizontal)   (GtkCList       *clist,
				 GtkScrollType   scroll_type,
				 gfloat          position);
  void   (*scroll_vertical)     (GtkCList       *clist,
				 GtkScrollType   scroll_type,
				 gfloat          position);
  void   (*toggle_add_mode)     (GtkCList       *clist);
  void   (*abort_column_resize) (GtkCList       *clist);
  void   (*resync_selection)    (GtkCList       *clist,
				 GdkEvent       *event);
  GList* (*selection_find)      (GtkCList       *clist,
				 gint            row_number,
				 GList          *row_list_element);
  void   (*draw_row)            (GtkCList       *clist,
				 GdkRectangle   *area,
				 gint            row,
				 GtkCListRow    *clist_row);
297 298 299 300
  void   (*draw_drag_highlight) (GtkCList        *clist,
				 GtkCListRow     *target_row,
				 gint             target_row_number,
				 GtkCListDragPos  drag_pos);
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321
  void   (*clear)               (GtkCList       *clist);
  void   (*fake_unselect_all)   (GtkCList       *clist,
				 gint            row);
  void   (*sort_list)           (GtkCList       *clist);
  gint   (*insert_row)          (GtkCList       *clist,
				 gint            row,
				 gchar          *text[]);
  void   (*remove_row)          (GtkCList       *clist,
				 gint            row);
  void   (*set_cell_contents)   (GtkCList       *clist,
				 GtkCListRow    *clist_row,
				 gint            column,
				 GtkCellType     type,
				 const gchar    *text,
				 guint8          spacing,
				 GdkPixmap      *pixmap,
				 GdkBitmap      *mask);
  void   (*cell_size_request)   (GtkCList       *clist,
				 GtkCListRow    *clist_row,
				 gint            column,
				 GtkRequisition *requisition);
322

323 324 325 326 327 328 329 330
};

struct _GtkCListColumn
{
  gchar *title;
  GdkRectangle area;
  
  GtkWidget *button;
331
  GdkWindow *window;
Tim Janik's avatar
Tim Janik committed
332
  
333
  gint width;
334 335
  gint min_width;
  gint max_width;
336
  GtkJustification justification;
Tim Janik's avatar
Tim Janik committed
337
  
338 339 340 341 342
  guint visible        : 1;  
  guint width_set      : 1;
  guint resizeable     : 1;
  guint auto_resize    : 1;
  guint button_passive : 1;
343 344 345 346 347 348
};

struct _GtkCListRow
{
  GtkCell *cell;
  GtkStateType state;
Tim Janik's avatar
Tim Janik committed
349
  
350 351
  GdkColor foreground;
  GdkColor background;
Tim Janik's avatar
Tim Janik committed
352
  
353 354
  GtkStyle *style;

355
  gpointer data;
356
  GtkDestroyNotify destroy;
Tim Janik's avatar
Tim Janik committed
357
  
358 359 360
  guint fg_set     : 1;
  guint bg_set     : 1;
  guint selectable : 1;
361 362 363 364 365 366 367
};

/* Cell Structures */
struct _GtkCellText
{
  GtkCellType type;
  
368 369
  gint16 vertical;
  gint16 horizontal;
370
  
371 372
  GtkStyle *style;

373 374 375 376 377 378 379
  gchar *text;
};

struct _GtkCellPixmap
{
  GtkCellType type;
  
380 381
  gint16 vertical;
  gint16 horizontal;
382
  
383 384
  GtkStyle *style;

385 386 387 388 389 390 391 392
  GdkPixmap *pixmap;
  GdkBitmap *mask;
};

struct _GtkCellPixText
{
  GtkCellType type;
  
393 394
  gint16 vertical;
  gint16 horizontal;
395
  
396 397
  GtkStyle *style;

398 399 400 401 402 403 404 405 406 407
  gchar *text;
  guint8 spacing;
  GdkPixmap *pixmap;
  GdkBitmap *mask;
};

struct _GtkCellWidget
{
  GtkCellType type;
  
408 409
  gint16 vertical;
  gint16 horizontal;
410
  
411 412
  GtkStyle *style;

413 414 415 416 417 418
  GtkWidget *widget;
};

struct _GtkCell
{
  GtkCellType type;
Tim Janik's avatar
Tim Janik committed
419
  
420 421
  gint16 vertical;
  gint16 horizontal;
Tim Janik's avatar
Tim Janik committed
422
  
423 424
  GtkStyle *style;

425 426
  union {
    gchar *text;
Tim Janik's avatar
Tim Janik committed
427
    
428 429 430 431
    struct {
      GdkPixmap *pixmap;
      GdkBitmap *mask;
    } pm;
Tim Janik's avatar
Tim Janik committed
432
    
433 434 435 436 437 438
    struct {
      gchar *text;
      guint8 spacing;
      GdkPixmap *pixmap;
      GdkBitmap *mask;
    } pt;
Tim Janik's avatar
Tim Janik committed
439
    
440 441 442 443
    GtkWidget *widget;
  } u;
};

Elliot Lee's avatar
Elliot Lee committed
444
GtkType gtk_clist_get_type (void) G_GNUC_CONST;
445 446

/* create a new GtkCList */
447 448
GtkWidget* gtk_clist_new             (gint   columns);
GtkWidget* gtk_clist_new_with_titles (gint   columns,
449
				      gchar *titles[]);
450

451 452 453 454 455 456 457 458 459
/* set adjustments of clist */
void gtk_clist_set_hadjustment (GtkCList      *clist,
				GtkAdjustment *adjustment);
void gtk_clist_set_vadjustment (GtkCList      *clist,
				GtkAdjustment *adjustment);

/* get adjustments of clist */
GtkAdjustment* gtk_clist_get_hadjustment (GtkCList *clist);
GtkAdjustment* gtk_clist_get_vadjustment (GtkCList *clist);
460

461 462 463 464
/* set the border style of the clist */
void gtk_clist_set_shadow_type (GtkCList      *clist,
				GtkShadowType  type);

465
/* set the clist's selection mode */
466 467
void gtk_clist_set_selection_mode (GtkCList         *clist,
				   GtkSelectionMode  mode);
468

469 470 471 472 473 474 475 476 477
/* enable clists reorder ability */
void gtk_clist_set_reorderable (GtkCList *clist,
				gboolean  reorderable);
void gtk_clist_set_use_drag_icons (GtkCList *clist,
				   gboolean  use_icons);
void gtk_clist_set_button_actions (GtkCList *clist,
				   guint     button,
				   guint8    button_actions);

478 479 480
/* freeze all visual updates of the list, and then thaw the list after
 * you have made a number of changes and the updates wil occure in a
 * more efficent mannor than if you made them on a unfrozen list
Tim Janik's avatar
Tim Janik committed
481 482 483
 */
void gtk_clist_freeze (GtkCList *clist);
void gtk_clist_thaw   (GtkCList *clist);
484

485
/* show and hide the column title buttons */
Tim Janik's avatar
Tim Janik committed
486 487
void gtk_clist_column_titles_show (GtkCList *clist);
void gtk_clist_column_titles_hide (GtkCList *clist);
488

Jay Painter's avatar
Jay Painter committed
489 490
/* set the column title to be a active title (responds to button presses, 
 * prelights, and grabs keyboard focus), or passive where it acts as just
Tim Janik's avatar
Tim Janik committed
491 492 493 494 495 496 497 498
 * a title
 */
void gtk_clist_column_title_active   (GtkCList *clist,
				      gint      column);
void gtk_clist_column_title_passive  (GtkCList *clist,
				      gint      column);
void gtk_clist_column_titles_active  (GtkCList *clist);
void gtk_clist_column_titles_passive (GtkCList *clist);
Jay Painter's avatar
Jay Painter committed
499

500
/* set the title in the column title button */
Tim Janik's avatar
Tim Janik committed
501 502 503
void gtk_clist_set_column_title (GtkCList    *clist,
				 gint         column,
				 const gchar *title);
504

505 506 507 508
/* returns the title of column. Returns NULL if title is not set */
gchar * gtk_clist_get_column_title (GtkCList *clist,
				    gint      column);

509
/* set a widget instead of a title for the column title button */
Tim Janik's avatar
Tim Janik committed
510 511 512
void gtk_clist_set_column_widget (GtkCList  *clist,
				  gint       column,
				  GtkWidget *widget);
513

514 515 516 517
/* returns the column widget */
GtkWidget * gtk_clist_get_column_widget (GtkCList *clist,
					 gint      column);

518
/* set the justification on a column */
519 520 521 522 523 524 525 526 527 528 529 530 531
void gtk_clist_set_column_justification (GtkCList         *clist,
					 gint              column,
					 GtkJustification  justification);

/* set visibility of a column */
void gtk_clist_set_column_visibility (GtkCList *clist,
				      gint      column,
				      gboolean  visible);

/* enable/disable column resize operations by mouse */
void gtk_clist_set_column_resizeable (GtkCList *clist,
				      gint      column,
				      gboolean  resizeable);
532

533 534 535 536 537
/* resize column automatically to its optimal width */
void gtk_clist_set_column_auto_resize (GtkCList *clist,
				       gint      column,
				       gboolean  auto_resize);

538 539
gint gtk_clist_columns_autosize (GtkCList *clist);

540 541 542 543
/* return the optimal column width, i.e. maximum of all cell widths */
gint gtk_clist_optimal_column_width (GtkCList *clist,
				     gint      column);

544 545
/* set the pixel width of a column; this is a necessary step in
 * creating a CList because otherwise the column width is chozen from
Tim Janik's avatar
Tim Janik committed
546 547 548 549 550
 * the width of the column title, which will never be right
 */
void gtk_clist_set_column_width (GtkCList *clist,
				 gint      column,
				 gint      width);
551

552 553 554 555 556 557 558 559
/* set column minimum/maximum width. min/max_width < 0 => no restriction */
void gtk_clist_set_column_min_width (GtkCList *clist,
				     gint      column,
				     gint      min_width);
void gtk_clist_set_column_max_width (GtkCList *clist,
				     gint      column,
				     gint      max_width);

560 561
/* change the height of the rows, the default (height=0) is
 * the hight of the current font.
Tim Janik's avatar
Tim Janik committed
562 563
 */
void gtk_clist_set_row_height (GtkCList *clist,
564
			       guint     height);
565

566 567 568 569
/* scroll the viewing area of the list to the given column and row;
 * row_align and col_align are between 0-1 representing the location the
 * row should appear on the screnn, 0.0 being top or left, 1.0 being
 * bottom or right; if row or column is -1 then then there is no change
Tim Janik's avatar
Tim Janik committed
570 571 572 573 574 575
 */
void gtk_clist_moveto (GtkCList *clist,
		       gint      row,
		       gint      column,
		       gfloat    row_align,
		       gfloat    col_align);
576

577
/* returns whether the row is visible */
Tim Janik's avatar
Tim Janik committed
578 579
GtkVisibility gtk_clist_row_is_visible (GtkCList *clist,
					gint      row);
580

581
/* returns the cell type */
Tim Janik's avatar
Tim Janik committed
582 583 584
GtkCellType gtk_clist_get_cell_type (GtkCList *clist,
				     gint      row,
				     gint      column);
585

586
/* sets a given cell's text, replacing its current contents */
Tim Janik's avatar
Tim Janik committed
587 588 589 590
void gtk_clist_set_text (GtkCList    *clist,
			 gint         row,
			 gint         column,
			 const gchar *text);
591

592
/* for the "get" functions, any of the return pointer can be
Tim Janik's avatar
Tim Janik committed
593 594
 * NULL if you are not interested
 */
595 596 597 598
gint gtk_clist_get_text (GtkCList  *clist,
			 gint       row,
			 gint       column,
			 gchar    **text);
599

600
/* sets a given cell's pixmap, replacing its current contents */
Tim Janik's avatar
Tim Janik committed
601 602 603 604 605 606 607 608 609 610 611
void gtk_clist_set_pixmap (GtkCList  *clist,
			   gint       row,
			   gint       column,
			   GdkPixmap *pixmap,
			   GdkBitmap *mask);

gint gtk_clist_get_pixmap (GtkCList   *clist,
			   gint        row,
			   gint        column,
			   GdkPixmap **pixmap,
			   GdkBitmap **mask);
612

613
/* sets a given cell's pixmap and text, replacing its current contents */
Tim Janik's avatar
Tim Janik committed
614 615 616 617 618 619 620 621
void gtk_clist_set_pixtext (GtkCList    *clist,
			    gint         row,
			    gint         column,
			    const gchar *text,
			    guint8       spacing,
			    GdkPixmap   *pixmap,
			    GdkBitmap   *mask);

622 623 624 625 626 627 628
gint gtk_clist_get_pixtext (GtkCList   *clist,
			    gint        row,
			    gint        column,
			    gchar     **text,
			    guint8     *spacing,
			    GdkPixmap **pixmap,
			    GdkBitmap **mask);
629

630
/* sets the foreground color of a row, the color must already
Tim Janik's avatar
Tim Janik committed
631 632
 * be allocated
 */
633 634 635
void gtk_clist_set_foreground (GtkCList       *clist,
			       gint            row,
			       const GdkColor *color);
636

637
/* sets the background color of a row, the color must already
Tim Janik's avatar
Tim Janik committed
638 639
 * be allocated
 */
640 641 642
void gtk_clist_set_background (GtkCList       *clist,
			       gint            row,
			       const GdkColor *color);
643

644 645
/* set / get cell styles */
void gtk_clist_set_cell_style (GtkCList *clist,
646 647
			       gint      row,
			       gint      column,
648 649 650
			       GtkStyle *style);

GtkStyle *gtk_clist_get_cell_style (GtkCList *clist,
651 652
				    gint      row,
				    gint      column);
653 654

void gtk_clist_set_row_style (GtkCList *clist,
655
			      gint      row,
656 657 658
			      GtkStyle *style);

GtkStyle *gtk_clist_get_row_style (GtkCList *clist,
659
				   gint      row);
660

661
/* this sets a horizontal and vertical shift for drawing
662 663
 * the contents of a cell; it can be positive or negitive;
 * this is particulary useful for indenting items in a column
Tim Janik's avatar
Tim Janik committed
664 665 666 667 668 669
 */
void gtk_clist_set_shift (GtkCList *clist,
			  gint      row,
			  gint      column,
			  gint      vertical,
			  gint      horizontal);
670

671 672 673 674 675 676 677
/* set/get selectable flag of a single row */
void gtk_clist_set_selectable (GtkCList *clist,
			       gint      row,
			       gboolean  selectable);
gboolean gtk_clist_get_selectable (GtkCList *clist,
				   gint      row);

678 679
/* prepend/append returns the index of the row you just added,
 * making it easier to append and modify a row
Tim Janik's avatar
Tim Janik committed
680
 */
681
gint gtk_clist_prepend (GtkCList    *clist,
682
		        gchar       *text[]);
683
gint gtk_clist_append  (GtkCList    *clist,
684
			gchar       *text[]);
685

686 687
/* inserts a row at index row and returns the row where it was
 * actually inserted (may be different from "row" in auto_sort mode)
Tim Janik's avatar
Tim Janik committed
688
 */
689 690
gint gtk_clist_insert (GtkCList    *clist,
		       gint         row,
691
		       gchar       *text[]);
692 693

/* removes row at index row */
Tim Janik's avatar
Tim Janik committed
694 695
void gtk_clist_remove (GtkCList *clist,
		       gint      row);
696 697

/* sets a arbitrary data pointer for a given row */
Tim Janik's avatar
Tim Janik committed
698 699 700
void gtk_clist_set_row_data (GtkCList *clist,
			     gint      row,
			     gpointer  data);
701

702
/* sets a data pointer for a given row with destroy notification */
703 704 705 706
void gtk_clist_set_row_data_full (GtkCList         *clist,
			          gint              row,
			          gpointer          data,
				  GtkDestroyNotify  destroy);
707

708
/* returns the data set for a row */
Tim Janik's avatar
Tim Janik committed
709 710
gpointer gtk_clist_get_row_data (GtkCList *clist,
				 gint      row);
711

712
/* givin a data pointer, find the first (and hopefully only!)
Tim Janik's avatar
Tim Janik committed
713 714 715 716
 * row that points to that data, or -1 if none do
 */
gint gtk_clist_find_row_from_data (GtkCList *clist,
				   gpointer  data);
717

718
/* force selection of a row */
Tim Janik's avatar
Tim Janik committed
719 720 721
void gtk_clist_select_row (GtkCList *clist,
			   gint      row,
			   gint      column);
722 723

/* force unselection of a row */
Tim Janik's avatar
Tim Janik committed
724 725 726
void gtk_clist_unselect_row (GtkCList *clist,
			     gint      row,
			     gint      column);
727

728 729 730
/* undo the last select/unselect operation */
void gtk_clist_undo_selection (GtkCList *clist);

731 732
/* clear the entire list -- this is much faster than removing
 * each item with gtk_clist_remove
Tim Janik's avatar
Tim Janik committed
733 734
 */
void gtk_clist_clear (GtkCList *clist);
735

Tim Janik's avatar
Tim Janik committed
736 737 738 739
/* return the row column corresponding to the x and y coordinates,
 * the returned values are only valid if the x and y coordinates
 * are respectively to a window == clist->clist_window
 */
Tim Janik's avatar
Tim Janik committed
740 741 742 743 744
gint gtk_clist_get_selection_info (GtkCList *clist,
			     	   gint      x,
			     	   gint      y,
			     	   gint     *row,
			     	   gint     *column);
745

746 747
/* in multiple or extended mode, select all rows */
void gtk_clist_select_all (GtkCList *clist);
748

749 750
/* in all modes except browse mode, deselect all rows */
void gtk_clist_unselect_all (GtkCList *clist);
751

752
/* swap the position of two rows */
Tim Janik's avatar
Tim Janik committed
753 754 755
void gtk_clist_swap_rows (GtkCList *clist,
			  gint      row1,
			  gint      row2);
756

757 758 759 760 761
/* move row from source_row position to dest_row position */
void gtk_clist_row_move (GtkCList *clist,
			 gint      source_row,
			 gint      dest_row);

Stefan Jeske's avatar
Stefan Jeske committed
762 763 764 765 766 767 768 769 770
/* sets a compare function different to the default */
void gtk_clist_set_compare_func (GtkCList            *clist,
				 GtkCListCompareFunc  cmp_func);

/* the column to sort by */
void gtk_clist_set_sort_column (GtkCList *clist,
				gint      column);

/* how to sort : ascending or descending */
771 772
void gtk_clist_set_sort_type (GtkCList    *clist,
			      GtkSortType  sort_type);
Stefan Jeske's avatar
Stefan Jeske committed
773 774 775 776 777 778 779 780

/* sort the list with the current compare function */
void gtk_clist_sort (GtkCList *clist);

/* Automatically sort upon insertion */
void gtk_clist_set_auto_sort (GtkCList *clist,
			      gboolean  auto_sort);

781 782 783 784 785
/* Private function for clist, ctree */

PangoLayout *_gtk_clist_create_cell_layout (GtkCList       *clist,
					    GtkCListRow    *clist_row,
					    gint            column);
786

787 788 789

G_END_DECLS

790 791

#endif				/* __GTK_CLIST_H__ */
792 793

#endif /* GTK_DISABLE_DEPRECATED */