summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2015-02-18 01:51:57 -0500
committerPietro Gagliardi <[email protected]>2015-02-18 01:51:57 -0500
commit9f8ae4051603d4d1bab02465c9662236644bb83d (patch)
tree224934ad1e4b5c24850f7af11652e2e1c65eeef1
parent847e9bfd2caacba1c90ee68753d5652abe484501 (diff)
Began fixing the new Windows Table. In its current state one bug is fixed and another has been spotted, with the diagnosis coming next.
-rw-r--r--table_windows.c6
-rw-r--r--table_windows.go3
-rw-r--r--winapi_windows.h1
-rw-r--r--wintable/draw.h1
4 files changed, 10 insertions, 1 deletions
diff --git a/table_windows.c b/table_windows.c
index ea5b50c..dbbcde2 100644
--- a/table_windows.c
+++ b/table_windows.c
@@ -57,6 +57,12 @@ void setTableSubclass(HWND hwnd, void *data)
xpanic("error subclassing Table to give it its own event handler", GetLastError());
}
+// TODO rename all of these functions to start with gotable, and all the exported ones in Go too
+void gotableSetRowCount(HWND hwnd, intptr_t count)
+{
+ SendMessageW(hwnd, tableSetRowCount, 0, (LPARAM) (&count));
+}
+
void tableAutosizeColumns(HWND hwnd, int nColumns)
{
int i;
diff --git a/table_windows.go b/table_windows.go
index 1be54a6..3b8d3dc 100644
--- a/table_windows.go
+++ b/table_windows.go
@@ -62,7 +62,7 @@ func (t *table) Unlock() {
Do(func() {
t.RLock()
defer t.RUnlock()
- C.SendMessageW(t.hwnd, C.tableSetRowCount, 0, C.LPARAM(C.intptr_t(reflect.Indirect(reflect.ValueOf(t.data)).Len())))
+ C.gotableSetRowCount(t.hwnd, C.intptr_t(reflect.Indirect(reflect.ValueOf(t.data)).Len()))
})
}()
}
@@ -90,6 +90,7 @@ func tableGetCell(data unsafe.Pointer, tnm *C.tableNM) C.LRESULT {
t.RLock()
defer t.RUnlock()
d := reflect.Indirect(reflect.ValueOf(t.data))
+fmt.Printf("%#v\n", *tnm)
datum := d.Index(int(tnm.row)).Field(int(tnm.column))
switch {
case datum.Type() == reflect.TypeOf((*image.RGBA)(nil)):
diff --git a/winapi_windows.h b/winapi_windows.h
index 49e3827..b2b883d 100644
--- a/winapi_windows.h
+++ b/winapi_windows.h
@@ -110,6 +110,7 @@ extern void tabLeaveChildren(HWND);
extern LPWSTR xtableWindowClass;
extern void doInitTable(void);
extern void setTableSubclass(HWND, void *);
+extern void gotableSetRowCount(HWND, intptr_t);
/* TODO
extern void tableAutosizeColumns(HWND, int);
extern intptr_t tableSelectedItem(HWND);
diff --git a/wintable/draw.h b/wintable/draw.h
index 3aeb300..2c6267a 100644
--- a/wintable/draw.h
+++ b/wintable/draw.h
@@ -166,6 +166,7 @@ static void draw(struct table *t, HDC dc, RECT cliprect, RECT client)
p.xoff = SendMessageW(t->header, HDM_GETBITMAPMARGIN, 0, 0);
p.y = client.top;
+printf("%d %d\n", t->vscrollpos, t->count);
for (i = t->vscrollpos; i < t->count; i++) {
p.row = i;
p.x = client.left - t->hscrollpos;