ReactOS 0.4.15-dev-7924-g5949c20
framewnd.c File Reference
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <process.h>
#include <stdio.h>
#include "main.h"
#include "about.h"
#include "framewnd.h"
Include dependency graph for framewnd.c:

Go to the source code of this file.

Macros

#define WIN32_LEAN_AND_MEAN
 

Functions

static void resize_frame_rect (HWND hWnd, PRECT prect)
 
void resize_frame_client (HWND hWnd)
 
LRESULT CALLBACK CBTProc (int code, WPARAM wParam, LPARAM lParam)
 
void toggle_child (HWND hWnd, UINT cmd, HWND hchild)
 
static HWND InitChildWindow (LPTSTR param)
 
BOOL CALLBACK CloseEnumProc (HWND hWnd, LPARAM lParam)
 
void OnEnterMenuLoop (HWND hWnd)
 
void OnExitMenuLoop (HWND hWnd)
 
void OnMenuSelect (HWND hWnd, UINT nItemID, UINT nFlags, HMENU hSysMenu)
 
LRESULT _CmdWndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 
LRESULT CALLBACK FrameWndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 

Variables

BOOL bInMenuLoop = FALSE
 
static HHOOK hcbthook
 
static ChildWndnewchild = NULL
 

Macro Definition Documentation

◆ WIN32_LEAN_AND_MEAN

#define WIN32_LEAN_AND_MEAN

Definition at line 26 of file framewnd.c.

Function Documentation

◆ _CmdWndProc()

LRESULT _CmdWndProc ( HWND  hWnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 258 of file framewnd.c.

259{
260 HWND hChildWnd;
261
262 if (1) {
263
264 switch (LOWORD(wParam)) {
267 break;
268 case ID_WINDOW_CLOSE:
269 hChildWnd = (HWND) SendMessage(hMDIClient, WM_MDIGETACTIVE, 0, 0);
270 if (!SendMessage(hChildWnd, WM_QUERYENDSESSION, 0, 0))
272 break;
273 case ID_FILE_EXIT:
274 SendMessage(hWnd, WM_CLOSE, 0, 0);
275 break;
278 break;
281 break;
282
283 case ID_FILE_OPEN:
285 InitChildWindow("Child Window");
286 return 0;
289 break;
292 break;
295 break;
298 break;
299 case ID_HELP_ABOUT:
301 break;
302 default:
303 hChildWnd = (HWND)SendMessage(hMDIClient, WM_MDIGETACTIVE, 0, 0);
304 if (IsWindow(hChildWnd))
305 SendMessage(hChildWnd, WM_COMMAND, wParam, lParam);
306 else
308 }
309 }
310 return 0;
311}
HWND hWnd
Definition: settings.c:17
void ShowAboutBox(HWND hWnd)
Definition: about.c:25
static void toggle_child(HWND hWnd, UINT cmd, HWND hchild)
Definition: framewnd.c:181
HWND hStatusBar
Definition: main.c:36
#define ID_HELP_ABOUT
Definition: resource.h:75
#define ID_WINDOW_CASCADE
Definition: resource.h:76
#define ID_FILE_EXIT
Definition: resource.h:46
#define ID_FILE_OPEN
Definition: resource.h:41
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
HANDLE HWND
Definition: compat.h:19
#define ID_WINDOW_TILE_VERT
Definition: resource.h:49
#define ID_WINDOW_TILE_HORZ
Definition: resource.h:48
BOOL CALLBACK CloseEnumProc(HWND hWnd, LPARAM lParam)
Definition: framewnd.c:191
static HWND InitChildWindow(LPTSTR param)
Definition: framewnd.c:136
HWND hMDIClient
Definition: main.c:49
#define ID_OPTIONS_TOOLBAR
Definition: resource.h:40
#define ID_WINDOW_ARRANGE_ICONS
Definition: resource.h:48
#define ID_OPTIONS_STATUSBAR
Definition: resource.h:41
#define ID_WINDOW_CLOSE
Definition: resource.h:32
#define ID_WINDOW_CLOSEALL
Definition: resource.h:33
#define ID_WINDOW_NEW_WINDOW
Definition: resource.h:44
HWND hToolBar
Definition: mplay32.c:23
#define LOWORD(l)
Definition: pedump.c:82
#define DefFrameProc
Definition: ros2win.h:32
Definition: tftpd.h:60
UINT_PTR WPARAM
Definition: windef.h:207
#define WM_MDITILE
Definition: winuser.h:1818
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define WM_CLOSE
Definition: winuser.h:1621
#define WM_MDICASCADE
Definition: winuser.h:1819
#define WM_COMMAND
Definition: winuser.h:1740
BOOL WINAPI EnumChildWindows(_In_opt_ HWND, _In_ WNDENUMPROC, _In_ LPARAM)
#define WM_MDIICONARRANGE
Definition: winuser.h:1820
#define WM_MDIDESTROY
Definition: winuser.h:1813
#define WM_QUERYENDSESSION
Definition: winuser.h:1622
#define SendMessage
Definition: winuser.h:5843
#define MDITILE_HORIZONTAL
Definition: winuser.h:2188
#define WM_MDIGETACTIVE
Definition: winuser.h:1821
#define MDITILE_VERTICAL
Definition: winuser.h:2189

◆ CBTProc()

LRESULT CALLBACK CBTProc ( int  code,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 92 of file framewnd.c.

93{
94 if (code == HCBT_CREATEWND && newchild) {
95 ChildWnd* pChildWnd = newchild;
96 newchild = NULL;
97 pChildWnd->hWnd = (HWND)wParam;
98 SetWindowLongPtr(pChildWnd->hWnd, GWLP_USERDATA, (LPARAM)pChildWnd);
99 }
101}
#define NULL
Definition: types.h:112
static HHOOK hcbthook
Definition: framewnd.c:89
static ChildWnd * newchild
Definition: framewnd.c:90
Definition: main.h:61
HWND hWnd
Definition: main.h:62
Definition: inflate.c:139
#define SetWindowLongPtr
Definition: treelist.c:70
#define GWLP_USERDATA
Definition: treelist.c:63
LONG_PTR LPARAM
Definition: windef.h:208
#define HCBT_CREATEWND
Definition: winuser.h:58
LRESULT WINAPI CallNextHookEx(_In_opt_ HHOOK, _In_ int, _In_ WPARAM, _In_ LPARAM)

Referenced by InitChildWindow().

◆ CloseEnumProc()

BOOL CALLBACK CloseEnumProc ( HWND  hWnd,
LPARAM  lParam 
)

Definition at line 191 of file framewnd.c.

192{
193 if (!GetWindow(hWnd, GW_OWNER)) {
195 if (SendMessage(hWnd, WM_QUERYENDSESSION, 0, 0)) {
197 }
198 }
199 return 1;
200}
#define GW_OWNER
Definition: winuser.h:766
HWND WINAPI GetParent(_In_ HWND)
HWND WINAPI GetWindow(_In_ HWND, _In_ UINT)
#define WM_MDIRESTORE
Definition: winuser.h:1815

Referenced by _CmdWndProc().

◆ FrameWndProc()

LRESULT CALLBACK FrameWndProc ( HWND  hWnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 324 of file framewnd.c.

325{
326 switch (message) {
327 case WM_CREATE:
328 {
330 CLIENTCREATESTRUCT ccs = { hMenuWindow, IDW_FIRST_CHILD };
331#if 0
332 hMDIClient = CreateWindow(_T("MDICLIENT"), NULL,
334 0, 0, 0, 0,
335 hWnd, (HMENU)1, hInst, &ccs);
336#else
337 hMDIClient = CreateWindowEx(0, _T("MDICLIENT"), NULL,
338// hMDIClient = CreateWindowEx(0, (LPCTSTR)(int)hChildWndClass, NULL,
340 0, 0, 0, 0,
341 hWnd, (HMENU)0, hInst, &ccs);
342#endif
343 }
344 break;
345 case WM_COMMAND:
347 break;
348 case WM_SIZE:
350 break;
351 case WM_ENTERMENULOOP:
353 break;
354 case WM_EXITMENULOOP:
356 break;
357 case WM_MENUSELECT:
359 break;
360 case WM_DESTROY:
362 break;
364 case WM_CLOSE:
367 return 0;
368 // else fall thru...
369 default:
371 }
372 return 0;
373}
static void resize_frame_client(HWND hWnd)
Definition: framewnd.c:55
static void OnEnterMenuLoop(HWND hWnd)
Definition: framewnd.c:117
static void OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU hSysMenu)
Definition: framewnd.c:137
static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: framewnd.c:1056
static void OnExitMenuLoop(HWND hWnd)
Definition: framewnd.c:129
HMENU hMenuFrame
Definition: main.c:37
HINSTANCE hInst
Definition: dxdiag.c:13
#define IDW_FIRST_CHILD
Definition: explorer.h:58
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
#define WS_CHILD
Definition: pedump.c:617
#define WS_BORDER
Definition: pedump.c:625
#define WS_VSCROLL
Definition: pedump.c:627
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_HSCROLL
Definition: pedump.c:628
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define HIWORD(l)
Definition: typedefs.h:247
#define _T(x)
Definition: vfdio.h:22
#define CreateWindowEx
Definition: winuser.h:5755
int WINAPI GetMenuItemCount(_In_opt_ HMENU)
#define WM_CREATE
Definition: winuser.h:1608
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define WM_SIZE
Definition: winuser.h:1611
#define CreateWindow
Definition: winuser.h:5754
#define WM_ENTERMENULOOP
Definition: winuser.h:1804
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define WM_EXITMENULOOP
Definition: winuser.h:1805
#define WM_DESTROY
Definition: winuser.h:1609
#define GW_CHILD
Definition: winuser.h:763
#define WM_MENUSELECT
Definition: winuser.h:1747

◆ InitChildWindow()

static HWND InitChildWindow ( LPTSTR  param)
static

Definition at line 136 of file framewnd.c.

137{
138 //TCHAR drv[_MAX_DRIVE];
140 ChildWnd* pChildWnd = NULL;
141/*
142 LPCTSTR root = Globals.drives;
143 int i;
144 for(i = cmd - ID_DRIVE_FIRST; i--; root++)
145 while(*root)
146 root++;
147 if (activate_drive_window(root))
148 return 0;
149 _tsplitpath(root, drv, 0, 0, 0);
150 if (!SetCurrentDirectory(drv)) {
151 display_error(hWnd, GetLastError());
152 return 0;
153 }
154 */
156// pChildWnd = alloc_child_window(path);
157// if (!create_child_window(pChildWnd))
158// free(pChildWnd);
159 pChildWnd = (ChildWnd*)malloc(sizeof(ChildWnd));
160 if (pChildWnd != NULL) {
165 0/*style*/, 0/*lParam*/
166 };
167 memset(pChildWnd, 0, sizeof(ChildWnd));
168 lstrcpy(pChildWnd->szPath, path);
169 pChildWnd->pos.length = sizeof(WINDOWPLACEMENT);
170 pChildWnd->pos.flags = 0;
171 pChildWnd->pos.showCmd = SW_SHOWNORMAL;
176 pChildWnd->nFocusPanel = 0;
177 pChildWnd->nSplitPos = 200;
179 newchild = pChildWnd;
180 pChildWnd->hWnd = (HWND)SendMessage(hMDIClient, WM_MDICREATE, 0, (LPARAM)&mcs);
182 if (pChildWnd->hWnd == NULL) {
183 free(pChildWnd);
184 newchild = pChildWnd = NULL;
185 }
186 return pChildWnd->hWnd;
187 }
188 return 0;
189}
static struct myctx * mcs
Definition: adnstest.c:53
WCHAR szChildClass[MAX_LOADSTRING]
Definition: main.c:45
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define MAX_PATH
Definition: compat.h:34
LRESULT CALLBACK CBTProc(int code, WPARAM wParam, LPARAM lParam)
Definition: framewnd.c:92
#define memset(x, y, z)
Definition: compat.h:39
int nSplitPos
Definition: main.h:69
WCHAR szPath[MAX_PATH]
Definition: main.h:71
int nFocusPanel
Definition: main.h:68
WINDOWPLACEMENT pos
Definition: main.h:70
RECT rcNormalPosition
Definition: winuser.h:3295
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
#define lstrcpy
Definition: winbase.h:3874
#define GetCurrentDirectory
Definition: winbase.h:3805
#define SW_SHOWNORMAL
Definition: winuser.h:770
#define WM_MDICREATE
Definition: winuser.h:1812
#define WH_CBT
Definition: winuser.h:35
#define SetWindowsHookEx
Definition: winuser.h:5856
BOOL WINAPI UnhookWindowsHookEx(_In_ HHOOK)
#define CW_USEDEFAULT
Definition: winuser.h:225
struct _WINDOWPLACEMENT WINDOWPLACEMENT
char TCHAR
Definition: xmlstorage.h:189

Referenced by _CmdWndProc().

◆ OnEnterMenuLoop()

void OnEnterMenuLoop ( HWND  hWnd)

Definition at line 202 of file framewnd.c.

203{
204 int nParts;
205
206 // Update the status bar pane sizes
207 nParts = -1;
211}
static BOOL bInMenuLoop
Definition: framewnd.c:35
#define TRUE
Definition: types.h:120
#define SB_SETTEXT
Definition: commctrl.h:1949
#define SB_SETPARTS
Definition: commctrl.h:1954

◆ OnExitMenuLoop()

void OnExitMenuLoop ( HWND  hWnd)

Definition at line 213 of file framewnd.c.

214{
215 RECT rc;
216 int nParts[3];
217
219 // Update the status bar pane sizes
220 GetClientRect(hWnd, &rc);
221 nParts[0] = 100;
222 nParts[1] = 210;
223 nParts[2] = rc.right;
227}
void UpdateStatusBar(void)
Definition: framewnd.c:173
#define FALSE
Definition: types.h:117
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)

◆ OnMenuSelect()

void OnMenuSelect ( HWND  hWnd,
UINT  nItemID,
UINT  nFlags,
HMENU  hSysMenu 
)

Definition at line 229 of file framewnd.c.

230{
231 TCHAR str[100];
232
233 strcpy(str, TEXT(""));
234 if (nFlags & MF_POPUP) {
235 if (hSysMenu != GetMenu(hWnd)) {
236 if (nItemID == 2) nItemID = 5;
237 }
238 }
239 if (LoadString(hInst, nItemID, str, 100)) {
240 // load appropriate string
241 LPTSTR lpsz = str;
242 // first newline terminates actual string
243 lpsz = _tcschr(lpsz, '\n');
244 if (lpsz != NULL)
245 *lpsz = '\0';
246 }
248}
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define _tcschr
Definition: tchar.h:1406
#define TEXT(s)
Definition: k32.h:26
const WCHAR * str
#define MF_POPUP
Definition: winuser.h:136
#define LoadString
Definition: winuser.h:5819
HMENU WINAPI GetMenu(_In_ HWND)
CHAR * LPTSTR
Definition: xmlstorage.h:192

◆ resize_frame_client()

void resize_frame_client ( HWND  hWnd)

Definition at line 80 of file framewnd.c.

81{
82 RECT rect;
83
86}
static void resize_frame_rect(HWND hWnd, PRECT prect)
Definition: framewnd.c:42
& rect
Definition: startmenu.cpp:1413

◆ resize_frame_rect()

static void resize_frame_rect ( HWND  hWnd,
PRECT  prect 
)
static

Definition at line 52 of file framewnd.c.

53{
54 RECT rt;
55
59 prect->top = rt.bottom+3;
60 prect->bottom -= rt.bottom+3;
61 }
63 int parts[] = {300, 500};
64
68 prect->bottom -= rt.bottom;
69 }
70 MoveWindow(hMDIClient, prect->left-1,prect->top-1,prect->right+2,prect->bottom+1, TRUE);
71}
static const D3D_BLOB_PART parts[]
Definition: blob.c:76
BOOL WINAPI IsWindowVisible(_In_ HWND)
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)

◆ toggle_child()

void toggle_child ( HWND  hWnd,
UINT  cmd,
HWND  hchild 
)

Definition at line 125 of file framewnd.c.

126{
127 BOOL vis = IsWindowVisible(hchild);
128
131 ShowWindow(hchild, vis?SW_HIDE:SW_SHOW);
133}
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ID_OPTIONS_MENU
Definition: resource.h:8
Definition: ftp_var.h:139
#define SW_HIDE
Definition: winuser.h:768
#define MF_BYCOMMAND
Definition: winuser.h:202
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define MF_CHECKED
Definition: winuser.h:132
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define SW_SHOW
Definition: winuser.h:775

Variable Documentation

◆ bInMenuLoop

BOOL bInMenuLoop = FALSE

Definition at line 46 of file framewnd.c.

◆ hcbthook

HHOOK hcbthook
static

Definition at line 89 of file framewnd.c.

Referenced by CBTProc(), and InitChildWindow().

◆ newchild

ChildWnd* newchild = NULL
static

Definition at line 90 of file framewnd.c.

Referenced by CBTProc(), and InitChildWindow().