medit/moo/mooedit/mooedit.h

129 lines
5.5 KiB
C
Raw Normal View History

2006-04-20 01:57:05 -07:00
/*
2005-09-06 09:21:05 -07:00
* mooedit.h
2005-06-22 11:20:32 -07:00
*
2010-11-07 01:20:45 -08:00
* Copyright (C) 2004-2010 by Yevgen Muntyan <emuntyan@sourceforge.net>
2005-06-22 11:20:32 -07: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-06-22 11:20:32 -07: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-06-22 11:20:32 -07:00
*/
#ifndef MOO_EDIT_H
#define MOO_EDIT_H
2005-06-22 11:20:32 -07:00
2010-12-08 01:11:51 -08:00
#include <mooedit/mootextview.h>
#include <mooedit/mooeditconfig.h>
2009-11-01 12:44:46 -08:00
#include <mooedit/mooedit-enums.h>
2010-11-23 21:54:39 -08:00
#include <mooedit/mooedittypes.h>
2010-12-12 02:29:20 -08:00
#include <mooedit/mooeditfileinfo.h>
#include <mooutils/mooprefs.h>
2005-06-22 11:20:32 -07:00
G_BEGIN_DECLS
2010-12-08 01:11:51 -08:00
#define MOO_TYPE_EDIT (moo_edit_get_type ())
#define MOO_EDIT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), MOO_TYPE_EDIT, MooEdit))
#define MOO_EDIT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOO_TYPE_EDIT, MooEditClass))
#define MOO_IS_EDIT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), MOO_TYPE_EDIT))
#define MOO_IS_EDIT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_EDIT))
#define MOO_EDIT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_EDIT, MooEditClass))
2005-06-22 11:20:32 -07:00
2005-09-02 16:27:25 -07:00
#define MOO_EDIT_IS_MODIFIED(edit) (moo_edit_get_status (edit) & MOO_EDIT_MODIFIED)
#define MOO_EDIT_IS_CLEAN(edit) (moo_edit_get_status (edit) & MOO_EDIT_CLEAN)
2006-06-29 22:58:35 -07:00
#define MOO_EDIT_IS_BUSY(edit) (moo_edit_get_state (edit) != MOO_EDIT_STATE_NORMAL)
2005-06-22 11:20:32 -07:00
2010-12-12 02:29:20 -08:00
typedef struct MooEditPrivate MooEditPrivate;
typedef struct MooEditClass MooEditClass;
2010-12-12 02:29:20 -08:00
struct MooEdit
2005-06-22 11:20:32 -07:00
{
2010-12-08 01:11:51 -08:00
MooTextView parent;
MooEditConfig *config;
2005-06-22 11:20:32 -07:00
MooEditPrivate *priv;
};
2010-12-12 02:29:20 -08:00
struct MooEditClass
2005-06-22 11:20:32 -07:00
{
2010-12-08 01:11:51 -08:00
MooTextViewClass parent_class;
2005-06-22 11:20:32 -07:00
/* emitted when filename, modified status, or file on disk
are changed. for use in editor to adjust title bar, etc. */
void (* doc_status_changed) (MooEdit *edit);
2005-06-22 11:20:32 -07:00
void (* filename_changed) (MooEdit *edit,
const char *new_filename);
2005-11-03 17:35:22 -08:00
void (* bookmarks_changed) (MooEdit *edit);
void (* config_notify) (MooEdit *edit,
guint var_id,
GParamSpec *pspec);
void (* save_before) (MooEdit *edit);
void (* save_after) (MooEdit *edit);
2005-06-22 11:20:32 -07:00
};
2010-12-12 02:29:20 -08:00
GType moo_edit_get_type (void) G_GNUC_CONST;
2005-06-22 11:20:32 -07:00
2010-12-12 02:29:20 -08:00
MooEditWindow *moo_edit_get_window (MooEdit *edit);
2010-11-23 21:54:39 -08:00
2010-12-12 02:29:20 -08:00
GFile *moo_edit_get_file (MooEdit *edit);
2010-11-23 21:54:39 -08:00
2010-12-12 02:29:20 -08:00
char *moo_edit_get_uri (MooEdit *edit);
2005-06-22 11:20:32 -07:00
2010-12-12 02:29:20 -08:00
char *moo_edit_get_filename (MooEdit *edit);
const char *moo_edit_get_display_name (MooEdit *edit);
const char *moo_edit_get_display_basename (MooEdit *edit);
2009-12-13 16:16:39 -08:00
2010-12-12 02:29:20 -08:00
const char *moo_edit_get_encoding (MooEdit *edit);
void moo_edit_set_encoding (MooEdit *edit,
const char *encoding);
2010-09-02 18:18:33 -07:00
2010-12-12 02:29:20 -08:00
const char *moo_edit_get_lang_id (MooEdit *edit);
2010-11-23 21:54:39 -08:00
2010-12-12 02:29:20 -08:00
MooEditor *moo_edit_get_editor (MooEdit *doc);
2010-12-08 01:11:51 -08:00
2009-12-13 16:16:39 -08:00
#ifdef __WIN32__
#define MOO_LE_DEFAULT MOO_LE_WIN32
#else
#define MOO_LE_DEFAULT MOO_LE_UNIX
#endif
2010-12-12 02:29:20 -08:00
MooLineEndType moo_edit_get_line_end_type (MooEdit *edit);
void moo_edit_set_line_end_type (MooEdit *edit,
MooLineEndType le);
gboolean moo_edit_is_empty (MooEdit *edit);
gboolean moo_edit_is_untitled (MooEdit *edit);
void moo_edit_set_modified (MooEdit *edit,
gboolean modified);
gboolean moo_edit_get_clean (MooEdit *edit);
void moo_edit_set_clean (MooEdit *edit,
gboolean clean);
MooEditStatus moo_edit_get_status (MooEdit *edit);
MooEditState moo_edit_get_state (MooEdit *edit);
gboolean moo_edit_reload (MooEdit *edit,
MooEditReloadInfo *info,
GError **error);
gboolean moo_edit_save (MooEdit *edit,
GError **error);
gboolean moo_edit_save_as (MooEdit *edit,
MooEditSaveInfo *info,
GError **error);
gboolean moo_edit_save_copy (MooEdit *edit,
MooEditSaveInfo *info,
GError **error);
gboolean moo_edit_close (MooEdit *edit,
gboolean ask_confirm);
2010-12-08 01:11:51 -08:00
2005-06-22 11:20:32 -07:00
G_END_DECLS
#endif /* MOO_EDIT_H */