| 1 | #ifndef TXWPRIV_H |
|---|
| 2 | #define TXWPRIV_H |
|---|
| 3 | // |
|---|
| 4 | // TxWin, Textmode Windowing Library |
|---|
| 5 | // |
|---|
| 6 | // Original code Copyright (c) 1995-2005 Fsys Software and Jan van Wijk |
|---|
| 7 | // |
|---|
| 8 | // ========================================================================== |
|---|
| 9 | // |
|---|
| 10 | // This file contains Original Code and/or Modifications of Original Code as |
|---|
| 11 | // defined in and that are subject to the GNU Lesser General Public License. |
|---|
| 12 | // You may not use this file except in compliance with the License. |
|---|
| 13 | // BY USING THIS FILE YOU AGREE TO ALL TERMS AND CONDITIONS OF THE LICENSE. |
|---|
| 14 | // A copy of the License is provided with the Original Code and Modifications, |
|---|
| 15 | // and is also available at http://www.dfsee.com/txwin/lgpl.htm |
|---|
| 16 | // |
|---|
| 17 | // This library is free software; you can redistribute it and/or modify |
|---|
| 18 | // it under the terms of the GNU Lesser General Public License as published |
|---|
| 19 | // by the Free Software Foundation; either version 2.1 of the License, |
|---|
| 20 | // or (at your option) any later version. |
|---|
| 21 | // |
|---|
| 22 | // This library is distributed in the hope that it will be useful, |
|---|
| 23 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 24 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|---|
| 25 | // See the GNU Lesser General Public License for more details. |
|---|
| 26 | // |
|---|
| 27 | // You should have received a copy of the GNU Lesser General Public License |
|---|
| 28 | // along with this library; (lgpl.htm) if not, write to the Free Software |
|---|
| 29 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 30 | // |
|---|
| 31 | // Questions on TxWin licensing can be directed to: txwin@fsys.nl |
|---|
| 32 | // |
|---|
| 33 | // ========================================================================== |
|---|
| 34 | // |
|---|
| 35 | // |
|---|
| 36 | // TX window library private interfaces |
|---|
| 37 | // |
|---|
| 38 | // Author: J. van Wijk |
|---|
| 39 | // |
|---|
| 40 | // Developed for LPTool/DFSee utilities |
|---|
| 41 | // |
|---|
| 42 | // JvW 29-08-2001 Added dialog windows |
|---|
| 43 | // JvW 12-07-1998 Initial version |
|---|
| 44 | |
|---|
| 45 | typedef struct txwinbase // private window and link info |
|---|
| 46 | { |
|---|
| 47 | struct txwinbase *parent; // parent window |
|---|
| 48 | struct txwinbase *owner; // owner window |
|---|
| 49 | TXWINDOW *window; // actual window data |
|---|
| 50 | ULONG *acceltable; // window accelerator table |
|---|
| 51 | TXWINPROC winproc; // window procedure |
|---|
| 52 | TXPOINT cursor; // relative cursor position |
|---|
| 53 | BOOL curvisible; // cursor visibility |
|---|
| 54 | USHORT us[TXQWS_SIZE]; // window USHORT values |
|---|
| 55 | ULONG ul[TXQWL_SIZE]; // window ULONG and PTR values |
|---|
| 56 | TXRECT restore; // size/pos for restore (a_F5) |
|---|
| 57 | TXWHANDLE oldFocus; // previous focus window |
|---|
| 58 | TXCELL *oldContent; // screen area save/restore |
|---|
| 59 | char *oldFooter; // original footer text |
|---|
| 60 | struct txwinbase *next; // next window (visiting order) |
|---|
| 61 | struct txwinbase *prev; // previous window |
|---|
| 62 | } TXWINBASE; // end of struct "txwinbase" |
|---|
| 63 | |
|---|
| 64 | #define TXW_ARROW_STD 0x0000 // no special arrow handling |
|---|
| 65 | #define TXW_ARROW_MOVE 0x0001 // move a window |
|---|
| 66 | #define TXW_ARROW_SIZE 0x0002 // size a window |
|---|
| 67 | #define TXW_ARROW_COLOR 0x0004 // select color scheme |
|---|
| 68 | |
|---|
| 69 | typedef struct txw_anchor |
|---|
| 70 | { |
|---|
| 71 | #if defined (DEV32) |
|---|
| 72 | ULONG session; // OS2 sessiontype VIO/FS ... |
|---|
| 73 | BOOL KbdKill; // KBD reader thread kill |
|---|
| 74 | #elif defined (DOS32) |
|---|
| 75 | char *dpmi1; // DPMI parameter ptr, 512 |
|---|
| 76 | char *dpmi2; // DPMI parameter ptr, 512 |
|---|
| 77 | short dpmi1Selector; |
|---|
| 78 | short dpmi2Selector; |
|---|
| 79 | #endif |
|---|
| 80 | BOOL insert; // global insert-mode |
|---|
| 81 | BOOL typeahead; // typeahead enabled |
|---|
| 82 | ULONG arrowMode; // in special arrow mode |
|---|
| 83 | USHORT autoid; // auto assigned window id |
|---|
| 84 | ULONG radixclass; // radix class bits, 1=HEX |
|---|
| 85 | short cursorRow; // saved cursor row |
|---|
| 86 | short cursorCol; // saved cursor col |
|---|
| 87 | TXRECT screen; // screen rectangle |
|---|
| 88 | USHORT reopenMenu; // menu-header ID to re-open |
|---|
| 89 | short mDragRow; // absolute row and col start |
|---|
| 90 | short mDragCol; // position on window drag |
|---|
| 91 | ULONG mDragFlags; // mouse dragging flags |
|---|
| 92 | BOOL useMouse; // mouse usage enabled |
|---|
| 93 | TXWHANDLE capture; // mouse capture window |
|---|
| 94 | TXWHANDLE modality; // modality window |
|---|
| 95 | TXWINBASE *focus; // focus window |
|---|
| 96 | TXWINBASE *desktop; // first window in chain |
|---|
| 97 | TXWINBASE *last; // last window in chain |
|---|
| 98 | long windows; // actual window count |
|---|
| 99 | TXWINBASE *sbview; // SBview for quick status |
|---|
| 100 | TXWHANDLE maincmd; // Entryfield marked as cmdline |
|---|
| 101 | TXWHANDLE mainmenu; // Canvas marked as main menu |
|---|
| 102 | BOOL defaultStatus; // show default status text |
|---|
| 103 | ULONG rsmaxlines; // max lines before resize dlg |
|---|
| 104 | ULONG codepage; // codepage, std 437 compatible |
|---|
| 105 | ULONG *acceltable; // system accelerator table |
|---|
| 106 | TXLN listmatch; // list match string value |
|---|
| 107 | } TXW_ANCHOR; // end of struct "txw_anchor" |
|---|
| 108 | |
|---|
| 109 | extern TXW_ANCHOR *txwa; // private anchor (HAB) |
|---|
| 110 | |
|---|
| 111 | extern BYTE *txVbuf; // one line video buffer |
|---|
| 112 | |
|---|
| 113 | // Validate window-handle, return its TXWBASE pointer, NULL is invalid |
|---|
| 114 | TXWINBASE *txwValidateHandle // RET window base pointer |
|---|
| 115 | ( |
|---|
| 116 | TXWHANDLE hwnd, // IN handle to validate |
|---|
| 117 | TXWINDOW **win // OUT attached window ptr |
|---|
| 118 | ); |
|---|
| 119 | |
|---|
| 120 | // Validate handle and calculate clip rectangle from all (parent) client areas |
|---|
| 121 | TXWINBASE *txwValidateAndClip // RET window base pointer |
|---|
| 122 | ( |
|---|
| 123 | TXWHANDLE hwnd, // IN handle to validate |
|---|
| 124 | TXWINDOW **window, // OUT attached window |
|---|
| 125 | BOOL border, // IN start clip with border |
|---|
| 126 | TXRECT *pclip // OUT combined clip rect |
|---|
| 127 | ); |
|---|
| 128 | |
|---|
| 129 | // Calculate visible region(s) for a 1-line string area |
|---|
| 130 | void txwVisibleLineRegions |
|---|
| 131 | ( |
|---|
| 132 | TXWINBASE *wnd, // IN window with string |
|---|
| 133 | TXRECT_ELEM *clr // INOUT list of clip rectangles |
|---|
| 134 | ); // on input the full line |
|---|
| 135 | |
|---|
| 136 | // Fast ScrollBuff paint, SBVIEW only; supports paint arround pop-up windows |
|---|
| 137 | void txwPaintSbView |
|---|
| 138 | ( |
|---|
| 139 | TXWINBASE *wnd // IN current window |
|---|
| 140 | ); |
|---|
| 141 | |
|---|
| 142 | // Default paint border-shadow for window, no tracing (for txwPaintSbView) |
|---|
| 143 | void txwPaintShadow |
|---|
| 144 | ( |
|---|
| 145 | TXWINBASE *wnd // IN current window |
|---|
| 146 | ); |
|---|
| 147 | |
|---|
| 148 | // Save window contents to be restored at destroy time (incl borders) |
|---|
| 149 | ULONG txwSaveWindowContent |
|---|
| 150 | ( |
|---|
| 151 | TXWINBASE *wnd // IN window |
|---|
| 152 | ); |
|---|
| 153 | |
|---|
| 154 | // Restore window contents saved at creation time (incl borders) |
|---|
| 155 | ULONG txwRestoreWindowContent |
|---|
| 156 | ( |
|---|
| 157 | TXWINBASE *wnd, // IN window |
|---|
| 158 | TXRECT *clip1, // IN partial restore area 1 |
|---|
| 159 | TXRECT *clip2 // IN partial restore area 2 |
|---|
| 160 | ); |
|---|
| 161 | |
|---|
| 162 | // Default paint window border and focus indication, for any window-class |
|---|
| 163 | void txwPaintBorder |
|---|
| 164 | ( |
|---|
| 165 | TXWINBASE *wnd, // IN current window |
|---|
| 166 | BOOL focus // IN focus indicator |
|---|
| 167 | ); |
|---|
| 168 | |
|---|
| 169 | // Default paint, for standard window-classes; draw client window contents |
|---|
| 170 | ULONG txwPaintWindow |
|---|
| 171 | ( |
|---|
| 172 | TXWINBASE *wnd, // IN current window |
|---|
| 173 | BOOL border // IN paint border too |
|---|
| 174 | ); |
|---|
| 175 | |
|---|
| 176 | // Default paint status-indicator parts for a window-class |
|---|
| 177 | ULONG txwPaintWinStatus |
|---|
| 178 | ( |
|---|
| 179 | TXWINBASE *wnd, // IN current window |
|---|
| 180 | char *text, // IN optional status text |
|---|
| 181 | BYTE color // IN optional status color |
|---|
| 182 | ); |
|---|
| 183 | |
|---|
| 184 | // Find enabled and visible window that is 'next' to origin window |
|---|
| 185 | TXWHANDLE txwFindNextFocus |
|---|
| 186 | ( |
|---|
| 187 | TXWHANDLE hwnd, // IN origin window |
|---|
| 188 | BOOL tabgroup // IN next GROUP, not window |
|---|
| 189 | ); |
|---|
| 190 | |
|---|
| 191 | // Find enabled and visible window that is 'previous' to origin window |
|---|
| 192 | TXWHANDLE txwFindPrevFocus |
|---|
| 193 | ( |
|---|
| 194 | TXWHANDLE hwnd, // IN origin window |
|---|
| 195 | BOOL tabgroup // IN prev GROUP, not window |
|---|
| 196 | ); |
|---|
| 197 | |
|---|
| 198 | /*======== Generic Widgets, TXWIDGET.C ================*/ |
|---|
| 199 | |
|---|
| 200 | // Initialize generic-widget data structures |
|---|
| 201 | BOOL txwInitGenericWidgets |
|---|
| 202 | ( |
|---|
| 203 | void |
|---|
| 204 | ); |
|---|
| 205 | |
|---|
| 206 | // Terminate all generic-widget data structures |
|---|
| 207 | void txwTermGenericWidgets |
|---|
| 208 | ( |
|---|
| 209 | void |
|---|
| 210 | ); |
|---|
| 211 | |
|---|
| 212 | /*======== Standard dialog handling, TXWSTDLG.C ================*/ |
|---|
| 213 | |
|---|
| 214 | // Initialize all standard dialog data structures |
|---|
| 215 | BOOL txwInitStandardDialogs |
|---|
| 216 | ( |
|---|
| 217 | void |
|---|
| 218 | ); |
|---|
| 219 | |
|---|
| 220 | // Terminate all standard dialog data structures |
|---|
| 221 | void txwTermStandardDialogs |
|---|
| 222 | ( |
|---|
| 223 | void |
|---|
| 224 | ); |
|---|
| 225 | |
|---|
| 226 | /*======== Keyboard processing for window classes, TXWIKEY.C ================*/ |
|---|
| 227 | |
|---|
| 228 | // Input key handling for the TEXTVIEW window class |
|---|
| 229 | ULONG txwIkeyTextview // RET result |
|---|
| 230 | ( |
|---|
| 231 | TXWHANDLE hwnd, // IN current window |
|---|
| 232 | ULONG mp1, // IN param 1 |
|---|
| 233 | ULONG mp2 // IN param 2 |
|---|
| 234 | ); |
|---|
| 235 | |
|---|
| 236 | // Input key handling for the SBVIEW window class |
|---|
| 237 | ULONG txwIkeySbView // RET result |
|---|
| 238 | ( |
|---|
| 239 | TXWHANDLE hwnd, // IN current window |
|---|
| 240 | ULONG mp1, // IN param 1 |
|---|
| 241 | ULONG mp2 // IN param 2 |
|---|
| 242 | ); |
|---|
| 243 | |
|---|
| 244 | // Input key handling for the ENTRYFIELD window class |
|---|
| 245 | ULONG txwIkeyEntryfield // RET result |
|---|
| 246 | ( |
|---|
| 247 | TXWHANDLE hwnd, // IN current window |
|---|
| 248 | ULONG mp1, // IN param 1 |
|---|
| 249 | ULONG mp2 // IN param 2 |
|---|
| 250 | ); |
|---|
| 251 | |
|---|
| 252 | // Input key handling for the BUTTON window class |
|---|
| 253 | ULONG txwIkeyButton // RET result |
|---|
| 254 | ( |
|---|
| 255 | TXWHANDLE hwnd, // IN current window |
|---|
| 256 | ULONG mp1, // IN param 1 |
|---|
| 257 | ULONG mp2 // IN param 2 |
|---|
| 258 | ); |
|---|
| 259 | |
|---|
| 260 | // Input key handling for the LISTBOX window class |
|---|
| 261 | ULONG txwIkeyListBox // RET result |
|---|
| 262 | ( |
|---|
| 263 | TXWHANDLE hwnd, // IN current window |
|---|
| 264 | ULONG mp1, // IN param 1 |
|---|
| 265 | ULONG mp2 // IN param 2 |
|---|
| 266 | ); |
|---|
| 267 | |
|---|
| 268 | |
|---|
| 269 | /*======== Hex Editor dialog and class handling TXWHEXED.C ==================*/ |
|---|
| 270 | |
|---|
| 271 | // Hex Editor class, paint window |
|---|
| 272 | void txwPaintHexEdit |
|---|
| 273 | ( |
|---|
| 274 | TXWINBASE *wnd // IN current window |
|---|
| 275 | ); |
|---|
| 276 | |
|---|
| 277 | // Window procedure for the HEXED window class, handling mouse and keyboard |
|---|
| 278 | // Called AFTER generic default processing, as class specific default handling |
|---|
| 279 | ULONG txwHexEditWinProc // RET result |
|---|
| 280 | ( |
|---|
| 281 | TXWHANDLE hwnd, // IN current window |
|---|
| 282 | ULONG msg, // IN message id |
|---|
| 283 | ULONG mp1, // IN param 1 |
|---|
| 284 | ULONG mp2 // IN param 2 |
|---|
| 285 | ); |
|---|
| 286 | |
|---|
| 287 | |
|---|
| 288 | /*======== Screen related functions, TXWIOP.C ===============================*/ |
|---|
| 289 | |
|---|
| 290 | #if defined (LINUX) |
|---|
| 291 | #define TXSCREEN_BEGIN_UPDATE() TxLinUpdateScreen(FALSE) |
|---|
| 292 | #define TXSCREEN_ENDOF_UPDATE() TxLinUpdateScreen(TRUE) |
|---|
| 293 | #define TXSCREEN_FLUSH_CACHED() TxLinClearTerminal() |
|---|
| 294 | |
|---|
| 295 | typedef enum txlterm // supported terminal types |
|---|
| 296 | { |
|---|
| 297 | TXLT_CONSOLE, // standard Linux console |
|---|
| 298 | TXLT_XTERM_VT100, // Xterm, ANSI or VT100 |
|---|
| 299 | TXLT_VT220, // VT220 compatible |
|---|
| 300 | } TXLTERM; // end of enum "txlterm" |
|---|
| 301 | |
|---|
| 302 | // Get type of Linux terminal used by low-level IO |
|---|
| 303 | TXLTERM TxLinTerminalType // RET Terminal type |
|---|
| 304 | ( |
|---|
| 305 | void |
|---|
| 306 | ); |
|---|
| 307 | |
|---|
| 308 | // refresh whole screen |
|---|
| 309 | void TxLinUpdateScreen |
|---|
| 310 | ( |
|---|
| 311 | BOOL finished // IN Virtual updates done |
|---|
| 312 | ); // will cause real screen |
|---|
| 313 | // update if outer level |
|---|
| 314 | |
|---|
| 315 | // Clear terminal screen buffer, forcing complete redraw on next Update |
|---|
| 316 | void TxLinClearTerminal |
|---|
| 317 | ( |
|---|
| 318 | void |
|---|
| 319 | ); |
|---|
| 320 | |
|---|
| 321 | #else |
|---|
| 322 | #define TXSCREEN_FLUSH_CACHED() |
|---|
| 323 | #define TXSCREEN_BEGIN_UPDATE() |
|---|
| 324 | #define TXSCREEN_ENDOF_UPDATE() |
|---|
| 325 | #endif |
|---|
| 326 | |
|---|
| 327 | #if defined (WIN32) |
|---|
| 328 | // Specific Win-NT console definitions and functions |
|---|
| 329 | |
|---|
| 330 | // display a string on NT console, with full ANSI support |
|---|
| 331 | void txNtConsoleDisplay |
|---|
| 332 | ( |
|---|
| 333 | char *text |
|---|
| 334 | ); |
|---|
| 335 | #endif |
|---|
| 336 | |
|---|
| 337 | |
|---|
| 338 | /*======== Message related functions, TXWMSG.C ==============================*/ |
|---|
| 339 | // Initialize low level input handling |
|---|
| 340 | ULONG TxInputInitialize |
|---|
| 341 | ( |
|---|
| 342 | void |
|---|
| 343 | ); |
|---|
| 344 | |
|---|
| 345 | // Initialize input for windowed Desktop environment |
|---|
| 346 | ULONG TxInputDesktopInit |
|---|
| 347 | ( |
|---|
| 348 | void |
|---|
| 349 | ); |
|---|
| 350 | |
|---|
| 351 | // Terminate low level input handling |
|---|
| 352 | ULONG TxInputTerminate |
|---|
| 353 | ( |
|---|
| 354 | void |
|---|
| 355 | ); |
|---|
| 356 | |
|---|
| 357 | #endif |
|---|