-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathContainer.c
137 lines (117 loc) · 2.7 KB
/
Container.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/*
* CLCL
*
* Container.c
*
* Copyright (C) 1996-2019 by Ohno Tomoaki. All rights reserved.
* https://www.nakka.com/
*/
/* Include Files */
#define _INC_OLE
#include <windows.h>
#undef _INC_OLE
#include "Viewer.h"
#include "Container.h"
/* Define */
#define WINDOW_CLASS TEXT("CLCLContainer")
/* Global Variables */
/* Local Function Prototypes */
/*
* binview_proc - ウィンドウのプロシージャ
*/
static LRESULT CALLBACK container_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
RECT window_rect;
HWND cWnd;
switch (msg) {
case WM_CREATE:
// ウィンドウ作成
break;
case WM_CLOSE:
// ウィンドウを閉じる
DestroyWindow(hWnd);
break;
case WM_DESTROY:
// ウィンドウの破棄
return DefWindowProc(hWnd, msg, wParam, lParam);
case WM_SETFOCUS:
if (wParam != 0 && (HWND)wParam != GetDlgItem(GetParent(hWnd), ID_TREE)) {
SetFocus(GetDlgItem(GetParent(hWnd), ID_TREE));
break;
}
cWnd = GetWindow(hWnd, GW_CHILD);
while (cWnd != NULL) {
if (IsWindowVisible(cWnd) == TRUE) {
SetFocus(cWnd);
break;
}
cWnd = GetWindow(cWnd, GW_HWNDNEXT);
}
break;
case WM_KILLFOCUS:
break;
case WM_SIZE:
// サイズ変更
GetClientRect(hWnd, (LPRECT)&window_rect);
// 子ウィンドウを検索してサイズを設定
cWnd = GetWindow(hWnd, GW_CHILD);
while (cWnd != NULL) {
if (IsWindowVisible(cWnd) == TRUE) {
MoveWindow(cWnd, 0, 0,
window_rect.right, window_rect.bottom, TRUE);
UpdateWindow(cWnd);
} else {
MoveWindow(cWnd, 0, 0,
window_rect.right, window_rect.bottom, FALSE);
}
cWnd = GetWindow(cWnd, GW_HWNDNEXT);
}
break;
case WM_NOTIFY:
return SendMessage(GetParent(hWnd), WM_NOTIFY, wParam, lParam);
case WM_ALLHIDE:
cWnd = GetWindow(hWnd, GW_CHILD);
while (cWnd != NULL) {
ShowWindow(cWnd, SW_HIDE);
cWnd = GetWindow(cWnd, GW_HWNDNEXT);
}
break;
default:
return DefWindowProc(hWnd, msg, wParam, lParam);
}
return 0;
}
/*
* container_regist - ウィンドウクラスの登録
*/
BOOL container_regist(const HINSTANCE hInstance)
{
WNDCLASS wc;
wc.style = 0;
wc.lpfnWndProc = (WNDPROC)container_proc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = NULL;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
wc.lpszMenuName = NULL;
wc.lpszClassName = WINDOW_CLASS;
// ウィンドウクラスの登録
return RegisterClass(&wc);
}
/*
* container_create - バイナリビューアの作成
*/
HWND container_create(const HINSTANCE hInstance, const HWND pWnd, int id)
{
HWND hWnd;
// ウィンドウの作成
hWnd = CreateWindow(WINDOW_CLASS,
TEXT(""),
WS_CHILD | WS_VISIBLE | WS_TABSTOP,
0, 0, 0, 0, pWnd, (HMENU)id, hInstance, NULL);
return hWnd;
}
/* End of source */