2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
11 * I've FINALLY stuck this in a separate file; I must have twenty different
12 * implementations floating around these days. Anyway, here's my generic
13 * let-your-dialog-resize-and-still-look-cool code; an example of how to use
16 * if dialog looks like:
18 * +-----------------------------------------------------+
20 * | [ TXT_HEADER (can resize horizontally, but should ] |
21 * | [ TXT_HEADER retain same vertical size. The ] |
22 * | [_TXT_HEADER__upper-left corner should not move)__] |
24 * | [ ID_LIST_BOX (should resize horizontally and ] |
25 * | [ ID_LIST_BOX vertically to match changes in ] |
26 * | [_ID_LIST_BOX__parent window; UL corner no move)__] |
28 * | (upper-left moves; don't resize ->) [OK] [CANCEL] |
30 * +-----------------------------------------------------+
32 * then define something like this as a global variable:
34 * rwWindowData awdDialog[] = {
35 * { TXT_HEADER, raSizeX },
36 * { ID_LIST_BOX, raSizeX | raSizeY },
37 * { IDOK, raMoveX | raMoveY },
38 * { IDCANCEL, raMoveX | raMoveY },
39 * { idDEFAULT, raLeaveAlone },
45 * RECT rFromLastSession = GuessWhereWindowShouldGo();
46 * ResizeWindow (hDlg, awdDialog, rwaMoveToHere, &rFromLastSession);
50 * // if (lp==0), we're minimizing--don't call ResizeWindow().
53 * ResizeWindow (hDlg, awdDialog, rwaFixupGuts);
55 * if you want to, say, add a status bar (which mucks with the client size
58 * AddStatusBar (hDlg, ...);
59 * ResizeWindow (hDlg, awdDialog, rwaJustResync);
61 * if you want to, say, add a tool bar (which doesn't much with the client
62 * location but should):
64 * AddToolbar (hDlg, ID_TOOLBAR, ...);
65 * GetWindowRect (GetDlgItem (hDlg, ID_TOOLBAR), &rToolBar);
66 * ResizeWindow (hDlg, awdDialog, rwaNewClientArea, &rToolBar);
82 * DEFINITIONS ________________________________________________________________
90 rwaMoveToHere, // resize window to {pr}, then fix guts
91 rwaFixupGuts, // reposition guts to match window size
92 rwaJustResync, // recognize new size but don't fix guts
93 rwaNewClientArea // pretend the client area changed
98 #define raLeaveAlone 0x0000 // don't modify window during resize
100 #define raSizeX 0x0001 // increase width if resizing X+
101 #define raSizeY 0x0002 // increase height if resizing Y+
102 #define raMoveX 0x0004 // move right if resizing X+
103 #define raMoveY 0x0008 // move down if resizing Y+
105 #define raSizeXB 0x0010 // decrease width if resizing X+
106 #define raSizeYB 0x0020 // decrease height if resizing Y+
107 #define raMoveXB 0x0040 // move left if resizing X+
108 #define raMoveYB 0x0080 // move up if resizing Y+
110 #define raSizeXC 0x0100 // increase width by X/2 if resizing X+
111 #define raSizeYC 0x0200 // increase height by Y/2 if resizing Y+
112 #define raMoveXC 0x0400 // move right by X/2 if resizing X+
113 #define raMoveYC 0x0800 // move down by Y/2 if resizing Y+
115 #define raRepaint 0x1000 // force repaint whenever resized
116 #define raNotify 0x2000 // notify window with WM_SIZE afterwards
118 // rwWindowData types:
122 int id; // child ID (-1=end list, 0=default)
123 DWORD ra; // what to do with this child window
124 DWORD cMinimum; // minimum size (0=no limit, LO=x,HI=y)
125 DWORD cMaximum; // maximum size (0=no limit, LO=x,HI=y)
128 #define idDEFAULT (-2)
129 #define idENDLIST (-3)
133 * PROTOTYPES _________________________________________________________________
137 EXPORTED HWND CreateSplitter (HWND, int, int, int, LONG *, rwWindowData *, BOOL);
138 EXPORTED void DeleteSplitter (HWND, int);
140 EXPORTED void ResizeWindow (HWND, rwWindowData *, rwAction, RECT * = NULL);
142 EXPORTED void GetRectInParent (HWND hWnd, RECT *pr);