@@ -31,7 +31,7 @@ BOOL ce::Control::create(HWND hwnd_p, LPSTR name, LPTSTR ico_res, int ct_id, LPR
31
31
tmp.lpszClassName = name;
32
32
33
33
if (RegisterClassEx (&tmp)) {
34
- hwnd = CreateWindowExA (
34
+ hwnd = :: CreateWindowEx (
35
35
NULL ,
36
36
name,
37
37
NULL ,
@@ -98,15 +98,15 @@ LRESULT ce::Control::wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
98
98
{
99
99
RECT rect_wnd;
100
100
101
- GetClientRect (hwnd, &rect_wnd);
101
+ :: GetClientRect (hwnd, &rect_wnd);
102
102
103
103
switch (msg) {
104
104
case WM_CREATE:
105
105
canvas.init (hwnd);
106
106
107
- hwnd_parent = GetParent (hwnd);
108
-
107
+ hwnd_parent = ::GetParent (hwnd);
109
108
109
+ icon = ::LoadIcon (g_fp->dll_hinst , icon_res);
110
110
111
111
tme.cbSize = sizeof (tme);
112
112
tme.dwFlags = TME_LEAVE;
@@ -124,60 +124,60 @@ LRESULT ce::Control::wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
124
124
ID2D1SolidColorBrush* pBrush = NULL ;
125
125
126
126
if (clicked)
127
- bg = BRIGHTEN (g_theme[g_config.theme ].bg_others , CE_CT_BR_CLICKED);
127
+ bg = BRIGHTEN (g_theme[g_config.theme ].bg , CE_CT_BR_CLICKED);
128
128
else if (hovered)
129
- bg = BRIGHTEN (g_theme[g_config.theme ].bg_others , CE_CT_BR_HOVERED);
129
+ bg = BRIGHTEN (g_theme[g_config.theme ].bg , CE_CT_BR_HOVERED);
130
130
else
131
- bg = g_theme[g_config.theme ].bg_others ;
131
+ bg = g_theme[g_config.theme ].bg ;
132
132
d2d_setup (&canvas, &rect_wnd, bg);
133
133
134
- if (g_render_target != NULL && g_d2d1_factory != NULL ) {
135
- g_render_target-> BeginDraw ();
136
- if (pBrush == NULL )
137
- g_render_target-> CreateSolidColorBrush ( D2D1::ColorF ( 0 , 0 , 0 ), &pBrush);
138
- g_render_target-> EndDraw ();
139
- }
134
+ ::DrawIcon (
135
+ canvas.hdc_memory,
136
+ ( int )(rect_wnd.right * 0 . 5f - CE_ICON_SIZE * 0 . 5f ),
137
+ ( int )(rect_wnd.bottom * 0 . 5f - CE_ICON_SIZE * 0 . 5f ),
138
+ icon
139
+ );
140
140
141
141
canvas.transfer (&rect_wnd);
142
142
return 0 ;
143
143
}
144
144
145
145
// マウスが動いたとき
146
146
case WM_MOUSEMOVE:
147
- SetCursor (LoadCursor (NULL , IDC_HAND));
147
+ :: SetCursor (LoadCursor(NULL , IDC_HAND));
148
148
hovered = TRUE ;
149
- InvalidateRect (hwnd, NULL , FALSE );
150
- TrackMouseEvent (&tme);
149
+ :: InvalidateRect (hwnd, NULL , FALSE );
150
+ :: TrackMouseEvent (&tme);
151
151
return 0 ;
152
152
153
153
// 左クリックがされたとき
154
154
case WM_LBUTTONDOWN:
155
- SetCursor (LoadCursor (NULL , IDC_HAND));
155
+ :: SetCursor (LoadCursor(NULL , IDC_HAND));
156
156
clicked = TRUE ;
157
- InvalidateRect (hwnd, NULL , FALSE );
158
- TrackMouseEvent (&tme);
157
+ :: InvalidateRect (hwnd, NULL , FALSE );
158
+ :: TrackMouseEvent (&tme);
159
159
return 0 ;
160
160
161
161
// 左クリックが終わったとき
162
162
case WM_LBUTTONUP:
163
- SetCursor (LoadCursor (NULL , IDC_HAND));
163
+ :: SetCursor (LoadCursor(NULL , IDC_HAND));
164
164
clicked = FALSE ;
165
- InvalidateRect (hwnd, NULL , FALSE );
165
+ :: InvalidateRect (hwnd, NULL , FALSE );
166
166
SendMessage (hwnd_parent, WM_COMMAND, id, 0 );
167
167
return 0 ;
168
168
169
169
// マウスがウィンドウから離れたとき
170
170
case WM_MOUSELEAVE:
171
171
clicked = FALSE ;
172
172
hovered = FALSE ;
173
- InvalidateRect (hwnd, NULL , FALSE );
173
+ :: InvalidateRect (hwnd, NULL , FALSE );
174
174
return 0 ;
175
175
176
176
// コマンド
177
177
case WM_COMMAND:
178
178
switch (wparam) {
179
179
case CE_CM_REDRAW:
180
- InvalidateRect (hwnd, NULL , FALSE );
180
+ :: InvalidateRect (hwnd, NULL , FALSE );
181
181
return 0 ;
182
182
}
183
183
return 0 ;
0 commit comments