|
||||
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 _XmTextOutP_h 0024 #define _XmTextOutP_h 0025 0026 #include <Xm/XmP.h> 0027 #include <Xm/Text.h> 0028 0029 #ifdef __cplusplus 0030 extern "C" { 0031 #endif 0032 0033 /**************************************************************** 0034 * 0035 * Definitions for modules implementing and using text output routines. 0036 * 0037 ****************************************************************/ 0038 0039 #define ShouldWordWrap(data, widget) (data->wordwrap && \ 0040 (!(((XmDirectionMatch(XmPrim_layout_direction(widget), \ 0041 XmTOP_TO_BOTTOM_RIGHT_TO_LEFT)) ? \ 0042 data->scrollvertical : data->scrollhorizontal) \ 0043 && XmIsScrolledWindow(widget->core.parent))) \ 0044 && widget->text.edit_mode != XmSINGLE_LINE_EDIT) 0045 0046 typedef struct _LineTableExtraRec { 0047 Dimension width; 0048 Boolean wrappedbychar; 0049 } LineTableExtraRec, *LineTableExtra ; 0050 0051 /* 0052 * output.c (part of stext) 0053 */ 0054 0055 typedef unsigned int LineNum; 0056 typedef enum {on, off} OnOrOff; /* For when Booleans aren't obvious enough. */ 0057 0058 /* 0059 * Return the line number containing the given position. If text currently 0060 * knows of no line containing that position, returns NOLINE. 0061 */ 0062 0063 #define NOLINE 30000 0064 0065 /* 0066 * These next define the types of the routines that output is required 0067 * to export for use by text and by input. 0068 */ 0069 0070 typedef struct _OutputDataRec { 0071 XmFontList fontlist; /* Fontlist for text. */ 0072 unsigned int blinkrate; 0073 Boolean wordwrap; /* Whether to wordwrap. */ 0074 Boolean cursor_position_visible; 0075 Boolean autoshowinsertpoint; 0076 Boolean hasfocus; 0077 Boolean has_rect; 0078 Boolean handlingexposures; /* TRUE if in the midst of expose events. */ 0079 Boolean exposevscroll; /* Non-zero if we expect expose events to be 0080 off vertically. */ 0081 Boolean exposehscroll; /* Non-zero if we expect expose events to be 0082 off horizontally. */ 0083 Boolean resizewidth, resizeheight; 0084 Boolean scrollvertical, scrollhorizontal; 0085 Boolean scrollleftside, scrolltopside; 0086 Boolean ignorevbar; /* Whether to ignore callbacks from vbar. */ 0087 Boolean ignorehbar; /* Whether to ignore callbacks from hbar. */ 0088 short int cursor_on; /* Whether IBeam cursor is visible. */ 0089 Boolean refresh_ibeam_off; /* Indicates whether area under IBeam needs 0090 * to be re-captured */ 0091 Boolean suspend_hoffset; /* temporarily suspend horizontal scrolling */ 0092 Boolean use_fontset; /* True if font to be used is fontset (and 0093 * thus need X11R5 Xmb* routines to draw */ 0094 Boolean have_inverted_image_gc; /* fg/bg of image gc have been swapped; 0095 * on == True, off == False */ 0096 OnOrOff blinkstate; 0097 Position insertx, inserty; 0098 int number_lines; /* Number of lines that fit in the window. */ 0099 int leftmargin, rightmargin; 0100 int topmargin, bottommargin; 0101 int scrollwidth; /* Total width of text we have to display. */ 0102 int vsliderSize; /* How big the thumb is in the vbar. */ 0103 int hoffset; /* How much we've scrolled off the left. */ 0104 int averagecharwidth; /* Number of pixels for an "average" char. */ 0105 int tabwidth; /* Number of pixels for a tab. */ 0106 short columns, rows; 0107 Dimension lineheight; /* Number of pixels per line. */ 0108 Dimension minwidth, minheight; 0109 Dimension prevW; 0110 Dimension prevH; 0111 Dimension cursorwidth, cursorheight; 0112 Dimension font_ascent; /* ascent of the font[set] */ 0113 Dimension font_descent; /* descent of the font[set] */ 0114 XtIntervalId timerid; 0115 Pixmap cursor; /* Pixmap for IBeam cursor stencil. */ 0116 Pixmap add_mode_cursor; /* Pixmap to use for add mode cursor. */ 0117 Pixmap ibeam_off; /* Pixmap for area under the IBeam. */ 0118 Pixmap stipple_tile; /* stipple for add mode cursor. */ 0119 GC gc, imagegc; 0120 Widget vbar, hbar; 0121 XFontStruct *font; /* font used when NULL font is set. */ 0122 /* New for 1.2 */ 0123 GC save_gc; /* GC for saving/resotring under IBeam */ 0124 short columns_set, rows_set; /* history of previously set dimensions */ 0125 /* New for 2.0 */ 0126 XmRenderTable rendertable; /* Alias for fontlist - only for resource 0127 setting */ 0128 GC cursor_gc; /* 1-bit depth GC for creating the I-beam 0129 stipples (normal & add mode) */ 0130 int scrollheight; /* Total height of text we have to display. */ 0131 int voffset; /* How much we've scrolled off the top. */ 0132 int tabheight; /* Number of pixels for a tab. */ 0133 Dimension linewidth; /* Number of pixels per line (when vw). */ 0134 Boolean suspend_voffset; /* temporarily suspend horizontal scrolling */ 0135 #ifdef USE_XFT 0136 Boolean use_xft; /* True if font to be used is XftFont */ 0137 #endif 0138 } OutputDataRec, *OutputData; 0139 0140 0141 /* 0142 * Create a new instance of an output object. This is expected to fill in 0143 * info about innerwidget and output in the widget record. 0144 */ 0145 0146 typedef void (*OutputCreateProc)( 0147 Widget, 0148 ArgList, 0149 Cardinal) ; 0150 /* 0151 * Given an (x,y) coordinate, return the closest corresponding position. (For 0152 * use by input; text shouldn't ever need to know.) 0153 */ 0154 0155 typedef XmTextPosition (*XYToPosProc)( 0156 XmTextWidget, 0157 #if NeedWidePrototypes 0158 int, 0159 int) ; 0160 #else 0161 Position, /* These are relative to the */ 0162 Position) ; /* innerwindow returned above. */ 0163 #endif 0164 0165 /* 0166 * Return the (x,y) coordinate corresponing to the given position. If this 0167 * returns FALSE, then the given position isn't being displayed. 0168 */ 0169 0170 typedef Boolean (*PosToXYProc)( 0171 XmTextWidget, 0172 XmTextPosition, 0173 Position *, /* These are relative to the */ 0174 Position *) ; /* innerwindow returned above. */ 0175 0176 /* 0177 * Measures the extent of a line. Given the line number and starting position 0178 * of a line, returns the starting position of the next line. Also returns 0179 * any extra information that the output module may want to associate with 0180 * this line for future reference. (In particular, it will want to associate 0181 * a vertical coordinate for this line.) This routine should return FALSE if 0182 * it decides that this line will not fit in the window. FALSE should never 0183 * be returned if the line number is zero. Output may assume that the line 0184 * table for all preceeding lines have already been set. In particular, when 0185 * this routine will return FALSE, then output knows that the entire linetable 0186 * has been calculated; that is a good time for it to look over the linetable 0187 * and decide if it wants to do something obnoxious like resize the window. 0188 * 0189 * A possible value to put in nextpos is PASTENDPOS. This indicates that the 0190 * current line contains the end of the text in the source. 0191 * 0192 * nextpos may be NULL. If it is, then this indicates that we only want to 0193 * know if the line will fit on the window. The caller already has its own 0194 * idea where the next line will start if it does fit. (If nextpos is NULL, 0195 * then no extra information should be generated, and the 'extra' parameter 0196 * should be ignored.) 0197 */ 0198 0199 #define PASTENDPOS 2147483647 /* Biggest number that can fit in long */ 0200 0201 typedef Boolean (*MeasureLineProc)( 0202 XmTextWidget, 0203 LineNum, 0204 XmTextPosition, 0205 XmTextPosition *, 0206 LineTableExtraRec **) ; 0207 0208 /* 0209 * Draw some text within a line. The output finds out information about the 0210 * line by calling the line table routines. 0211 * 0212 * %%% Document special cases (like lines containing PASTENDPOS). 0213 */ 0214 0215 typedef void (*DrawProc)( 0216 XmTextWidget, 0217 LineNum, 0218 XmTextPosition, 0219 XmTextPosition, 0220 XmHighlightMode) ; 0221 0222 /* 0223 * Output should draw or erase an insertion point at the given position. 0224 */ 0225 0226 typedef void (*DrawInsertionPointProc)( 0227 XmTextWidget, 0228 XmTextPosition, 0229 OnOrOff) ; 0230 0231 /* 0232 * Output should ensure that the given position is visible (e.g., not scrolled 0233 * off horizontally). 0234 */ 0235 typedef void (*MakePositionVisibleProc)( 0236 XmTextWidget, 0237 XmTextPosition) ; 0238 0239 /* Text would like to move some lines around on the screen. It would like to 0240 * move lines fromline through toline (inclusive) to now start at line 0241 * destline. If output can perform this move by means of a XCopyArea or 0242 * similar simple call, it does so and returns TRUE; otherwise, it will return 0243 * FALSE. If TRUE, output should modify affected values in the 0244 * "extra" entries in the linetable, because after returning text will go ahead 0245 * and move linetable entries around. 0246 */ 0247 0248 typedef Boolean (*MoveLinesProc)( 0249 XmTextWidget, 0250 LineNum, 0251 LineNum, 0252 LineNum) ; 0253 0254 /* 0255 * Inform output of invalidated positions. 0256 */ 0257 0258 typedef void (*InvalidateProc)( 0259 XmTextWidget, 0260 XmTextPosition, 0261 XmTextPosition, 0262 long) ; 0263 0264 /* 0265 * Get preferred size of text widget based on the row and column 0266 * resources multiplied by font attributes as well as adding the 0267 * margin resource values to the computed size. 0268 */ 0269 typedef void (*GetPreferredSizeProc)( 0270 Widget, 0271 Dimension *, 0272 Dimension *) ; 0273 0274 /* 0275 * Get values out of the output object. 0276 */ 0277 0278 typedef void (*GetValuesProc)( 0279 Widget, 0280 ArgList, 0281 Cardinal) ; 0282 0283 /* 0284 * Set values in the output object. 0285 */ 0286 0287 typedef Boolean (*SetValuesProc)( 0288 Widget, 0289 Widget, 0290 Widget, 0291 ArgList, 0292 Cardinal *) ; 0293 0294 0295 typedef struct _OutputRec { 0296 struct _OutputDataRec *data; /* Output-specific data; opaque type. */ 0297 XYToPosProc XYToPos; 0298 PosToXYProc PosToXY; 0299 MeasureLineProc MeasureLine; 0300 DrawProc Draw; 0301 DrawInsertionPointProc DrawInsertionPoint; 0302 MakePositionVisibleProc MakePositionVisible; 0303 MoveLinesProc MoveLines; 0304 InvalidateProc Invalidate; 0305 GetPreferredSizeProc GetPreferredSize; 0306 GetValuesProc GetValues; 0307 SetValuesProc SetValues; 0308 XmRealizeOutProc realize; 0309 XtWidgetProc destroy; 0310 XmResizeFlagProc resize; 0311 XtExposeProc expose; 0312 } OutputRec; 0313 0314 0315 #ifdef __cplusplus 0316 } /* Close scope of 'extern "C"' declaration which encloses file. */ 0317 #endif 0318 0319 #endif /* _XmTextOutP_h */ 0320 /* DON'T ADD ANYTHING AFTER THIS #endif */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |