Added new template multiple document interface application.

svn path=/trunk/; revision=3199
This commit is contained in:
Robert Dickenson 2002-07-09 19:53:58 +00:00
parent d28f38708e
commit 95e5b26b81
22 changed files with 1952 additions and 0 deletions

View file

@ -0,0 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// winfile.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file

View file

@ -0,0 +1,33 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_)
#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files:
#include <windows.h>
#include <commctrl.h>
// C RunTime Header Files
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
// Local Header Files
// TODO: reference additional headers your program requires here
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_)

View file

@ -0,0 +1,69 @@
/*
* ReactOS About Dialog Box
*
* about.c
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifdef _MSC_VER
#include "stdafx.h"
#else
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <process.h>
#include <stdio.h>
#endif
#include "main.h"
#include "about.h"
extern HINSTANCE hInst;
LRESULT CALLBACK AboutDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND hLicenseEditWnd;
TCHAR strLicense[0x1000];
switch (message) {
case WM_INITDIALOG:
hLicenseEditWnd = GetDlgItem(hDlg, IDC_LICENSE_EDIT);
LoadString(hInst, IDS_LICENSE, strLicense, 0x1000);
SetWindowText(hLicenseEditWnd, strLicense);
return TRUE;
case WM_COMMAND:
if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL)) {
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
}
break;
}
return 0;
}
void ShowAboutBox(HWND hWnd)
{
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, (DLGPROC)AboutDialogWndProc);
}

View file

@ -0,0 +1,38 @@
/*
* ReactOS About Dialog Box
*
* about.h
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __ABOUT_H__
#define __ABOUT_H__
#ifdef __cplusplus
extern "C" {
#endif
void ShowAboutBox(HWND hWnd);
#ifdef __cplusplus
};
#endif
#endif // __ABOUT_H__

View file

@ -0,0 +1,272 @@
/*
* ReactOS Application MDI Child Window
*
* childwnd.c
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifdef _MSC_VER
#include "stdafx.h"
#else
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <process.h>
#include <stdio.h>
#endif
#include <assert.h>
#define ASSERT assert
#include "main.h"
#include "childwnd.h"
////////////////////////////////////////////////////////////////////////////////
static void draw_splitbar(HWND hWnd, int x)
{
RECT rt;
HDC hdc = GetDC(hWnd);
GetClientRect(hWnd, &rt);
rt.left = x - SPLIT_WIDTH/2;
rt.right = x + SPLIT_WIDTH/2+1;
InvertRect(hdc, &rt);
ReleaseDC(hWnd, hdc);
}
static void OnPaint(HWND hWnd, ChildWnd* pChildWnd)
{
PAINTSTRUCT ps;
RECT rt;
GetClientRect(hWnd, &rt);
BeginPaint(hWnd, &ps);
// lastBrush = SelectObject(ps.hdc, (HBRUSH)GetStockObject(WHITE_BRUSH));
// Rectangle(ps.hdc, rt.left, rt.top-1, rt.right, rt.bottom+1);
// SelectObject(ps.hdc, lastBrush);
// rt.top = rt.bottom - GetSystemMetrics(SM_CYHSCROLL);
FillRect(ps.hdc, &rt, GetStockObject(BLACK_BRUSH));
/*
rt.left = pChildWnd->nSplitPos-SPLIT_WIDTH/2;
rt.right = pChildWnd->nSplitPos+SPLIT_WIDTH/2+1;
lastBrush = SelectBrush(ps.hdc, (HBRUSH)GetStockObject(COLOR_SPLITBAR));
Rectangle(ps.hdc, rt.left, rt.top-1, rt.right, rt.bottom+1);
SelectObject(ps.hdc, lastBrush);
#ifdef _NO_EXTENSIONS
rt.top = rt.bottom - GetSystemMetrics(SM_CYHSCROLL);
FillRect(ps.hdc, &rt, GetStockObject(BLACK_BRUSH));
#endif
*/
EndPaint(hWnd, &ps);
}
static void OnSize(ChildWnd* pChildWnd, WPARAM wParam, LPARAM lParam)
{
if (wParam != SIZE_MINIMIZED) {
//resize_tree(pChildWnd, LOWORD(lParam), HIWORD(lParam));
}
}
//
// FUNCTION: ChildWndProc(HWND, unsigned, WORD, LONG)
//
// PURPOSE: Processes messages for the child windows.
//
// WM_COMMAND - process the application menu
// WM_PAINT - Paint the main window
// WM_DESTROY - post a quit message and return
//
//
LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
static int last_split;
// Pane* pane;
ChildWnd* pChildWnd = (ChildWnd*)GetWindowLong(hWnd, GWL_USERDATA);
// ChildWnd* new_child;
ASSERT(pChildWnd);
if (1) {
switch(message) {
case WM_CREATE:
return 0;
case WM_MDIACTIVATE: // set an alternate menu here
if (lParam == (LPARAM)hWnd) {
} else {
}
DrawMenuBar(hFrameWnd);
// return 0;
break;
case WM_PAINT:
OnPaint(hWnd, pChildWnd);
return 0;
case WM_NCDESTROY:
//SetWindowLong(hWnd, GWL_USERDATA, 0);
break;
case WM_SETCURSOR:
if (LOWORD(lParam) == HTCLIENT) {
POINT pt;
GetCursorPos(&pt);
ScreenToClient(hWnd, &pt);
if (pt.x>=pChildWnd->nSplitPos-SPLIT_WIDTH/2 && pt.x<pChildWnd->nSplitPos+SPLIT_WIDTH/2+1) {
SetCursor(LoadCursor(0, IDC_SIZEWE));
return TRUE;
}
}
//goto def;
break;
case WM_LBUTTONDOWN: {
RECT rt;
int x = LOWORD(lParam);
GetClientRect(hWnd, &rt);
if (x>=pChildWnd->nSplitPos-SPLIT_WIDTH/2 && x<pChildWnd->nSplitPos+SPLIT_WIDTH/2+1) {
last_split = pChildWnd->nSplitPos;
#ifdef _NO_EXTENSIONS
draw_splitbar(hWnd, last_split);
#endif
SetCapture(hWnd);
}
break;}
case WM_LBUTTONUP:
if (GetCapture() == hWnd) {
#ifdef _NO_EXTENSIONS
RECT rt;
int x = LOWORD(lParam);
draw_splitbar(hWnd, last_split);
last_split = -1;
GetClientRect(hWnd, &rt);
pChildWnd->nSplitPos = x;
//resize_tree(pChildWnd, rt.right, rt.bottom);
#endif
ReleaseCapture();
}
break;
#ifdef _NO_EXTENSIONS
case WM_CAPTURECHANGED:
if (GetCapture()==hWnd && last_split>=0)
draw_splitbar(hWnd, last_split);
break;
#endif
case WM_KEYDOWN:
if (wParam == VK_ESCAPE)
if (GetCapture() == hWnd) {
RECT rt;
#ifdef _NO_EXTENSIONS
draw_splitbar(hWnd, last_split);
#else
pChildWnd->nSplitPos = last_split;
#endif
GetClientRect(hWnd, &rt);
//resize_tree(pChildWnd, rt.right, rt.bottom);
last_split = -1;
ReleaseCapture();
SetCursor(LoadCursor(0, IDC_ARROW));
}
break;
case WM_MOUSEMOVE:
if (GetCapture() == hWnd) {
RECT rt;
int x = LOWORD(lParam);
#ifdef _NO_EXTENSIONS
HDC hdc = GetDC(hWnd);
GetClientRect(hWnd, &rt);
rt.left = last_split-SPLIT_WIDTH/2;
rt.right = last_split+SPLIT_WIDTH/2+1;
InvertRect(hdc, &rt);
last_split = x;
rt.left = x-SPLIT_WIDTH/2;
rt.right = x+SPLIT_WIDTH/2+1;
InvertRect(hdc, &rt);
ReleaseDC(hWnd, hdc);
#else
GetClientRect(hWnd, &rt);
if (x>=0 && x<rt.right) {
pChildWnd->nSplitPos = x;
resize_tree(pChildWnd, rt.right, rt.bottom);
rt.left = x-SPLIT_WIDTH/2;
rt.right = x+SPLIT_WIDTH/2+1;
InvalidateRect(hWnd, &rt, FALSE);
UpdateWindow(pChildWnd->left.hWnd);
UpdateWindow(hWnd);
UpdateWindow(pChildWnd->right.hWnd);
}
#endif
}
break;
#ifndef _NO_EXTENSIONS
case WM_GETMINMAXINFO:
DefMDIChildProc(hWnd, message, wParam, lParam);
{LPMINMAXINFO lpmmi = (LPMINMAXINFO)lParam;
lpmmi->ptMaxTrackSize.x <<= 1;//2*GetSystemMetrics(SM_CXSCREEN) / SM_CXVIRTUALSCREEN
lpmmi->ptMaxTrackSize.y <<= 1;//2*GetSystemMetrics(SM_CYSCREEN) / SM_CYVIRTUALSCREEN
break;}
#endif
case WM_SETFOCUS:
SetCurrentDirectory(pChildWnd->szPath);
SetFocus(pChildWnd->nFocusPanel? pChildWnd->hRightWnd: pChildWnd->hLeftWnd);
break;
/*
case WM_COMMAND:
pane = GetFocus()==pChildWnd->left.hWnd? &pChildWnd->left: &pChildWnd->right;
switch(LOWORD(wParam)) {
case ID_WINDOW_NEW_WINDOW:
return 0;
default:
return pane_command(pane, LOWORD(wParam));
break;
}
break;
*/
case WM_SIZE:
if (wParam != SIZE_MINIMIZED) {
OnSize(pChildWnd, wParam, lParam);
}
// fall through
default: def:
return DefMDIChildProc(hWnd, message, wParam, lParam);
}
}
return DefMDIChildProc(hWnd, message, wParam, lParam);
}

View file

@ -0,0 +1,42 @@
/*
* ReactOS Application MDI Child Window
*
* childwnd.h
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __CHILD_WND_H__
#define __CHILD_WND_H__
#ifdef __cplusplus
extern "C" {
#endif
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
LRESULT CALLBACK ChildWndProc(HWND, UINT, WPARAM, LPARAM);
#ifdef __cplusplus
};
#endif
#endif // __CHILD_WND_H__

View file

@ -0,0 +1,376 @@
/*
* ReactOS Application
*
* framewnd.c
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifdef _MSC_VER
#include "stdafx.h"
#else
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <process.h>
#include <stdio.h>
#endif
#include "main.h"
#include "about.h"
#include "framewnd.h"
//#include "childwnd.h"
////////////////////////////////////////////////////////////////////////////////
// Global Variables:
//
BOOL bInMenuLoop = FALSE; // Tells us if we are in the menu loop
////////////////////////////////////////////////////////////////////////////////
// Local module support methods
//
static void resize_frame_rect(HWND hWnd, PRECT prect)
{
RECT rt;
if (IsWindowVisible(hToolBar)) {
SendMessage(hToolBar, WM_SIZE, 0, 0);
GetClientRect(hToolBar, &rt);
prect->top = rt.bottom+3;
prect->bottom -= rt.bottom+3;
}
if (IsWindowVisible(hStatusBar)) {
int parts[] = {300, 500};
SendMessage(hStatusBar, WM_SIZE, 0, 0);
SendMessage(hStatusBar, SB_SETPARTS, 2, (LPARAM)&parts);
GetClientRect(hStatusBar, &rt);
prect->bottom -= rt.bottom;
}
MoveWindow(hMDIClient, prect->left-1,prect->top-1,prect->right+2,prect->bottom+1, TRUE);
}
static void resize_frame(HWND hWnd, int cx, int cy)
{
RECT rect = {0, 0, cx, cy};
resize_frame_rect(hWnd, &rect);
}
void resize_frame_client(HWND hWnd)
{
RECT rect;
GetClientRect(hWnd, &rect);
resize_frame_rect(hWnd, &rect);
}
////////////////////////////////////////////////////////////////////////////////
static HHOOK hcbthook;
static ChildWnd* newchild = NULL;
LRESULT CALLBACK CBTProc(int code, WPARAM wParam, LPARAM lParam)
{
if (code == HCBT_CREATEWND && newchild) {
ChildWnd* pChildWnd = newchild;
newchild = NULL;
pChildWnd->hWnd = (HWND)wParam;
SetWindowLong(pChildWnd->hWnd, GWL_USERDATA, (LPARAM)pChildWnd);
}
return CallNextHookEx(hcbthook, code, wParam, lParam);
}
#if 0
HWND create_child_window(ChildWnd* pChildWnd)
{
MDICREATESTRUCT mcs = {
szChildClass, (LPTSTR)pChildWnd->path, hInst,
pChildWnd->pos.rcNormalPosition.left, pChildWnd->pos.rcNormalPosition.top,
pChildWnd->pos.rcNormalPosition.right-pChildWnd->pos.rcNormalPosition.left,
pChildWnd->pos.rcNormalPosition.bottom-pChildWnd->pos.rcNormalPosition.top,
0/*style*/, 0/*lParam*/
};
hcbthook = SetWindowsHookEx(WH_CBT, CBTProc, 0, GetCurrentThreadId());
newchild = pChildWnd;
pChildWnd->hWnd = (HWND)SendMessage(hMDIClient, WM_MDICREATE, 0, (LPARAM)&mcs);
if (!pChildWnd->hWnd)
return 0;
UnhookWindowsHookEx(hcbthook);
return pChildWnd->hWnd;
}
#endif
void toggle_child(HWND hWnd, UINT cmd, HWND hchild)
{
BOOL vis = IsWindowVisible(hchild);
HMENU hMenuOptions = GetSubMenu(hMenuFrame, ID_OPTIONS_MENU);
CheckMenuItem(hMenuOptions, cmd, vis?MF_BYCOMMAND:MF_BYCOMMAND|MF_CHECKED);
ShowWindow(hchild, vis?SW_HIDE:SW_SHOW);
resize_frame_client(hWnd);
}
static HWND InitChildWindow(LPTSTR param)
{
//TCHAR drv[_MAX_DRIVE];
TCHAR path[MAX_PATH];
ChildWnd* pChildWnd = NULL;
/*
LPCTSTR root = Globals.drives;
int i;
for(i = cmd - ID_DRIVE_FIRST; i--; root++)
while(*root)
root++;
if (activate_drive_window(root))
return 0;
_tsplitpath(root, drv, 0, 0, 0);
if (!SetCurrentDirectory(drv)) {
display_error(hWnd, GetLastError());
return 0;
}
*/
GetCurrentDirectory(MAX_PATH, path);
// pChildWnd = alloc_child_window(path);
// if (!create_child_window(pChildWnd))
// free(pChildWnd);
pChildWnd = (ChildWnd*)malloc(sizeof(ChildWnd));
if (pChildWnd != NULL) {
MDICREATESTRUCT mcs = {
szChildClass, path, hInst,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
0/*style*/, 0/*lParam*/
};
memset(pChildWnd, 0, sizeof(ChildWnd));
lstrcpy(pChildWnd->szPath, path);
pChildWnd->pos.length = sizeof(WINDOWPLACEMENT);
pChildWnd->pos.flags = 0;
pChildWnd->pos.showCmd = SW_SHOWNORMAL;
pChildWnd->pos.rcNormalPosition.left = CW_USEDEFAULT;
pChildWnd->pos.rcNormalPosition.top = CW_USEDEFAULT;
pChildWnd->pos.rcNormalPosition.right = CW_USEDEFAULT;
pChildWnd->pos.rcNormalPosition.bottom = CW_USEDEFAULT;
pChildWnd->nFocusPanel = 0;
pChildWnd->nSplitPos = 200;
hcbthook = SetWindowsHookEx(WH_CBT, CBTProc, 0, GetCurrentThreadId());
newchild = pChildWnd;
pChildWnd->hWnd = (HWND)SendMessage(hMDIClient, WM_MDICREATE, 0, (LPARAM)&mcs);
UnhookWindowsHookEx(hcbthook);
if (pChildWnd->hWnd == NULL) {
free(pChildWnd);
newchild = pChildWnd = NULL;
}
return pChildWnd->hWnd;
}
return 0;
}
BOOL CALLBACK CloseEnumProc(HWND hWnd, LPARAM lParam)
{
if (!GetWindow(hWnd, GW_OWNER)) {
SendMessage(GetParent(hWnd), WM_MDIRESTORE, (WPARAM)hWnd, 0);
if (SendMessage(hWnd, WM_QUERYENDSESSION, 0, 0)) {
SendMessage(GetParent(hWnd), WM_MDIDESTROY, (WPARAM)hWnd, 0);
}
}
return 1;
}
void OnEnterMenuLoop(HWND hWnd)
{
int nParts;
// Update the status bar pane sizes
nParts = -1;
SendMessage(hStatusBar, SB_SETPARTS, 1, (long)&nParts);
bInMenuLoop = TRUE;
SendMessage(hStatusBar, SB_SETTEXT, (WPARAM)0, (LPARAM)_T(""));
}
void OnExitMenuLoop(HWND hWnd)
{
RECT rc;
int nParts[3];
bInMenuLoop = FALSE;
// Update the status bar pane sizes
GetClientRect(hWnd, &rc);
nParts[0] = 100;
nParts[1] = 210;
nParts[2] = rc.right;
SendMessage(hStatusBar, SB_SETPARTS, 3, (long)nParts);
SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)_T(""));
UpdateStatusBar();
}
void OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU hSysMenu)
{
TCHAR str[100];
strcpy(str, TEXT(""));
if (nFlags & MF_POPUP) {
if (hSysMenu != GetMenu(hWnd)) {
if (nItemID == 2) nItemID = 5;
}
}
if (LoadString(hInst, nItemID, str, 100)) {
// load appropriate string
LPTSTR lpsz = str;
// first newline terminates actual string
lpsz = _tcschr(lpsz, '\n');
if (lpsz != NULL)
*lpsz = '\0';
}
SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)str);
}
////////////////////////////////////////////////////////////////////////////////
//
// FUNCTION: _CmdWndProc(HWND, unsigned, WORD, LONG)
//
// PURPOSE: Processes WM_COMMAND messages for the main frame window.
//
//
LRESULT _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND hChildWnd;
if (1) {
switch (LOWORD(wParam)) {
case ID_WINDOW_CLOSEALL:
EnumChildWindows(hMDIClient, &CloseEnumProc, 0);
break;
case ID_WINDOW_CLOSE:
hChildWnd = (HWND) SendMessage(hMDIClient, WM_MDIGETACTIVE, 0, 0);
if (!SendMessage(hChildWnd, WM_QUERYENDSESSION, 0, 0))
SendMessage(hMDIClient, WM_MDIDESTROY, (WPARAM)hChildWnd, 0);
break;
case ID_FILE_EXIT:
SendMessage(hWnd, WM_CLOSE, 0, 0);
break;
case ID_OPTIONS_TOOLBAR:
toggle_child(hWnd, LOWORD(wParam), hToolBar);
break;
case ID_OPTIONS_STATUSBAR:
toggle_child(hWnd, LOWORD(wParam), hStatusBar);
break;
case ID_FILE_OPEN:
case ID_WINDOW_NEW_WINDOW:
InitChildWindow("Child Window");
return 0;
case ID_WINDOW_CASCADE:
SendMessage(hMDIClient, WM_MDICASCADE, 0, 0);
break;
case ID_WINDOW_TILE_HORZ:
SendMessage(hMDIClient, WM_MDITILE, MDITILE_HORIZONTAL, 0);
break;
case ID_WINDOW_TILE_VERT:
SendMessage(hMDIClient, WM_MDITILE, MDITILE_VERTICAL, 0);
break;
case ID_WINDOW_ARRANGE_ICONS:
SendMessage(hMDIClient, WM_MDIICONARRANGE, 0, 0);
break;
case ID_HELP_ABOUT:
ShowAboutBox(hWnd);
break;
default:
hChildWnd = (HWND)SendMessage(hMDIClient, WM_MDIGETACTIVE, 0, 0);
if (IsWindow(hChildWnd))
SendMessage(hChildWnd, WM_COMMAND, wParam, lParam);
else
return DefFrameProc(hWnd, hMDIClient, message, wParam, lParam);
}
}
return 0;
}
////////////////////////////////////////////////////////////////////////////////
//
// FUNCTION: FrameWndProc(HWND, unsigned, WORD, LONG)
//
// PURPOSE: Processes messages for the main frame window.
//
// WM_COMMAND - process the application menu
// WM_DESTROY - post a quit message and return
//
//
LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
case WM_CREATE:
{
HMENU hMenuWindow = GetSubMenu(hMenuFrame, GetMenuItemCount(hMenuFrame)-2);
CLIENTCREATESTRUCT ccs = { hMenuWindow, IDW_FIRST_CHILD };
#if 0
hMDIClient = CreateWindow(_T("MDICLIENT"), NULL,
WS_CHILD|WS_CLIPCHILDREN|WS_VISIBLE,
0, 0, 0, 0,
hWnd, (HMENU)1, hInst, &ccs);
#else
hMDIClient = CreateWindowEx(0, _T("MDICLIENT"), NULL,
// hMDIClient = CreateWindowEx(0, (LPCTSTR)(int)hChildWndClass, NULL,
WS_CHILD|WS_CLIPCHILDREN|WS_VSCROLL|WS_HSCROLL|WS_VISIBLE|WS_BORDER,
0, 0, 0, 0,
hWnd, (HMENU)0, hInst, &ccs);
#endif
}
break;
case WM_COMMAND:
return _CmdWndProc(hWnd, message, wParam, lParam);
break;
case WM_SIZE:
resize_frame_client(hWnd);
break;
case WM_ENTERMENULOOP:
OnEnterMenuLoop(hWnd);
break;
case WM_EXITMENULOOP:
OnExitMenuLoop(hWnd);
break;
case WM_MENUSELECT:
OnMenuSelect(hWnd, LOWORD(wParam), HIWORD(wParam), (HMENU)lParam);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_QUERYENDSESSION:
case WM_CLOSE:
SendMessage(hWnd, WM_COMMAND, ID_WINDOW_CLOSEALL, 0);
if (GetWindow(hMDIClient, GW_CHILD) != NULL)
return 0;
// else fall thru...
default:
return DefFrameProc(hWnd, hMDIClient, message, wParam, lParam);
}
return 0;
}

View file

@ -0,0 +1,42 @@
/*
* ReactOS Application Main Window
*
* framewnd.h
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __FRAME_WND_H__
#define __FRAME_WND_H__
#ifdef __cplusplus
extern "C" {
#endif
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
LRESULT CALLBACK FrameWndProc(HWND, UINT, WPARAM, LPARAM);
#ifdef __cplusplus
};
#endif
#endif // __FRAME_WND_H__

View file

@ -0,0 +1,268 @@
/*
* ReactOS Application
*
* main.c
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifdef _MSC_VER
#include "stdafx.h"
#else
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <process.h>
#include <stdio.h>
#endif
#include "main.h"
#include "framewnd.h"
#include "childwnd.h"
////////////////////////////////////////////////////////////////////////////////
// Global Variables:
//
HINSTANCE hInst;
HACCEL hAccel;
HWND hFrameWnd;
HWND hMDIClient;
HMENU hMenuFrame;
HWND hStatusBar;
HWND hToolBar;
HFONT hFont;
TCHAR szTitle[MAX_LOADSTRING];
TCHAR szFrameClass[MAX_LOADSTRING];
TCHAR szChildClass[MAX_LOADSTRING];
////////////////////////////////////////////////////////////////////////////////
//
//
// FUNCTION: InitInstance(HANDLE, int)
//
// PURPOSE: Saves instance handle and creates main window
//
// COMMENTS:
//
// In this function, we save the instance handle in a global variable and
// create and display the main program window.
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
// ChildWnd* pChildWnd;
WNDCLASSEX wcFrame = {
sizeof(WNDCLASSEX),
CS_HREDRAW | CS_VREDRAW/*style*/,
FrameWndProc,
0/*cbClsExtra*/,
0/*cbWndExtra*/,
hInstance,
LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MDI_APP)),
LoadCursor(0, IDC_ARROW),
0/*hbrBackground*/,
0/*lpszMenuName*/,
szFrameClass,
(HICON)LoadImage(hInstance, MAKEINTRESOURCE(IDI_MDI_APP), IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED)
};
ATOM hFrameWndClass = RegisterClassEx(&wcFrame); // register frame window class
#if 0
WNDCLASS wcChild = {
CS_CLASSDC|CS_DBLCLKS|CS_VREDRAW,
ChildWndProc,
0/*cbClsExtra*/,
0/*cbWndExtra*/,
hInstance,
0/*hIcon*/,
LoadCursor(0, IDC_ARROW),
0/*hbrBackground*/,
0/*lpszMenuName*/,
szChildClass
};
ATOM hChildWndClass = RegisterClass(&wcChild); // register child windows class
#else
WNDCLASSEX wcChild = {
sizeof(WNDCLASSEX),
CS_HREDRAW | CS_VREDRAW/*style*/,
ChildWndProc,
0/*cbClsExtra*/,
sizeof(HANDLE)/*cbWndExtra*/,
hInstance,
LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MDI_APP)),
LoadCursor(0, IDC_ARROW),
0/*hbrBackground*/,
0/*lpszMenuName*/,
szChildClass,
(HICON)LoadImage(hInstance, MAKEINTRESOURCE(IDC_MDI_APP), IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED)
};
ATOM hChildWndClass = RegisterClassEx(&wcChild); // register child windows class
#endif
HMENU hMenu = LoadMenu(hInstance, MAKEINTRESOURCE(IDC_MDI_APP));
HMENU hMenuOptions = GetSubMenu(hMenu, ID_OPTIONS_MENU);
HMENU hChildMenu = LoadMenu(hInstance, MAKEINTRESOURCE(IDC_MDI_APP_CHILD));
INITCOMMONCONTROLSEX icc = {
sizeof(INITCOMMONCONTROLSEX),
ICC_BAR_CLASSES
};
HDC hdc = GetDC(0);
hMenuFrame = hMenu;
// hMenuView = GetSubMenu(hMenuFrame, ID_VIEW_MENU);
hAccel = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_MDI_APP));
hFont = CreateFont(-MulDiv(8,GetDeviceCaps(hdc,LOGPIXELSY),72), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _T("MS Sans Serif"));
ReleaseDC(0, hdc);
hFrameWnd = CreateWindowEx(0, (LPCTSTR)(int)hFrameWndClass, szTitle,
// hFrameWnd = CreateWindow(szFrameClass, szTitle,
WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
NULL/*hWndParent*/, hMenuFrame, hInstance, NULL/*lpParam*/);
if (!hFrameWnd) {
return FALSE;
}
if (InitCommonControlsEx(&icc))
{
int nParts[3];
TBBUTTON toolbarBtns[] = {
{0, 0, 0, TBSTYLE_SEP},
{0, ID_WINDOW_NEW_WINDOW, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{1, ID_WINDOW_CASCADE, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{2, ID_WINDOW_TILE_HORZ, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{3, ID_WINDOW_TILE_VERT, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{4, 2/*TODO: ID_...*/, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{5, 2/*TODO: ID_...*/, TBSTATE_ENABLED, TBSTYLE_BUTTON},
};
hToolBar = CreateToolbarEx(hFrameWnd, WS_CHILD|WS_VISIBLE,
IDC_TOOLBAR, 2, hInstance, IDB_TOOLBAR, toolbarBtns,
sizeof(toolbarBtns)/sizeof(TBBUTTON), 16, 15, 16, 15, sizeof(TBBUTTON));
CheckMenuItem(hMenuOptions, ID_OPTIONS_TOOLBAR, MF_BYCOMMAND|MF_CHECKED);
// Create the status bar
hStatusBar = CreateStatusWindow(WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|SBT_NOBORDERS,
"", hFrameWnd, IDC_STATUSBAR);
if (!hStatusBar)
return FALSE;
CheckMenuItem(hMenuOptions, ID_OPTIONS_STATUSBAR, MF_BYCOMMAND|MF_CHECKED);
// Create the status bar panes
nParts[0] = 100;
nParts[1] = 210;
nParts[2] = 400;
SendMessage(hStatusBar, SB_SETPARTS, 3, (long)nParts);
} else {
CheckMenuItem(hMenuOptions, ID_OPTIONS_TOOLBAR, MF_BYCOMMAND|MF_GRAYED);
CheckMenuItem(hMenuOptions, ID_OPTIONS_STATUSBAR, MF_BYCOMMAND|MF_GRAYED);
}
ShowWindow(hFrameWnd, nCmdShow);
UpdateWindow(hFrameWnd);
UpdateStatusBar();
return TRUE;
}
void UpdateStatusBar(void)
{
TCHAR text[260];
DWORD size;
size = sizeof(text)/sizeof(TCHAR);
GetUserName(text, &size);
SendMessage(hStatusBar, SB_SETTEXT, 1, (LPARAM)text);
size = sizeof(text)/sizeof(TCHAR);
GetComputerName(text, &size);
SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)text);
}
static int g_foundPrevInstance = 0;
// search for already running win[e]files
static BOOL CALLBACK EnumWndProc(HWND hWnd, LPARAM lParam)
{
TCHAR cls[128];
GetClassName(hWnd, cls, 128);
if (!lstrcmp(cls, (LPCTSTR)lParam)) {
g_foundPrevInstance++;
return FALSE;
}
return TRUE;
}
void ExitInstance(void)
{
DestroyMenu(hMenuFrame);
}
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
MSG msg;
HACCEL hAccel;
HWND hMDIClient;
// Initialize global strings
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadString(hInstance, IDC_MDI_APP, szFrameClass, MAX_LOADSTRING);
LoadString(hInstance, IDC_MDI_APP_CHILD, szChildClass, MAX_LOADSTRING);
// Allow only one running instance
EnumWindows(EnumWndProc, (LPARAM)szFrameClass);
if (g_foundPrevInstance)
return 1;
// Store instance handle in our global variable
hInst = hInstance;
// Perform application initialization:
if (!InitInstance(hInstance, nCmdShow)) {
return FALSE;
}
hAccel = LoadAccelerators(hInstance, (LPCTSTR)IDC_MDI_APP);
hMDIClient = GetWindow(hFrameWnd, GW_CHILD);
// Main message loop:
while (GetMessage(&msg, (HWND)NULL, 0, 0)) {
if (!TranslateMDISysAccel(hMDIClient, &msg) &&
!TranslateAccelerator(hFrameWnd/*hwndFrame*/, hAccel, &msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
ExitInstance();
return msg.wParam;
}

View file

@ -0,0 +1,83 @@
/*
* ReactOS Application
*
* main.h
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* Based on Winefile, Copyright 2000 martin Fuchs <martin-fuchs@gmx.net>
*/
#ifndef __MAIN_H__
#define __MAIN_H__
#ifdef __cplusplus
extern "C" {
#endif
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "resource.h"
#include "../../lib/ros2win/ros2win.h"
////////////////////////////////////////////////////////////////////////////////
#define SPLIT_WIDTH 5
#define MAX_LOADSTRING 100
//#define BUFFER_LEN 1024
#define _NO_EXTENSIONS
typedef struct {
HWND hWnd;
HWND hLeftWnd;
HWND hRightWnd;
int nFocusPanel; // 0: left 1: right
int nSplitPos;
WINDOWPLACEMENT pos;
TCHAR szPath[MAX_PATH];
} ChildWnd;
void UpdateStatusBar(void);
////////////////////////////////////////////////////////////////////////////////
// Global Variables:
extern HINSTANCE hInst;
extern HACCEL hAccel;
extern HWND hFrameWnd;
extern HMENU hMenuFrame;
extern HWND hMDIClient;
extern HWND hStatusBar;
extern HWND hToolBar;
extern HFONT hFont;
extern TCHAR szTitle[];
extern TCHAR szFrameClass[];
extern TCHAR szChildClass[];
#ifdef __cplusplus
};
#endif
#endif // __MAIN_H__

View file

@ -0,0 +1,66 @@
#
# ReactOS winfile
#
# Makefile
#
# Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
PATH_TO_TOP = ../..
TARGET = mdi
BASE_CFLAGS = -DGCC -D_WIN32_IE=0x0400
RCFLAGS = -DGCC -D_WIN32_IE=0x0400
OBJS = about.o \
framewnd.o \
childwnd.o \
main.o
#LIBS = -lgdi32 -luser32 -lkernel32 -lcomctl32
LIBS = -lgdi32 -luser32 -lkernel32 -l../../lib/ros2win/ros2win
all: $(TARGET).exe
$(TARGET).res: $(TARGET).rc
$(TARGET).exe: $(OBJS) $(TARGET).coff
$(CC) -Wl,--subsystem,windows -o $(TARGET).exe $(OBJS) $(TARGET).coff $(LIBS)
$(NM) --numeric-sort $(TARGET).exe > $(TARGET).sym
about.o: about.c about.h resource.h
main.o: main.c main.h childwnd.h framewnd.h resource.h
childwnd.o: childwnd.c childwnd.h resource.h
framewnd.o: framewnd.c framewnd.h resource.h
#$(TARGET).o: $(TARGET).c $(TARGET).h resource.h
clean:
- $(RM) $(OBJS)
- $(RM) $(TARGET).exe
- $(RM) $(TARGET).sym
- $(RM) $(TARGET).coff
include $(PATH_TO_TOP)/rules.mak

View file

@ -0,0 +1,39 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: mdi - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\Robert\LOCALS~1\Temp\RSP1EF.tmp" with contents
[
/nologo /MLd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Fp"Debug/mdi.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c
"F:\DATAVOL\PROJECTS\REACTOS\source\rosapps\templates\mdi\childwnd.c"
]
Creating command line "cl.exe @C:\DOCUME~1\Robert\LOCALS~1\Temp\RSP1EF.tmp"
Creating temporary file "C:\DOCUME~1\Robert\LOCALS~1\Temp\RSP1F0.tmp" with contents
[
kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib ../../lib/ros2win/Debug/ros2win.lib /nologo /subsystem:windows /incremental:yes /pdb:"Debug/mdi.pdb" /debug /machine:I386 /out:"Debug/mdi.exe" /pdbtype:sept
.\Debug\about.obj
.\Debug\childwnd.obj
.\Debug\framewnd.obj
.\Debug\main.obj
.\Debug\StdAfx.obj
.\Debug\mdi.res
.\Debug\panelwnd.obj
]
Creating command line "link.exe @C:\DOCUME~1\Robert\LOCALS~1\Temp\RSP1F0.tmp"
<h3>Output Window</h3>
Compiling...
childwnd.c
F:\DATAVOL\PROJECTS\REACTOS\source\rosapps\templates\mdi\childwnd.c(267) : warning C4102: 'def' : unreferenced label
Linking...
<h3>Results</h3>
mdi.exe - 0 error(s), 1 warning(s)
</pre>
</body>
</html>

View file

@ -0,0 +1,262 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#define APSTUDIO_HIDDEN_SYMBOLS
#include "windows.h"
#undef APSTUDIO_HIDDEN_SYMBOLS
#include "resource.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_MDI_APP ICON DISCARDABLE "res/mdi.ico"
IDI_SMALL ICON DISCARDABLE "res/small.ico"
////////////////////////////////////////////////////////////////////////////////
// Bitmaps
//
IDB_TOOLBAR BITMAP DISCARDABLE "res/toolbar.bmp"
IDB_IMAGES BITMAP DISCARDABLE "res/images.bmp"
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDC_MDI_APP MENU DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&Open\tEnter", ID_FILE_OPEN
MENUITEM SEPARATOR
MENUITEM "&Run...\t", ID_FILE_RUN, GRAYED
MENUITEM "&Print...\t", ID_FILE_PRINT, GRAYED
MENUITEM SEPARATOR
MENUITEM "E&xit", ID_FILE_EXIT
END
POPUP "&Options"
BEGIN
MENUITEM "&Confirmation...", ID_OPTIONS_CONFIRMATION, GRAYED
MENUITEM "&Font...", ID_OPTIONS_FONT, GRAYED
MENUITEM "Customise Tool&bar...", ID_OPTIONS_CUSTOMISE_TOOLBAR, GRAYED
MENUITEM SEPARATOR
MENUITEM "&Toolbar", ID_OPTIONS_TOOLBAR
MENUITEM "&Statusbar", ID_OPTIONS_STATUSBAR
MENUITEM SEPARATOR
MENUITEM "&Save Settings on Exit", ID_OPTIONS_SAVE_ON_EXIT, GRAYED
END
POPUP "&Window"
BEGIN
MENUITEM "&New Window", ID_WINDOW_NEW_WINDOW
MENUITEM "&Cascade\tShift+F5", ID_WINDOW_CASCADE
MENUITEM "Tile &Horizontally", ID_WINDOW_TILE_HORZ
MENUITEM "&Tile Vertically\tShift+F4", ID_WINDOW_TILE_VERT
MENUITEM "&Arrange Icons", ID_WINDOW_ARRANGE_ICONS
MENUITEM "&Refresh\tF5", ID_WINDOW_REFRESH
// MENUITEM SEPARATOR
END
POPUP "&Help"
BEGIN
MENUITEM "&Contents", ID_HELP_CONTENTS, GRAYED
MENUITEM "&Search for Help on...", ID_HELP_SEARCH_HELP, GRAYED
MENUITEM "&How to Use Help", ID_HELP_HOW_TO_USE_HELP, GRAYED
MENUITEM SEPARATOR
MENUITEM "&About MDI Application", ID_HELP_ABOUT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOG DISCARDABLE 22, 17, 230, 75
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
CAPTION "About"
FONT 8, "System"
BEGIN
ICON IDI_MDI_APP,IDI_MDI_APP,14,9,16,16
LTEXT "ReactOS MDI Template Application Version 1.0",IDC_STATIC,49,10,119,8,
SS_NOPREFIX
LTEXT "Copyright (C) 2002 ReactOS Team",IDC_STATIC,49,20,119,8
DEFPUSHBUTTON "OK",IDOK,195,6,30,11,WS_GROUP
END
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
"#include ""windows.h""\r\n"
"#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
"#include ""resource.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_APP_TITLE "ReactOS Application"
ID_FILE_MENU "Commands for working with files"
ID_OPTIONS_MENU "Commands for setting options"
ID_WINDOW_MENU "Commands for manipulating windows"
ID_HELP_MENU "Commands for displaying help and information about application"
ID_FILE_OPEN "Opens a new application window"
ID_FILE_RUN "Runs an external application"
ID_FILE_PRINT "Prints the contents of the application window"
ID_FILE_EXIT "Quits the application"
ID_OPTIONS_CONFIRMATION "Controls confirmation messages..."
ID_OPTIONS_FONT "Changes the Application Font..."
ID_OPTIONS_CUSTOMISE_TOOLBAR "Customises the toolbar..."
ID_OPTIONS_TOOLBAR "Shows or hides the tool bar"
ID_OPTIONS_STATUSBAR "Shows or hides the status bar"
ID_OPTIONS_SAVE_ON_EXIT "Saves settings when exiting application"
ID_VIEW_SPLIT "Change position of split between two panes"
ID_WINDOW_NEW_WINDOW "Opens a new window"
ID_WINDOW_CASCADE "Cascades windows"
ID_WINDOW_TILE_HORZ "Tiles windows horizontally"
ID_WINDOW_TILE_VERT "Tiles windows vertically"
ID_WINDOW_ARRANGE_ICONS "Arranges icons"
ID_WINDOW_REFRESH "Updates the contents of a window"
ID_HELP_CONTENTS "Displays contents for Application Help"
ID_HELP_SEARCH_HELP "Searches for a topic in Application Help"
ID_HELP_HOW_TO_USE_HELP "Displays information about using help"
ID_HELP_ABOUT "Displays program information, version number and copyright"
IDC_MDI_APP "MDI_APP"
IDC_MDI_APP_CHILD "MDI_APP_CHILD"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (Australia) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENA)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_AUS
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_DIALOG1 DIALOG DISCARDABLE 0, 0, 186, 95
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,129,7,50,14
PUSHBUTTON "Cancel",IDCANCEL,129,24,50,14
END
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_DIALOG1, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 179
TOPMARGIN, 7
BOTTOMMARGIN, 88
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
ID_HELP_ABOUT "Displays program information, version number, and copyright."
END
#endif // English (Australia) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View file

@ -0,0 +1,112 @@
/*
* ReactOS Application
*
* panelwnd.c
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifdef _MSC_VER
#include "stdafx.h"
#else
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <process.h>
#include <stdio.h>
#endif
#include <assert.h>
#define ASSERT assert
#include "main.h"
#include "panelwnd.h"
////////////////////////////////////////////////////////////////////////////////
static void OnPaint(HWND hWnd, ChildWnd* pChildWnd)
{
PAINTSTRUCT ps;
RECT rt;
GetClientRect(hWnd, &rt);
BeginPaint(hWnd, &ps);
// lastBrush = SelectObject(ps.hdc, (HBRUSH)GetStockObject(WHITE_BRUSH));
// Rectangle(ps.hdc, rt.left, rt.top-1, rt.right, rt.bottom+1);
// SelectObject(ps.hdc, lastBrush);
// rt.top = rt.bottom - GetSystemMetrics(SM_CYHSCROLL);
FillRect(ps.hdc, &rt, GetStockObject(BLACK_BRUSH));
/*
rt.left = pChildWnd->nSplitPos-SPLIT_WIDTH/2;
rt.right = pChildWnd->nSplitPos+SPLIT_WIDTH/2+1;
lastBrush = SelectBrush(ps.hdc, (HBRUSH)GetStockObject(COLOR_SPLITBAR));
Rectangle(ps.hdc, rt.left, rt.top-1, rt.right, rt.bottom+1);
SelectObject(ps.hdc, lastBrush);
#ifdef _NO_EXTENSIONS
rt.top = rt.bottom - GetSystemMetrics(SM_CYHSCROLL);
FillRect(ps.hdc, &rt, GetStockObject(BLACK_BRUSH));
#endif
*/
EndPaint(hWnd, &ps);
}
//
// FUNCTION: ChildWndProc(HWND, unsigned, WORD, LONG)
//
// PURPOSE: Processes messages for the pChildWnd windows.
//
// WM_COMMAND - process the application menu
// WM_PAINT - Paint the main window
// WM_DESTROY - post a quit message and return
//
//
LRESULT CALLBACK PanelWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
// Pane* pane;
// ChildWnd* pChildWnd = (ChildWnd*)GetWindowLong(hWnd, GWL_USERDATA);
// ChildWnd* new_child;
// ASSERT(pChildWnd);
if (1) {
switch(message) {
case WM_CREATE:
break;
case WM_PAINT:
OnPaint(hWnd, 0/*pChildWnd*/);
break;
/*
case WM_COMMAND:
pane = GetFocus()==pChildWnd->left.hWnd? &pChildWnd->left: &pChildWnd->right;
switch(LOWORD(wParam)) {
case ID_WINDOW_NEW_WINDOW:
break;
default:
return pane_command(pane, LOWORD(wParam));
}
break;
*/
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
}
return 0;
}

View file

@ -0,0 +1,42 @@
/*
* ReactOS Application MDI Child Panel Window
*
* panelwnd.h
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __PANEL_WND_H__
#define __PANEL_WND_H__
#ifdef __cplusplus
extern "C" {
#endif
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
LRESULT CALLBACK PanelWndProc(HWND, UINT, WPARAM, LPARAM);
#ifdef __cplusplus
};
#endif
#endif // __PANEL_WND_H__

Binary file not shown.

After

Width:  |  Height:  |  Size: 758 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View file

@ -0,0 +1,71 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by mdi.rc
//
#define IDW_FIRST_CHILD 200
#define ID_FILE_MENU 0
#define ID_OPTIONS_MENU 1
#define ID_WINDOW_MENU 2
#define ID_HELP_MENU 3
#define IDD_ABOUTBOX 104
#define IDS_APP_TITLE 105
#define IDI_MDI_APP 107
#define IDI_SMALL 108
#define IDC_MDI_APP 109
#define IDC_MDI_APP_CHILD 110
#define IDC_STATUSBAR 112
#define IDC_TOOLBAR 113
#define IDD_DIALOG1 131
#define IDB_OPEN_FILE 132
#define IDB_CLOSED_FILE 133
#define IDB_ROOT 134
#define IDB_TOOLBAR 135
#define IDB_IMAGES 137
#define ID_FILE_OPEN 769
#define ID_FILE_RUN 778
#define ID_FILE_PRINT 779
#define ID_FILE_EXIT 784
#define ID_WINDOW_CLOSE 798
#define ID_WINDOW_CLOSEALL 799
#define ID_VIEW_SPLIT 800
#define ID_OPTIONS_CONFIRMATION 809
#define ID_OPTIONS_FONT 810
#define ID_OPTIONS_CUSTOMISE_TOOLBAR 811
#define ID_OPTIONS_TOOLBAR 812
#define ID_OPTIONS_STATUSBAR 814
#define ID_OPTIONS_SAVE_ON_EXIT 817
#define ID_WINDOW_NEW_WINDOW 821
#define ID_WINDOW_CASCADE 822
#define ID_WINDOW_TILE_HORZ 823
#define ID_WINDOW_TILE_VERT 824
#define ID_WINDOW_ARRANGE_ICONS 825
#define ID_WINDOW_REFRESH 826
#define ID_HELP_CONTENTS 827
#define ID_HELP_SEARCH_HELP 828
#define ID_HELP_HOW_TO_USE_HELP 829
#define ID_HELP_ABOUT 830
#define IDC_LICENSE_EDIT 831
#define IDS_LICENSE 832
#define IDC_STATIC -1
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 138
#define _APS_NEXT_COMMAND_VALUE 32832
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 110
#endif
#endif

View file

@ -0,0 +1,82 @@
/*
* ReactOS to Win32 entry points for testing
*
* ros2win.c
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifdef _MSC_VER
#include "stdafx.h"
#else
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <process.h>
#include <stdio.h>
#endif
#define __ROS2WIN_H__MAIN__
#include "ros2win.h"
//#undef DefWndProc
//#undef DefFrameProc
//#undef DefMDIChildProc
extern HINSTANCE hInst;
LRESULT CALLBACK RosWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
case WM_CREATE:
// return TRUE;
break;
case WM_COMMAND:
// return TRUE;
break;
}
return DefWindowProc(hWnd, message, wParam, lParam);
}
LRESULT CALLBACK RosDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
case WM_INITDIALOG:
// return TRUE;
break;
}
return DefDlgProc(hDlg, message, wParam, lParam);
}
LRESULT CALLBACK RosFrameProc(HWND hWnd, HWND hMdi, UINT message, WPARAM wParam, LPARAM lParam)
{
return DefFrameProc(hWnd, hMdi, message, wParam, lParam);
}
LRESULT CALLBACK RosMDIChildProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
return DefMDIChildProc(hWnd, message, wParam, lParam);
}
/*
*/

View file

@ -0,0 +1,47 @@
/*
* ReactOS to Win32 entry points for testing
*
* ros2win.h
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __ROS2WIN_H__
#define __ROS2WIN_H__
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __ROS2WIN_H__MAIN__
#define DefWindowProc RosWindowProc
#define DefFrameProc RosFrameProc
#define DefMDIChildProc RosMDIChildProc
#define DefDlgProc RosDlgProc
#endif
LRESULT CALLBACK RosWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK RosFrameProc(HWND hWnd, HWND hMdi, UINT message, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK RosMDIChildProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK RosDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
#ifdef __cplusplus
};
#endif
#endif // __ROS2WIN_H__