📄 tktext.h
字号:
* node there is no information about the * tag. One or more children of the node * do contain information about the tag. */ int toggleCount; /* Total number of tag toggles */ /* * Information for displaying text with this tag. The information * belows acts as an override on information specified by lower-priority * tags. If no value is specified, then the next-lower-priority tag * on the text determins the value. The text widget itself provides * defaults if no tag specifies an override. */ Tk_3DBorder border; /* Used for drawing background. NULL means * no value specified here. */ char *bdString; /* -borderwidth option string (malloc-ed). * NULL means option not specified. */ int borderWidth; /* Width of 3-D border for background. */ char *reliefString; /* -relief option string (malloc-ed). * NULL means option not specified. */ int relief; /* 3-D relief for background. */ Pixmap bgStipple; /* Stipple bitmap for background. None * means no value specified here. */ XColor *fgColor; /* Foreground color for text. NULL means * no value specified here. */ Tk_Font tkfont; /* Font for displaying text. NULL means * no value specified here. */ Pixmap fgStipple; /* Stipple bitmap for text and other * foreground stuff. None means no value * specified here.*/ char *justifyString; /* -justify option string (malloc-ed). * NULL means option not specified. */ Tk_Justify justify; /* How to justify text: TK_JUSTIFY_LEFT, * TK_JUSTIFY_RIGHT, or TK_JUSTIFY_CENTER. * Only valid if justifyString is non-NULL. */ char *lMargin1String; /* -lmargin1 option string (malloc-ed). * NULL means option not specified. */ int lMargin1; /* Left margin for first display line of * each text line, in pixels. Only valid * if lMargin1String is non-NULL. */ char *lMargin2String; /* -lmargin2 option string (malloc-ed). * NULL means option not specified. */ int lMargin2; /* Left margin for second and later display * lines of each text line, in pixels. Only * valid if lMargin2String is non-NULL. */ char *offsetString; /* -offset option string (malloc-ed). * NULL means option not specified. */ int offset; /* Vertical offset of text's baseline from * baseline of line. Used for superscripts * and subscripts. Only valid if * offsetString is non-NULL. */ char *overstrikeString; /* -overstrike option string (malloc-ed). * NULL means option not specified. */ int overstrike; /* Non-zero means draw horizontal line through * middle of text. Only valid if * overstrikeString is non-NULL. */ char *rMarginString; /* -rmargin option string (malloc-ed). * NULL means option not specified. */ int rMargin; /* Right margin for text, in pixels. Only * valid if rMarginString is non-NULL. */ char *spacing1String; /* -spacing1 option string (malloc-ed). * NULL means option not specified. */ int spacing1; /* Extra spacing above first display * line for text line. Only valid if * spacing1String is non-NULL. */ char *spacing2String; /* -spacing2 option string (malloc-ed). * NULL means option not specified. */ int spacing2; /* Extra spacing between display * lines for the same text line. Only valid * if spacing2String is non-NULL. */ char *spacing3String; /* -spacing2 option string (malloc-ed). * NULL means option not specified. */ int spacing3; /* Extra spacing below last display * line for text line. Only valid if * spacing3String is non-NULL. */ char *tabString; /* -tabs option string (malloc-ed). * NULL means option not specified. */ struct TkTextTabArray *tabArrayPtr; /* Info about tabs for tag (malloc-ed) * or NULL. Corresponds to tabString. */ char *underlineString; /* -underline option string (malloc-ed). * NULL means option not specified. */ int underline; /* Non-zero means draw underline underneath * text. Only valid if underlineString is * non-NULL. */ Tk_Uid wrapMode; /* How to handle wrap-around for this tag. * Must be tkTextCharUid, tkTextNoneUid, * tkTextWordUid, or NULL to use wrapMode * for whole widget. */ int affectsDisplay; /* Non-zero means that this tag affects the * way information is displayed on the screen * (so need to redisplay if tag changes). */} TkTextTag;#define TK_TAG_AFFECTS_DISPLAY 0x1#define TK_TAG_UNDERLINE 0x2#define TK_TAG_JUSTIFY 0x4#define TK_TAG_OFFSET 0x10/* * The data structure below is used for searching a B-tree for transitions * on a single tag (or for all tag transitions). No code outside of * tkTextBTree.c should ever modify any of the fields in these structures, * but it's OK to use them for read-only information. */typedef struct TkTextSearch { TkTextIndex curIndex; /* Position of last tag transition * returned by TkBTreeNextTag, or * index of start of segment * containing starting position for * search if TkBTreeNextTag hasn't * been called yet, or same as * stopIndex if search is over. */ TkTextSegment *segPtr; /* Actual tag segment returned by last * call to TkBTreeNextTag, or NULL if * TkBTreeNextTag hasn't returned * anything yet. */ TkTextSegment *nextPtr; /* Where to resume search in next * call to TkBTreeNextTag. */ TkTextSegment *lastPtr; /* Stop search before just before * considering this segment. */ TkTextTag *tagPtr; /* Tag to search for (or tag found, if * allTags is non-zero). */ int linesLeft; /* Lines left to search (including * curIndex and stopIndex). When * this becomes <= 0 the search is * over. */ int allTags; /* Non-zero means ignore tag check: * search for transitions on all * tags. */} TkTextSearch;/* * The following data structure describes a single tab stop. */typedef enum {LEFT, RIGHT, CENTER, NUMERIC} TkTextTabAlign;typedef struct TkTextTab { int location; /* Offset in pixels of this tab stop * from the left margin (lmargin2) of * the text. */ TkTextTabAlign alignment; /* Where the tab stop appears relative * to the text. */} TkTextTab;typedef struct TkTextTabArray { int numTabs; /* Number of tab stops. */ TkTextTab tabs[1]; /* Array of tabs. The actual size * will be numTabs. THIS FIELD MUST * BE THE LAST IN THE STRUCTURE. */} TkTextTabArray;/* * A data structure of the following type is kept for each text widget that * currently exists for this process: */typedef struct TkText { Tk_Window tkwin; /* Window that embodies the text. NULL * means that the window has been destroyed * but the data structures haven't yet been * cleaned up.*/ Display *display; /* Display for widget. Needed, among other * things, to allow resources to be freed * even after tkwin has gone away. */ Tcl_Interp *interp; /* Interpreter associated with widget. Used * to delete widget command. */ Tcl_Command widgetCmd; /* Token for text's widget command. */ TkTextBTree tree; /* B-tree representation of text and tags for * widget. */ Tcl_HashTable tagTable; /* Hash table that maps from tag names to * pointers to TkTextTag structures. */ int numTags; /* Number of tags currently defined for * widget; needed to keep track of * priorities. */ Tcl_HashTable markTable; /* Hash table that maps from mark names to * pointers to mark segments. */ Tcl_HashTable windowTable; /* Hash table that maps from window names * to pointers to window segments. If a * window segment doesn't yet have an * associated window, there is no entry for * it here. */ Tcl_HashTable imageTable; /* Hash table that maps from image names * to pointers to image segments. If an * image segment doesn't yet have an * associated image, there is no entry for * it here. */ Tk_Uid state; /* Normal or disabled. Text is read-only * when disabled. */ /* * Default information for displaying (may be overridden by tags * applied to ranges of characters). */ Tk_3DBorder border; /* Structure used to draw 3-D border and * default background. */ int borderWidth; /* Width of 3-D border to draw around entire * widget. */ int padX, padY; /* Padding between text and window border. */ int relief; /* 3-d effect for border around entire * widget: TK_RELIEF_RAISED etc. */ int highlightWidth; /* Width in pixels of highlight to draw * around widget when it has the focus. * <= 0 means don't draw a highlight. */ XColor *highlightBgColorPtr; /* Color for drawing traversal highlight * area when highlight is off. */ XColor *highlightColorPtr; /* Color for drawing traversal highlight. */ Tk_Cursor cursor; /* Current cursor for window, or None. */ XColor *fgColor; /* Default foreground color for text. */ Tk_Font tkfont; /* Default font for displaying text. */ int charWidth; /* Width of average character in default * font. */ int spacing1; /* Default extra spacing above first display * line for each text line. */ int spacing2; /* Default extra spacing between display lines * for the same text line. */ int spacing3; /* Default extra spacing below last display * line for each text line. */ char *tabOptionString; /* Value of -tabs option string (malloc'ed). */ TkTextTabArray *tabArrayPtr; /* Information about tab stops (malloc'ed). * NULL means perform default tabbing * behavior. */ /* * Additional information used for displaying: */ Tk_Uid wrapMode; /* How to handle wrap-around. Must be * tkTextCharUid, tkTextNoneUid, or * tkTextWordUid. */ int width, height; /* Desired dimensions for window, measured * in characters. */ int setGrid; /* Non-zero means pass gridding information * to window manager. */ int prevWidth, prevHeight; /* Last known dimensions of window; used to * detect changes in size. */ TkTextIndex topIndex; /* Identifies first character in top display * line of window. */ struct TextDInfo *dInfoPtr; /* Information maintained by tkTextDisp.c. */ /* * Information related to selection. */ TkTextTag *selTagPtr; /* Pointer to "sel" tag. Used to tell when * a new selection has been made. */ Tk_3DBorder selBorder; /* Border and background for selected * characters. This is a copy of information * in *cursorTagPtr, so it shouldn't be * explicitly freed. */ char *selBdString; /* Value of -selectborderwidth option, or NULL * if not specified (malloc'ed). */ XColor *selFgColorPtr; /* Foreground color for selected text. * This is a copy of information in * *cursorTagPtr, so it shouldn't be * explicitly freed. */ int exportSelection; /* Non-zero means tie "sel" tag to X * selection. */ TkTextIndex selIndex; /* Used during multi-pass selection retrievals. * This index identifies the next character * to be returned from the selection. */ int abortSelections; /* Set to 1 whenever the text is modified * in a way that interferes with selection * retrieval: used to abort incremental * selection retrievals. */ int selOffset; /* Offset in selection corresponding to * selLine and selCh. -1 means neither * this information nor selIndex is of any * use. */ /* * Information related to insertion cursor: */ TkTextSegment *insertMarkPtr; /* Points to segment for "insert" mark. */ Tk_3DBorder insertBorder; /* Used to draw vertical bar for insertion * cursor. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -