|
|
1.1 root 1:
2: /******************************************************************************\
3: * This is a part of the Microsoft Source Code Samples.
4: * Copyright (C) 1993 Microsoft Corporation.
5: * All rights reserved.
6: * This source code is only intended as a supplement to
7: * Microsoft Development Tools and/or WinHelp documentation.
8: * See these sources for detailed information regarding the
9: * Microsoft samples programs.
10: \******************************************************************************/
11:
12: /*
13: * TPRIV.H
14: *
15: * Data structures used internally by table class.
16: *
17: * Note: include after table.h
18: */
19:
20:
21: #ifndef abs
22: #define abs(x) (((x) > 0)? (x) : -(x))
23: #endif
24:
25: /* one of these per visible line */
26: typedef struct {
27: CellPos linepos; /* posn and clipping info for line */
28:
29: lpCellData pdata; /* array of CellData structs for all cells */
30: } LineData, FAR * lpLineData;
31:
32:
33: /* master info struct pointed to by window extra bytes */
34:
35: typedef struct {
36: /* table info */
37: TableHdr hdr; /* main hdr info from owner */
38: lpColProps pcolhdr; /* ptr to array of phdr->ncols hdrs */
39:
40: /* window info */
41: int avewidth; /* font ave width - for default cell sizing */
42: int rowheight; /* height of one row */
43: int rowwidth; /* total width of one row in pixels */
44: int winwidth; /* width of window */
45: int nlines; /* actual lines currently visible */
46:
47: lpCellPos pcellpos; /* array of cell position structs */
48:
49: /* scroll settings */
50: long scrollscale; /* scaling factor (force 16-bit range) */
51: long toprow; /* 0-based rownr of top moveable line */
52: int scroll_dx; /* horz scroll posn in pixels. */
53:
54: /* column data */
55: lpLineData pdata; /* ptr to array of nlines of LineData */
56:
57: /* selection/dragging */
58: UINT trackmode; /* current mouse-tracking mode */
59: int tracknr; /* col or row being resized */
60: int trackline1; /* currently drawn track lines */
61: int trackline2;
62: BOOL selvisible; /* used during mouse-down: T if sel drawn */
63: TableSelection select;
64:
65: } Table, FAR * lpTable;
66:
67: /* trackmode constants */
68: #define TRACK_NONE 0
69: #define TRACK_COLUMN 1
70: #define TRACK_CELL 2
71:
72: /* private flags in CellData struct */
73: #define CELL_VALID 1
74:
75: /* window extra bytes are used to hold the owner, heap and Table structs */
76: #define WW_OWNER 0 /* HWND of owner */
77: #define WW_HEAP (WW_OWNER + sizeof(HWND)) /* gmem heap */
78: #define WL_TABLE (WW_HEAP + sizeof(HANDLE)) /* lpTable */
79: #define WLTOTAL (WL_TABLE + sizeof(lpTable)) /* total extra bytes */
80:
81: /* ---------- global data -------------------*/
82:
83: extern HPEN hpenDotted; /* in table.c */
84: extern HANDLE hVertCurs; /* in table.c */
85: extern HANDLE hNormCurs; /* in table.c */
86:
87: /*------function prototypes ---------------------------------------*/
88:
89: /* in table.c */
90:
91: void gtab_init(void); /* called from DLL startup function */
92: long gtab_sendtq(HWND hwnd, UINT cmd, long lParam);
93: void gtab_invallines(HWND hwnd, lpTable ptab, int start, int count);
94: void gtab_setsize(HWND hwnd, lpTable ptab);
95: void gtab_calcwidths(HWND hwnd, lpTable ptab);
96: void gtab_deltable(HWND hwnd, lpTable ptab);
97: BOOL gtab_alloclinedata(HWND hwnd, HANDLE heap, lpTable ptab);
98:
99: /* in tpaint.c */
100: void gtab_paint(HWND hwnd, HDC hdc, lpTable ptab, int line);
101: void gtab_vsep(HWND hwnd, lpTable ptab, HDC hdc);
102: void gtab_hsep(HWND hwnd, lpTable ptab, HDC hdc);
103: void gtab_invertsel(HWND hwnd, lpTable ptab, HDC hdc_in);
104: void gtab_drawvertline(HWND hwnd, lpTable ptab);
105:
106: /* in tscroll.c */
107: void gtab_dovscroll(HWND hwnd, lpTable ptab, long change);
108: void gtab_dohscroll(HWND hwnd, lpTable ptab, long change);
109: long gtab_linetorow(HWND hwnd, lpTable ptab, int line);
110: int gtab_rowtoline(HWND hwnd, lpTable ptab, long row);
111: void gtab_msg_vscroll(HWND hwnd, lpTable ptab, int opcode, int pos);
112: void gtab_msg_hscroll(HWND hwnd, lpTable ptab, int opcode, int pos);
113: void gtab_select(HWND hwnd, lpTable ptab, long row, long col, long nrows,
114: long ncells, BOOL bNotify);
115: void gtab_enter(HWND hwnd, lpTable ptab, long row, long col, long nrows,
116: long ncells);
117: void gtab_press(HWND hwnd, lpTable ptab, int x, int y);
118: void gtab_release(HWND hwnd, lpTable ptab, int x, int y);
119: void gtab_move(HWND hwnd, lpTable ptab, int x, int y);
120: void gtab_dblclick(HWND hwnd, lpTable ptab, int x, int y);
121: void gtab_showsel(HWND hwnd, lpTable ptab, BOOL bToBottom);
122: void gtab_showsel_middle(HWND hwnd, lpTable ptab);
123: int gtab_key(HWND hwnd, lpTable ptab, int vkey);
124:
125: /* in tprint.c */
126: void gtab_print(HWND hwnd, lpTable ptab, HANDLE heap, lpPrintContext pcontext);
127: void gtab_boxcell(HWND hwnd, HDC hdc, LPRECT rcp, LPRECT pclip, UINT boxmode);
128:
129:
130:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.