text-context.h revision 283b476d68aaebafad5c687c34438dd2fe00c1ef
5562N/A#ifndef __SP_TEXT_CONTEXT_H__
5562N/A#define __SP_TEXT_CONTEXT_H__
5562N/A
5562N/A/*
5562N/A * SPTextContext
7118N/A *
7118N/A * Authors:
5562N/A * Lauris Kaplinski <lauris@kaplinski.com>
5562N/A * bulia byak <buliabyak@users.sf.net>
5562N/A *
5562N/A * Copyright (C) 1999-2005 authors
5562N/A * Copyright (C) 2001 Ximian, Inc.
5562N/A *
5562N/A * Released under GNU GPL, read the file 'COPYING' for more information
5562N/A */
5562N/A
7118N/A/* #include <gdk/gdkic.h> */
7118N/A#include <sigc++/sigc++.h>
5562N/A#include <gtk/gtkimcontext.h>
5562N/A
7118N/A#include "event-context.h"
7118N/A#include <display/display-forward.h>
7118N/A#include <2geom/point.h>
7118N/A#include "libnrtype/Layout-TNG.h"
7118N/A
7118N/A#define SP_TYPE_TEXT_CONTEXT (sp_text_context_get_type ())
7118N/A#define SP_TEXT_CONTEXT(obj) (GTK_CHECK_CAST ((obj), SP_TYPE_TEXT_CONTEXT, SPTextContext))
7118N/A#define SP_TEXT_CONTEXT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), SP_TYPE_TEXT_CONTEXT, SPTextContextClass))
7118N/A#define SP_IS_TEXT_CONTEXT(obj) (GTK_CHECK_TYPE ((obj), SP_TYPE_TEXT_CONTEXT))
7118N/A#define SP_IS_TEXT_CONTEXT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), SP_TYPE_TEXT_CONTEXT))
5562N/A
5562N/Aclass SPTextContext;
5562N/Aclass SPTextContextClass;
5562N/Aclass SPCanvasArena;
5562N/A
5562N/Astruct SPTextContext : public SPEventContext {
5562N/A
5562N/A sigc::connection sel_changed_connection;
5562N/A sigc::connection sel_modified_connection;
5562N/A sigc::connection style_set_connection;
5562N/A sigc::connection style_query_connection;
5562N/A
5562N/A GtkIMContext *imc;
5562N/A
5562N/A SPItem *text; // the text we're editing, or NULL if none selected
5562N/A
5562N/A /* Text item position in root coordinates */
5562N/A Geom::Point pdoc;
5562N/A /* Insertion point position */
5562N/A Inkscape::Text::Layout::iterator text_sel_start;
5562N/A Inkscape::Text::Layout::iterator text_sel_end;
5562N/A
5562N/A gchar uni[9];
5562N/A bool unimode;
5562N/A guint unipos;
5562N/A
5562N/A SPCanvasItem *cursor;
5562N/A SPCanvasItem *indicator;
5562N/A SPCanvasItem *frame; // hiliting the first frame of flowtext; FIXME: make this a list to accommodate arbitrarily many chained shapes
5562N/A std::vector<SPCanvasItem*> text_selection_quads;
5562N/A gint timeout;
5562N/A guint show : 1;
7118N/A guint phase : 1;
7118N/A guint nascent_object : 1; // true if we're clicked on canvas to put cursor, but no text typed yet so ->text is still NULL
7118N/A
7118N/A guint over_text : 1; // true if cursor is over a text object
7118N/A
7118N/A guint dragging : 2; // dragging selection over text
7118N/A
7118N/A guint creating : 1; // dragging rubberband to create flowtext
7118N/A SPCanvasItem *grabbed; // we grab while we are creating, to get events even if the mouse goes out of the window
7118N/A Geom::Point p0; // initial point if the flowtext rect
7118N/A
7118N/A /* Preedit String */
7118N/A gchar* preedit_string;
7118N/A};
7118N/A
7118N/Astruct SPTextContextClass {
7118N/A SPEventContextClass parent_class;
7118N/A};
7118N/A
7118N/A/* Standard Gtk function */
7118N/AGtkType sp_text_context_get_type (void);
7118N/A
7118N/Abool sp_text_paste_inline(SPEventContext *ec);
7118N/AGlib::ustring sp_text_get_selected_text(SPEventContext const *ec);
7118N/ASPCSSAttr *sp_text_get_style_at_cursor(SPEventContext const *ec);
7118N/Abool sp_text_delete_selection(SPEventContext *ec);
7118N/Avoid sp_text_context_place_cursor (SPTextContext *tc, SPObject *text, Inkscape::Text::Layout::iterator where);
7118N/Avoid sp_text_context_place_cursor_at (SPTextContext *tc, SPObject *text, Geom::Point const p);
5562N/AInkscape::Text::Layout::iterator *sp_text_context_get_cursor_position(SPTextContext *tc, SPObject *text);
5562N/A
7118N/A#endif
5562N/A