|
Packit |
b099d7 |
/*
|
|
Packit |
b099d7 |
* Motif
|
|
Packit |
b099d7 |
*
|
|
Packit |
b099d7 |
* Copyright (c) 1987-2012, The Open Group. All rights reserved.
|
|
Packit |
b099d7 |
*
|
|
Packit |
b099d7 |
* These libraries and programs are free software; you can
|
|
Packit |
b099d7 |
* redistribute them and/or modify them under the terms of the GNU
|
|
Packit |
b099d7 |
* Lesser General Public License as published by the Free Software
|
|
Packit |
b099d7 |
* Foundation; either version 2 of the License, or (at your option)
|
|
Packit |
b099d7 |
* any later version.
|
|
Packit |
b099d7 |
*
|
|
Packit |
b099d7 |
* These libraries and programs are distributed in the hope that
|
|
Packit |
b099d7 |
* they will be useful, but WITHOUT ANY WARRANTY; without even the
|
|
Packit |
b099d7 |
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
Packit |
b099d7 |
* PURPOSE. See the GNU Lesser General Public License for more
|
|
Packit |
b099d7 |
* details.
|
|
Packit |
b099d7 |
*
|
|
Packit |
b099d7 |
* You should have received a copy of the GNU Lesser General Public
|
|
Packit |
b099d7 |
* License along with these librararies and programs; if not, write
|
|
Packit |
b099d7 |
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
|
|
Packit |
b099d7 |
* Floor, Boston, MA 02110-1301 USA
|
|
Packit |
b099d7 |
*/
|
|
Packit |
b099d7 |
/*
|
|
Packit |
b099d7 |
* HISTORY
|
|
Packit |
b099d7 |
*/
|
|
Packit |
b099d7 |
/* $TOG: TextOutP.h /main/17 1997/03/18 10:55:51 dbl $ */
|
|
Packit |
b099d7 |
/* (c) Copyright 1989, DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. */
|
|
Packit |
b099d7 |
/* (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992 HEWLETT-PACKARD COMPANY */
|
|
Packit |
b099d7 |
/*
|
|
Packit |
b099d7 |
* (c) Copyright 1995 FUJITSU LIMITED
|
|
Packit |
b099d7 |
* This is source code modified by FUJITSU LIMITED under the Joint
|
|
Packit |
b099d7 |
* Development Agreement for the CDEnext PST.
|
|
Packit |
b099d7 |
* This is unpublished proprietary source code of FUJITSU LIMITED
|
|
Packit |
b099d7 |
*/
|
|
Packit |
b099d7 |
#ifndef _XmTextOutP_h
|
|
Packit |
b099d7 |
#define _XmTextOutP_h
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
#include <Xm/XmP.h>
|
|
Packit |
b099d7 |
#include <Xm/Text.h>
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
#ifdef __cplusplus
|
|
Packit |
b099d7 |
extern "C" {
|
|
Packit |
b099d7 |
#endif
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
/****************************************************************
|
|
Packit |
b099d7 |
*
|
|
Packit |
b099d7 |
* Definitions for modules implementing and using text output routines.
|
|
Packit |
b099d7 |
*
|
|
Packit |
b099d7 |
****************************************************************/
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
#define ShouldWordWrap(data, widget) (data->wordwrap && \
|
|
Packit |
b099d7 |
(!(((XmDirectionMatch(XmPrim_layout_direction(widget), \
|
|
Packit |
b099d7 |
XmTOP_TO_BOTTOM_RIGHT_TO_LEFT)) ? \
|
|
Packit |
b099d7 |
data->scrollvertical : data->scrollhorizontal) \
|
|
Packit |
b099d7 |
&& XmIsScrolledWindow(widget->core.parent))) \
|
|
Packit |
b099d7 |
&& widget->text.edit_mode != XmSINGLE_LINE_EDIT)
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
typedef struct _LineTableExtraRec {
|
|
Packit |
b099d7 |
Dimension width;
|
|
Packit |
b099d7 |
Boolean wrappedbychar;
|
|
Packit |
b099d7 |
} LineTableExtraRec, *LineTableExtra ;
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
/*
|
|
Packit |
b099d7 |
* output.c (part of stext)
|
|
Packit |
b099d7 |
*/
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
typedef unsigned int LineNum;
|
|
Packit |
b099d7 |
typedef enum {on, off} OnOrOff; /* For when Booleans aren't obvious enough. */
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
/*
|
|
Packit |
b099d7 |
* Return the line number containing the given position. If text currently
|
|
Packit |
b099d7 |
* knows of no line containing that position, returns NOLINE.
|
|
Packit |
b099d7 |
*/
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
#define NOLINE 30000
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
/*
|
|
Packit |
b099d7 |
* These next define the types of the routines that output is required
|
|
Packit |
b099d7 |
* to export for use by text and by input.
|
|
Packit |
b099d7 |
*/
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
typedef struct _OutputDataRec {
|
|
Packit |
b099d7 |
XmFontList fontlist; /* Fontlist for text. */
|
|
Packit |
b099d7 |
unsigned int blinkrate;
|
|
Packit |
b099d7 |
Boolean wordwrap; /* Whether to wordwrap. */
|
|
Packit |
b099d7 |
Boolean cursor_position_visible;
|
|
Packit |
b099d7 |
Boolean autoshowinsertpoint;
|
|
Packit |
b099d7 |
Boolean hasfocus;
|
|
Packit |
b099d7 |
Boolean has_rect;
|
|
Packit |
b099d7 |
Boolean handlingexposures; /* TRUE if in the midst of expose events. */
|
|
Packit |
b099d7 |
Boolean exposevscroll; /* Non-zero if we expect expose events to be
|
|
Packit |
b099d7 |
off vertically. */
|
|
Packit |
b099d7 |
Boolean exposehscroll; /* Non-zero if we expect expose events to be
|
|
Packit |
b099d7 |
off horizontally. */
|
|
Packit |
b099d7 |
Boolean resizewidth, resizeheight;
|
|
Packit |
b099d7 |
Boolean scrollvertical, scrollhorizontal;
|
|
Packit |
b099d7 |
Boolean scrollleftside, scrolltopside;
|
|
Packit |
b099d7 |
Boolean ignorevbar; /* Whether to ignore callbacks from vbar. */
|
|
Packit |
b099d7 |
Boolean ignorehbar; /* Whether to ignore callbacks from hbar. */
|
|
Packit |
b099d7 |
short int cursor_on; /* Whether IBeam cursor is visible. */
|
|
Packit |
b099d7 |
Boolean refresh_ibeam_off; /* Indicates whether area under IBeam needs
|
|
Packit |
b099d7 |
* to be re-captured */
|
|
Packit |
b099d7 |
Boolean suspend_hoffset; /* temporarily suspend horizontal scrolling */
|
|
Packit |
b099d7 |
Boolean use_fontset; /* True if font to be used is fontset (and
|
|
Packit |
b099d7 |
* thus need X11R5 Xmb* routines to draw */
|
|
Packit |
b099d7 |
Boolean have_inverted_image_gc; /* fg/bg of image gc have been swapped;
|
|
Packit |
b099d7 |
* on == True, off == False */
|
|
Packit |
b099d7 |
OnOrOff blinkstate;
|
|
Packit |
b099d7 |
Position insertx, inserty;
|
|
Packit |
b099d7 |
int number_lines; /* Number of lines that fit in the window. */
|
|
Packit |
b099d7 |
int leftmargin, rightmargin;
|
|
Packit |
b099d7 |
int topmargin, bottommargin;
|
|
Packit |
b099d7 |
int scrollwidth; /* Total width of text we have to display. */
|
|
Packit |
b099d7 |
int vsliderSize; /* How big the thumb is in the vbar. */
|
|
Packit |
b099d7 |
int hoffset; /* How much we've scrolled off the left. */
|
|
Packit |
b099d7 |
int averagecharwidth; /* Number of pixels for an "average" char. */
|
|
Packit |
b099d7 |
int tabwidth; /* Number of pixels for a tab. */
|
|
Packit |
b099d7 |
short columns, rows;
|
|
Packit |
b099d7 |
Dimension lineheight; /* Number of pixels per line. */
|
|
Packit |
b099d7 |
Dimension minwidth, minheight;
|
|
Packit |
b099d7 |
Dimension prevW;
|
|
Packit |
b099d7 |
Dimension prevH;
|
|
Packit |
b099d7 |
Dimension cursorwidth, cursorheight;
|
|
Packit |
b099d7 |
Dimension font_ascent; /* ascent of the font[set] */
|
|
Packit |
b099d7 |
Dimension font_descent; /* descent of the font[set] */
|
|
Packit |
b099d7 |
XtIntervalId timerid;
|
|
Packit |
b099d7 |
Pixmap cursor; /* Pixmap for IBeam cursor stencil. */
|
|
Packit |
b099d7 |
Pixmap add_mode_cursor; /* Pixmap to use for add mode cursor. */
|
|
Packit |
b099d7 |
Pixmap ibeam_off; /* Pixmap for area under the IBeam. */
|
|
Packit |
b099d7 |
Pixmap stipple_tile; /* stipple for add mode cursor. */
|
|
Packit |
b099d7 |
GC gc, imagegc;
|
|
Packit |
b099d7 |
Widget vbar, hbar;
|
|
Packit |
b099d7 |
XFontStruct *font; /* font used when NULL font is set. */
|
|
Packit |
b099d7 |
/* New for 1.2 */
|
|
Packit |
b099d7 |
GC save_gc; /* GC for saving/resotring under IBeam */
|
|
Packit |
b099d7 |
short columns_set, rows_set; /* history of previously set dimensions */
|
|
Packit |
b099d7 |
/* New for 2.0 */
|
|
Packit |
b099d7 |
XmRenderTable rendertable; /* Alias for fontlist - only for resource
|
|
Packit |
b099d7 |
setting */
|
|
Packit |
b099d7 |
GC cursor_gc; /* 1-bit depth GC for creating the I-beam
|
|
Packit |
b099d7 |
stipples (normal & add mode) */
|
|
Packit |
b099d7 |
int scrollheight; /* Total height of text we have to display. */
|
|
Packit |
b099d7 |
int voffset; /* How much we've scrolled off the top. */
|
|
Packit |
b099d7 |
int tabheight; /* Number of pixels for a tab. */
|
|
Packit |
b099d7 |
Dimension linewidth; /* Number of pixels per line (when vw). */
|
|
Packit |
b099d7 |
Boolean suspend_voffset; /* temporarily suspend horizontal scrolling */
|
|
Packit |
b099d7 |
#ifdef USE_XFT
|
|
Packit |
b099d7 |
Boolean use_xft; /* True if font to be used is XftFont */
|
|
Packit |
b099d7 |
#endif
|
|
Packit |
b099d7 |
} OutputDataRec, *OutputData;
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
/*
|
|
Packit |
b099d7 |
* Create a new instance of an output object. This is expected to fill in
|
|
Packit |
b099d7 |
* info about innerwidget and output in the widget record.
|
|
Packit |
b099d7 |
*/
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
typedef void (*OutputCreateProc)(
|
|
Packit |
b099d7 |
Widget,
|
|
Packit |
b099d7 |
ArgList,
|
|
Packit |
b099d7 |
Cardinal) ;
|
|
Packit |
b099d7 |
/*
|
|
Packit |
b099d7 |
* Given an (x,y) coordinate, return the closest corresponding position. (For
|
|
Packit |
b099d7 |
* use by input; text shouldn't ever need to know.)
|
|
Packit |
b099d7 |
*/
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
typedef XmTextPosition (*XYToPosProc)(
|
|
Packit |
b099d7 |
XmTextWidget,
|
|
Packit |
b099d7 |
#if NeedWidePrototypes
|
|
Packit |
b099d7 |
int,
|
|
Packit |
b099d7 |
int) ;
|
|
Packit |
b099d7 |
#else
|
|
Packit |
b099d7 |
Position, /* These are relative to the */
|
|
Packit |
b099d7 |
Position) ; /* innerwindow returned above. */
|
|
Packit |
b099d7 |
#endif
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
/*
|
|
Packit |
b099d7 |
* Return the (x,y) coordinate corresponing to the given position. If this
|
|
Packit |
b099d7 |
* returns FALSE, then the given position isn't being displayed.
|
|
Packit |
b099d7 |
*/
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
typedef Boolean (*PosToXYProc)(
|
|
Packit |
b099d7 |
XmTextWidget,
|
|
Packit |
b099d7 |
XmTextPosition,
|
|
Packit |
b099d7 |
Position *, /* These are relative to the */
|
|
Packit |
b099d7 |
Position *) ; /* innerwindow returned above. */
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
/*
|
|
Packit |
b099d7 |
* Measures the extent of a line. Given the line number and starting position
|
|
Packit |
b099d7 |
* of a line, returns the starting position of the next line. Also returns
|
|
Packit |
b099d7 |
* any extra information that the output module may want to associate with
|
|
Packit |
b099d7 |
* this line for future reference. (In particular, it will want to associate
|
|
Packit |
b099d7 |
* a vertical coordinate for this line.) This routine should return FALSE if
|
|
Packit |
b099d7 |
* it decides that this line will not fit in the window. FALSE should never
|
|
Packit |
b099d7 |
* be returned if the line number is zero. Output may assume that the line
|
|
Packit |
b099d7 |
* table for all preceeding lines have already been set. In particular, when
|
|
Packit |
b099d7 |
* this routine will return FALSE, then output knows that the entire linetable
|
|
Packit |
b099d7 |
* has been calculated; that is a good time for it to look over the linetable
|
|
Packit |
b099d7 |
* and decide if it wants to do something obnoxious like resize the window.
|
|
Packit |
b099d7 |
*
|
|
Packit |
b099d7 |
* A possible value to put in nextpos is PASTENDPOS. This indicates that the
|
|
Packit |
b099d7 |
* current line contains the end of the text in the source.
|
|
Packit |
b099d7 |
*
|
|
Packit |
b099d7 |
* nextpos may be NULL. If it is, then this indicates that we only want to
|
|
Packit |
b099d7 |
* know if the line will fit on the window. The caller already has its own
|
|
Packit |
b099d7 |
* idea where the next line will start if it does fit. (If nextpos is NULL,
|
|
Packit |
b099d7 |
* then no extra information should be generated, and the 'extra' parameter
|
|
Packit |
b099d7 |
* should be ignored.)
|
|
Packit |
b099d7 |
*/
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
#define PASTENDPOS 2147483647 /* Biggest number that can fit in long */
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
typedef Boolean (*MeasureLineProc)(
|
|
Packit |
b099d7 |
XmTextWidget,
|
|
Packit |
b099d7 |
LineNum,
|
|
Packit |
b099d7 |
XmTextPosition,
|
|
Packit |
b099d7 |
XmTextPosition *,
|
|
Packit |
b099d7 |
LineTableExtraRec **) ;
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
/*
|
|
Packit |
b099d7 |
* Draw some text within a line. The output finds out information about the
|
|
Packit |
b099d7 |
* line by calling the line table routines.
|
|
Packit |
b099d7 |
*
|
|
Packit |
b099d7 |
* %%% Document special cases (like lines containing PASTENDPOS).
|
|
Packit |
b099d7 |
*/
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
typedef void (*DrawProc)(
|
|
Packit |
b099d7 |
XmTextWidget,
|
|
Packit |
b099d7 |
LineNum,
|
|
Packit |
b099d7 |
XmTextPosition,
|
|
Packit |
b099d7 |
XmTextPosition,
|
|
Packit |
b099d7 |
XmHighlightMode) ;
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
/*
|
|
Packit |
b099d7 |
* Output should draw or erase an insertion point at the given position.
|
|
Packit |
b099d7 |
*/
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
typedef void (*DrawInsertionPointProc)(
|
|
Packit |
b099d7 |
XmTextWidget,
|
|
Packit |
b099d7 |
XmTextPosition,
|
|
Packit |
b099d7 |
OnOrOff) ;
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
/*
|
|
Packit |
b099d7 |
* Output should ensure that the given position is visible (e.g., not scrolled
|
|
Packit |
b099d7 |
* off horizontally).
|
|
Packit |
b099d7 |
*/
|
|
Packit |
b099d7 |
typedef void (*MakePositionVisibleProc)(
|
|
Packit |
b099d7 |
XmTextWidget,
|
|
Packit |
b099d7 |
XmTextPosition) ;
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
/* Text would like to move some lines around on the screen. It would like to
|
|
Packit |
b099d7 |
* move lines fromline through toline (inclusive) to now start at line
|
|
Packit |
b099d7 |
* destline. If output can perform this move by means of a XCopyArea or
|
|
Packit |
b099d7 |
* similar simple call, it does so and returns TRUE; otherwise, it will return
|
|
Packit |
b099d7 |
* FALSE. If TRUE, output should modify affected values in the
|
|
Packit |
b099d7 |
* "extra" entries in the linetable, because after returning text will go ahead
|
|
Packit |
b099d7 |
* and move linetable entries around.
|
|
Packit |
b099d7 |
*/
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
typedef Boolean (*MoveLinesProc)(
|
|
Packit |
b099d7 |
XmTextWidget,
|
|
Packit |
b099d7 |
LineNum,
|
|
Packit |
b099d7 |
LineNum,
|
|
Packit |
b099d7 |
LineNum) ;
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
/*
|
|
Packit |
b099d7 |
* Inform output of invalidated positions.
|
|
Packit |
b099d7 |
*/
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
typedef void (*InvalidateProc)(
|
|
Packit |
b099d7 |
XmTextWidget,
|
|
Packit |
b099d7 |
XmTextPosition,
|
|
Packit |
b099d7 |
XmTextPosition,
|
|
Packit |
b099d7 |
long) ;
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
/*
|
|
Packit |
b099d7 |
* Get preferred size of text widget based on the row and column
|
|
Packit |
b099d7 |
* resources multiplied by font attributes as well as adding the
|
|
Packit |
b099d7 |
* margin resource values to the computed size.
|
|
Packit |
b099d7 |
*/
|
|
Packit |
b099d7 |
typedef void (*GetPreferredSizeProc)(
|
|
Packit |
b099d7 |
Widget,
|
|
Packit |
b099d7 |
Dimension *,
|
|
Packit |
b099d7 |
Dimension *) ;
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
/*
|
|
Packit |
b099d7 |
* Get values out of the output object.
|
|
Packit |
b099d7 |
*/
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
typedef void (*GetValuesProc)(
|
|
Packit |
b099d7 |
Widget,
|
|
Packit |
b099d7 |
ArgList,
|
|
Packit |
b099d7 |
Cardinal) ;
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
/*
|
|
Packit |
b099d7 |
* Set values in the output object.
|
|
Packit |
b099d7 |
*/
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
typedef Boolean (*SetValuesProc)(
|
|
Packit |
b099d7 |
Widget,
|
|
Packit |
b099d7 |
Widget,
|
|
Packit |
b099d7 |
Widget,
|
|
Packit |
b099d7 |
ArgList,
|
|
Packit |
b099d7 |
Cardinal *) ;
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
typedef struct _OutputRec {
|
|
Packit |
b099d7 |
struct _OutputDataRec *data; /* Output-specific data; opaque type. */
|
|
Packit |
b099d7 |
XYToPosProc XYToPos;
|
|
Packit |
b099d7 |
PosToXYProc PosToXY;
|
|
Packit |
b099d7 |
MeasureLineProc MeasureLine;
|
|
Packit |
b099d7 |
DrawProc Draw;
|
|
Packit |
b099d7 |
DrawInsertionPointProc DrawInsertionPoint;
|
|
Packit |
b099d7 |
MakePositionVisibleProc MakePositionVisible;
|
|
Packit |
b099d7 |
MoveLinesProc MoveLines;
|
|
Packit |
b099d7 |
InvalidateProc Invalidate;
|
|
Packit |
b099d7 |
GetPreferredSizeProc GetPreferredSize;
|
|
Packit |
b099d7 |
GetValuesProc GetValues;
|
|
Packit |
b099d7 |
SetValuesProc SetValues;
|
|
Packit |
b099d7 |
XmRealizeOutProc realize;
|
|
Packit |
b099d7 |
XtWidgetProc destroy;
|
|
Packit |
b099d7 |
XmResizeFlagProc resize;
|
|
Packit |
b099d7 |
XtExposeProc expose;
|
|
Packit |
b099d7 |
} OutputRec;
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
#ifdef __cplusplus
|
|
Packit |
b099d7 |
} /* Close scope of 'extern "C"' declaration which encloses file. */
|
|
Packit |
b099d7 |
#endif
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
#endif /* _XmTextOutP_h */
|
|
Packit |
b099d7 |
/* DON'T ADD ANYTHING AFTER THIS #endif */
|