mirror of
https://github.com/reactos/reactos.git
synced 2024-12-26 17:14:41 +00:00
Split window control, listview and treeview moved to child window.
svn path=/trunk/; revision=3221
This commit is contained in:
parent
45552bacf0
commit
dbbae605b7
7 changed files with 182 additions and 298 deletions
|
@ -31,6 +31,7 @@ RCFLAGS = -DGCC -D_WIN32_IE=0x0400
|
||||||
|
|
||||||
OBJS = about.o \
|
OBJS = about.o \
|
||||||
framewnd.o \
|
framewnd.o \
|
||||||
|
childwnd.o \
|
||||||
listview.o \
|
listview.o \
|
||||||
treeview.o \
|
treeview.o \
|
||||||
main.o
|
main.o
|
||||||
|
|
|
@ -40,19 +40,15 @@
|
||||||
#include "treeview.h"
|
#include "treeview.h"
|
||||||
#include "listview.h"
|
#include "listview.h"
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
//#include <winspool.h>
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Global Variables:
|
// Globals and Variables:
|
||||||
//
|
//
|
||||||
|
|
||||||
HWND hTreeWnd; // Tree Control Window
|
static BOOL bInMenuLoop = FALSE; // Tells us if we are in the menu loop
|
||||||
HWND hListWnd; // List Control Window
|
|
||||||
HWND hSplitWnd; // Splitter Bar Control Window
|
static HWND hChildWnd;
|
||||||
int nOldWidth; // Holds the previous client area width
|
|
||||||
int nOldHeight; // Holds the previous client area height
|
|
||||||
BOOL bInMenuLoop = FALSE; // Tells us if we are in the menu loop
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Local module support methods
|
// Local module support methods
|
||||||
|
@ -60,7 +56,6 @@ BOOL bInMenuLoop = FALSE; // Tells us if we are in the menu loop
|
||||||
|
|
||||||
static void resize_frame_rect(HWND hWnd, PRECT prect)
|
static void resize_frame_rect(HWND hWnd, PRECT prect)
|
||||||
{
|
{
|
||||||
// int new_top;
|
|
||||||
RECT rt;
|
RECT rt;
|
||||||
/*
|
/*
|
||||||
if (IsWindowVisible(hToolBar)) {
|
if (IsWindowVisible(hToolBar)) {
|
||||||
|
@ -71,10 +66,11 @@ static void resize_frame_rect(HWND hWnd, PRECT prect)
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
if (IsWindowVisible(hStatusBar)) {
|
if (IsWindowVisible(hStatusBar)) {
|
||||||
|
SetupStatusBar(TRUE);
|
||||||
GetClientRect(hStatusBar, &rt);
|
GetClientRect(hStatusBar, &rt);
|
||||||
prect->bottom -= rt.bottom;
|
prect->bottom -= rt.bottom;
|
||||||
}
|
}
|
||||||
// MoveWindow(hWnd, prect->left-1,prect->top-1,prect->right+2,prect->bottom+1, TRUE);
|
MoveWindow(hChildWnd, prect->left-1,prect->top-1,prect->right+2,prect->bottom+1, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void resize_frame(HWND hWnd, int cx, int cy)
|
static void resize_frame(HWND hWnd, int cx, int cy)
|
||||||
|
@ -92,84 +88,8 @@ void resize_frame_client(HWND hWnd)
|
||||||
resize_frame_rect(hWnd, &rect);
|
resize_frame_rect(hWnd, &rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void draw_splitbar(HWND hWnd, int x)
|
|
||||||
{
|
|
||||||
RECT rt;
|
|
||||||
HDC hdc = GetDC(hWnd);
|
|
||||||
|
|
||||||
GetClientRect(hWnd, &rt);
|
static void OnEnterMenuLoop(HWND hWnd)
|
||||||
if (IsWindowVisible(hStatusBar)) {
|
|
||||||
RECT rect;
|
|
||||||
GetClientRect(hStatusBar, &rect);
|
|
||||||
rt.bottom -= rect.bottom;
|
|
||||||
}
|
|
||||||
rt.left = x - SPLIT_WIDTH/2;
|
|
||||||
rt.right = x + SPLIT_WIDTH/2+1;
|
|
||||||
InvertRect(hdc, &rt);
|
|
||||||
ReleaseDC(hWnd, hdc);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define _NO_EXTENSIONS
|
|
||||||
|
|
||||||
static int nSplitPos = 250;
|
|
||||||
|
|
||||||
static void ResizeWnd(int cx, int cy)
|
|
||||||
{
|
|
||||||
HDWP hdwp = BeginDeferWindowPos(2);
|
|
||||||
RECT rt = {0, 0, cx, cy};
|
|
||||||
|
|
||||||
cx = nSplitPos + SPLIT_WIDTH/2;
|
|
||||||
if (IsWindowVisible(hStatusBar)) {
|
|
||||||
RECT rect;
|
|
||||||
GetClientRect(hStatusBar, &rect);
|
|
||||||
rt.bottom -= rect.bottom;
|
|
||||||
}
|
|
||||||
DeferWindowPos(hdwp, hTreeWnd, 0, rt.left, rt.top, nSplitPos-SPLIT_WIDTH/2-rt.left, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE);
|
|
||||||
DeferWindowPos(hdwp, hListWnd, 0, rt.left+cx+1, rt.top, rt.right-cx, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE);
|
|
||||||
EndDeferWindowPos(hdwp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void OnSize(WPARAM wParam, LPARAM lParam)
|
|
||||||
{
|
|
||||||
if (wParam != SIZE_MINIMIZED) {
|
|
||||||
ResizeWnd(LOWORD(lParam), HIWORD(lParam));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
// OnSize()
|
|
||||||
// This function handles all the sizing events for the application
|
|
||||||
// It re-sizes every window, and child window that needs re-sizing
|
|
||||||
static void OnSize(UINT nType, int cx, int cy)
|
|
||||||
{
|
|
||||||
int nParts[3];
|
|
||||||
int nXDifference;
|
|
||||||
int nYDifference;
|
|
||||||
RECT rc;
|
|
||||||
|
|
||||||
if (nType == SIZE_MINIMIZED)
|
|
||||||
return;
|
|
||||||
nXDifference = cx - nOldWidth;
|
|
||||||
nYDifference = cy - nOldHeight;
|
|
||||||
nOldWidth = cx;
|
|
||||||
nOldHeight = cy;
|
|
||||||
|
|
||||||
// Update the status bar size
|
|
||||||
GetWindowRect(hStatusBar, &rc);
|
|
||||||
SendMessage(hStatusBar, WM_SIZE, nType, MAKELPARAM(cx, cy + (rc.bottom - rc.top)));
|
|
||||||
|
|
||||||
// Update the status bar pane sizes
|
|
||||||
nParts[0] = bInMenuLoop ? -1 : 100;
|
|
||||||
nParts[1] = 210;
|
|
||||||
nParts[2] = cx;
|
|
||||||
SendMessage(hStatusBar, SB_SETPARTS, bInMenuLoop ? 1 : 3, (long)nParts);
|
|
||||||
GetWindowRect(hStatusBar, &rc);
|
|
||||||
MoveWindow(hTreeWnd,0,0,cx/2,cy-(rc.bottom - rc.top),TRUE);
|
|
||||||
MoveWindow(hListWnd,cx/2,0,cx,cy-(rc.bottom - rc.top),TRUE);
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
void OnEnterMenuLoop(HWND hWnd)
|
|
||||||
{
|
{
|
||||||
int nParts;
|
int nParts;
|
||||||
|
|
||||||
|
@ -180,7 +100,7 @@ void OnEnterMenuLoop(HWND hWnd)
|
||||||
SendMessage(hStatusBar, SB_SETTEXT, (WPARAM)0, (LPARAM)_T(""));
|
SendMessage(hStatusBar, SB_SETTEXT, (WPARAM)0, (LPARAM)_T(""));
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnExitMenuLoop(HWND hWnd)
|
static void OnExitMenuLoop(HWND hWnd)
|
||||||
{
|
{
|
||||||
RECT rc;
|
RECT rc;
|
||||||
int nParts[3];
|
int nParts[3];
|
||||||
|
@ -194,13 +114,15 @@ void OnExitMenuLoop(HWND hWnd)
|
||||||
nParts[2] = rc.right;
|
nParts[2] = rc.right;
|
||||||
SendMessage(hStatusBar, SB_SETPARTS, 3, (long)nParts);
|
SendMessage(hStatusBar, SB_SETPARTS, 3, (long)nParts);
|
||||||
SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)_T(""));
|
SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)_T(""));
|
||||||
|
SetupStatusBar(TRUE);
|
||||||
|
UpdateStatusBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU hSysMenu)
|
static void OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU hSysMenu)
|
||||||
{
|
{
|
||||||
TCHAR str[100];
|
TCHAR str[100];
|
||||||
|
|
||||||
strcpy(str, TEXT(""));
|
_tcscpy(str, _T(""));
|
||||||
if (nFlags & MF_POPUP) {
|
if (nFlags & MF_POPUP) {
|
||||||
if (hSysMenu != GetMenu(hWnd)) {
|
if (hSysMenu != GetMenu(hWnd)) {
|
||||||
if (nItemID == 2) nItemID = 5;
|
if (nItemID == 2) nItemID = 5;
|
||||||
|
@ -217,6 +139,46 @@ void OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU hSysMenu)
|
||||||
SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)str);
|
SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetupStatusBar(BOOL bResize)
|
||||||
|
{
|
||||||
|
int nParts[4];
|
||||||
|
// int parts[] = {300, 500};
|
||||||
|
// SendMessage(Globals.hStatusBar, WM_SIZE, 0, 0);
|
||||||
|
// SendMessage(Globals.hStatusBar, SB_SETPARTS, 2, (LPARAM)&parts);
|
||||||
|
|
||||||
|
// Create the status bar panes
|
||||||
|
nParts[0] = 150;
|
||||||
|
nParts[1] = 220;
|
||||||
|
nParts[2] = 100;
|
||||||
|
nParts[3] = 100;
|
||||||
|
if (bResize)
|
||||||
|
SendMessage(hStatusBar, WM_SIZE, 0, 0);
|
||||||
|
SendMessage(hStatusBar, SB_SETPARTS, 4, (long)nParts);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UpdateStatusBar(void)
|
||||||
|
{
|
||||||
|
TCHAR text[260];
|
||||||
|
DWORD size;
|
||||||
|
|
||||||
|
// size = sizeof(text)/sizeof(TCHAR);
|
||||||
|
// GetUserName(text, &size);
|
||||||
|
// SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM)text);
|
||||||
|
size = sizeof(text)/sizeof(TCHAR);
|
||||||
|
GetComputerName(text, &size);
|
||||||
|
SendMessage(hStatusBar, SB_SETTEXT, 3, (LPARAM)text);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void toggle_child(HWND hWnd, UINT cmd, HWND hchild)
|
||||||
|
{
|
||||||
|
BOOL vis = IsWindowVisible(hchild);
|
||||||
|
HMENU hMenuView = GetSubMenu(hMenuFrame, ID_VIEW_MENU);
|
||||||
|
|
||||||
|
CheckMenuItem(hMenuView, cmd, vis?MF_BYCOMMAND:MF_BYCOMMAND|MF_CHECKED);
|
||||||
|
ShowWindow(hchild, vis?SW_HIDE:SW_SHOW);
|
||||||
|
resize_frame_client(hWnd);
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// FUNCTION: _CmdWndProc(HWND, unsigned, WORD, LONG)
|
// FUNCTION: _CmdWndProc(HWND, unsigned, WORD, LONG)
|
||||||
|
@ -227,19 +189,15 @@ void OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU hSysMenu)
|
||||||
|
|
||||||
static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
int wmId, wmEvent;
|
|
||||||
wmId = LOWORD(wParam);
|
|
||||||
wmEvent = HIWORD(wParam);
|
|
||||||
|
|
||||||
switch (LOWORD(wParam)) {
|
switch (LOWORD(wParam)) {
|
||||||
// Parse the menu selections:
|
// Parse the menu selections:
|
||||||
case ID_REGISTRY_PRINTERSETUP:
|
case ID_REGISTRY_PRINTERSETUP:
|
||||||
//PRINTDLG pd;
|
//PRINTDLG pd;
|
||||||
//PrintDlg(&pd);
|
//PrintDlg(&pd);
|
||||||
//PAGESETUPDLG psd;
|
//PAGESETUPDLG psd;
|
||||||
//PageSetupDlg(&psd);
|
//PageSetupDlg(&psd);
|
||||||
break;
|
break;
|
||||||
case ID_REGISTRY_OPENLOCAL:
|
case ID_REGISTRY_OPENLOCAL:
|
||||||
/*
|
/*
|
||||||
{
|
{
|
||||||
HWND hChildWnd;
|
HWND hChildWnd;
|
||||||
|
@ -253,29 +211,36 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
case ID_REGISTRY_EXIT:
|
case ID_REGISTRY_EXIT:
|
||||||
DestroyWindow(hWnd);
|
DestroyWindow(hWnd);
|
||||||
break;
|
break;
|
||||||
case ID_VIEW_REFRESH:
|
case ID_VIEW_REFRESH:
|
||||||
// TODO:
|
// TODO:
|
||||||
break;
|
break;
|
||||||
case ID_HELP_HELPTOPICS:
|
// case ID_OPTIONS_TOOLBAR:
|
||||||
// WinHelp(hWnd, _T("regedit"), HELP_CONTENTS, 0);
|
// toggle_child(hWnd, LOWORD(wParam), hToolBar);
|
||||||
WinHelp(hWnd, _T("regedit"), HELP_FINDER, 0);
|
// break;
|
||||||
break;
|
case ID_VIEW_STATUSBAR:
|
||||||
case ID_HELP_ABOUT:
|
toggle_child(hWnd, LOWORD(wParam), hStatusBar);
|
||||||
|
break;
|
||||||
|
case ID_HELP_HELPTOPICS:
|
||||||
|
// WinHelp(hWnd, _T("regedit"), HELP_CONTENTS, 0);
|
||||||
|
WinHelp(hWnd, _T("regedit"), HELP_FINDER, 0);
|
||||||
|
break;
|
||||||
|
case ID_HELP_ABOUT:
|
||||||
#ifdef WINSHELLAPI
|
#ifdef WINSHELLAPI
|
||||||
ShellAbout(hWnd, szTitle, "", LoadIcon(hInst, (LPCTSTR)IDI_REGEDIT));
|
ShellAbout(hWnd, szTitle, _T(""), LoadIcon(hInst, (LPCTSTR)IDI_REGEDIT));
|
||||||
#else
|
#else
|
||||||
ShowAboutBox(hWnd);
|
ShowAboutBox(hWnd);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// FUNCTION: FrameWndProc(HWND, unsigned, WORD, LONG)
|
// FUNCTION: FrameWndProc(HWND, unsigned, WORD, LONG)
|
||||||
|
@ -289,15 +254,17 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
//
|
//
|
||||||
LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
static int last_split;
|
|
||||||
PAINTSTRUCT ps;
|
|
||||||
HDC hdc;
|
|
||||||
|
|
||||||
switch (message) {
|
switch (message) {
|
||||||
case WM_CREATE:
|
case WM_CREATE:
|
||||||
//HWND CreateListView(HWND hwndParent/*, Pane* pane*/, int id, LPTSTR lpszPathName);
|
{
|
||||||
hTreeWnd = CreateTreeView(hWnd, 1000, "c:\\foobar.txt");
|
// HMENU hMenuWindow = GetSubMenu(hMenuFrame, GetMenuItemCount(hMenuFrame)-2);
|
||||||
hListWnd = CreateListView(hWnd, 1001, "");
|
hChildWnd = CreateWindowEx(0, szChildClass, _T("regedit child window"),
|
||||||
|
// hChildWnd = CreateWindowEx(0, (LPCTSTR)(int)hChildWndClass, _T("regedit child window"),
|
||||||
|
// WS_CHILD|WS_CLIPCHILDREN|WS_VISIBLE|WS_BORDER,
|
||||||
|
WS_CHILD|WS_VISIBLE|WS_BORDER,
|
||||||
|
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
|
||||||
|
hWnd, (HMENU)0, hInst, NULL/*lpParam*/);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
if (!_CmdWndProc(hWnd, message, wParam, lParam)) {
|
if (!_CmdWndProc(hWnd, message, wParam, lParam)) {
|
||||||
|
@ -305,121 +272,13 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
// resize_frame_client(hWnd);
|
resize_frame_client(hWnd);
|
||||||
// OnSize(wParam, LOWORD(lParam), HIWORD(lParam));
|
|
||||||
// break;
|
|
||||||
OnSize(wParam, lParam);
|
|
||||||
goto def;
|
|
||||||
case WM_PAINT:
|
|
||||||
hdc = BeginPaint(hWnd, &ps);
|
|
||||||
// TODO: Add any drawing code here...
|
|
||||||
//RECT rt;
|
|
||||||
//GetClientRect(hWnd, &rt);
|
|
||||||
//DrawText(hdc, szHello, strlen(szHello), &rt, DT_CENTER);
|
|
||||||
EndPaint(hWnd, &ps);
|
|
||||||
break;
|
|
||||||
break;
|
break;
|
||||||
|
// OnSize(wParam, lParam);
|
||||||
|
// goto def;
|
||||||
case WM_TIMER:
|
case WM_TIMER:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_SETCURSOR:
|
|
||||||
if (LOWORD(lParam) == HTCLIENT) {
|
|
||||||
POINT pt;
|
|
||||||
GetCursorPos(&pt);
|
|
||||||
ScreenToClient(hWnd, &pt);
|
|
||||||
if (pt.x>=nSplitPos-SPLIT_WIDTH/2 && pt.x<nSplitPos+SPLIT_WIDTH/2+1) {
|
|
||||||
SetCursor(LoadCursor(0, IDC_SIZEWE));
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
goto def;
|
|
||||||
|
|
||||||
case WM_LBUTTONDOWN: {
|
|
||||||
RECT rt;
|
|
||||||
int x = LOWORD(lParam);
|
|
||||||
|
|
||||||
GetClientRect(hWnd, &rt);
|
|
||||||
if (x>=nSplitPos-SPLIT_WIDTH/2 && x<nSplitPos+SPLIT_WIDTH/2+1) {
|
|
||||||
last_split = 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);
|
|
||||||
nSplitPos = x;
|
|
||||||
ResizeWnd(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
|
|
||||||
nSplitPos = last_split;
|
|
||||||
#endif
|
|
||||||
GetClientRect(hWnd, &rt);
|
|
||||||
ResizeWnd(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) {
|
|
||||||
nSplitPos = x;
|
|
||||||
ResizeWnd(rt.right, rt.bottom);
|
|
||||||
rt.left = x-SPLIT_WIDTH/2;
|
|
||||||
rt.right = x+SPLIT_WIDTH/2+1;
|
|
||||||
InvalidateRect(hWnd, &rt, FALSE);
|
|
||||||
UpdateWindow(hTreeWnd);
|
|
||||||
UpdateWindow(hWnd);
|
|
||||||
UpdateWindow(hListWnd);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
|
||||||
case WM_ENTERMENULOOP:
|
case WM_ENTERMENULOOP:
|
||||||
OnEnterMenuLoop(hWnd);
|
OnEnterMenuLoop(hWnd);
|
||||||
break;
|
break;
|
||||||
|
@ -432,7 +291,7 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
WinHelp(hWnd, _T("regedit"), HELP_QUIT, 0);
|
WinHelp(hWnd, _T("regedit"), HELP_QUIT, 0);
|
||||||
PostQuitMessage(0);
|
PostQuitMessage(0);
|
||||||
default: def:
|
default:
|
||||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -32,13 +32,11 @@ extern "C" {
|
||||||
#endif // _MSC_VER > 1000
|
#endif // _MSC_VER > 1000
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern HWND hTreeWnd; // Tree Control Window
|
|
||||||
extern HWND hListWnd; // List Control Window
|
|
||||||
extern HWND hSplitWnd; // Splitter Bar Control Window
|
|
||||||
|
|
||||||
LRESULT CALLBACK FrameWndProc(HWND, UINT, WPARAM, LPARAM);
|
LRESULT CALLBACK FrameWndProc(HWND, UINT, WPARAM, LPARAM);
|
||||||
|
|
||||||
|
void SetupStatusBar(BOOL bResize);
|
||||||
|
void UpdateStatusBar(void);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
};
|
};
|
||||||
|
|
|
@ -45,8 +45,6 @@
|
||||||
// Global Variables:
|
// Global Variables:
|
||||||
//
|
//
|
||||||
|
|
||||||
extern HINSTANCE hInst;
|
|
||||||
extern HWND hMainWnd;
|
|
||||||
static WNDPROC g_orgListWndProc;
|
static WNDPROC g_orgListWndProc;
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,8 +55,8 @@ static WNDPROC g_orgListWndProc;
|
||||||
|
|
||||||
|
|
||||||
#define MAX_LIST_COLUMNS (IDS_LIST_COLUMN_LAST - IDS_LIST_COLUMN_FIRST + 1)
|
#define MAX_LIST_COLUMNS (IDS_LIST_COLUMN_LAST - IDS_LIST_COLUMN_FIRST + 1)
|
||||||
static int default_column_widths[MAX_LIST_COLUMNS] = { 175, 100, 100 };
|
static int default_column_widths[MAX_LIST_COLUMNS] = { 200, 175, 400 };
|
||||||
static int column_alignment[MAX_LIST_COLUMNS] = { LVCFMT_LEFT, LVCFMT_RIGHT, LVCFMT_RIGHT };
|
static int column_alignment[MAX_LIST_COLUMNS] = { LVCFMT_LEFT, LVCFMT_LEFT, LVCFMT_LEFT };
|
||||||
|
|
||||||
static void CreateListColumns(HWND hWndListView)
|
static void CreateListColumns(HWND hWndListView)
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,22 +36,21 @@
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "framewnd.h"
|
#include "framewnd.h"
|
||||||
|
#include "childwnd.h"
|
||||||
#include "treeview.h"
|
|
||||||
#include "listview.h"
|
|
||||||
#include <shellapi.h>
|
|
||||||
//#include <winspool.h>
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Global Variables:
|
// Global Variables:
|
||||||
|
//
|
||||||
|
|
||||||
HINSTANCE hInst;
|
HINSTANCE hInst;
|
||||||
HWND hMainWnd;
|
HWND hFrameWnd;
|
||||||
HWND hStatusBar;
|
HWND hStatusBar;
|
||||||
|
HMENU hMenuFrame;
|
||||||
|
|
||||||
TCHAR szTitle[MAX_LOADSTRING];
|
TCHAR szTitle[MAX_LOADSTRING];
|
||||||
TCHAR szFrameClass[MAX_LOADSTRING];
|
TCHAR szFrameClass[MAX_LOADSTRING];
|
||||||
//TCHAR szWindowClass[MAX_LOADSTRING];
|
TCHAR szChildClass[MAX_LOADSTRING];
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -66,11 +65,46 @@ TCHAR szFrameClass[MAX_LOADSTRING];
|
||||||
// In this function, we save the instance handle in a global variable and
|
// In this function, we save the instance handle in a global variable and
|
||||||
// create and display the main program window.
|
// create and display the main program window.
|
||||||
//
|
//
|
||||||
|
|
||||||
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
|
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
|
||||||
{
|
{
|
||||||
int nParts[3];
|
WNDCLASSEX wcFrame = {
|
||||||
WNDCLASSEX wcex;
|
sizeof(WNDCLASSEX),
|
||||||
|
CS_HREDRAW | CS_VREDRAW/*style*/,
|
||||||
|
FrameWndProc,
|
||||||
|
0/*cbClsExtra*/,
|
||||||
|
0/*cbWndExtra*/,
|
||||||
|
hInstance,
|
||||||
|
LoadIcon(hInstance, MAKEINTRESOURCE(IDI_REGEDIT)),
|
||||||
|
LoadCursor(0, IDC_ARROW),
|
||||||
|
0/*hbrBackground*/,
|
||||||
|
0/*lpszMenuName*/,
|
||||||
|
szFrameClass,
|
||||||
|
(HICON)LoadImage(hInstance, MAKEINTRESOURCE(IDI_REGEDIT), IMAGE_ICON,
|
||||||
|
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED)
|
||||||
|
};
|
||||||
|
ATOM hFrameWndClass = RegisterClassEx(&wcFrame); // register frame window class
|
||||||
|
|
||||||
|
WNDCLASSEX wcChild = {
|
||||||
|
sizeof(WNDCLASSEX),
|
||||||
|
CS_HREDRAW | CS_VREDRAW/*style*/,
|
||||||
|
ChildWndProc,
|
||||||
|
0/*cbClsExtra*/,
|
||||||
|
sizeof(HANDLE)/*cbWndExtra*/,
|
||||||
|
hInstance,
|
||||||
|
LoadIcon(hInstance, MAKEINTRESOURCE(IDI_REGEDIT)),
|
||||||
|
LoadCursor(0, IDC_ARROW),
|
||||||
|
0/*hbrBackground*/,
|
||||||
|
0/*lpszMenuName*/,
|
||||||
|
szChildClass,
|
||||||
|
(HICON)LoadImage(hInstance, MAKEINTRESOURCE(IDI_REGEDIT), IMAGE_ICON,
|
||||||
|
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED)
|
||||||
|
|
||||||
|
};
|
||||||
|
ATOM hChildWndClass = RegisterClassEx(&wcChild); // register child windows class
|
||||||
|
|
||||||
|
/*
|
||||||
|
WNDCLASSEX wcex;
|
||||||
wcex.cbSize = sizeof(WNDCLASSEX);
|
wcex.cbSize = sizeof(WNDCLASSEX);
|
||||||
wcex.style = CS_HREDRAW | CS_VREDRAW;
|
wcex.style = CS_HREDRAW | CS_VREDRAW;
|
||||||
wcex.lpfnWndProc = (WNDPROC)FrameWndProc;
|
wcex.lpfnWndProc = (WNDPROC)FrameWndProc;
|
||||||
|
@ -79,49 +113,45 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
|
||||||
wcex.hInstance = hInstance;
|
wcex.hInstance = hInstance;
|
||||||
wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_REGEDIT);
|
wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_REGEDIT);
|
||||||
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
|
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||||
wcex.hbrBackground = (HBRUSH)SS_BLACKRECT/*(COLOR_WINDOW+1)*/;
|
wcex.hbrBackground = (HBRUSH)SS_BLACKRECT;
|
||||||
// wcex.lpszMenuName = (LPCSTR)IDC_REGEDIT;
|
// wcex.lpszMenuName = (LPCSTR)IDC_REGEDIT;
|
||||||
wcex.lpszMenuName = (LPCSTR)IDR_REGEDIT_MENU;
|
wcex.lpszMenuName = (LPCSTR)IDR_REGEDIT_MENU;
|
||||||
wcex.lpszClassName = szFrameClass;
|
wcex.lpszClassName = szFrameClass;
|
||||||
wcex.hIconSm = LoadIcon((HINSTANCE)wcex.hInstance, (LPCTSTR)IDI_SMALL);
|
wcex.hIconSm = LoadIcon((HINSTANCE)wcex.hInstance, (LPCTSTR)IDI_SMALL);
|
||||||
RegisterClassEx(&wcex);
|
RegisterClassEx(&wcex);
|
||||||
|
*/
|
||||||
|
|
||||||
|
hMenuFrame = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_REGEDIT_MENU));
|
||||||
|
|
||||||
// Initialize the Windows Common Controls DLL
|
// Initialize the Windows Common Controls DLL
|
||||||
InitCommonControls();
|
InitCommonControls();
|
||||||
|
|
||||||
hInst = hInstance; // Store instance handle in our global variable
|
hInst = hInstance; // Store instance handle in our global variable
|
||||||
hMainWnd = CreateWindow(szFrameClass, szTitle, WS_OVERLAPPEDWINDOW,
|
// hFrameWnd = CreateWindow(szFrameClass, szTitle, WS_OVERLAPPEDWINDOW,
|
||||||
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
|
// CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
|
||||||
if (!hMainWnd) {
|
hFrameWnd = CreateWindowEx(0, (LPCTSTR)(int)hFrameWndClass, _T("regedit application"),
|
||||||
|
WS_OVERLAPPEDWINDOW,
|
||||||
|
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
|
||||||
|
NULL, hMenuFrame, hInstance, NULL/*lpParam*/);
|
||||||
|
|
||||||
|
if (!hFrameWnd) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the minimum window sizes
|
|
||||||
// GetWindowRect(hMainWnd, &rc);
|
|
||||||
// nMinimumWidth = (rc.right - rc.left);
|
|
||||||
// nMinimumHeight = (rc.bottom - rc.top);
|
|
||||||
|
|
||||||
// Create the status bar
|
// Create the status bar
|
||||||
hStatusBar = CreateStatusWindow(WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|SBT_NOBORDERS,
|
hStatusBar = CreateStatusWindow(WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|SBT_NOBORDERS,
|
||||||
_T(""), hMainWnd, STATUS_WINDOW);
|
_T(""), hFrameWnd, STATUS_WINDOW);
|
||||||
if (!hStatusBar)
|
if (hStatusBar) {
|
||||||
return FALSE;
|
// Create the status bar panes
|
||||||
|
int nParts[3];
|
||||||
// Create the status bar panes
|
nParts[0] = 100;
|
||||||
nParts[0] = 100;
|
nParts[1] = 210;
|
||||||
nParts[1] = 210;
|
nParts[2] = 400;
|
||||||
nParts[2] = 400;
|
SendMessage(hStatusBar, SB_SETPARTS, 3, (long)nParts);
|
||||||
SendMessage(hStatusBar, SB_SETPARTS, 3, (long)nParts);
|
CheckMenuItem(GetSubMenu(hMenuFrame, ID_VIEW_MENU), ID_VIEW_STATUSBAR, MF_BYCOMMAND|MF_CHECKED);
|
||||||
|
}
|
||||||
/*
|
ShowWindow(hFrameWnd, nCmdShow);
|
||||||
hSplitWnd = CreateWindow(szFrameClass, "splitter window", WS_VISIBLE|WS_CHILD,
|
UpdateWindow(hFrameWnd);
|
||||||
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0,
|
|
||||||
hMainWnd, (HMENU)SPLIT_WINDOW, hInstance, NULL);
|
|
||||||
if (!hSplitWnd)
|
|
||||||
return FALSE;
|
|
||||||
*/
|
|
||||||
ShowWindow(hMainWnd, nCmdShow);
|
|
||||||
UpdateWindow(hMainWnd);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +159,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
|
||||||
|
|
||||||
void ExitInstance(void)
|
void ExitInstance(void)
|
||||||
{
|
{
|
||||||
// DestroyMenu(hMenuFrame);
|
DestroyMenu(hMenuFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -144,7 +174,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
||||||
// Initialize global strings
|
// Initialize global strings
|
||||||
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
|
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
|
||||||
LoadString(hInstance, IDC_REGEDIT_FRAME, szFrameClass, MAX_LOADSTRING);
|
LoadString(hInstance, IDC_REGEDIT_FRAME, szFrameClass, MAX_LOADSTRING);
|
||||||
// LoadString(hInstance, IDC_REGEDIT, szWindowClass, MAX_LOADSTRING);
|
LoadString(hInstance, IDC_REGEDIT, szChildClass, MAX_LOADSTRING);
|
||||||
|
|
||||||
// Store instance handle in our global variable
|
// Store instance handle in our global variable
|
||||||
hInst = hInstance;
|
hInst = hInstance;
|
||||||
|
|
|
@ -44,13 +44,15 @@ extern "C" {
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Global Variables:
|
// Global Variables:
|
||||||
|
//
|
||||||
extern HINSTANCE hInst;
|
extern HINSTANCE hInst;
|
||||||
extern HWND hMainWnd;
|
extern HWND hFrameWnd;
|
||||||
extern HWND hStatusBar;
|
extern HWND hStatusBar;
|
||||||
|
extern HMENU hMenuFrame;
|
||||||
|
|
||||||
extern TCHAR szTitle[];
|
extern TCHAR szTitle[];
|
||||||
extern TCHAR szFrameClass[];
|
extern TCHAR szFrameClass[];
|
||||||
//extern TCHAR szWindowClass[];
|
extern TCHAR szChildClass[];
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
typedef struct tagNMITEMACTIVATE{
|
typedef struct tagNMITEMACTIVATE{
|
||||||
|
|
|
@ -41,10 +41,6 @@
|
||||||
#include "treeview.h"
|
#include "treeview.h"
|
||||||
|
|
||||||
|
|
||||||
// Global Variables:
|
|
||||||
extern HINSTANCE hInst;
|
|
||||||
extern HWND hMainWnd;
|
|
||||||
|
|
||||||
// Global variables and constants
|
// Global variables and constants
|
||||||
// Image_Open, Image_Closed, and Image_Root - integer variables for
|
// Image_Open, Image_Closed, and Image_Root - integer variables for
|
||||||
// indexes of the images.
|
// indexes of the images.
|
||||||
|
@ -152,12 +148,12 @@ static BOOL InitTreeViewItems(HWND hwndTV)
|
||||||
{
|
{
|
||||||
HTREEITEM hItem;
|
HTREEITEM hItem;
|
||||||
|
|
||||||
hItem = AddItemToTree(hwndTV, "My Computer", 1);
|
hItem = AddItemToTree(hwndTV, _T("My Computer"), 1);
|
||||||
AddItemToTree(hwndTV, "HKEY_CLASSES_ROOT", 2);
|
AddItemToTree(hwndTV, _T("HKEY_CLASSES_ROOT"), 2);
|
||||||
AddItemToTree(hwndTV, "HKEY_CURRENT_USER", 2);
|
AddItemToTree(hwndTV, _T("HKEY_CURRENT_USER"), 2);
|
||||||
AddItemToTree(hwndTV, "HKEY_LOCAL_MACHINE", 2);
|
AddItemToTree(hwndTV, _T("HKEY_LOCAL_MACHINE"), 2);
|
||||||
AddItemToTree(hwndTV, "HKEY_USERS", 2);
|
AddItemToTree(hwndTV, _T("HKEY_USERS"), 2);
|
||||||
AddItemToTree(hwndTV, "HKEY_CURRENT_CONFIG", 2);
|
AddItemToTree(hwndTV, _T("HKEY_CURRENT_CONFIG"), 2);
|
||||||
|
|
||||||
TreeView_Expand(hwndTV, hItem, TVE_EXPAND);
|
TreeView_Expand(hwndTV, hItem, TVE_EXPAND);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
Loading…
Reference in a new issue