X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=gtk%2Fgtktextlayout.h;h=819aaf23692e196e8e1da55a8d872cd289f2ca09;hb=32aa7f0582febb614c41e4130ad34ac44ef6efd2;hp=8977a97eb71d7ed34d51660283801f3e2eb1f220;hpb=35876710dc133b5cab14241174ba0e680ca854af;p=~andy%2Fgtk diff --git a/gtk/gtktextlayout.h b/gtk/gtktextlayout.h index 8977a97eb..819aaf236 100644 --- a/gtk/gtktextlayout.h +++ b/gtk/gtktextlayout.h @@ -23,8 +23,7 @@ * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * License along with this library. If not, see . * * Original Tk license: * @@ -76,12 +75,8 @@ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ -#ifndef GTK_TEXT_LAYOUT_H -#define GTK_TEXT_LAYOUT_H - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ +#ifndef __GTK_TEXT_LAYOUT_H__ +#define __GTK_TEXT_LAYOUT_H__ /* This is a "semi-private" header; it is intended for * use by the text widget, and the text canvas item, @@ -89,9 +84,13 @@ extern "C" { * canvas item can use it, but users are not supposed * to use it. */ +#ifndef GTK_TEXT_USE_INTERNAL_UNSUPPORTED_API +#error "You are not supposed to be including this file; the equivalent public API is in gtktextview.h" +#endif + +#include -#include -#include +G_BEGIN_DECLS /* forward declarations that have to be here to avoid including * gtktextbtree.h @@ -100,21 +99,20 @@ typedef struct _GtkTextLine GtkTextLine; typedef struct _GtkTextLineData GtkTextLineData; #define GTK_TYPE_TEXT_LAYOUT (gtk_text_layout_get_type ()) -#define GTK_TEXT_LAYOUT(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_TEXT_LAYOUT, GtkTextLayout)) -#define GTK_TEXT_LAYOUT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_TEXT_LAYOUT, GtkTextLayoutClass)) -#define GTK_IS_TEXT_LAYOUT(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_TEXT_LAYOUT)) -#define GTK_IS_TEXT_LAYOUT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TEXT_LAYOUT)) -#define GTK_TEXT_LAYOUT_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_TEXT_LAYOUT, GtkTextLayoutClass)) +#define GTK_TEXT_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TEXT_LAYOUT, GtkTextLayout)) +#define GTK_TEXT_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TEXT_LAYOUT, GtkTextLayoutClass)) +#define GTK_IS_TEXT_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TEXT_LAYOUT)) +#define GTK_IS_TEXT_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TEXT_LAYOUT)) +#define GTK_TEXT_LAYOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TEXT_LAYOUT, GtkTextLayoutClass)) typedef struct _GtkTextLayout GtkTextLayout; typedef struct _GtkTextLayoutClass GtkTextLayoutClass; typedef struct _GtkTextLineDisplay GtkTextLineDisplay; -typedef struct _GtkTextCursorDisplay GtkTextCursorDisplay; typedef struct _GtkTextAttrAppearance GtkTextAttrAppearance; struct _GtkTextLayout { - GtkObject parent_instance; + GObject parent_instance; /* width of the display area on-screen, * i.e. pixels we should wrap to fit inside. */ @@ -157,17 +155,29 @@ struct _GtkTextLayout /* Whether to show the insertion cursor */ guint cursor_visible : 1; + /* For what GtkTextDirection to draw cursor GTK_TEXT_DIR_NONE - + * means draw both cursors. + */ + guint cursor_direction : 2; + + /* The keyboard direction is used to default the alignment when + there are no strong characters. + */ + guint keyboard_direction : 2; + /* The preedit string and attributes, if any */ gchar *preedit_string; PangoAttrList *preedit_attrs; gint preedit_len; gint preedit_cursor; + + guint overwrite_mode : 1; }; struct _GtkTextLayoutClass { - GtkObjectClass parent_class; + GObjectClass parent_class; /* Some portion of the layout was invalidated */ @@ -197,6 +207,15 @@ struct _GtkTextLayoutClass GtkWidget *child, gint x, gint y); + + void (*invalidate_cursors) (GtkTextLayout *layout, + const GtkTextIter *start, + const GtkTextIter *end); + + /* Padding for future expansion */ + void (*_gtk_reserved1) (void); + void (*_gtk_reserved2) (void); + void (*_gtk_reserved3) (void); }; struct _GtkTextAttrAppearance @@ -204,20 +223,12 @@ struct _GtkTextAttrAppearance PangoAttribute attr; GtkTextAppearance appearance; }; -struct _GtkTextCursorDisplay -{ - gint x; - gint y; - gint height; - guint is_strong : 1; - guint is_weak : 1; -}; + struct _GtkTextLineDisplay { PangoLayout *layout; - GSList *cursors; - GSList *shaped_objects; - + GArray *cursors; /* indexes of cursors in the PangoLayout */ + GtkTextDirection direction; gint width; /* Width of layout */ @@ -233,23 +244,42 @@ struct _GtkTextLineDisplay gint bottom_margin; gint insert_index; /* Byte index of insert cursor within para or -1 */ - gboolean size_only; GtkTextLine *line; + + GdkColor *pg_bg_color; + + GdkRectangle block_cursor; + guint cursors_invalid : 1; + guint has_block_cursor : 1; + guint cursor_at_line_end : 1; + guint size_only : 1; + + GdkRGBA *pg_bg_rgba; }; -extern PangoAttrType gtk_text_attr_appearance_type; - -GtkType gtk_text_layout_get_type (void) G_GNUC_CONST; -GtkTextLayout* gtk_text_layout_new (void); -void gtk_text_layout_set_buffer (GtkTextLayout *layout, - GtkTextBuffer *buffer); -void gtk_text_layout_set_default_style (GtkTextLayout *layout, - GtkTextAttributes *values); -void gtk_text_layout_set_contexts (GtkTextLayout *layout, - PangoContext *ltr_context, - PangoContext *rtl_context); -void gtk_text_layout_default_style_changed (GtkTextLayout *layout); - +#ifdef GTK_COMPILATION +extern G_GNUC_INTERNAL PangoAttrType gtk_text_attr_appearance_type; +#endif + +GType gtk_text_layout_get_type (void) G_GNUC_CONST; + +GtkTextLayout* gtk_text_layout_new (void); +void gtk_text_layout_set_buffer (GtkTextLayout *layout, + GtkTextBuffer *buffer); +GtkTextBuffer *gtk_text_layout_get_buffer (GtkTextLayout *layout); +void gtk_text_layout_set_default_style (GtkTextLayout *layout, + GtkTextAttributes *values); +void gtk_text_layout_set_contexts (GtkTextLayout *layout, + PangoContext *ltr_context, + PangoContext *rtl_context); +void gtk_text_layout_set_cursor_direction (GtkTextLayout *layout, + GtkTextDirection direction); +void gtk_text_layout_set_overwrite_mode (GtkTextLayout *layout, + gboolean overwrite); +void gtk_text_layout_set_keyboard_direction (GtkTextLayout *layout, + GtkTextDirection keyboard_dir); +void gtk_text_layout_default_style_changed (GtkTextLayout *layout); + void gtk_text_layout_set_screen_width (GtkTextLayout *layout, gint width); void gtk_text_layout_set_preedit_string (GtkTextLayout *layout, @@ -294,9 +324,17 @@ void gtk_text_layout_get_iter_at_pixel (GtkTextLayout *layout, GtkTextIter *iter, gint x, gint y); +void gtk_text_layout_get_iter_at_position (GtkTextLayout *layout, + GtkTextIter *iter, + gint *trailing, + gint x, + gint y); void gtk_text_layout_invalidate (GtkTextLayout *layout, const GtkTextIter *start, const GtkTextIter *end); +void gtk_text_layout_invalidate_cursors(GtkTextLayout *layout, + const GtkTextIter *start, + const GtkTextIter *end); void gtk_text_layout_free_line_data (GtkTextLayout *layout, GtkTextLine *line, GtkTextLineData *line_data); @@ -304,8 +342,8 @@ void gtk_text_layout_free_line_data (GtkTextLayout *layout, gboolean gtk_text_layout_is_valid (GtkTextLayout *layout); void gtk_text_layout_validate_yrange (GtkTextLayout *layout, GtkTextIter *anchor_line, - gint y0, - gint y1); + gint y0_, + gint y1_); void gtk_text_layout_validate (GtkTextLayout *layout, gint max_pixels); @@ -323,6 +361,10 @@ void gtk_text_layout_changed (GtkTextLayout *layout, gint y, gint old_height, gint new_height); +void gtk_text_layout_cursors_changed (GtkTextLayout *layout, + gint y, + gint old_height, + gint new_height); void gtk_text_layout_get_iter_location (GtkTextLayout *layout, const GtkTextIter *iter, GdkRectangle *rect); @@ -330,10 +372,16 @@ void gtk_text_layout_get_line_yrange (GtkTextLayout *layout, const GtkTextIter *iter, gint *y, gint *height); +void _gtk_text_layout_get_line_xrange (GtkTextLayout *layout, + const GtkTextIter *iter, + gint *x, + gint *width); void gtk_text_layout_get_cursor_locations (GtkTextLayout *layout, GtkTextIter *iter, GdkRectangle *strong_pos, GdkRectangle *weak_pos); +gboolean _gtk_text_layout_get_block_cursor (GtkTextLayout *layout, + GdkRectangle *pos); gboolean gtk_text_layout_clamp_iter_to_vrange (GtkTextLayout *layout, GtkTextIter *iter, gint top, @@ -356,6 +404,11 @@ gboolean gtk_text_layout_move_iter_visually (GtkTextLayout *layout, gboolean gtk_text_layout_iter_starts_line (GtkTextLayout *layout, const GtkTextIter *iter); +void gtk_text_layout_get_iter_at_line (GtkTextLayout *layout, + GtkTextIter *iter, + GtkTextLine *line, + gint byte_offset); + /* Don't use these. Use gtk_text_view_add_child_at_anchor(). * These functions are defined in gtktextchild.c, but here * since they are semi-public and require GtkTextLayout to @@ -375,8 +428,6 @@ void gtk_text_anchored_child_set_layout (GtkWidget *child, void gtk_text_layout_spew (GtkTextLayout *layout); -#ifdef __cplusplus -} -#endif /* __cplusplus */ +G_END_DECLS -#endif /* GTK_TEXT_LAYOUT_H */ +#endif /* __GTK_TEXT_LAYOUT_H__ */