Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:15:29

0001 /* 
0002  * Motif
0003  *
0004  * Copyright (c) 1987-2012, The Open Group. All rights reserved.
0005  *
0006  * These libraries and programs are free software; you can
0007  * redistribute them and/or modify them under the terms of the GNU
0008  * Lesser General Public License as published by the Free Software
0009  * Foundation; either version 2 of the License, or (at your option)
0010  * any later version.
0011  *
0012  * These libraries and programs are distributed in the hope that
0013  * they will be useful, but WITHOUT ANY WARRANTY; without even the
0014  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
0015  * PURPOSE. See the GNU Lesser General Public License for more
0016  * details.
0017  *
0018  * You should have received a copy of the GNU Lesser General Public
0019  * License along with these librararies and programs; if not, write
0020  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
0021  * Floor, Boston, MA 02110-1301 USA
0022 */ 
0023 #ifndef _XmTextP_h
0024 #define _XmTextP_h
0025 
0026 #include <Xm/PrimitiveP.h>
0027 #include <Xm/TextOutP.h>
0028 #include <Xm/TextInP.h>
0029 #include <Xm/TransferT.h>
0030 
0031 typedef struct _InputRec *Input;
0032 typedef struct _OutputRec *Output;
0033 
0034 #ifdef __cplusplus
0035 extern "C" {
0036 #endif
0037 
0038 #define NODELTA     LONG_MAX
0039 
0040 #define TEXTWIDGETCLASS "Text"  /* Resource class for the text widget. */
0041 
0042 #define GetSrc(widget)  (((XmTextWidget) (widget))->text.source)
0043 
0044 typedef struct {
0045   XtPointer     extension;  /* Pointer to extension record */
0046 } XmTextClassPart;
0047 
0048 typedef struct _XmTextClassRec {
0049     CoreClassPart core_class;
0050     XmPrimitiveClassPart primitive_class;
0051     XmTextClassPart text_class;
0052 } XmTextClassRec;
0053 
0054 externalref XmTextClassRec  xmTextClassRec;
0055 
0056 typedef struct {
0057     XmTextPosition start;   /* First position in this line. */
0058     Boolean changed;        /* TRUE if something in this line changed. */
0059     XmTextPosition changed_position; /* First position within the line that
0060                     has changed, if any. */
0061     Boolean past_end;       /* TRUE if this line is past the end of any */
0062                 /* line actually on the screen. */
0063     LineTableExtra extra;   /* Extra info the output module keeps. */
0064 } LineRec, *Line;
0065 
0066 typedef struct _XmTextLineTableRec{
0067     unsigned int start_pos:31;
0068     unsigned int virt_line:1;
0069 } XmTextLineTableRec, *XmTextLineTable;
0070 
0071 typedef struct {
0072     XmTextPosition from, to;    /* Information on one range to repaint. */
0073 } RangeRec;
0074 
0075 typedef struct {
0076     Cardinal number;        /* Number of ranges defined. */
0077     Cardinal maximum;       /* Number of ranges we have space for. */
0078     RangeRec *range;        /* Pointer to array of ranges. */
0079 } Ranges;
0080 
0081 /*
0082  * The data for on-the-spot support.
0083  */
0084 typedef struct _OnTheSpotDataTW {
0085     XmTextPosition start;
0086     XmTextPosition end;
0087     XmTextPosition cursor;
0088     XmTextPosition over_len;
0089     XmTextPosition over_maxlen;
0090     char *over_str;
0091     int under_preedit;
0092     Boolean under_verify_preedit;
0093     Boolean verify_commit;
0094     int pad;
0095 } OnTheSpotDataRecTW, *OnTheSpotDataTW;
0096 
0097 #define PreStartTW(tw) ((tw)->text.onthespot->start)
0098 #define PreEndTW(tw) ((tw)->text.onthespot->end)
0099 #define PreCursorTW(tw) ((tw)->text.onthespot->cursor)
0100 #define PreOverLen(tw) ((tw)->text.onthespot->over_len)
0101 #define PreOverMaxLen(tw) ((tw)->text.onthespot->over_maxlen)
0102 #define PreOverStr(tw) ((tw)->text.onthespot->over_str)
0103 #define PreUnder(tw) ((tw)->text.onthespot->under_preedit)
0104 #define UnderVerifyPreedit(tw) ((tw)->text.onthespot->under_verify_preedit)
0105 #define VerifyCommitNeeded(tw) ((tw)->text.onthespot->verify_commit)
0106 
0107 
0108 /*
0109  * Structure for main text info. 
0110  */
0111 
0112 typedef struct _XmTextPart {
0113     XmTextSource source;           /* The source for this widget. */
0114     XtCallbackList activate_callback;      /* command activate callback. */
0115     XtCallbackList focus_callback;     /* Focus callback. */
0116     XtCallbackList losing_focus_callback;  /* Losing focus callback. */
0117     XtCallbackList value_changed_callback; /* Value changed callback. */
0118     XtCallbackList modify_verify_callback; /* Verify value to change callback.*/
0119     XtCallbackList wcs_modify_verify_callback; /* Verify value to change 
0120                         * callback.*/
0121     XtCallbackList motion_verify_callback; /* Insert cursor position 
0122                           change callback. */
0123     XtCallbackList gain_primary_callback; /* Gained ownership of Primary
0124                          Selection */
0125     XtCallbackList lose_primary_callback; /* Lost ownership of Primary
0126                          Selection */
0127     char *value;            /* The sring value in the widget */
0128     wchar_t *wc_value;              /* Pointer for wchar_t value set by app */
0129     Dimension margin_height;        /* height between text borders and text */
0130     Dimension margin_width;         /* width between text borders and text */
0131     Position cursor_position_x;     /* x pixel location of cursor */
0132     OutputCreateProc output_create; /* Routine to create the output portion. */
0133     InputCreateProc input_create;   /* Routine to create the input portion. */
0134     /* The naming incongruity amongst the next three items was introduced */
0135     /* due to a collision with top_position as used as a Form constraint; */
0136     /* It has no other implications. */
0137     XmTextPosition top_character;    /* First position to display. */
0138     XmTextPosition bottom_position; /* Last position to display. */
0139     XmTextPosition cursor_position; /* Location of the insertion point. */
0140     int max_length;         /* Sets the max. length of string */
0141     int edit_mode;          /* Sets the line editing mode
0142                        (i.e. sinlge_line, multi_line, ...) */
0143     Boolean auto_show_cursor_position; /* If true, automatically try to show
0144                       the cursor position whenever it
0145                       changes. */
0146     Boolean editable;         /* Determines if text is editable */
0147     Boolean verify_bell;      /* Determines if bell is sounded when verify
0148                    *  callback returns doit - False
0149                                    */
0150     Boolean add_mode;         /* Determines the state of add moder */
0151     Boolean traversed;            /* Flag used with losing focus verification to
0152                      indicate a traversal key pressed event */
0153     Boolean in_redisplay;     /* Whether currently in the redisplay proc. */
0154     Boolean needs_redisplay;      /* Whether we need to repaint or refigure. */
0155     Boolean in_refigure_lines;    /* Whether currently in refigurelines proc. */
0156     Boolean needs_refigure_lines; /* Whether we need to refigure. */
0157     Boolean in_setvalues;         /* Use to reduce unnecessary redisplays and
0158                      geometry requsets */
0159     Boolean in_resize;        /* Make sure there are no geometry requests
0160                      while we are in resize procedure. */
0161     Boolean in_expose;        /* Make sure there are no geometry requests
0162                      while we are in expose procedure. */
0163     Boolean highlight_changed;    /* Whether highlighting recently changed. */
0164     Boolean pendingoff;         /* TRUE if we shouldn't do pending delete on
0165                                    the current selection. */
0166     char char_size;             /* number of bytes for storing a character */
0167 
0168     OnOrOff on_or_off;        /* used to halt unecessary motion verify
0169                      callback calls during primary moves.*/
0170     Output output;         /* The output portion. */
0171     Input input;           /* The input portion. */
0172 
0173     XmTextPosition first_position; /* First legal position in the source. */
0174     XmTextPosition last_position;  /* Last legal position in the source. */
0175     XmTextPosition forget_past;    /* Forget all about positions past this. */
0176     XmTextPosition force_display;  /* Force this position to be displayed. */
0177     XmTextPosition new_top;    /* Desired new top position. */
0178     XmTextPosition last_top_char;  /* unused - available. */
0179     XmTextPosition dest_position;  /* Location of the destination point. */
0180     int disable_depth;         /* How many levels of disable we've done. */
0181 
0182     int pending_scroll;     /* Number of lines we want to scroll. */
0183     int total_lines;        /* Total number of lines in the text widget */
0184     int top_line;       /* Line number of the top visible line */
0185     int vsbar_scrolling;    /* scrolling using the vertical scrollbar */
0186 
0187     Cardinal number_lines;  /* Number of line table entries. */
0188     Cardinal maximum_lines; /* Maximum number of line table entries. */
0189     Line line;          /* Pointer to array of line table entries. */
0190 
0191     Ranges repaint;     /* Info on the repaint ranges. */
0192     _XmHighlightData highlight; /* Info on the highlighting regions. */
0193     _XmHighlightData old_highlight;/* Old value of above. */
0194     Widget inner_widget;    /* Pointer to widget which actually contains
0195                    text (may be same or different from
0196                    this record).  */
0197     XmTextLineTable line_table;
0198     unsigned int table_size;
0199     unsigned int table_index;
0200 
0201     XtCallbackList  destination_callback;   /* Selection destination cb */
0202     int          hsbar_scrolling;/* scroring using the horizontal scrollbar */
0203 
0204     OnTheSpotDataTW onthespot;  /* On the spot preedit style support. */
0205     
0206     XtTranslations tm_table;
0207 } XmTextPart;
0208 
0209 typedef struct _XmTextRec {
0210     CorePart    core;
0211     XmPrimitivePart primitive;
0212     XmTextPart text;
0213 } XmTextRec;
0214 
0215 
0216 #ifdef __cplusplus
0217 }  /* Close scope of 'extern "C"' declaration which encloses file. */
0218 #endif
0219 
0220 #endif /* _XmTextP_h */
0221 /* DON't ADD STUFF AFTER THIS #endif */