1 /** 2 * 3 * $Header: /cvsroot/lesstif/lesstif/include/Motif-2.1/Xm/TextOutP.h,v 1.2 2005/03/29 15:28:00 dannybackx Exp $ 4 * 5 * Copyright (C) 1995 Free Software Foundation, Inc. 6 * Copyright � 1995, 1997, 1999, 2000, 2001, 2002 LessTif Development Team 7 * 8 * This file is part of the GNU LessTif Library. 9 * 10 * This library is free software; you can redistribute it and/or 11 * modify it under the terms of the GNU Library General Public 12 * License as published by the Free Software Foundation; either 13 * version 2 of the License, or (at your option) any later version. 14 * 15 * This library is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 * Library General Public License for more details. 19 * 20 * You should have received a copy of the GNU Library General Public 21 * License along with this library; if not, write to the Free 22 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 23 * 24 **/ 25 26 #ifndef _XM_TEXTOUTP_H 27 #define _XM_TEXTOUTP_H 28 29 #include <Xm/XmP.h> 30 #include <Xm/Text.h> 31 #include <limits.h> /* for INT_MAX */ 32 33 #ifdef __cplusplus 34 extern "C" { 35 #endif 36 37 #define NOLINE 30000 38 #define PASTENDPOS INT_MAX 39 40 typedef struct _LineTableExtraRec { 41 Dimension width; 42 Boolean wrappedbychar; 43 } LineTableExtraRec, *LineTableExtra; 44 45 typedef unsigned int LineNum; 46 typedef enum { 47 on, 48 off 49 } OnOrOff; 50 51 typedef struct _OutputDataRec { 52 XmFontList fontlist; 53 unsigned int blinkrate; 54 Boolean wordwrap; 55 Boolean cursor_position_visible; 56 Boolean autoshowinsertpoint; 57 Boolean hasfocus; 58 Boolean has_rect; 59 Boolean handlingexposures; 60 Boolean exposevscroll; 61 Boolean exposehscroll; 62 Boolean resizewidth, resizeheight; 63 Boolean scrollvertical, scrollhorizontal; 64 Boolean scrollleftside, scrolltopside; 65 Boolean ignorevbar; 66 Boolean ignorehbar; 67 short int cursor_on; 68 Boolean refresh_ibeam_off; 69 Boolean suspend_hoffset; 70 Boolean use_fontset; 71 Boolean have_inverted_image_gc; 72 OnOrOff blinkstate; 73 Position insertx, inserty; 74 int number_lines; 75 int leftmargin, rightmargin; 76 int topmargin, bottommargin; 77 int scrollwidth; 78 int vsliderSize; 79 int hoffset; 80 int averagecharwidth; 81 int tabwidth; 82 short columns, rows; 83 Dimension lineheight; 84 Dimension minwidth, minheight; 85 Dimension prevW; 86 Dimension prevH; 87 Dimension cursorwidth, cursorheight; 88 Dimension font_ascent; 89 Dimension font_descent; 90 XtIntervalId timerid; 91 Pixmap cursor; 92 Pixmap add_mode_cursor; 93 Pixmap ibeam_off; 94 Pixmap stipple_tile; 95 GC gc, imagegc; 96 Widget vbar, hbar; 97 XFontStruct *font; 98 GC save_gc; 99 short columns_set, rows_set; 100 101 /* rwmcm: Extra stuff that I'm not sure I will need */ 102 Boolean fontlist_created; 103 104 /* Stuff to support anti-aliased fonts through Xft */ 105 XmFontType font_type; 106 XtPointer xft_font; /* Should be 'XftFont *' but this would require an 107 * additional include file. */ 108 Boolean check_set_render_table; 109 } OutputDataRec, *OutputData; 110 111 typedef void (*OutputCreateProc)(Widget, ArgList, Cardinal); 112 typedef XmTextPosition (*XYToPosProc)(XmTextWidget, Position, Position); 113 typedef void (*GetPreferredSizeProc)(Widget, Dimension *, Dimension *); 114 typedef void (*GetValuesProc)(Widget, ArgList, Cardinal); 115 typedef Boolean (*SetValuesProc)(Widget, Widget, Widget, ArgList, Cardinal *); 116 typedef void (*DrawInsertionPointProc)(XmTextWidget, XmTextPosition, OnOrOff); 117 typedef void (*MakePositionVisibleProc)(XmTextWidget, XmTextPosition); 118 typedef Boolean (*MoveLinesProc)(XmTextWidget, LineNum, LineNum, LineNum); 119 typedef Boolean (*PosToXYProc)(XmTextWidget, XmTextPosition, Position *, Position *); 120 typedef Boolean (*MeasureLineProc)(XmTextWidget, 121 LineNum, 122 XmTextPosition, 123 XmTextPosition *, 124 LineTableExtraRec **); 125 typedef void (*DrawProc)(XmTextWidget, 126 LineNum, 127 XmTextPosition, 128 XmTextPosition, 129 XmHighlightMode) ; 130 typedef void (*InvalidateProc)(XmTextWidget, 131 XmTextPosition, 132 XmTextPosition, 133 long); 134 135 136 typedef struct _OutputRec { 137 struct _OutputDataRec *data; 138 XYToPosProc XYToPos; 139 PosToXYProc PosToXY; 140 MeasureLineProc MeasureLine; 141 DrawProc Draw; 142 DrawInsertionPointProc DrawInsertionPoint; 143 MakePositionVisibleProc MakePositionVisible; 144 MoveLinesProc MoveLines; 145 InvalidateProc Invalidate; 146 GetPreferredSizeProc GetPreferredSize; 147 GetValuesProc GetValues; 148 SetValuesProc SetValues; 149 XmRealizeOutProc realize; 150 XtWidgetProc destroy; 151 XmResizeFlagProc resize; 152 XtExposeProc expose; 153 } OutputRec; 154 155 156 void _XmTextDrawDestination(XmTextWidget widget); 157 void _XmTextClearDestination(XmTextWidget widget, Boolean ignore_sens); 158 void _XmTextDestinationVisible(Widget w, Boolean turn_on); 159 void _XmTextChangeBlinkBehavior(XmTextWidget widget, Boolean newvalue); 160 void _XmTextOutputCreate(Widget wid, ArgList args, Cardinal num_args); 161 void _XmTextAdjustGC(XmTextWidget tw); 162 Boolean _XmTextShouldWordWrap(XmTextWidget widget); 163 Boolean _XmTextScrollable(XmTextWidget widget); 164 void _XmTextOutputGetSecResData(XmSecondaryResourceData *secResDataRtn); 165 int _XmTextGetNumberLines(XmTextWidget widget); 166 Boolean _XmTextGetDisplayRect(Widget w, XRectangle *display_rect); 167 void _XmTextMarginsProc(Widget w, XmBaselineMargins *margins_rec); 168 void _XmTextChangeHOffset(XmTextWidget widget, int length); 169 void _XmTextToggleCursorGC(Widget widget); 170 void _XmTextFreeContextData(Widget w, 171 XtPointer clientData, 172 XtPointer callData); 173 void _XmTextResetClipOrigin(XmTextWidget tw, 174 XmTextPosition position, 175 Boolean clip_mask_reset) ; 176 XmTextPosition _XmTextFindLineEnd(XmTextWidget w, 177 XmTextPosition pos, 178 LineTableExtra *extra); 179 void _XmTextMovingCursorPosition(XmTextWidget w, XmTextPosition pos); 180 Boolean _XmTextGetBaselines(Widget widget, 181 Dimension **baselines, 182 int *line_count) ; 183 int _XmOut_FontTextWidth(OutputData o, char *s, int l); 184 int _XmOut_FontMaxWidth(OutputData o); 185 186 187 #define Out_XOffset(o) (o->hoffset) 188 /*CP:The next 2 macros are badly named and are not used correctly in the sources */ 189 #define Out_XDraw(o) (o->prevW) 190 #define Out_YDraw(o) (o->prevH) 191 #define Out_PrevW(o) (o->prevW) 192 #define Out_PrevH(o) (o->prevH) 193 /* 194 #define Out_FontHeight(o) (o->lineheight) 195 */ 196 #ifdef USE_XFT 197 # define Out_FontHeight(o) \ 198 (Out_XftFont(o) ? Out_XftFont(o)->height : o->lineheight) 199 #define Out_FontAscent(o) \ 200 (Out_XftFont(o) ? Out_XftFont(o)->ascent : o->font->max_bounds.ascent) 201 #define Out_FontDescent(o) \ 202 (Out_XftFont(o) ? Out_XftFont(o)->descent : o->font->max_bounds.descent) 203 #else 204 # define Out_FontHeight(o) (o->lineheight) 205 # define Out_FontAscent(o) (o->font->max_bounds.ascent) 206 # define Out_FontDescent(o) (o->font->max_bounds.descent) 207 #endif 208 #define Out_CursorSave(o) (o->ibeam_off) 209 #define Out_CursorSaveValid(o) (o->refresh_ibeam_off) 210 #define Out_CursorIBeam(o) (o->cursor) 211 #define Out_CursorAddMode(o) (o->add_mode_cursor) 212 #define Out_CursorStipple(o) (o->stipple_tile) 213 #define Out_CursorX(o) (o->insertx) 214 #define Out_CursorY(o) (o->inserty) 215 #define Out_CursorPositionVisible(o) (o->cursor_position_visible) 216 #define Out_CursorHeight(o) (o->cursorheight) 217 #define Out_CursorWidth(o) (o->cursorwidth) 218 219 #define Out_Font(o) (o->font) 220 #define Out_FontList(o) (o->fontlist) 221 #define Out_FontListCreated(o) (o->fontlist_created) 222 #define Out_FontType(o) (o->font_type) 223 /* 224 * This macro is obsolete 225 * #define Out_FontTextWidth(o,s,l) (int)XTextWidth(Out_Font(o), s, l) 226 */ 227 #define Out_FontAverageWidth(o) (o->averagecharwidth) 228 #define Out_Font_Ascent(o) (o->font_ascent) 229 #define Out_Font_Descent(o) (o->font_descent) 230 #define Out_DrawGC(o) (o->gc) /* drawing and copying */ 231 #define Out_DrawGCInverted(o) (o->have_inverted_image_gc) 232 #define Out_CursorGC(o) (o->imagegc) /* highlighting text */ 233 #define Out_CopyGC(o) (o->save_gc) /* cursor (not clipped) */ 234 235 #define Out_BlinkRate(o) (o->blinkrate) 236 #define Out_BlinkState(o) (o->blinkstate) 237 #define Out_BlinkOn(o) (o->cursor_on) 238 #define Out_Columns(o) (o->columns) 239 #define Out_ColumnsSet(o) (o->columns_set) 240 #define Out_HasFocus(o) (o->hasfocus) 241 #define Out_ResizeWidth(o) (o->resizewidth) 242 #define Out_ResizeHeight(o) (o->resizeheight) 243 #define Out_MinWidth(o) (o->minwidth) 244 #define Out_MinHeight(o) (o->minheight) 245 #define Out_OldLength(o) (o->old_length) 246 #define Out_Rows(o) (o->rows) 247 #define Out_RowsSet(o) (o->rows_set) 248 #define Out_TimerId(o) (o->timerid) 249 #define Out_TabWidth(o) (o->tabwidth) 250 #define Out_ScrollVertical(o) (o->scrollvertical) 251 #define Out_ScrollHorizontal(o) (o->scrollhorizontal) 252 #define Out_ScrollLeftSide(o) (o->scrollleftside) 253 #define Out_ScrollTopSide(o) (o->scrolltopside) 254 #define Out_Vbar(o) (o->vbar) 255 #define Out_Hbar(o) (o->hbar) 256 #define Out_ScrollWidth(o) (o->scrollwidth) 257 #define Out_NumberLines(o) (o->number_lines) 258 #define Out_WordWrap(o) (o->wordwrap) 259 #define Out_LeftMargin(o) (o->leftmargin) 260 #define Out_RightMargin(o) (o->rightmargin) 261 #define Out_TopMargin(o) (o->topmargin) 262 #define Out_BottomMargin(o) (o->bottommargin) 263 #define Out_ExposeVScroll(o) (o->exposevscroll) 264 #define Out_ExposeHScroll(o) (o->exposehscroll) 265 #define Out_HandlingExposures(o) (o->handlingexposures) 266 #define Out_UseFontSet(o) (o->use_fontset) 267 #define Out_XftFont(o) ((XftFont *)(o->xft_font)) 268 269 #ifdef __cplusplus 270 } 271 #endif 272 273 #endif /* _XM_TEXTOUTP_H */ 274