|
|
1.1 root 1: #ifndef _TEXTWIN_DOT_H
2: #define _TEXTWIN_DOT_H
3:
4: /*
5: * TW.H 5.20A June 8, 1995
6: *
7: * The Greenleaf Comm Library
8: *
9: * Copyright (C) 1984-1995 Greenleaf Software Inc. All Rights Reserved.
10: *
11: * NOTES
12: *
13: * This file contains all the function prototypes, structures, and other
14: * definitions needed to use the TW stuff under Windows.
15: *
16: * MODIFICATIONS
17: *
18: * December 12, 1992 4.00A : Initial release
19: *
20: * December 6, 1994 5.00D : TWGetLine() was modified for Win32 to accept
21: * Unicode strings for the caption and prompt.
22: * The function did not change for 16-bit Windows.
23: *
24: */
25:
26: #include "compiler.h"
27: #if defined( GF_WINDOWS ) || defined( GF_WIN32 )
28: #include <windows.h>
29:
30: #ifdef GF_ZORTECH_CPP
31: #include <dos.h>
32: #define _fcalloc farcalloc
33: #define _ffree farfree
34: #endif
35:
36:
37: typedef enum tw_attribute { TW_NORMAL=0, TW_REVERSE } TW_ATTR;
38:
39: /*
40: * VTW stands for Virtual Text Window. A Text Window is nominally a virtual
41: * 132x25 window, with scroll back capability of 75 lines.
42: */
43:
44: #define VTW_MAX_ROWS 25
45: #define VTW_MAX_COLS 132
46: #define VTW_BUFFER_ROWS 100
47: #define VTW_BUFFER_COLS 132
48: #define VTW_CARET_ROW_OFFSET ( VTW_BUFFER_ROWS - VTW_MAX_ROWS )
49:
50: struct TWINSTANCEDATAtag {
51: HINSTANCE ThisInstance;
52: HINSTANCE WhatInstance;
53: int ThisShow;
54: HWND ClientHandle;
55: int TWAppClosed;
56: HMENU TWMainMenu;
57: HMENU TWFileMenu;
58: HMENU TWWindowMenu;
59: HWND TWFrameHandle;
60: #if defined( GF_WINDOWS ) && !defined( GF_WIN32 )
61: HTASK hTask;
62: #elif defined( GF_WIN32 )
63: HANDLE hTask;
64: #else
65: int hTask;
66: #endif
67: int nRefCount;
68: };
69:
70: typedef struct {
71: HWND hwnd;
72: LPSTR Title;
73: int VTWRows; /* Rows in the Virtual Text Window */
74: int VTWCols; /* Cols in the Virtual Text Window */
75: int VTWCaretRow; /* Current Caret row in the VTW */
76: int VTWCaretCol; /* Current Caret col in the VTW */
77: int CharWidth;
78: int CharHeight;
79: int VisibleRows;
80: int VisibleCols;
81: int VisibleXPixels;
82: int VisibleYPixels;
83: int FirstVisibleCol;
84: int FirstVisibleRow;
85: int FirstVisibleRowOffset;
86: int CaretOn;
87: int HasFocus;
88: int Scrollable;
89: int CurrentAttribute;
90: unsigned int KeyboardHead;
91: unsigned int KeyboardTail;
92: unsigned int KeyboardBuffer[ 128 ];
93: char ScreenBuffer[ VTW_BUFFER_ROWS ][ VTW_BUFFER_COLS ];
94: char AttributeBuffer[ VTW_BUFFER_ROWS ][ VTW_BUFFER_COLS ];
95: HFONT Font;
96: HFONT OldFont;
97: int LastCommand;
98: struct TWINSTANCEDATAtag far *lpThis;
99: #if !defined( GF_ZORTECH_CPP ) && !defined( GF_WATCOM_C ) && !defined( GF_SYMANTEC_CPP )
100: } GF_FAR TW_WINDOW;
101: #else
102: } STW_WINDOW;
103:
104: #if defined( GF_SYMANTEC_CPP )
105: #if __INTSIZE__ == 2 && ( __SMALL__ || __COMPACT__ || __MEDIUM__ )
106: #define TW_WINDOW STW_WINDOW GF_FAR
107: #else
108: #define TW_WINDOW STW_WINDOW GF_FAR
109: #endif
110: #else
111: #define TW_WINDOW STW_WINDOW GF_FAR
112: #endif
113: #endif
114:
115: #define SetTWNotifyHandler SetTWCommNotifyHandler
116:
117: #ifdef __cplusplus
118: extern "C" {
119: #endif
120:
121: extern int TWAppClosed;
122: extern HMENU TWMainMenu;
123: extern HMENU TWFileMenu;
124: extern HMENU TWWindowMenu;
125: extern HWND TWFrameHandle;
126:
127:
128: int GF_CONV TWInitialize( HANDLE hInstance,
129: HANDLE PreviousInstance,
130: int nCmdShow,
131: char GF_DLL_FAR *title );
132: TW_WINDOW * GF_CONV TWDefineWindow( int ul_row,
133: int ul_col,
134: int width,
135: int height,
136: int scrollable,
137: char GF_DLL_FAR *name,
138: char GF_DLL_FAR *font,
139: int font_size );
140: void GF_CONV TWPutc( TW_WINDOW *window, int c );
141: void GF_CONV TWPuts( TW_WINDOW *window, char GF_DLL_FAR *string );
142: void GF_CDECL TWPrintf( TW_WINDOW *window, char GF_DLL_FAR *fmt, ... );
143:
144: int GF_CONV TWKbhit( TW_WINDOW *vw );
145: unsigned int GF_CONV TWGetkey( TW_WINDOW *vw );
146: void GF_CONV TWPokec( TW_WINDOW *window, int row,
147: int col, int c );
148: void GF_CONV TWScrollUp( TW_WINDOW *window, int line_count );
149: void GF_CONV TWScrollDown( TW_WINDOW *window, int line_count );
150: void GF_CONV TWYield( void );
151: void GF_CONV TWSetAttribute( TW_WINDOW *window, int attribute );
152: void GF_CONV TWPokes( TW_WINDOW *window, int row,
153: int col, char GF_DLL_FAR *string );
154: void GF_CONV TWGoto( TW_WINDOW *window, int row, int col );
155: void GF_CDECL TWPokef( TW_WINDOW *window, int row, int col,
156: char GF_DLL_FAR *fmt, ... );
157: void GF_CONV TWClearWindow( TW_WINDOW *window );
158: void GF_CONV TWInsertChar( TW_WINDOW *window, int row, int col, int c );
159: void GF_CONV TWDeleteChar( TW_WINDOW *window, int row, int col );
160: void GF_CONV TWClearToEndOfLine( TW_WINDOW *window, int row, int col );
161: void GF_CONV TWClearToEndOfWindow( TW_WINDOW *window, int row, int col );
162: #if defined( GF_WIN32 )
163: int GF_CONV TWGetLine( LPWSTR caption, LPWSTR prompt,
164: char GF_DLL_FAR *buffer, int n );
165: #else
166: int GF_CONV TWGetLine( char GF_DLL_FAR *caption, char GF_DLL_FAR *prompt,
167: char GF_DLL_FAR *buffer, int n );
168: #endif
169: int GF_CONV TWMenu( TW_WINDOW *tw, unsigned char row, unsigned char col, char GF_DLL_FAR *menu[] );
170:
171:
172: char * GF_CONV TWGets( TW_WINDOW *window, char GF_DLL_FAR *string, int length );
173: struct TWINSTANCEDATAtag far * GF_CONV GetTWInstanceDataPtr( void );
174:
175: void GF_CONV TWFreeInstanceData( void );
176: void GF_CONV TWFreeWindow( TW_WINDOW *tw );
177:
178: #ifdef GF_ZORTECH_CPP
179: void far * _fmemset( void far *buf, int val, size_t count );
180: char far * _fstrcpy( char far *string1, const char far *string2 );
181: void far * _fmemmove( void far *dest, const void far *srce, size_t count );
182: #endif
183:
184: #ifndef VGFD_DLL
185: extern int ( GF_CONV * TWCommNotifyHandler )( TW_WINDOW *tw, HWND hwnd,
186: WPARAM wParam, LPARAM lParam );
187:
188: void GF_CONV SetTWCommNotifyHandler( int (GF_CONV *f)( TW_WINDOW *tw,
189: HWND hwnd,
190: WPARAM wParam,
191: LPARAM lParam ) );
192: #endif
193:
194:
195: #ifdef __cplusplus
196: }
197: #endif
198:
199: #endif /* ifdef GF_WINDOWS */
200:
201: #endif /* #ifndef _TEXTWIN_DOT_H */
202:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.