summaryrefslogtreecommitdiff
path: root/wintable/test.c
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2015-01-07 12:43:58 -0500
committerPietro Gagliardi <[email protected]>2015-01-07 12:43:58 -0500
commitff4212913a391abb9019f034f93c2f009fa55f66 (patch)
tree663df789da0795812d45cb2074b7445eb346be2c /wintable/test.c
parent095c6dc79cfa0a81a18422a4e0b3657a2691861d (diff)
Split the actual test code from the main Table code.
Diffstat (limited to 'wintable/test.c')
-rw-r--r--wintable/test.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/wintable/test.c b/wintable/test.c
new file mode 100644
index 0000000..a9832df
--- /dev/null
+++ b/wintable/test.c
@@ -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;
+}