|
|
1.1 root 1: /****************************** Module Header ******************************\
2: * Module Name: skelres.c
3: *
4: * Resident portion of Presentation Manager Skel Application
5: *
6: * Created: 25-Jul-88 (adapted from PM Template App.)
7: *
8: * Created by Microsoft Corporation
9: *
10: *
11: \***************************************************************************/
12:
13: #define INCL_WIN
14: #define INCL_AVIO
15: #define INCL_BASE
16:
17: #include <os2.h>
18: #include "browse.h"
19:
20: extern HAB hAB;
21: extern HMQ hMsgQ;
22: extern HWND hwndSkel;
23: extern HWND hwndSkelFrame;
24: extern HDC hDC;
25: extern HVPS hVPS;
26: extern HPS hPS;
27:
28: SHORT cdecl main( argc, argv )
29: int argc;
30: char *argv[];
31: {
32: QMSG qMsg;
33:
34: hAB = WinInitialize(NULL);
35: hMsgQ = WinCreateMsgQueue( hAB, 0 );
36:
37: if ( !SkelInitApp( ) ) /* error = false */
38: return( FALSE );
39: if ( !Initialize( argc,argv ) ) { /* error = -1, OK = 0 */
40:
41: while( WinGetMsg( hAB, (PQMSG)&qMsg, (HWND)NULL, 0, 0 ) )
42: {
43: WinDispatchMsg( hAB, (PQMSG)&qMsg );
44: }
45: }
46:
47: VioAssociate( NULL, hVPS ); /* disassociate */
48: VioDestroyPS( hVPS );
49: WinDestroyWindow( hwndSkelFrame ); /* automatically closes DC */
50: WinDestroyMsgQueue( hMsgQ );
51: WinTerminate( hAB );
52: }
53:
54:
55:
56: ULONG FAR PASCAL SkelWndProc( hWnd, message, mp1, mp2 )
57: HWND hWnd;
58: USHORT message;
59: MPARAM mp1;
60: MPARAM mp2;
61: {
62: /* Procedures which make up the window class. */
63:
64: HPS hPS;
65: RECTL rect;
66:
67: switch( message )
68: {
69: case WM_CREATE:
70: /***********************************************************\
71: * Window's being created; mp2 contains lpParam field
72: * passed to CreateWindow
73: \***********************************************************/
74: SkelCreate( hWnd, (ULONG)mp2 );
75: break;
76:
77: case WM_ACTIVATE:
78: /***********************************************************\
79: * Window is becoming active window if LOUSHORT(mp1) is
80: * TRUE, inactive if LOUSHORT(mp1) is FALSE. mp2 is
81: * the window handle of the window being deactivated.
82: \***********************************************************/
83: if ( SHORT1FROMMP(mp1) && SHORT2FROMMP(mp1) )
84: WinSetFocus( HWND_DESKTOP, hWnd );
85: break;
86:
87: case WM_SETFOCUS:
88: /***********************************************************\
89: * The window is getting the focus. mp1 contains the
90: * window handle of the window that previously had the focus.
91: \***********************************************************/
92: SkelSetFocus( hWnd );
93: break;
94:
95: case WM_PAINT:
96: /***********************************************************\
97: * Time for the window to draw itself.
98: \***********************************************************/
99: hPS = WinBeginPaint( hWnd, (HPS)NULL, (PRECTL)&rect );
100: SkelPaint( hWnd, hPS );
101: WinEndPaint( hPS );
102: break;
103:
104: case WM_CHAR:
105: /***********************************************************\
106: * Character input. The low word of mp1 contains the
107: * key type flags, the high word of mp1 contains the
108: * auto-repeat count, and the low word of mp2 contains
109: * the character code.
110: \***********************************************************/
111: SkelCharInput( hWnd, SHORT1FROMMP(mp2), SHORT1FROMMP(mp1),
112: SHORT2FROMMP(mp1) );
113: break;
114:
115: case WM_CLOSE:
116: /***********************************************************\
117: * message from system to close the Client window.
118: \***********************************************************/
119: SkelQueryQuit( hWnd );
120: break;
121:
122: case WM_COMMAND:
123: /***********************************************************\
124: * A menu item has been selected, or a control is notifying
125: * its parent. mp1 is the menu item value (for menus),
126: * or control ID (for controls). For controls, the low word
127: * of mp2 has the window handle of the control, and the hi
128: * word has the notification code. For menus, mp2 contains
129: * 0L.
130: \***********************************************************/
131: SkelCommand( hWnd, SHORT1FROMMP(mp1), SHORT1FROMMP(mp2),
132: SHORT2FROMMP(mp2));
133: break;
134:
135: case WM_TIMER:
136: /***********************************************************\
137: * Timer message. mp1 contains the timer ID value
138: \***********************************************************/
139: SkelTimer( hWnd, SHORT1FROMMP(mp1) );
140: break;
141:
142: case WM_VSCROLL:
143: /***********************************************************\
144: * Vertical scroll bar input. mp1 contains the
145: * scroll code. For the thumb movement codes, the low
146: * word of mp2 contain the new scroll position.
147: * Possible values for mp1 are: SB_LINEUP, SB_LINEDOWN,
148: * SB_PAGEUP, SB_PAGEDOWN, SB_THUMBPOSITION, SB_THUMBTRACK
149: \***********************************************************/
150:
151: SkelVertScroll( hWnd, HIUSHORT(mp2), LOUSHORT(mp2) );
152: break;
153:
154: case WM_HSCROLL:
155: /***********************************************************\
156: * Horizontal scroll bar input. Parameters same as for
157: * WM_HSCROLL. UP and DOWN should be interpreted as LEFT
158: * and RIGHT, respectively.
159: \***********************************************************/
160: SkelHorzScroll( hWnd, HIUSHORT(mp2), LOUSHORT(mp2) );
161: break;
162:
163: case WM_ERASEBACKGROUND:
164: /*
165: * Don't let frame control erase background for us
166: */
167: return (FALSE);
168: break;
169:
170: case WM_SIZE:
171: /* initialize hwndSkelFrame for first size message */
172: if (hwndSkelFrame==NULL)
173: hwndSkelFrame = hWnd;
174: WinDefAVioWindowProc(hWnd, message, mp1, mp2 );
175: GetWinCharSize();
176: ExecuteAction( NULL, NULL); /* redraw screen */
177: return (FALSE);
178: break;
179:
180:
181: /***********************************************************\
182: * For each of following mouse window messages, mp1 contains
183: * bits indicating whether or not various virtual keys are down,
184: * and mp2 is a WPOINT containing the mouse coordinates. The
185: * keydown bits of mp1 are: MK_LBUTTON (set if Left Button is
186: * down); MK_RBUTTON (set if Right Button is down); MK_SHIFT (set
187: * if Shift Key is down); MK_CONTROL (set if Control Key is down).
188: * Since this sample does nothing with the mouse message it is
189: * passed to DefWindowProc for handling
190: \***********************************************************/
191:
192:
193: case WM_MOUSEMOVE:
194: case WM_BUTTON1DOWN:
195: case WM_BUTTON1UP:
196: case WM_BUTTON2DOWN:
197: case WM_BUTTON2UP:
198: case WM_BUTTON1DBLCLK:
199: case WM_BUTTON2DBLCLK:
200:
201: default:
202: /***********************************************************\
203: * Everything else comes here. This call MUST exist
204: * in your window proc.
205: \***********************************************************/
206:
207: return( (ULONG)WinDefWindowProc(hWnd, message, mp1, mp2));
208: break;
209: }
210: return( 0L );
211: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.