Split the actual test code from the main Table code.
This commit is contained in:
parent
095c6dc79c
commit
ff4212913a
|
@ -1,7 +1,4 @@
|
||||||
// 19 october 2014
|
// 7 january 2015
|
||||||
#include "../wininclude_windows.h"
|
|
||||||
|
|
||||||
// #qo LIBS: user32 kernel32 gdi32 comctl32 uxtheme ole32 oleaut32 oleacc uuid
|
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
// - should tablePanic be CALLBACK or some other equivalent macro? and definitely export initTable somehow, but which alias macro to use?
|
// - should tablePanic be CALLBACK or some other equivalent macro? and definitely export initTable somehow, but which alias macro to use?
|
||||||
|
@ -173,49 +170,3 @@ void initTable(void (*panicfunc)(const char *msg, DWORD lastError), BOOL (*WINAP
|
||||||
if (RegisterClassW(&wc) == 0)
|
if (RegisterClassW(&wc) == 0)
|
||||||
panic("error registering Table window class");
|
panic("error registering Table window class");
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
HWND mainwin;
|
|
||||||
MSG msg;
|
|
||||||
INITCOMMONCONTROLSEX icc;
|
|
||||||
|
|
||||||
ZeroMemory(&icc, sizeof (INITCOMMONCONTROLSEX));
|
|
||||||
icc.dwSize = sizeof (INITCOMMONCONTROLSEX);
|
|
||||||
icc.dwICC = ICC_LISTVIEW_CLASSES;
|
|
||||||
if (InitCommonControlsEx(&icc) == 0)
|
|
||||||
panic("(test program) error initializing comctl32.dll");
|
|
||||||
initTable(NULL, _TrackMouseEvent);
|
|
||||||
mainwin = CreateWindowExW(0,
|
|
||||||
tableWindowClass, L"Main Window",
|
|
||||||
WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL,
|
|
||||||
CW_USEDEFAULT, CW_USEDEFAULT,
|
|
||||||
400, 400,
|
|
||||||
NULL, NULL, GetModuleHandle(NULL), NULL);
|
|
||||||
if (mainwin == NULL)
|
|
||||||
panic("(test program) error creating Table");
|
|
||||||
SendMessageW(mainwin, tableAddColumn, tableColumnText, (LPARAM) L"Column");
|
|
||||||
SendMessageW(mainwin, tableAddColumn, tableColumnImage, (LPARAM) L"Column 2");
|
|
||||||
SendMessageW(mainwin, tableAddColumn, tableColumnCheckbox, (LPARAM) L"Column 3");
|
|
||||||
if (argc > 1) {
|
|
||||||
NONCLIENTMETRICSW ncm;
|
|
||||||
HFONT font;
|
|
||||||
|
|
||||||
ZeroMemory(&ncm, sizeof (NONCLIENTMETRICSW));
|
|
||||||
ncm.cbSize = sizeof (NONCLIENTMETRICSW);
|
|
||||||
if (SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof (NONCLIENTMETRICSW), &ncm, sizeof (NONCLIENTMETRICSW)) == 0)
|
|
||||||
panic("(test program) error getting non-client metrics");
|
|
||||||
font = CreateFontIndirectW(&ncm.lfMessageFont);
|
|
||||||
if (font == NULL)
|
|
||||||
panic("(test program) error creating lfMessageFont HFONT");
|
|
||||||
SendMessageW(mainwin, WM_SETFONT, (WPARAM) font, TRUE);
|
|
||||||
}
|
|
||||||
ShowWindow(mainwin, SW_SHOWDEFAULT);
|
|
||||||
if (UpdateWindow(mainwin) == 0)
|
|
||||||
panic("(test program) error updating window");
|
|
||||||
while (GetMessageW(&msg, NULL, 0, 0) > 0) {
|
|
||||||
TranslateMessage(&msg);
|
|
||||||
DispatchMessageW(&msg);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
// 19 october 2014
|
||||||
|
#include "../wininclude_windows.h"
|
||||||
|
|
||||||
|
// #qo LIBS: user32 kernel32 gdi32 comctl32 uxtheme ole32 oleaut32 oleacc uuid
|
||||||
|
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
HWND mainwin;
|
||||||
|
MSG msg;
|
||||||
|
INITCOMMONCONTROLSEX icc;
|
||||||
|
|
||||||
|
ZeroMemory(&icc, sizeof (INITCOMMONCONTROLSEX));
|
||||||
|
icc.dwSize = sizeof (INITCOMMONCONTROLSEX);
|
||||||
|
icc.dwICC = ICC_LISTVIEW_CLASSES;
|
||||||
|
if (InitCommonControlsEx(&icc) == 0)
|
||||||
|
panic("(test program) error initializing comctl32.dll");
|
||||||
|
initTable(NULL, _TrackMouseEvent);
|
||||||
|
mainwin = CreateWindowExW(0,
|
||||||
|
tableWindowClass, L"Main Window",
|
||||||
|
WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL,
|
||||||
|
CW_USEDEFAULT, CW_USEDEFAULT,
|
||||||
|
400, 400,
|
||||||
|
NULL, NULL, GetModuleHandle(NULL), NULL);
|
||||||
|
if (mainwin == NULL)
|
||||||
|
panic("(test program) error creating Table");
|
||||||
|
SendMessageW(mainwin, tableAddColumn, tableColumnText, (LPARAM) L"Column");
|
||||||
|
SendMessageW(mainwin, tableAddColumn, tableColumnImage, (LPARAM) L"Column 2");
|
||||||
|
SendMessageW(mainwin, tableAddColumn, tableColumnCheckbox, (LPARAM) L"Column 3");
|
||||||
|
if (argc > 1) {
|
||||||
|
NONCLIENTMETRICSW ncm;
|
||||||
|
HFONT font;
|
||||||
|
|
||||||
|
ZeroMemory(&ncm, sizeof (NONCLIENTMETRICSW));
|
||||||
|
ncm.cbSize = sizeof (NONCLIENTMETRICSW);
|
||||||
|
if (SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof (NONCLIENTMETRICSW), &ncm, sizeof (NONCLIENTMETRICSW)) == 0)
|
||||||
|
panic("(test program) error getting non-client metrics");
|
||||||
|
font = CreateFontIndirectW(&ncm.lfMessageFont);
|
||||||
|
if (font == NULL)
|
||||||
|
panic("(test program) error creating lfMessageFont HFONT");
|
||||||
|
SendMessageW(mainwin, WM_SETFONT, (WPARAM) font, TRUE);
|
||||||
|
}
|
||||||
|
ShowWindow(mainwin, SW_SHOWDEFAULT);
|
||||||
|
if (UpdateWindow(mainwin) == 0)
|
||||||
|
panic("(test program) error updating window");
|
||||||
|
while (GetMessageW(&msg, NULL, 0, 0) > 0) {
|
||||||
|
TranslateMessage(&msg);
|
||||||
|
DispatchMessageW(&msg);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue