📄 gtkclist.h
字号:
/* 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 * modify it under the terms of the GNU Lesser General Public * 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. *//* * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS * 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/. */#if !defined (GTK_DISABLE_DEPRECATED) || defined (__GTK_CLIST_C__) || defined (__GTK_CTREE_C__)#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>#include <gtk/gtkenums.h>G_BEGIN_DECLS/* clist flags */enum { GTK_CLIST_IN_DRAG = 1 << 0, GTK_CLIST_ROW_HEIGHT_SET = 1 << 1, GTK_CLIST_SHOW_TITLES = 1 << 2, /* Unused */ 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};/* cell types */typedef enum{ GTK_CELL_EMPTY, GTK_CELL_TEXT, GTK_CELL_PIXMAP, GTK_CELL_PIXTEXT, GTK_CELL_WIDGET} GtkCellType;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;#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))#define GTK_CLIST_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_CLIST, GtkCListClass))#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))#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)#define GTK_CLIST_ADD_MODE(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_ADD_MODE)#define GTK_CLIST_AUTO_SORT(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_AUTO_SORT)#define GTK_CLIST_AUTO_RESIZE_BLOCKED(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_AUTO_RESIZE_BLOCKED)#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)#define GTK_CLIST_ROW(_glist_) ((GtkCListRow *)((_glist_)->data))/* 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;typedef gint (*GtkCListCompareFunc) (GtkCList *clist, gconstpointer ptr1, gconstpointer ptr2);typedef struct _GtkCListCellInfo GtkCListCellInfo;typedef struct _GtkCListDestInfo GtkCListDestInfo;struct _GtkCListCellInfo{ gint row; gint column;};struct _GtkCListDestInfo{ GtkCListCellInfo cell; GtkCListDragPos insert_pos;};struct _GtkCList{ GtkContainer container; guint16 flags; gpointer reserved1; gpointer reserved2; guint freeze_count; /* allocation rectangle after the container_border_width * and the width of the shadow border */ GdkRectangle internal_allocation; /* 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; /* the scrolling window and its height and width to * 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; /* list of selected rows */ GList *selection; GList *selection_end; GList *undo_selection; GList *undo_unselection; gint undo_anchor; /* mouse buttons */ guint8 button_actions[5]; guint8 drag_button; /* dnd */ GtkCListCellInfo click_cell; /* scroll adjustments */ GtkAdjustment *hadjustment; GtkAdjustment *vadjustment; /* xor GC for the vertical drag line */ GdkGC *xor_gc; /* gc for drawing unselected cells */ GdkGC *fg_gc; GdkGC *bg_gc; /* cursor used to indicate dragging */ GdkCursor *cursor_drag; /* the current x-pixel location of the xor-drag line */ gint x_drag; /* focus handling */ gint focus_row; gint focus_header_column; /* dragging the selection */ gint anchor; GtkStateType anchor_state; gint drag_pos; gint htimer; gint vtimer; GtkSortType sort_type; GtkCListCompareFunc compare; gint sort_column; gint drag_highlight_row; GtkCListDragPos drag_highlight_pos;};struct _GtkCListClass{ GtkContainerClass parent_class; void (*set_scroll_adjustments) (GtkCList *clist, GtkAdjustment *hadjustment, GtkAdjustment *vadjustment); void (*refresh) (GtkCList *clist); void (*select_row) (GtkCList *clist, gint row, gint column, GdkEvent *event); void (*unselect_row) (GtkCList *clist, gint row, gint column, GdkEvent *event); void (*row_move) (GtkCList *clist, gint source_row, gint dest_row); 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); void (*draw_drag_highlight) (GtkCList *clist, GtkCListRow *target_row, gint target_row_number, GtkCListDragPos drag_pos); 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);};struct _GtkCListColumn{ gchar *title; GdkRectangle area; GtkWidget *button; GdkWindow *window; gint width; gint min_width; gint max_width; GtkJustification justification; guint visible : 1; guint width_set : 1; guint resizeable : 1; guint auto_resize : 1; guint button_passive : 1;};struct _GtkCListRow{ GtkCell *cell; GtkStateType state; GdkColor foreground; GdkColor background; GtkStyle *style; gpointer data; GDestroyNotify destroy; guint fg_set : 1; guint bg_set : 1; guint selectable : 1;};/* Cell Structures */struct _GtkCellText{ GtkCellType type; gint16 vertical; gint16 horizontal; GtkStyle *style; gchar *text;};struct _GtkCellPixmap{ GtkCellType type; gint16 vertical; gint16 horizontal; GtkStyle *style; GdkPixmap *pixmap; GdkBitmap *mask;};struct _GtkCellPixText{ GtkCellType type; gint16 vertical; gint16 horizontal; GtkStyle *style; gchar *text;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -