2006-05-21 18:11:05 -05:00
|
|
|
/*
|
2005-11-27 19:34:29 +00:00
|
|
|
* mootreeview.h
|
|
|
|
*
|
2010-12-21 20:15:45 -08:00
|
|
|
* Copyright (C) 2004-2010 by Yevgen Muntyan <emuntyan@users.sourceforge.net>
|
2005-11-27 19:34:29 +00:00
|
|
|
*
|
2008-09-05 17:20:50 -05:00
|
|
|
* This file is part of medit. medit 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.1 of the License,
|
|
|
|
* or (at your option) any later version.
|
2005-11-27 19:34:29 +00:00
|
|
|
*
|
2008-09-05 17:20:50 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with medit. If not, see <http://www.gnu.org/licenses/>.
|
2005-11-27 19:34:29 +00:00
|
|
|
*/
|
|
|
|
|
2007-06-10 04:06:03 -05:00
|
|
|
#ifndef MOO_TREE_VIEW_H
|
|
|
|
#define MOO_TREE_VIEW_H
|
2005-11-27 19:34:29 +00:00
|
|
|
|
2011-09-26 00:41:51 -07:00
|
|
|
#include <gtk/gtk.h>
|
2006-04-16 11:40:46 -05:00
|
|
|
#include "moofileview/mooiconview.h"
|
2005-11-27 19:34:29 +00:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
|
2006-05-13 16:09:46 -05:00
|
|
|
#define MOO_TYPE_TREE_VIEW (_moo_tree_view_get_type ())
|
2005-11-27 19:34:29 +00:00
|
|
|
#define MOO_TREE_VIEW(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), MOO_TYPE_TREE_VIEW, MooTreeView))
|
|
|
|
#define MOO_TREE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOO_TYPE_TREE_VIEW, MooTreeViewClass))
|
|
|
|
#define MOO_IS_TREE_VIEW(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), MOO_TYPE_TREE_VIEW))
|
|
|
|
#define MOO_IS_TREE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_TREE_VIEW))
|
|
|
|
#define MOO_TREE_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_TREE_VIEW, MooTreeViewClass))
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct _MooTreeView MooTreeView;
|
|
|
|
typedef struct _MooTreeViewClass MooTreeViewClass;
|
|
|
|
typedef struct _MooTreeViewChild MooTreeViewChild;
|
|
|
|
typedef struct _MooTreeViewTree MooTreeViewTree;
|
|
|
|
typedef struct _MooTreeViewIcon MooTreeViewIcon;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
MOO_TREE_VIEW_TREE,
|
|
|
|
MOO_TREE_VIEW_ICON
|
|
|
|
} MooTreeViewChildType;
|
|
|
|
|
|
|
|
struct _MooTreeViewTree
|
|
|
|
{
|
|
|
|
GtkTreeView *view;
|
|
|
|
GtkTreeSelection *selection;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _MooTreeViewIcon
|
|
|
|
{
|
|
|
|
MooIconView *view;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _MooTreeViewChild
|
|
|
|
{
|
|
|
|
MooTreeViewChildType type;
|
|
|
|
MooTreeView *parent;
|
|
|
|
GtkWidget *widget;
|
|
|
|
union {
|
|
|
|
MooTreeViewTree tree;
|
|
|
|
MooTreeViewIcon icon;
|
2006-07-08 09:59:35 -05:00
|
|
|
} u;
|
2005-11-27 19:34:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _MooTreeView
|
|
|
|
{
|
|
|
|
GObject object;
|
|
|
|
GSList *children;
|
|
|
|
MooTreeViewChild *active;
|
|
|
|
GtkTreeModel *model;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _MooTreeViewClass
|
|
|
|
{
|
|
|
|
GObjectClass object_class;
|
|
|
|
|
|
|
|
gboolean (* button_press_event) (MooTreeView *view,
|
|
|
|
GtkWidget *widget,
|
|
|
|
GdkEventButton *event);
|
|
|
|
gboolean (* key_press_event) (MooTreeView *view,
|
|
|
|
GtkWidget *widget,
|
|
|
|
GdkEventKey *event);
|
|
|
|
|
|
|
|
void (* row_activated) (MooTreeView *view,
|
|
|
|
const GtkTreePath *path);
|
|
|
|
void (* selection_changed) (MooTreeView *view);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
typedef void (*MooTreeViewForeachFunc) (GtkTreeModel *model,
|
|
|
|
GtkTreePath *path,
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
gpointer data);
|
|
|
|
|
|
|
|
|
2006-05-13 16:09:46 -05:00
|
|
|
GType _moo_tree_view_get_type (void) G_GNUC_CONST;
|
2005-11-27 19:34:29 +00:00
|
|
|
|
2006-05-13 16:09:46 -05:00
|
|
|
MooTreeView *_moo_tree_view_new (GtkTreeModel *model);
|
2005-11-27 19:34:29 +00:00
|
|
|
|
2006-05-13 16:09:46 -05:00
|
|
|
void _moo_tree_view_add (MooTreeView *view,
|
2005-11-27 19:34:29 +00:00
|
|
|
GtkWidget *real_view);
|
2006-05-13 16:09:46 -05:00
|
|
|
void _moo_tree_view_set_active (MooTreeView *view,
|
2005-11-27 19:34:29 +00:00
|
|
|
GtkWidget *real_view);
|
|
|
|
|
2006-05-13 16:09:46 -05:00
|
|
|
GtkTreeModel *_moo_tree_view_get_model (gpointer view);
|
2005-11-27 19:34:29 +00:00
|
|
|
|
2006-05-13 16:09:46 -05:00
|
|
|
gboolean _moo_tree_view_selection_is_empty (MooTreeView *view);
|
|
|
|
gboolean _moo_tree_view_path_is_selected (MooTreeView *view,
|
2005-11-27 19:34:29 +00:00
|
|
|
GtkTreePath *path);
|
2006-05-13 16:09:46 -05:00
|
|
|
void _moo_tree_view_unselect_all (MooTreeView *view);
|
|
|
|
GList *_moo_tree_view_get_selected_rows (MooTreeView *view);
|
|
|
|
GtkTreePath *_moo_tree_view_get_selected_path (MooTreeView *view);
|
|
|
|
void _moo_tree_view_selected_foreach (MooTreeView *view,
|
2005-11-27 19:34:29 +00:00
|
|
|
MooTreeViewForeachFunc func,
|
|
|
|
gpointer data);
|
|
|
|
|
|
|
|
/* window coordinates */
|
2006-05-13 16:09:46 -05:00
|
|
|
gboolean _moo_tree_view_get_path_at_pos (gpointer view,
|
2005-11-27 19:34:29 +00:00
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
GtkTreePath **path);
|
|
|
|
|
2006-05-13 16:09:46 -05:00
|
|
|
void _moo_tree_view_widget_to_abs_coords (gpointer view,
|
2005-12-05 07:41:19 +00:00
|
|
|
int wx,
|
|
|
|
int wy,
|
|
|
|
int *absx,
|
|
|
|
int *absy);
|
|
|
|
|
2006-05-13 16:09:46 -05:00
|
|
|
void _moo_tree_view_set_cursor (MooTreeView *view,
|
2005-11-27 19:34:29 +00:00
|
|
|
GtkTreePath *path,
|
|
|
|
gboolean start_editing);
|
2006-05-13 16:09:46 -05:00
|
|
|
void _moo_tree_view_scroll_to_cell (MooTreeView *view,
|
2005-11-27 19:34:29 +00:00
|
|
|
GtkTreePath *path);
|
|
|
|
|
2006-05-13 16:09:46 -05:00
|
|
|
void _moo_tree_view_set_drag_dest_row (gpointer view,
|
2005-12-05 07:41:19 +00:00
|
|
|
GtkTreePath *path);
|
2005-11-27 19:34:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
2007-06-10 04:06:03 -05:00
|
|
|
#endif /* MOO_TREE_VIEW_H */
|