medit/moo/mooutils/moohistorylist.h

115 lines
4.9 KiB
C

/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4; coding: utf-8 -*-
*
* moohistorylist.h
*
* Copyright (C) 2004-2005 by Yevgen Muntyan <muntyan@math.tamu.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* See COPYING file that comes with this distribution.
*/
#ifndef __MOO_HISTORY_LIST_H__
#define __MOO_HISTORY_LIST_H__
#include <gtk/gtktreemodel.h>
#include <mooutils/moomenumgr.h>
G_BEGIN_DECLS
#define MOO_TYPE_HISTORY_LIST_ITEM (moo_history_list_item_get_type ())
#define MOO_TYPE_HISTORY_LIST (moo_history_list_get_type ())
#define MOO_HISTORY_LIST(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), MOO_TYPE_HISTORY_LIST, MooHistoryList))
#define MOO_HISTORY_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOO_TYPE_HISTORY_LIST, MooHistoryListClass))
#define MOO_IS_HISTORY_LIST(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), MOO_TYPE_HISTORY_LIST))
#define MOO_IS_HISTORY_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_HISTORY_LIST))
#define MOO_HISTORY_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_HISTORY_LIST, MooHistoryListClass))
typedef struct _MooHistoryListItem MooHistoryListItem;
typedef struct _MooHistoryList MooHistoryList;
typedef struct _MooHistoryListPrivate MooHistoryListPrivate;
typedef struct _MooHistoryListClass MooHistoryListClass;
typedef char *(*MooHistoryDisplayFunc) (const char *item,
gpointer data);
typedef gboolean (*MooHistoryCompareFunc) (const char *text,
MooHistoryListItem *item,
gpointer data);
struct _MooHistoryListItem
{
char *data;
char *display;
guint builtin : 1;
};
struct _MooHistoryList
{
GObject parent;
MooHistoryListPrivate *priv;
};
struct _MooHistoryListClass
{
GObjectClass parent_class;
void (*activate_item) (MooHistoryList *list,
MooHistoryListItem *item,
gpointer menu_data);
void (*changed) (MooHistoryList *list);
};
GType moo_history_list_get_type (void) G_GNUC_CONST;
GType moo_history_list_item_get_type (void) G_GNUC_CONST;
MooHistoryList *moo_history_list_new (const char *user_id);
GtkTreeModel *moo_history_list_get_model (MooHistoryList *list);
void moo_history_list_add (MooHistoryList *list,
const char *item);
void moo_history_list_add_filename (MooHistoryList *list,
const char *filename);
void moo_history_list_add_full (MooHistoryList *list,
const char *item,
const char *display_item);
void moo_history_list_set_display_func (MooHistoryList *list,
MooHistoryDisplayFunc func,
gpointer data);
void moo_history_list_set_compare_func (MooHistoryList *list,
MooHistoryCompareFunc func,
gpointer data);
char *moo_history_list_display_basename (const char *entry,
gpointer data);
gboolean moo_history_list_is_empty (MooHistoryList *list);
guint moo_history_list_n_user_entries (MooHistoryList *list);
guint moo_history_list_get_max_entries (MooHistoryList *list);
void moo_history_list_set_max_entries (MooHistoryList *list,
guint num);
void moo_history_list_add_builtin (MooHistoryList *list,
const char *item,
const char *display_item);
MooMenuMgr *moo_history_list_get_menu_mgr (MooHistoryList *list);
MooHistoryListItem *moo_history_list_item_new (const char *data,
const char *display,
gboolean builtin);
MooHistoryListItem *moo_history_list_item_copy (const MooHistoryListItem *item);
void moo_history_list_item_free (MooHistoryListItem *item);
G_END_DECLS
#endif /* __MOO_HISTORY_LIST_H__ */