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 _XmTextFP_h
0024 #define _XmTextFP_h
0025 
0026 #include <Xm/PrimitiveP.h>
0027 #include <Xm/TextF.h>
0028 #ifdef USE_XFT
0029 #include <X11/Xft/Xft.h>
0030 #endif
0031 
0032 #ifdef __cplusplus
0033 extern "C" {
0034 #endif
0035 
0036 /*
0037  * Defines for different cursors
0038  */
0039 
0040 #define IBEAM_WIDTH 3
0041 #define CARET_WIDTH 9
0042 #define CARET_HEIGHT    5
0043 
0044 /*
0045  * Here is the Text Field Widget class structure.
0046  */
0047 
0048 typedef struct _XmTextFieldClassPart {
0049   XtPointer extension;      /* Pointer to extension record. */
0050 } XmTextFieldClassPart;
0051 
0052 typedef struct _XmTextFieldClassRec {
0053   CoreClassPart core_class;  /* Not RectObjClassPart so I can reference
0054                   core_class s */
0055   XmPrimitiveClassPart primitive_class;
0056   XmTextFieldClassPart text_class;
0057 } XmTextFieldClassRec;
0058 
0059 externalref XmTextFieldClassRec xmTextFieldClassRec;
0060 
0061 /*
0062  * On the spot support.
0063  */
0064 typedef struct _OnTheSpotData {
0065   XmTextPosition start;
0066   XmTextPosition end;
0067   XmTextPosition cursor;
0068   int over_len;
0069   int over_maxlen;
0070   char *over_str;
0071   int under_preedit;
0072   Boolean under_verify_preedit;
0073   Boolean verify_commit;
0074   int pad;
0075 } OnTheSpotDataRec, *OnTheSpotData;
0076 
0077 /*
0078  * Here is the Text Field Widget instance structures.
0079  */
0080 
0081 typedef struct _XmTextFieldPart {
0082     XtCallbackList activate_callback;          /* Command activate callback */
0083     XtCallbackList focus_callback;             /* Verify gain focus callback */
0084     XtCallbackList losing_focus_callback;      /* Verify losing focus 
0085                           callback */
0086     XtCallbackList modify_verify_callback;     /* Verify value to change 
0087                           callback */
0088     XtCallbackList wcs_modify_verify_callback; /* Verify value to change 
0089                           callback */
0090     XtCallbackList motion_verify_callback;     /* Verify insert cursor position
0091                           to change callback */
0092     XtCallbackList gain_primary_callback;      /* Gained ownership of Primary
0093                           Selection */
0094     XtCallbackList lose_primary_callback;      /* Lost ownership of Primary
0095                           Selection */
0096     XtCallbackList value_changed_callback;     /* Notify that value has changed
0097                           callback */
0098     char * value;       /* pointer to widget value stored as char * */
0099     wchar_t * wc_value;     /* pointer to widget value stored as 
0100                    wchar_t * */
0101 
0102     XmFontList font_list;   /* Uses only the font portion of fontlist */
0103 #if USE_XFT
0104     XtPointer font;         /* font retrieved from the fontlist */
0105 #else
0106     XFontStruct *font;          /* font retrieved from the fontlist */
0107 #endif
0108     XmTextScanType *selection_array; /* Description of what to cycle
0109                     through on selections */
0110     _XmHighlightData highlight;      /* Info on the highlighting regions. */
0111 
0112     GC gc;          /* Normal GC for drawing text and cursor */
0113     GC image_gc;        /* Image GC for drawing text cursor*/
0114     GC save_gc;                 /* GC for saving/restoring under IBeam */
0115 
0116     Pixmap ibeam_off;       /* pixmap for area under the IBeam */
0117     Pixmap add_mode_cursor; /* The add mode cursor pixmap */
0118     Pixmap cursor;      /* The ibeam cursor stencil */
0119     Pixmap putback;     /* AVAILABLE: was in 1.1 but not really used */
0120     Pixmap stipple_tile;    /* The tile pattern for the stippled I-beam */
0121     Pixmap image_clip;      /* AVAILABLE: was in 1.2 but not used now */
0122 
0123     XmTextPosition cursor_position;  /* Character location of the insert 
0124                     cursor */
0125     XmTextPosition new_h_offset;     /* AVAILABLE: was in 1.1 but not used */
0126     XmTextPosition h_offset;         /* The x position of the first character
0127                     (relative to left edge of widget) */
0128     XmTextPosition orig_left;        /* Left primary selection prior to 
0129                     extend */
0130     XmTextPosition orig_right;       /* Right primary selection prior to
0131                     extend */
0132     XmTextPosition prim_pos_left;    /* Left primary selection position */
0133     XmTextPosition prim_pos_right;   /* Right primary selection position */
0134     XmTextPosition prim_anchor;      /* Primary selection pivot point */
0135 
0136     XmTextPosition sec_pos_left;     /* Left secondary selection position */
0137     XmTextPosition sec_pos_right;    /* Right secondary selection position */
0138     XmTextPosition sec_anchor;       /* Secondary selection pivot point */
0139 
0140     XmTextPosition stuff_pos;   /* Position to stuff the primary selection */
0141 
0142     Position select_pos_x;      /* x position for timer-based scrolling */
0143 
0144     Time prim_time;             /* Timestamp of primary selection */
0145     Time dest_time;             /* Timestamp of destination selection */
0146     Time sec_time;              /* Timestamp of secondary selection */
0147     Time last_time;             /* Time of last selection event */
0148 
0149     XtIntervalId timer_id;  /* Blinking cursor timer */
0150     XtIntervalId select_id;     /* Timer based scrolling identifier */
0151 
0152     int blink_rate;     /* Rate of blinking text cursor in msec */
0153     int selection_array_count;  /* Selection array count */
0154     int threshold;      /* Selection threshold */
0155     int size_allocd;        /* Size allocated for value string */
0156     int string_length;          /* The number of characters in the string 
0157                    (including the trailing NULL) */
0158     int cursor_height;      /* Save cursor dimensions */
0159     int cursor_width;       /* Save cursor dimensions */
0160     int sarray_index;       /* Index into selection array */
0161     int max_length;     /* Maximum number of character that can be
0162                    inserted into the text field widget */
0163 
0164     int max_char_size;          /* Max bytes per character in cur locale */
0165     short columns;      /* The number of characters in the width */
0166 
0167     Dimension margin_width; /* Height between text borders and text */
0168     Dimension margin_height;    /* Width between text borders and text */
0169     Dimension average_char_width;   /* Average character width based on font */
0170     Dimension margin_top;       /* Height between text borders and top of 
0171                    text */
0172     Dimension margin_bottom;    /* Height between text borders and bottom of 
0173                    text */
0174     Dimension font_ascent;      /* Ascent of font or fontset used by widget */
0175     Dimension font_descent;     /* Descent of font or fontset used by widget */
0176 
0177     Boolean resize_width;   /* Allows the widget to grow horizontally
0178                    when borders are reached */
0179     Boolean pending_delete; /* Delete primary selection on insert when
0180                    set to True */
0181     Boolean editable;       /* Sets editablility of text */
0182     Boolean verify_bell;        /* Determines if bell is sounded when verify
0183                    callback returns doit - False */
0184     Boolean cursor_position_visible; /* Sets visibility of insert cursor */
0185 
0186     Boolean traversed;          /* Flag used with losing focus verification to
0187                                    indicate a traversal key pressed event */
0188     Boolean add_mode;       /* Add mode for cursor movement */
0189     Boolean has_focus;      /* Flag that indicates whether the widget
0190                        has input focus */
0191     Boolean blink_on;       /* State of Blinking insert cursor */
0192     short int cursor_on;    /* Indicates whether the cursor is visible */
0193     Boolean refresh_ibeam_off;  /* Indicates whether the area under IBeam needs
0194                    to be re-captured */
0195     Boolean have_inverted_image_gc;  /* fg/bg of image gc have been swapped */
0196     Boolean has_primary;    /* Indicates that is has the
0197                    primary selection */
0198     Boolean has_secondary;  /* Indicates that is has the
0199                    secondary selection */
0200     Boolean has_destination;    /* Indicates that is has the
0201                    destination selection */
0202     Boolean sec_drag;           /* Indicates a secondary drag was made */ 
0203     Boolean selection_move; /* Indicates that the action requires a
0204                    secondary move (i.e. copy & cut) */
0205     Boolean pending_off;    /* indicates pending delete state */
0206     Boolean fontlist_created;   /* Indicates that the text field widget created
0207                    it's own fontlist */
0208     Boolean has_rect;       /* currently has clipping rectangle */
0209     Boolean do_drop;        /* Indicates that the widget the recieved the
0210                    button release, did not have a previous
0211                                    button press, so it is o.k. to request
0212                    the MOTIF_DROP selection. */
0213     Boolean cancel;     /* Cancels selection actions when true */
0214     Boolean extending;      /* Indicates extending primary selection */
0215     Boolean sec_extending;      /* Indicates extending secondary selection */
0216     Boolean changed_visible;    /* Indicates whether the dest_visible flag
0217                                    is in a temporary changed state */
0218     Boolean have_fontset;       /* The widgets font is a fontset, not a 
0219                    fontstruct... use R5 draw routines */
0220     Boolean in_setvalues;   /* used to disable unnecessary redisplays */
0221     Boolean do_resize;      /* used to prevent inappropriate resizes */
0222     Boolean redisplay;      /* used to set redisplay flag in setvalues */
0223     Boolean overstrike;     /* overstrike mode for character input */
0224     Boolean sel_start;      /* overstrike mode for character input */
0225     XtPointer extension;    /* Pointer to extension record. */
0226 
0227     XtCallbackList  destination_callback;   /* Selection destination cb */
0228     Boolean selection_link; /* Indicates that the action requires a
0229                    link */
0230     /* New for 2.0 */
0231     Boolean take_primary;   /* Indicates that is has to take the
0232                    primary selection */
0233     GC cursor_gc;               /* 1-bit depth GC for creating the I-beam 
0234                    stipples (normal & add mode) */
0235     XtIntervalId drag_id;       /* timer to start btn1 drag */
0236     _XmTextActionRec *transfer_action;  /* to keep track of delayed action */
0237     /* Boolean rt_save; */          /* used for MT work */
0238     OnTheSpotData onthespot;    /* data for on-the-spot im support */
0239 
0240     Boolean check_set_render_table; /* used for MT safe work */
0241     Boolean programmatic_highlights;    /* XmTextFieldSetHighlight called */
0242 #ifdef USE_XFT
0243     Boolean use_xft;
0244 #endif
0245 } XmTextFieldPart;
0246 
0247 typedef struct _XmTextFieldRec {
0248     CorePart core;
0249     XmPrimitivePart primitive;
0250     XmTextFieldPart text;
0251 } XmTextFieldRec;
0252 
0253 
0254 /****************
0255  *
0256  * Macros for the uncached data
0257  *
0258  ****************/
0259 
0260 #define TextF_ActivateCallback(tfg) \
0261     (((XmTextFieldWidget)(tfg)) -> text.activate_callback)
0262 #define TextF_LosingFocusCallback(tfg)  \
0263     (((XmTextFieldWidget)(tfg)) -> text.losing_focus_callback)
0264 #define TextF_FocusCallback(tfg)    \
0265     (((XmTextFieldWidget)(tfg)) -> text.focus_callback)
0266 #define TextF_ModifyVerifyCallback(tfg) \
0267     (((XmTextFieldWidget)(tfg)) -> text.modify_verify_callback)
0268 #define TextF_ModifyVerifyCallbackWcs(tfg) \
0269     (((XmTextFieldWidget)(tfg)) -> text.wcs_modify_verify_callback)
0270 #define TextF_MotionVerifyCallback(tfg) \
0271     (((XmTextFieldWidget)(tfg)) -> text.motion_verify_callback)
0272 #define TextF_ValueChangedCallback(tfg) \
0273     (((XmTextFieldWidget)(tfg)) -> text.value_changed_callback)
0274 #define TextF_Value(tfg)        \
0275     (((XmTextFieldWidget)(tfg)) -> text.value)
0276 #define TextF_WcValue(tfg)      \
0277     (((XmTextFieldWidget)(tfg)) -> text.wc_value)
0278 #define TextF_MarginHeight(tfg)     \
0279     (((XmTextFieldWidget)(tfg)) -> text.margin_height)
0280 #define TextF_MarginWidth(tfg)      \
0281     (((XmTextFieldWidget)(tfg)) -> text.margin_width)
0282 #define TextF_CursorPosition(tfg)   \
0283     (((XmTextFieldWidget)(tfg)) -> text.cursor_position)
0284 #define TextF_Columns(tfg)      \
0285     (((XmTextFieldWidget)(tfg)) -> text.columns)
0286 #define TextF_MaxLength(tfg)        \
0287     (((XmTextFieldWidget)(tfg)) -> text.max_length)
0288 #define TextF_BlinkRate(tfg)        \
0289     (((XmTextFieldWidget)(tfg)) -> text.blink_rate)
0290 #define TextF_FontList(tfg)     \
0291     (((XmTextFieldWidget)(tfg)) -> text.font_list)
0292 #define TextF_Font(tfg)         \
0293     ((XFontStruct*)(((XmTextFieldWidget)(tfg)) -> text.font))
0294 #define TextF_FontAscent(tfg)       \
0295     (((XmTextFieldWidget)(tfg)) -> text.font_ascent)
0296 #define TextF_FontDescent(tfg)      \
0297     (((XmTextFieldWidget)(tfg)) -> text.font_descent)
0298 #define TextF_SelectionArray(tfg)   \
0299     (((XmTextFieldWidget)(tfg)) -> text.selection_array)
0300 #define TextF_SelectionArrayCount(tfg)  \
0301     (((XmTextFieldWidget)(tfg)) -> text.selection_array_count)
0302 #define TextF_ResizeWidth(tfg)      \
0303     (((XmTextFieldWidget)(tfg)) -> text.resize_width)
0304 #define TextF_PendingDelete(tfg)    \
0305     (((XmTextFieldWidget)(tfg)) -> text.pending_delete)
0306 #define TextF_Editable(tfg)     \
0307     (((XmTextFieldWidget)(tfg)) -> text.editable)
0308 #define TextF_CursorPositionVisible(tfg) \
0309     (((XmTextFieldWidget)(tfg)) -> text.cursor_position_visible)
0310 #define TextF_Threshold(tfg)        \
0311     (((XmTextFieldWidget)(tfg)) -> text.threshold)
0312 #define TextF_UseFontSet(tfg)       \
0313     (((XmTextFieldWidget)(tfg)) -> text.have_fontset)
0314 #ifdef USE_XFT
0315 #define TextF_UseXft(tfg)       \
0316     (((XmTextFieldWidget)(tfg)) -> text.use_xft)
0317 #define TextF_XftFont(tfg)      \
0318     ((XftFont*)(((XmTextFieldWidget)(tfg)) -> text.font))
0319 #endif
0320 
0321 /*
0322  * On the spot support.
0323  */
0324 #define PreStart(tfg)                           (((XmTextFieldWidget)(tfg)) -> \
0325                                            text.onthespot->start)
0326 #define PreEnd(tfg)                             (((XmTextFieldWidget)(tfg)) -> \
0327                                            text.onthespot->end)
0328 #define PreCursor(tfg)                          (((XmTextFieldWidget)(tfg)) -> \
0329                                            text.onthespot->cursor)
0330 #define FUnderVerifyPreedit(tfg)        (((XmTextFieldWidget)(tfg)) -> \
0331                      text.onthespot->under_verify_preedit)
0332 #define FVerifyCommitNeeded(tfg)        (((XmTextFieldWidget)(tfg)) -> \
0333                      text.onthespot->verify_commit)
0334 
0335 #ifdef __cplusplus
0336 }  /* Close scope of 'extern "C"' declaration which encloses file. */
0337 #endif
0338 
0339 #endif /* _XmTextFieldWidgetP_h */