home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / include / Xm / TextP.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-30  |  10.8 KB  |  281 lines

  1. /* 
  2.  * (c) Copyright 1989, 1990, 1991, 1992, 1993 OPEN SOFTWARE FOUNDATION, INC. 
  3.  * ALL RIGHTS RESERVED 
  4. */ 
  5. /* 
  6.  * Motif Release 1.2.3
  7. */ 
  8. /*   $RCSfile: TextP.h,v $ $Revision: 10.1 $ $Date: 1994/02/03 15:52:47 $ */
  9. /*
  10. *  (c) Copyright 1989, DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. */
  11. /*
  12. *  (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992 HEWLETT-PACKARD COMPANY */
  13. #ifndef _XmTextP_h
  14. #define _XmTextP_h
  15.  
  16. #include <Xm/PrimitiveP.h>
  17. #include <Xm/TextOutP.h>
  18. #include <Xm/TextInP.h>
  19.  
  20. typedef struct _InputRec *Input;
  21. typedef struct _OutputRec *Output;
  22.  
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26.  
  27. #define MAXINT    2147483647 /* Biggest number that can fit in long */
  28.  
  29. #define NODELTA        MAXINT
  30.  
  31. #define TEXTWIDGETCLASS    "Text"    /* Resource class for the text widget. */
  32.  
  33. #define GetSrc(widget)  (((XmTextWidget) (widget))->text.source)
  34.  
  35. #ifndef MIN
  36. #define MIN(x,y)    ((x) < (y) ? (x) : (y))
  37. #endif /* MIN */
  38.  
  39. typedef struct {
  40.     XtPointer        extension;    /* Pointer to extension record */
  41. } XmTextClassPart;
  42.  
  43. typedef struct _XmTextClassRec {
  44.     CoreClassPart core_class;
  45.     XmPrimitiveClassPart primitive_class;
  46.     XmTextClassPart text_class;
  47. } XmTextClassRec;
  48.  
  49. externalref XmTextClassRec    xmTextClassRec;
  50.  
  51. typedef struct {
  52.     XmTextPosition start;    /* First position in this line. */
  53.     Boolean changed;        /* TRUE if something in this line changed. */
  54.     XmTextPosition changed_position; /* First position within the line that
  55.                     has changed, if any. */
  56.     Boolean past_end;        /* TRUE if this line is past the end of any */
  57.                 /* line actually on the screen. */
  58.     LineTableExtra extra;    /* Extra info the output module keeps. */
  59. } LineRec, *Line;
  60.  
  61. typedef struct _XmTextLineTableRec{
  62.     unsigned int start_pos:31;
  63.     unsigned int virt_line:1;
  64. } XmTextLineTableRec, *XmTextLineTable;
  65.  
  66. typedef struct {
  67.     XmTextPosition from, to;    /* Information on one range to repaint. */
  68. } RangeRec;
  69.  
  70. typedef struct {
  71.     Cardinal number;        /* Number of ranges defined. */
  72.     Cardinal maximum;        /* Number of ranges we have space for. */
  73.     RangeRec *range;        /* Pointer to array of ranges. */
  74. } Ranges;
  75.  
  76.  
  77. /*
  78.  * Structure for main text info. 
  79.  */
  80.  
  81. typedef struct _XmTextPart {
  82.     XmTextSource source;           /* The source for this widget. */
  83.     XtCallbackList activate_callback;      /* command activate callback. */
  84.     XtCallbackList focus_callback;       /* Focus callback. */
  85.     XtCallbackList losing_focus_callback;  /* Losing focus callback. */
  86.     XtCallbackList value_changed_callback; /* Value changed callback. */
  87.     XtCallbackList modify_verify_callback; /* Verify value to change callback.*/
  88.     XtCallbackList wcs_modify_verify_callback; /* Verify value to change 
  89.                         * callback.*/
  90.     XtCallbackList motion_verify_callback; /* Insert cursor position 
  91.                           change callback. */
  92.     XtCallbackList gain_primary_callback; /* Gained ownership of Primary
  93.                          Selection */
  94.     XtCallbackList lose_primary_callback; /* Lost ownership of Primary
  95.                          Selection */
  96.     char *value;            /* The sring value in the widget */
  97.     wchar_t *wc_value;              /* Pointer for wchar_t value set by app */
  98.     Dimension margin_height;        /* height between text borders and text */
  99.     Dimension margin_width;         /* width between text borders and text */
  100.     Position cursor_position_x;     /* x pixel location of cursor */
  101.     OutputCreateProc output_create; /* Routine to create the output portion. */
  102.     InputCreateProc input_create;   /* Routine to create the input portion. */
  103.     /* The naming incongruity amongst the next three items was introduced */
  104.     /* due to a collision with top_position as used as a Form constraint; */
  105.     /* It has no other implications. */
  106.     XmTextPosition top_character;    /* First position to display. */
  107.     XmTextPosition bottom_position; /* Last position to display. */
  108.     XmTextPosition cursor_position; /* Location of the insertion point. */
  109.     int max_length;            /* Sets the max. length of string */
  110.     int edit_mode;            /* Sets the line editing mode
  111.                        (i.e. sinlge_line, multi_line, ...) */
  112.     Boolean auto_show_cursor_position; /* If true, automatically try to show
  113.                       the cursor position whenever it
  114.                       changes. */
  115.     Boolean editable;          /* Determines if text is editable */
  116.     Boolean verify_bell;       /* Determines if bell is sounded when verify
  117.                    *  callback returns doit - False
  118.                                    */
  119.     Boolean add_mode;          /* Determines the state of add moder */
  120.     Boolean traversed;            /* Flag used with losing focus verification to
  121.                      indicate a traversal key pressed event */
  122.     Boolean in_redisplay;      /* Whether currently in the redisplay proc. */
  123.     Boolean needs_redisplay;      /* Whether we need to repaint or refigure. */
  124.     Boolean in_refigure_lines;      /* Whether currently in refigurelines proc. */
  125.     Boolean needs_refigure_lines; /* Whether we need to refigure. */
  126.     Boolean in_setvalues;         /* Use to reduce unnecessary redisplays and
  127.                      geometry requsets */
  128.     Boolean in_resize;          /* Make sure there are no geometry requests
  129.                      while we are in resize procedure. */
  130.     Boolean in_expose;          /* Make sure there are no geometry requests
  131.                      while we are in expose procedure. */
  132.     Boolean highlight_changed;      /* Whether highlighting recently changed. */
  133.     Boolean pendingoff;         /* TRUE if we shouldn't do pending delete on
  134.                                    the current selection. */
  135.     char char_size;             /* number of bytes for storing a character */
  136.  
  137.     OnOrOff on_or_off;          /* used to halt unecessary motion verify
  138.                      callback calls during primary moves.*/
  139.     Output output;           /* The output portion. */
  140.     Input input;           /* The input portion. */
  141.  
  142.     XmTextPosition first_position; /* First legal position in the source. */
  143.     XmTextPosition last_position;  /* Last legal position in the source. */
  144.     XmTextPosition forget_past;       /* Forget all about positions past this. */
  145.     XmTextPosition force_display;  /* Force this position to be displayed. */
  146.     XmTextPosition new_top;       /* Desired new top position. */
  147.     XmTextPosition last_top_char;  /* unused - available. */
  148.     XmTextPosition dest_position;  /* Location of the destination point. */
  149.     int disable_depth;           /* How many levels of disable we've done. */
  150.  
  151.     int pending_scroll;        /* Number of lines we want to scroll. */
  152.     int total_lines;        /* Total number of lines in the text widget */
  153.     int top_line;        /* Line number of the top visible line */
  154.     int vsbar_scrolling;    /* scrolling using the vertical scrollbar */
  155.  
  156.     Cardinal number_lines;    /* Number of line table entries. */
  157.     Cardinal maximum_lines;    /* Maximum number of line table entries. */
  158.     Line line;            /* Pointer to array of line table entries. */
  159.  
  160.     Ranges repaint;        /* Info on the repaint ranges. */
  161.     _XmHighlightData highlight;    /* Info on the highlighting regions. */
  162.     _XmHighlightData old_highlight;/* Old value of above. */
  163.     Widget inner_widget;    /* Pointer to widget which actually contains
  164.                    text (may be same or different from
  165.                    this record).  */
  166.     XmTextLineTable line_table;
  167.     unsigned int table_size;
  168.     unsigned int table_index;
  169.     /* Added by IXI */
  170.     Line  old_line;
  171.     Cardinal old_max_lines;
  172.     XmTextPosition tell_output_force_dpy;
  173. } XmTextPart;
  174.  
  175. typedef struct _XmTextRec {
  176.     CorePart    core;
  177.     XmPrimitivePart primitive;
  178.     XmTextPart text;
  179. } XmTextRec;
  180.  
  181.  
  182. /********    Private Function Declarations    ********/
  183. #ifdef _NO_PROTO
  184.  
  185. extern XmTextPosition _XmTextFindScroll() ;
  186. extern int _XmTextGetTotalLines() ;
  187. extern XmTextLineTable _XmTextGetLineTable() ;
  188. extern void _XmTextRealignLineTable() ;
  189. extern unsigned int _XmTextGetTableIndex() ;
  190. extern void _XmTextUpdateLineTable() ;
  191. extern void _XmTextMarkRedraw() ;
  192. extern LineNum _XmTextNumLines() ;
  193. extern void _XmTextLineInfo() ;
  194. extern LineNum _XmTextPosToLine() ;
  195. extern void _XmTextInvalidate() ;
  196. extern void _XmTextSetTopCharacter() ;
  197. extern int _XmTextCountCharacters() ;
  198. extern void _XmTextSetCursorPosition() ;
  199. extern void _XmTextDisableRedisplay() ;
  200. extern void _XmTextEnableRedisplay() ;
  201.  
  202. #else
  203.  
  204. extern XmTextPosition _XmTextFindScroll( 
  205.                         XmTextWidget widget,
  206.                         XmTextPosition start,
  207.                         int delta) ;
  208. extern int _XmTextGetTotalLines( 
  209.                         Widget widget) ;
  210. extern XmTextLineTable _XmTextGetLineTable( 
  211.                         Widget widget,
  212.                         int *total_lines) ;
  213. extern void _XmTextRealignLineTable( 
  214.                         XmTextWidget widget,
  215.                         XmTextLineTable *temp_table,
  216.                         int *temp_table_size,
  217.                         register unsigned int cur_index,
  218.                         register XmTextPosition cur_start,
  219.                         register XmTextPosition cur_end) ;
  220. extern unsigned int _XmTextGetTableIndex(
  221.             XmTextWidget widget,
  222.             XmTextPosition pos) ;
  223. extern void _XmTextUpdateLineTable( 
  224.                         Widget widget,
  225.                         XmTextPosition start,
  226.                         XmTextPosition end,
  227.                         XmTextBlock block,
  228. #if NeedWidePrototypes
  229.                         int update) ;
  230. #else
  231.                         Boolean update) ;
  232. #endif /* NeedWidePrototypes */
  233. extern void _XmTextMarkRedraw( 
  234.                         XmTextWidget widget,
  235.                         XmTextPosition left,
  236.                         XmTextPosition right) ;
  237. extern LineNum _XmTextNumLines( 
  238.                         XmTextWidget widget) ;
  239. extern void _XmTextLineInfo( 
  240.                         XmTextWidget widget,
  241.                         LineNum line,
  242.                         XmTextPosition *startpos,
  243.                         LineTableExtra *extra) ;
  244. extern LineNum _XmTextPosToLine( 
  245.                         XmTextWidget widget,
  246.                         XmTextPosition position) ;
  247. extern void _XmTextInvalidate( 
  248.                         XmTextWidget widget,
  249.                         XmTextPosition position,
  250.                         XmTextPosition topos,
  251.                         long delta) ;
  252. extern void _XmTextSetTopCharacter(
  253.                       Widget widget,
  254.                       XmTextPosition top_character) ;
  255. extern int _XmTextCountCharacters( 
  256.                         char *str,
  257.                         int num_count_bytes) ;
  258. extern void _XmTextSetCursorPosition( 
  259.                         Widget widget,
  260.                         XmTextPosition position) ;
  261. extern void _XmTextDisableRedisplay( 
  262.                         XmTextWidget widget,
  263. #if NeedWidePrototypes
  264.                         int losesbackingstore) ;
  265. #else
  266.                         Boolean losesbackingstore) ;
  267. #endif /* NeedWidePrototypes */
  268. extern void _XmTextEnableRedisplay( 
  269.                         XmTextWidget widget) ;
  270.  
  271. #endif /* _NO_PROTO */
  272. /********    End Private Function Declarations    ********/
  273.  
  274.  
  275. #ifdef __cplusplus
  276. }  /* Close scope of 'extern "C"' declaration which encloses file. */
  277. #endif
  278.  
  279. #endif /* _XmTextP_h */
  280. /* DON't ADD STUFF AFTER THIS #endif */
  281.