Implemented Table column names on all platforms. Updates #40.
This commit is contained in:
parent
23e6739dfa
commit
e252945cb3
|
@ -31,7 +31,11 @@ func finishNewTable(b *tablebase, ty reflect.Type) Table {
|
|||
// also sets the delegate
|
||||
C.tableMakeDataSource(t.id, unsafe.Pointer(t))
|
||||
for i := 0; i < ty.NumField(); i++ {
|
||||
cname := C.CString(ty.Field(i).Name)
|
||||
colname := ty.Field(i).Tag.Get("uicolumn")
|
||||
if colname == "" {
|
||||
colname = ty.Field(i).Name
|
||||
}
|
||||
cname := C.CString(colname)
|
||||
coltype := C.colTypeText
|
||||
editable := false
|
||||
switch {
|
||||
|
|
|
@ -61,7 +61,11 @@ func finishNewTable(b *tablebase, ty reflect.Type) Table {
|
|||
C.gpointer(unsafe.Pointer(t)))
|
||||
C.gtk_tree_view_set_model(t.treeview, t.modelgtk)
|
||||
for i := 0; i < ty.NumField(); i++ {
|
||||
cname := togstr(ty.Field(i).Name)
|
||||
colname := ty.Field(i).Tag.Get("uicolumn")
|
||||
if colname == "" {
|
||||
colname = ty.Field(i).Name
|
||||
}
|
||||
cname := togstr(colname)
|
||||
switch {
|
||||
case ty.Field(i).Type == reflect.TypeOf((*image.RGBA)(nil)):
|
||||
// can't use GDK_TYPE_PIXBUF here because it's a macro that expands to a function and cgo hates that
|
||||
|
|
|
@ -6,6 +6,7 @@ package ui
|
|||
// - why are we not getting keyboard input (focus?) on a mouse click?
|
||||
// - are we getting keyboard input (focus?) on tab?
|
||||
// - random freezes on Windows 7 when resizing headers or clicking new rows; likely another package ui infrastructure issue though...
|
||||
// - investigate japanese display in the table headers on wine (it has worked in the past in ANSI mode via Shift-JIS with what I assume is the same font, so huh?)
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
@ -53,9 +54,13 @@ func finishNewTable(b *tablebase, ty reflect.Type) Table {
|
|||
case ty.Field(i).Type.Kind() == reflect.Bool:
|
||||
coltype = C.tableColumnCheckbox
|
||||
}
|
||||
colname := toUTF16(ty.Field(i).Name)
|
||||
C.SendMessageW(t.hwnd, C.tableAddColumn, coltype, C.LPARAM(uintptr(unsafe.Pointer(colname))))
|
||||
// TODO free colname
|
||||
colname := ty.Field(i).Tag.Get("uicolumn")
|
||||
if colname == "" {
|
||||
colname = ty.Field(i).Name
|
||||
}
|
||||
ccolname := toUTF16(colname)
|
||||
C.SendMessageW(t.hwnd, C.tableAddColumn, coltype, C.LPARAM(uintptr(unsafe.Pointer(ccolname))))
|
||||
// TODO free ccolname
|
||||
}
|
||||
t.colcount = C.int(ty.NumField())
|
||||
return t
|
||||
|
|
Loading…
Reference in New Issue