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