Mercurial > godwindows
changeset 100:0c720f011dad
Attempt to switch from unsafe.Pointer to C.uintptr_t for storing Dynamic Window handles.
Window handles on Windows are not actual pointers, so they can trip cgo's pointer checks.
author | Brian Smith <brian@dbsoft.org> |
---|---|
date | Sat, 06 Nov 2021 22:14:59 -0500 |
parents | ad39f3ddb362 |
children | 22ce98fcafa1 |
files | dw/dw.go dw/dwglue.c dwootest/dwootest.go dwtest/dwtest.go |
diffstat | 4 files changed, 497 insertions(+), 485 deletions(-) [+] |
line wrap: on
line diff
--- a/dw/dw.go Sat Nov 06 07:14:50 2021 -0500 +++ b/dw/dw.go Sat Nov 06 22:14:59 2021 -0500 @@ -17,7 +17,7 @@ import "os" type HANDLE interface { - GetHandle() unsafe.Pointer + GetHandle() C.uintptr_t GetType() C.uint } type DRAWABLE interface { @@ -33,103 +33,103 @@ BitBltPixmap(xdest int, ydest int, width int, height int, srcp HPIXMAP, xsrc int, ysrc int) } type HGENERIC struct { - hwnd unsafe.Pointer + hwnd C.uintptr_t } type HWND struct { - hwnd unsafe.Pointer + hwnd C.uintptr_t } type HENTRYFIELD struct { - hwnd unsafe.Pointer + hwnd C.uintptr_t } type HTEXT struct { - hwnd unsafe.Pointer + hwnd C.uintptr_t } type HTREE struct { - hwnd unsafe.Pointer + hwnd C.uintptr_t } type HCONTAINER struct { - hwnd unsafe.Pointer + hwnd C.uintptr_t filesystem bool } type HMLE struct { - hwnd unsafe.Pointer + hwnd C.uintptr_t } type HBUTTON struct { - hwnd unsafe.Pointer + hwnd C.uintptr_t } type HSPINBUTTON struct { - hwnd unsafe.Pointer + hwnd C.uintptr_t } type HNOTEBOOK struct { - hwnd unsafe.Pointer + hwnd C.uintptr_t } type HBOX struct { - hwnd unsafe.Pointer + hwnd C.uintptr_t } type HSCROLLBOX struct { - hwnd unsafe.Pointer + hwnd C.uintptr_t } type HMENUITEM struct { - hwnd unsafe.Pointer + hwnd C.uintptr_t } type HLISTBOX struct { - hwnd unsafe.Pointer + hwnd C.uintptr_t } type HPERCENT struct { - hwnd unsafe.Pointer + hwnd C.uintptr_t } type HSLIDER struct { - hwnd unsafe.Pointer + hwnd C.uintptr_t } type HSCROLLBAR struct { - hwnd unsafe.Pointer + hwnd C.uintptr_t } type HRENDER struct { - hwnd unsafe.Pointer + hwnd C.uintptr_t } type HHTML struct { - hwnd unsafe.Pointer + hwnd C.uintptr_t } type HCALENDAR struct { - hwnd unsafe.Pointer + hwnd C.uintptr_t } type HBITMAP struct { - hwnd unsafe.Pointer + hwnd C.uintptr_t } type HSPLITBAR struct { - hwnd unsafe.Pointer + hwnd C.uintptr_t } type HTREEITEM struct { - htreeitem unsafe.Pointer + htreeitem C.uintptr_t htree HANDLE } type HCONTINS struct { - ptr unsafe.Pointer + ptr C.uintptr_t rowcount int hcont HANDLE filesystem bool } type HDIALOG struct { - hdialog unsafe.Pointer + hdialog C.uintptr_t } type HEV struct { - hev unsafe.Pointer + hev C.uintptr_t } type HMTX struct { - hmtx unsafe.Pointer -} -type HICN unsafe.Pointer + hmtx C.uintptr_t +} +type HICN C.uintptr_t type HTIMER struct { tid C.int } type HMENUI struct { - hmenui unsafe.Pointer + hmenui C.uintptr_t } type HPIXMAP struct { - hpixmap unsafe.Pointer + hpixmap C.uintptr_t } type HPRINT struct { - hprint unsafe.Pointer + hprint C.uintptr_t jobname string } type HNOTEPAGE struct { @@ -162,7 +162,7 @@ var NOHMENUI HMENUI var NOMENU HMENUI var NOHTREEITEM HTREEITEM -var NOHICN HICN = nil +var NOHICN HICN = 0 // Import as much as we can from C var HORZ = C.DW_HORZ @@ -436,7 +436,8 @@ // Convert a POINTER to a HANDLE (use with care) func POINTER_TO_HANDLE(ptr POINTER) HANDLE { - return HANDLE(HGENERIC{unsafe.Pointer(ptr)}) + h := cgo.Handle(ptr) + return h.Value().(HANDLE) } // Convert a HANDLE to a UINTPTR, mostly used for display purposes @@ -445,8 +446,9 @@ } // Convert a HANDLE to a POINTER (use with care) -func HANDLE_TO_POINTER(handle HANDLE) POINTER { - return POINTER(handle.GetHandle()) +func HANDLE_TO_POINTER(h interface{}) POINTER { + handle := cgo.NewHandle(h) + return POINTER(handle) } // Convert a Go Object to a POINTER @@ -476,7 +478,7 @@ if handle.GetType() == 1 || handle.GetType() == 0 { return HWND{handle.GetHandle()} } - return HWND{nil} + return HWND{0} } // Convert HANDLE to HENTRYFIELD (use with care) @@ -484,7 +486,7 @@ if handle.GetType() == 2 || handle.GetType() == 0 { return HENTRYFIELD{handle.GetHandle()} } - return HENTRYFIELD{nil} + return HENTRYFIELD{0} } // Convert HANDLE to HTEXT (use with care) @@ -492,7 +494,7 @@ if handle.GetType() == 3 || handle.GetType() == 0 { return HTEXT{handle.GetHandle()} } - return HTEXT{nil} + return HTEXT{0} } // Convert HANDLE to HTREE (use with care) @@ -500,7 +502,7 @@ if handle.GetType() == 4 || handle.GetType() == 0 { return HTREE{handle.GetHandle()} } - return HTREE{nil} + return HTREE{0} } // Convert HANDLE to HCONTAINER (use with care) @@ -512,7 +514,7 @@ } return HCONTAINER{handle.GetHandle(), filesystem} } - return HCONTAINER{nil, false} + return HCONTAINER{0, false} } // Convert HANDLE to HMLE (use with care) @@ -520,7 +522,7 @@ if handle.GetType() == 6 || handle.GetType() == 0 { return HMLE{handle.GetHandle()} } - return HMLE{nil} + return HMLE{0} } // Convert HANDLE to HBUTTON (use with care) @@ -528,7 +530,7 @@ if handle.GetType() == 7 || handle.GetType() == 0 { return HBUTTON{handle.GetHandle()} } - return HBUTTON{nil} + return HBUTTON{0} } // Convert HANDLE to HSPINBUTTON (use with care) @@ -536,7 +538,7 @@ if handle.GetType() == 8 || handle.GetType() == 0 { return HSPINBUTTON{handle.GetHandle()} } - return HSPINBUTTON{nil} + return HSPINBUTTON{0} } // Convert HANDLE to HNOTEBOOK (use with care) @@ -544,7 +546,7 @@ if handle.GetType() == 9 || handle.GetType() == 0 { return HNOTEBOOK{handle.GetHandle()} } - return HNOTEBOOK{nil} + return HNOTEBOOK{0} } // Convert HANDLE to HBOX (use with care) @@ -552,7 +554,7 @@ if handle.GetType() == 10 || handle.GetType() == 0 { return HBOX{handle.GetHandle()} } - return HBOX{nil} + return HBOX{0} } // Convert HANDLE to HSCROLLBOX (use with care) @@ -560,7 +562,7 @@ if handle.GetType() == 11 || handle.GetType() == 0 { return HSCROLLBOX{handle.GetHandle()} } - return HSCROLLBOX{nil} + return HSCROLLBOX{0} } // Convert HANDLE to HMENUITEM (use with care) @@ -568,7 +570,7 @@ if handle.GetType() == 12 || handle.GetType() == 0 { return HMENUITEM{handle.GetHandle()} } - return HMENUITEM{nil} + return HMENUITEM{0} } // Convert HANDLE to HLISTBOX (use with care) @@ -576,7 +578,7 @@ if handle.GetType() == 13 || handle.GetType() == 0 { return HLISTBOX{handle.GetHandle()} } - return HLISTBOX{nil} + return HLISTBOX{0} } // Convert HANDLE to HPERCENT (use with care) @@ -584,7 +586,7 @@ if handle.GetType() == 14 || handle.GetType() == 0 { return HPERCENT{handle.GetHandle()} } - return HPERCENT{nil} + return HPERCENT{0} } // Convert HANDLE to HSLIDER (use with care) @@ -592,7 +594,7 @@ if handle.GetType() == 15 || handle.GetType() == 0 { return HSLIDER{handle.GetHandle()} } - return HSLIDER{nil} + return HSLIDER{0} } // Convert HANDLE to HSCROLLBAR (use with care) @@ -600,7 +602,7 @@ if handle.GetType() == 16 || handle.GetType() == 0 { return HSCROLLBAR{handle.GetHandle()} } - return HSCROLLBAR{nil} + return HSCROLLBAR{0} } // Convert HANDLE to HRENDER (use with care) @@ -608,7 +610,7 @@ if handle.GetType() == 17 || handle.GetType() == 0 { return HRENDER{handle.GetHandle()} } - return HRENDER{nil} + return HRENDER{0} } // Convert HANDLE to HHTML (use with care) @@ -616,7 +618,7 @@ if handle.GetType() == 18 || handle.GetType() == 0 { return HHTML{handle.GetHandle()} } - return HHTML{nil} + return HHTML{0} } // Convert HANDLE to HCALENDAR (use with care) @@ -624,7 +626,7 @@ if handle.GetType() == 19 || handle.GetType() == 0 { return HCALENDAR{handle.GetHandle()} } - return HCALENDAR{nil} + return HCALENDAR{0} } // Convert HANDLE to HBITMAP (use with care) @@ -632,7 +634,7 @@ if handle.GetType() == 20 || handle.GetType() == 0 { return HBITMAP{handle.GetHandle()} } - return HBITMAP{nil} + return HBITMAP{0} } // Convert HANDLE to HSPLITBAR (use with care) @@ -640,10 +642,10 @@ if handle.GetType() == 21 || handle.GetType() == 0 { return HSPLITBAR{handle.GetHandle()} } - return HSPLITBAR{nil} -} - -func (window HGENERIC) GetHandle() unsafe.Pointer { + return HSPLITBAR{0} +} + +func (window HGENERIC) GetHandle() C.uintptr_t { return window.hwnd } @@ -651,7 +653,7 @@ return 0 } -func (window HWND) GetHandle() unsafe.Pointer { +func (window HWND) GetHandle() C.uintptr_t { return window.hwnd } @@ -659,7 +661,7 @@ return 1 } -func (window HENTRYFIELD) GetHandle() unsafe.Pointer { +func (window HENTRYFIELD) GetHandle() C.uintptr_t { return window.hwnd } @@ -667,7 +669,7 @@ return 2 } -func (window HTEXT) GetHandle() unsafe.Pointer { +func (window HTEXT) GetHandle() C.uintptr_t { return window.hwnd } @@ -675,7 +677,7 @@ return 3 } -func (window HTREE) GetHandle() unsafe.Pointer { +func (window HTREE) GetHandle() C.uintptr_t { return window.hwnd } @@ -683,7 +685,7 @@ return 4 } -func (window HCONTAINER) GetHandle() unsafe.Pointer { +func (window HCONTAINER) GetHandle() C.uintptr_t { return window.hwnd } @@ -691,7 +693,7 @@ return 5 } -func (window HMLE) GetHandle() unsafe.Pointer { +func (window HMLE) GetHandle() C.uintptr_t { return window.hwnd } @@ -699,7 +701,7 @@ return 6 } -func (window HBUTTON) GetHandle() unsafe.Pointer { +func (window HBUTTON) GetHandle() C.uintptr_t { return window.hwnd } @@ -707,7 +709,7 @@ return 7 } -func (window HSPINBUTTON) GetHandle() unsafe.Pointer { +func (window HSPINBUTTON) GetHandle() C.uintptr_t { return window.hwnd } @@ -715,7 +717,7 @@ return 8 } -func (window HNOTEBOOK) GetHandle() unsafe.Pointer { +func (window HNOTEBOOK) GetHandle() C.uintptr_t { return window.hwnd } @@ -723,7 +725,7 @@ return 9 } -func (window HBOX) GetHandle() unsafe.Pointer { +func (window HBOX) GetHandle() C.uintptr_t { return window.hwnd } @@ -731,7 +733,7 @@ return 10 } -func (window HSCROLLBOX) GetHandle() unsafe.Pointer { +func (window HSCROLLBOX) GetHandle() C.uintptr_t { return window.hwnd } @@ -739,7 +741,7 @@ return 11 } -func (window HMENUITEM) GetHandle() unsafe.Pointer { +func (window HMENUITEM) GetHandle() C.uintptr_t { return window.hwnd } @@ -747,7 +749,7 @@ return 12 } -func (window HLISTBOX) GetHandle() unsafe.Pointer { +func (window HLISTBOX) GetHandle() C.uintptr_t { return window.hwnd } @@ -755,7 +757,7 @@ return 13 } -func (window HPERCENT) GetHandle() unsafe.Pointer { +func (window HPERCENT) GetHandle() C.uintptr_t { return window.hwnd } @@ -763,7 +765,7 @@ return 14 } -func (window HSLIDER) GetHandle() unsafe.Pointer { +func (window HSLIDER) GetHandle() C.uintptr_t { return window.hwnd } @@ -771,7 +773,7 @@ return 15 } -func (window HSCROLLBAR) GetHandle() unsafe.Pointer { +func (window HSCROLLBAR) GetHandle() C.uintptr_t { return window.hwnd } @@ -779,7 +781,7 @@ return 16 } -func (window HRENDER) GetHandle() unsafe.Pointer { +func (window HRENDER) GetHandle() C.uintptr_t { return window.hwnd } @@ -787,7 +789,7 @@ return 17 } -func (window HHTML) GetHandle() unsafe.Pointer { +func (window HHTML) GetHandle() C.uintptr_t { return window.hwnd } @@ -795,7 +797,7 @@ return 18 } -func (window HCALENDAR) GetHandle() unsafe.Pointer { +func (window HCALENDAR) GetHandle() C.uintptr_t { return window.hwnd } @@ -803,7 +805,7 @@ return 19 } -func (window HBITMAP) GetHandle() unsafe.Pointer { +func (window HBITMAP) GetHandle() C.uintptr_t { return window.hwnd } @@ -811,7 +813,7 @@ return 20 } -func (window HSPLITBAR) GetHandle() unsafe.Pointer { +func (window HSPLITBAR) GetHandle() C.uintptr_t { return window.hwnd } @@ -819,7 +821,7 @@ return 21 } -func (treeitem HTREEITEM) GetHandle() unsafe.Pointer { +func (treeitem HTREEITEM) GetHandle() C.uintptr_t { return treeitem.htreeitem } @@ -827,7 +829,7 @@ return 22 } -func (contins HCONTINS) GetHandle() unsafe.Pointer { +func (contins HCONTINS) GetHandle() C.uintptr_t { return contins.ptr } @@ -835,7 +837,7 @@ return 0 } -func (event HEV) GetHandle() unsafe.Pointer { +func (event HEV) GetHandle() C.uintptr_t { return event.hev } @@ -843,7 +845,7 @@ return 0 } -func (mutex HMTX) GetHandle() unsafe.Pointer { +func (mutex HMTX) GetHandle() C.uintptr_t { return mutex.hmtx } @@ -927,7 +929,7 @@ ctitle := C.CString(title) defer C.free(unsafe.Pointer(ctitle)) - return HWND{C.go_window_new(unsafe.Pointer(owner.hwnd), ctitle, C.ulong(flags))} + return HWND{C.go_window_new(owner.GetHandle(), ctitle, C.ulong(flags))} } // Create a new Window Frame. @@ -1037,7 +1039,7 @@ // Sets the default focus item for a window/dialog. func Window_default(window HWND, defaultitem HANDLE) { - C.go_window_default(unsafe.Pointer(window.hwnd), defaultitem.GetHandle()) + C.go_window_default(window.GetHandle(), defaultitem.GetHandle()) } // Sets the default focus item for a window/dialog. @@ -1226,7 +1228,7 @@ // Sets the icon used for a given window. func Window_set_icon(handle HANDLE, icon HICN) { - C.go_window_set_icon(handle.GetHandle(), unsafe.Pointer(icon)) + C.go_window_set_icon(handle.GetHandle(), C.uintptr_t(icon)) } // Sets the icon used for a given window. @@ -2785,7 +2787,7 @@ // Create a menubar on a window. func Menubar_new(location HWND) HMENUI { - return HMENUI{C.go_menubar_new(unsafe.Pointer(location.hwnd))} + return HMENUI{C.go_menubar_new(location.GetHandle())} } // Create a menubar on a window. @@ -2939,7 +2941,7 @@ // Deletes an icon from the taskbar. func Taskbar_delete(handle HANDLE, icon HICN) { - C.go_taskbar_delete(handle.GetHandle(), unsafe.Pointer(icon)) + C.go_taskbar_delete(handle.GetHandle(), C.uintptr_t(icon)) } // Deletes an icon from the taskbar. @@ -2952,7 +2954,7 @@ cbubbletext := C.CString(bubbletext) defer C.free(unsafe.Pointer(cbubbletext)) - C.go_taskbar_insert(handle.GetHandle(), unsafe.Pointer(icon), cbubbletext) + C.go_taskbar_insert(handle.GetHandle(), C.uintptr_t(icon), cbubbletext) } // Inserts an icon into the taskbar. @@ -3437,7 +3439,7 @@ ctext := C.CString(text) defer C.free(unsafe.Pointer(ctext)) - C.go_font_text_extents_get(handle.GetHandle(), unsafe.Pointer(pixmap.hpixmap), ctext, &width, &height) + C.go_font_text_extents_get(handle.GetHandle(), pixmap.hpixmap, ctext, &width, &height) return int(width), int(height) } @@ -3486,12 +3488,12 @@ // Copies from one surface to another. func Pixmap_bitblt(dest HANDLE, destp HPIXMAP, xdest int, ydest int, width int, height int, src HANDLE, srcp HPIXMAP, xsrc int, ysrc int) { - C.go_pixmap_bitblt(dest.GetHandle(), unsafe.Pointer(destp.hpixmap), C.int(xdest), C.int(ydest), C.int(width), C.int(height), src.GetHandle(), unsafe.Pointer(srcp.hpixmap), C.int(xsrc), C.int(ysrc)) + C.go_pixmap_bitblt(dest.GetHandle(), C.uintptr_t(destp.hpixmap), C.int(xdest), C.int(ydest), C.int(width), C.int(height), src.GetHandle(), C.uintptr_t(srcp.hpixmap), C.int(xsrc), C.int(ysrc)) } // Copies from one surface to another allowing for stretching. func Pixmap_stretch_bitblt(dest HANDLE, destp HPIXMAP, xdest int, ydest int, width int, height int, src HANDLE, srcp HPIXMAP, xsrc int, ysrc int, srcwidth int, srcheight int) int { - return int(C.go_pixmap_stretch_bitblt(dest.GetHandle(), unsafe.Pointer(destp.hpixmap), C.int(xdest), C.int(ydest), C.int(width), C.int(height), src.GetHandle(), unsafe.Pointer(srcp.hpixmap), C.int(xsrc), C.int(ysrc), C.int(srcwidth), C.int(srcheight))) + return int(C.go_pixmap_stretch_bitblt(dest.GetHandle(), C.uintptr_t(destp.hpixmap), C.int(xdest), C.int(ydest), C.int(width), C.int(height), src.GetHandle(), C.uintptr_t(srcp.hpixmap), C.int(xsrc), C.int(ysrc), C.int(srcwidth), C.int(srcheight))) } // Copies from one surface to another allowing for stretching. @@ -3536,7 +3538,7 @@ // Sets the transparent color for a pixmap. func Pixmap_set_transparent_color(pixmap HPIXMAP, color COLOR) { - C.go_pixmap_set_transparent_color(unsafe.Pointer(pixmap.hpixmap), C.ulong(color)) + C.go_pixmap_set_transparent_color(C.uintptr_t(pixmap.hpixmap), C.ulong(color)) } // Sets the transparent color for a pixmap. @@ -3549,7 +3551,7 @@ cfontname := C.CString(fontname) defer C.free(unsafe.Pointer(cfontname)) - return int(C.go_pixmap_set_font(unsafe.Pointer(pixmap.hpixmap), cfontname)) + return int(C.go_pixmap_set_font(C.uintptr_t(pixmap.hpixmap), cfontname)) } // Sets the font used by a specified pixmap. @@ -3559,7 +3561,7 @@ // Destroys an allocated pixmap. func Pixmap_destroy(pixmap HPIXMAP) { - C.go_pixmap_destroy(unsafe.Pointer(pixmap.hpixmap)) + C.go_pixmap_destroy(C.uintptr_t(pixmap.hpixmap)) } // Destroys an allocated pixmap. @@ -3569,7 +3571,7 @@ // Returns the width in pixels of the specified pixmap. func Pixmap_width(pixmap HPIXMAP) int { - return int(C.go_pixmap_width(unsafe.Pointer(pixmap.hpixmap))) + return int(C.go_pixmap_width(C.uintptr_t(pixmap.hpixmap))) } // Returns the width in pixels of the specified pixmap. @@ -3579,7 +3581,7 @@ // Returns the height in pixels of the specified pixmap. func Pixmap_height(pixmap HPIXMAP) int { - return int(C.go_pixmap_height(unsafe.Pointer(pixmap.hpixmap))) + return int(C.go_pixmap_height(C.uintptr_t(pixmap.hpixmap))) } // Returns the height in pixels of the specified pixmap. @@ -3589,7 +3591,7 @@ // Draw a point. func Draw_point(handle HANDLE, pixmap HPIXMAP, x int, y int) { - C.go_draw_point(handle.GetHandle(), unsafe.Pointer(pixmap.hpixmap), C.int(x), C.int(y)) + C.go_draw_point(handle.GetHandle(), C.uintptr_t(pixmap.hpixmap), C.int(x), C.int(y)) } // Draw a point on a widget. @@ -3604,7 +3606,7 @@ // Draw a line. func Draw_line(handle HANDLE, pixmap HPIXMAP, x1 int, y1 int, x2 int, y2 int) { - C.go_draw_line(handle.GetHandle(), unsafe.Pointer(pixmap.hpixmap), C.int(x1), C.int(y1), C.int(x2), C.int(y2)) + C.go_draw_line(handle.GetHandle(), C.uintptr_t(pixmap.hpixmap), C.int(x1), C.int(y1), C.int(x2), C.int(y2)) } // Draw a line on a widget. @@ -3632,7 +3634,7 @@ xHeader := (*reflect.SliceHeader)((unsafe.Pointer(&cx))) yHeader := (*reflect.SliceHeader)((unsafe.Pointer(&cy))) - C.go_draw_polygon(handle.GetHandle(), unsafe.Pointer(pixmap.hpixmap), C.int(flags), C.int(count), (*C.int)(unsafe.Pointer(xHeader.Data)), (*C.int)(unsafe.Pointer(yHeader.Data))) + C.go_draw_polygon(handle.GetHandle(), C.uintptr_t(pixmap.hpixmap), C.int(flags), C.int(count), (*C.int)(unsafe.Pointer(xHeader.Data)), (*C.int)(unsafe.Pointer(yHeader.Data))) } // Draw a polygon on a widget. @@ -3647,7 +3649,7 @@ // Draw a rectangle. func Draw_rect(handle HANDLE, pixmap HPIXMAP, fill int, x int, y int, width int, height int) { - C.go_draw_rect(handle.GetHandle(), unsafe.Pointer(pixmap.hpixmap), C.int(fill), C.int(x), C.int(y), C.int(width), C.int(height)) + C.go_draw_rect(handle.GetHandle(), C.uintptr_t(pixmap.hpixmap), C.int(fill), C.int(x), C.int(y), C.int(width), C.int(height)) } // Draw a rectangle on a widget. @@ -3662,7 +3664,7 @@ // Draw an arc. func Draw_arc(handle HANDLE, pixmap HPIXMAP, flags int, xorigin int, yorigin int, x1 int, y1 int, x2 int, y2 int) { - C.go_draw_arc(handle.GetHandle(), unsafe.Pointer(pixmap.hpixmap), C.int(flags), C.int(xorigin), C.int(yorigin), C.int(x1), C.int(y1), C.int(x2), C.int(y2)) + C.go_draw_arc(handle.GetHandle(), C.uintptr_t(pixmap.hpixmap), C.int(flags), C.int(xorigin), C.int(yorigin), C.int(x1), C.int(y1), C.int(x2), C.int(y2)) } // Draw an arc on a widget. @@ -3680,7 +3682,7 @@ ctext := C.CString(text) defer C.free(unsafe.Pointer(ctext)) - C.go_draw_text(handle.GetHandle(), unsafe.Pointer(pixmap.hpixmap), C.int(x), C.int(y), ctext) + C.go_draw_text(handle.GetHandle(), C.uintptr_t(pixmap.hpixmap), C.int(x), C.int(y), ctext) } // Draw text on a widget. @@ -3735,7 +3737,7 @@ ctitle := C.CString(title) defer C.free(unsafe.Pointer(ctitle)) - return HTREEITEM{C.go_tree_insert(handle.GetHandle(), ctitle, unsafe.Pointer(icon), parent.htreeitem, unsafe.Pointer(itemdata)), handle} + return HTREEITEM{C.go_tree_insert(handle.GetHandle(), ctitle, C.uintptr_t(icon), parent.htreeitem, unsafe.Pointer(itemdata)), handle} } // Inserts an item into a tree widget. @@ -3748,7 +3750,7 @@ ctitle := C.CString(title) defer C.free(unsafe.Pointer(ctitle)) - return HTREEITEM{C.go_tree_insert_after(handle.GetHandle(), item.htreeitem, ctitle, unsafe.Pointer(icon), parent.htreeitem, unsafe.Pointer(itemdata)), handle} + return HTREEITEM{C.go_tree_insert_after(handle.GetHandle(), item.htreeitem, ctitle, C.uintptr_t(icon), parent.htreeitem, unsafe.Pointer(itemdata)), handle} } // Inserts an item into a tree widget after another item. @@ -3781,7 +3783,7 @@ ctitle := C.CString(title) defer C.free(unsafe.Pointer(ctitle)) - C.go_tree_item_change(handle.GetHandle(), item.htreeitem, ctitle, unsafe.Pointer(icon)) + C.go_tree_item_change(handle.GetHandle(), item.htreeitem, ctitle, C.uintptr_t(icon)) } // Sets the text and icon of an item in a tree widget. @@ -4144,7 +4146,7 @@ // Sets an item in specified row and column to the given icon. func Container_set_item_icon(handle HANDLE, contins HCONTINS, column int, row int, icon HICN) { - C.go_container_set_item_icon(handle.GetHandle(), contins.ptr, C.int(column), C.int(row), unsafe.Pointer(icon)) + C.go_container_set_item_icon(handle.GetHandle(), contins.GetHandle(), C.int(column), C.int(row), C.uintptr_t(icon)) } // Sets an item in specified row and column to the given icon. @@ -4157,7 +4159,7 @@ // Sets an item in specified row and column to the given time. func Container_set_item_time(handle HANDLE, contins HCONTINS, column int, row int, seconds int, minutes int, hours int) { - C.go_container_set_item_time(handle.GetHandle(), contins.ptr, C.int(column), C.int(row), C.int(seconds), C.int(minutes), C.int(hours)) + C.go_container_set_item_time(handle.GetHandle(), contins.GetHandle(), C.int(column), C.int(row), C.int(seconds), C.int(minutes), C.int(hours)) } // Sets an item in specified row and column to the given time. @@ -4170,7 +4172,7 @@ // Sets an item in specified row and column to the given date. func Container_set_item_date(handle HANDLE, contins HCONTINS, column int, row int, day int, month int, year int) { - C.go_container_set_item_date(handle.GetHandle(), contins.ptr, C.int(column), C.int(row), C.int(day), C.int(month), C.int(year)) + C.go_container_set_item_date(handle.GetHandle(), contins.GetHandle(), C.int(column), C.int(row), C.int(day), C.int(month), C.int(year)) } // Sets an item in specified row and column to the given date. @@ -4209,7 +4211,7 @@ // Changes an existing item in specified row and column to the given icon. func Container_change_item_icon(handle HANDLE, column int, row int, icon HICN) { - C.go_container_change_item_icon(handle.GetHandle(), C.int(column), C.int(row), unsafe.Pointer(icon)) + C.go_container_change_item_icon(handle.GetHandle(), C.int(column), C.int(row), C.uintptr_t(icon)) } // Changes an existing item in specified row and column to the given icon. @@ -4259,7 +4261,7 @@ // Sets the title of a row in the container. func Container_set_row_title(contins HCONTINS, row int, title string) { ctitle := C.CString(title) - C.dw_container_set_row_title(contins.ptr, C.int(row), ctitle) + C.go_container_set_row_title(contins.GetHandle(), C.int(row), ctitle) defer C.free(unsafe.Pointer(ctitle)) } @@ -4270,7 +4272,7 @@ // Sets the pointer of a row in the container. func Container_set_row_data(contins HCONTINS, row int, data POINTER) { - C.dw_container_set_row_data(contins.ptr, C.int(row), unsafe.Pointer(data)) + C.go_container_set_row_data(contins.GetHandle(), C.int(row), unsafe.Pointer(data)) } // Sets the pointer of a row in the container. @@ -4301,8 +4303,8 @@ // Inserts allocated rows into the container widget. func Container_insert(handle HANDLE, contins HCONTINS, rowcount int) { - C.go_container_insert(handle.GetHandle(), contins.ptr, C.int(rowcount)) - contins.ptr = nil + C.go_container_insert(handle.GetHandle(), contins.GetHandle(), C.int(rowcount)) + contins.ptr = 0 contins.rowcount = 0 } @@ -4476,27 +4478,27 @@ // Sets an item in specified row and column to the given data. func Filesystem_set_item(handle HANDLE, contins HCONTINS, column int, row int, data POINTER) { - C.go_filesystem_set_item(handle.GetHandle(), contins.ptr, C.int(column), C.int(row), unsafe.Pointer(data)) + C.go_filesystem_set_item(handle.GetHandle(), contins.GetHandle(), C.int(column), C.int(row), unsafe.Pointer(data)) } // Sets an item in specified row and column to the given unsigned integer. func Filesystem_set_item_ulong(handle HANDLE, contins HCONTINS, column int, row int, val uint) { - C.go_filesystem_set_item_ulong(handle.GetHandle(), contins.ptr, C.int(column), C.int(row), C.ulong(val)) + C.go_filesystem_set_item_ulong(handle.GetHandle(), contins.GetHandle(), C.int(column), C.int(row), C.ulong(val)) } // Sets an item in specified row and column to the given icon. func Filesystem_set_item_icon(handle HANDLE, contins HCONTINS, column int, row int, icon HICN) { - C.go_filesystem_set_item_icon(handle.GetHandle(), contins.ptr, C.int(column), C.int(row), unsafe.Pointer(icon)) + C.go_filesystem_set_item_icon(handle.GetHandle(), contins.GetHandle(), C.int(column), C.int(row), C.uintptr_t(icon)) } // Sets an item in specified row and column to the given time. func Filesystem_set_item_time(handle HANDLE, contins HCONTINS, column int, row int, seconds int, minutes int, hours int) { - C.go_filesystem_set_item_time(handle.GetHandle(), contins.ptr, C.int(column), C.int(row), C.int(seconds), C.int(minutes), C.int(hours)) + C.go_filesystem_set_item_time(handle.GetHandle(), contins.GetHandle(), C.int(column), C.int(row), C.int(seconds), C.int(minutes), C.int(hours)) } // Sets an item in specified row and column to the given date. func Filesystem_set_item_date(handle HANDLE, contins HCONTINS, column int, row int, day int, month int, year int) { - C.go_filesystem_set_item_date(handle.GetHandle(), contins.ptr, C.int(column), C.int(row), C.int(day), C.int(month), C.int(year)) + C.go_filesystem_set_item_date(handle.GetHandle(), contins.GetHandle(), C.int(column), C.int(row), C.int(day), C.int(month), C.int(year)) } // Sets the filename and icon of the row in a filesystem style container. @@ -4504,7 +4506,7 @@ cfilename := C.CString(filename) defer C.free(unsafe.Pointer(cfilename)) - C.go_filesystem_set_file(handle.GetHandle(), contins.ptr, C.int(row), cfilename, unsafe.Pointer(icon)) + C.go_filesystem_set_file(handle.GetHandle(), contins.GetHandle(), C.int(row), cfilename, C.uintptr_t(icon)) } // Sets the filename and icon of the row in a filesystem style container. @@ -4526,7 +4528,7 @@ // Changes an existing item in specified row and column to the given icon. func Filesystem_change_item_icon(handle HANDLE, column int, row int, icon HICN) { - C.go_filesystem_change_item_icon(handle.GetHandle(), C.int(column), C.int(row), unsafe.Pointer(icon)) + C.go_filesystem_change_item_icon(handle.GetHandle(), C.int(column), C.int(row), C.uintptr_t(icon)) } // Changes an existing item in specified row and column to the given time. @@ -4544,7 +4546,7 @@ cfilename := C.CString(filename) defer C.free(unsafe.Pointer(cfilename)) - C.go_filesystem_change_file(handle.GetHandle(), C.int(row), cfilename, unsafe.Pointer(icon)) + C.go_filesystem_change_file(handle.GetHandle(), C.int(row), cfilename, C.uintptr_t(icon)) } // Changes the filename and icon of the row in a filesystem style container. @@ -4627,7 +4629,7 @@ // Creates a splitbar widget with given widgets on either side. func Splitbar_new(btype int, topleft HWND, bottomright HWND, id uint) HSPLITBAR { - return HSPLITBAR{C.go_splitbar_new(C.int(btype), unsafe.Pointer(topleft.hwnd), unsafe.Pointer(bottomright.hwnd), C.ulong(id))} + return HSPLITBAR{C.go_splitbar_new(C.int(btype), topleft.GetHandle(), bottomright.GetHandle(), C.ulong(id))} } // Creates a splitbar widget with given widgets on either side. @@ -4657,7 +4659,7 @@ // Creates a new print object. func PrintNew(jobname string) HPRINT { - return HPRINT{nil, jobname} + return HPRINT{0, jobname} } // Creates a new print object. @@ -4670,8 +4672,8 @@ // Runs the print job, causing the draw page callbacks to fire. func Print_run(print HPRINT, flags uint) int { - if print.hprint != nil { - return int(C.go_print_run(unsafe.Pointer(print.hprint), C.ulong(flags))) + if print.hprint != 0 { + return int(C.go_print_run(C.uintptr_t(print.hprint), C.ulong(flags))) } return C.DW_ERROR_UNKNOWN } @@ -4683,8 +4685,8 @@ // Cancels the print job, typically called from a draw page callback. func Print_cancel(print HPRINT) { - if print.hprint != nil { - C.go_print_cancel(unsafe.Pointer(print.hprint)) + if print.hprint != 0 { + C.go_print_cancel(C.uintptr_t(print.hprint)) } } @@ -4709,7 +4711,7 @@ // Closes a semaphore created by Mutex_new(). func Mutex_close(handle HMTX) { - C.go_mutex_close(unsafe.Pointer(handle.hmtx)) + C.go_mutex_close(C.uintptr_t(handle.hmtx)) } // Closes a semaphore created by MutexNew(). @@ -4719,7 +4721,7 @@ // Tries to gain access to the semaphore, if it can't it blocks. func Mutex_lock(handle HMTX) { - C.go_mutex_lock(unsafe.Pointer(handle.hmtx)) + C.go_mutex_lock(C.uintptr_t(handle.hmtx)) } // Tries to gain access to the semaphore, if it can't it blocks. @@ -4729,7 +4731,7 @@ // Reliquishes the access to the semaphore. func Mutex_unlock(handle HMTX) { - C.go_mutex_unlock(unsafe.Pointer(handle.hmtx)) + C.go_mutex_unlock(C.uintptr_t(handle.hmtx)) } // Reliquishes the access to the semaphore. @@ -4739,7 +4741,7 @@ // Tries to gain access to the semaphore. func Mutex_trylock(handle HMTX) int { - return int(C.go_mutex_trylock(unsafe.Pointer(handle.hmtx))) + return int(C.go_mutex_trylock(C.uintptr_t(handle.hmtx))) } // Tries to gain access to the semaphore. @@ -4759,7 +4761,7 @@ // Accepts a dialog and returns the given data to the initial call of Dialog_wait(). func Dialog_dismiss(handle HDIALOG, result POINTER) int { - return int(C.go_dialog_dismiss(unsafe.Pointer(handle.hdialog), unsafe.Pointer(result))) + return int(C.go_dialog_dismiss(C.uintptr_t(handle.hdialog), unsafe.Pointer(result))) } // Returns the given data to the initial call of Wait(). @@ -4769,7 +4771,7 @@ // Accepts a dialog, waits for Dialog_dismiss() to be called by a signal handler with the given dialog. func Dialog_wait(handle HDIALOG) POINTER { - return POINTER(C.go_dialog_wait(unsafe.Pointer(handle.hdialog))) + return POINTER(C.go_dialog_wait(C.uintptr_t(handle.hdialog))) } // Waits for Dismiss() to be called by a signal handler. @@ -4789,8 +4791,8 @@ // Closes a semaphore created by Event_new(). func Event_close(handle *HEV) int { - retval := int(C.go_event_close(unsafe.Pointer(handle.hev))) - handle.hev = nil + retval := int(C.go_event_close(C.uintptr_t(handle.hev))) + handle.hev = 0 return retval } @@ -4801,7 +4803,7 @@ // Posts a semaphore created by Event_new(). Causing all threads waiting on this event in Event_wait() to continue. func Event_post(handle HEV) int { - return int(C.go_event_post(unsafe.Pointer(handle.hev))) + return int(C.go_event_post(C.uintptr_t(handle.hev))) } // Posts a semaphore created by EventNew(). Causing all threads waiting on this event in Wait() to continue. @@ -4811,7 +4813,7 @@ // Resets a semaphore created by Event_new(). func Event_reset(handle HEV) int { - return int(C.go_event_reset(unsafe.Pointer(handle.hev))) + return int(C.go_event_reset(C.uintptr_t(handle.hev))) } // Resets a semaphore created by EventNew(). @@ -4821,7 +4823,7 @@ // Waits on a semaphore created by Event_new(), until the event gets posted or until the timeout expires. func Event_wait(handle HEV, timeout int) int { - return int(C.go_event_wait(unsafe.Pointer(handle.hev), C.ulong(timeout))) + return int(C.go_event_wait(C.uintptr_t(handle.hev), C.ulong(timeout))) } // Waits on a semaphore created by EventNew(), until the event gets posted or until the timeout expires. @@ -4836,7 +4838,7 @@ csigname := C.CString(C.DW_SIGNAL_DELETE) defer C.free(unsafe.Pointer(csigname)) - C.go_signal_connect(unsafe.Pointer(window.hwnd), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) + C.go_signal_connect(window.GetHandle(), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) } // Connect a function or closure to a widget clicked event. @@ -4844,7 +4846,7 @@ csigname := C.CString(C.DW_SIGNAL_CLICKED) defer C.free(unsafe.Pointer(csigname)) - C.go_signal_connect(unsafe.Pointer(window.hwnd), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) + C.go_signal_connect(window.GetHandle(), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) } // Connect a function or closure to a focus clicked event. @@ -4852,7 +4854,7 @@ csigname := C.CString(C.DW_SIGNAL_SET_FOCUS) defer C.free(unsafe.Pointer(csigname)) - C.go_signal_connect(unsafe.Pointer(window.hwnd), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) + C.go_signal_connect(window.GetHandle(), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) } // Connect a function or closure to a key press event. @@ -4860,7 +4862,7 @@ csigname := C.CString(C.DW_SIGNAL_KEY_PRESS) defer C.free(unsafe.Pointer(csigname)) - C.go_signal_connect(unsafe.Pointer(window.hwnd), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) + C.go_signal_connect(window.GetHandle(), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) } // Connect a function or closure to a key press event. @@ -4868,7 +4870,7 @@ csigname := C.CString(C.DW_SIGNAL_KEY_PRESS) defer C.free(unsafe.Pointer(csigname)) - C.go_signal_connect(unsafe.Pointer(window.hwnd), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) + C.go_signal_connect(window.GetHandle(), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) } // Connect a function or closure to a mouse motion event. @@ -4876,7 +4878,7 @@ csigname := C.CString(C.DW_SIGNAL_MOTION_NOTIFY) defer C.free(unsafe.Pointer(csigname)) - C.go_signal_connect(unsafe.Pointer(window.hwnd), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) + C.go_signal_connect(window.GetHandle(), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) } // Connect a function or closure to a mouse button press event. @@ -4884,7 +4886,7 @@ csigname := C.CString(C.DW_SIGNAL_BUTTON_PRESS) defer C.free(unsafe.Pointer(csigname)) - C.go_signal_connect(unsafe.Pointer(window.hwnd), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) + C.go_signal_connect(window.GetHandle(), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) } // Connect a function or closure to a mouse button release event. @@ -4892,7 +4894,7 @@ csigname := C.CString(C.DW_SIGNAL_BUTTON_RELEASE) defer C.free(unsafe.Pointer(csigname)) - C.go_signal_connect(unsafe.Pointer(window.hwnd), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) + C.go_signal_connect(window.GetHandle(), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) } // Connect a function or closure to a render expose event. @@ -4900,7 +4902,7 @@ csigname := C.CString(C.DW_SIGNAL_EXPOSE) defer C.free(unsafe.Pointer(csigname)) - C.go_signal_connect(unsafe.Pointer(window.hwnd), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) + C.go_signal_connect(window.GetHandle(), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) } // Connect a function or closure to a configure (size change) event. @@ -4908,7 +4910,7 @@ csigname := C.CString(C.DW_SIGNAL_CONFIGURE) defer C.free(unsafe.Pointer(csigname)) - C.go_signal_connect(unsafe.Pointer(window.hwnd), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) + C.go_signal_connect(window.GetHandle(), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) } // Connect a function or closure to a tree ENTER/RETURN press event. @@ -4916,7 +4918,7 @@ csigname := C.CString(C.DW_SIGNAL_ITEM_ENTER) defer C.free(unsafe.Pointer(csigname)) - C.go_signal_connect(unsafe.Pointer(window.hwnd), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) + C.go_signal_connect(window.GetHandle(), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) } // Connect a function or closure to a container ENTER/RETURN press event. @@ -4924,7 +4926,7 @@ csigname := C.CString(C.DW_SIGNAL_ITEM_ENTER) defer C.free(unsafe.Pointer(csigname)) - C.go_signal_connect(unsafe.Pointer(window.hwnd), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) + C.go_signal_connect(window.GetHandle(), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) } // Connect a function or closure to a tree context event. @@ -4932,7 +4934,7 @@ csigname := C.CString(C.DW_SIGNAL_ITEM_CONTEXT) defer C.free(unsafe.Pointer(csigname)) - C.go_signal_connect(unsafe.Pointer(window.hwnd), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) + C.go_signal_connect(window.GetHandle(), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) } // Connect a function or closure to a container context event. @@ -4940,7 +4942,7 @@ csigname := C.CString(C.DW_SIGNAL_ITEM_CONTEXT) defer C.free(unsafe.Pointer(csigname)) - C.go_signal_connect(unsafe.Pointer(window.hwnd), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) + C.go_signal_connect(window.GetHandle(), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) } // Connect a function or closure to a tree select event. @@ -4948,7 +4950,7 @@ csigname := C.CString(C.DW_SIGNAL_ITEM_SELECT) defer C.free(unsafe.Pointer(csigname)) - C.go_signal_connect(unsafe.Pointer(window.hwnd), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) + C.go_signal_connect(window.GetHandle(), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) } // Connect a function or closure to a container select event. @@ -4956,7 +4958,7 @@ csigname := C.CString(C.DW_SIGNAL_ITEM_SELECT) defer C.free(unsafe.Pointer(csigname)) - C.go_signal_connect(unsafe.Pointer(window.hwnd), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) + C.go_signal_connect(window.GetHandle(), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) } // Connect a function or closure to a listbox select event. @@ -4964,7 +4966,7 @@ csigname := C.CString(C.DW_SIGNAL_LIST_SELECT) defer C.free(unsafe.Pointer(csigname)) - C.go_signal_connect(unsafe.Pointer(window.hwnd), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) + C.go_signal_connect(window.GetHandle(), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) } // Connect a function or closure to a value changed event. @@ -4972,7 +4974,7 @@ csigname := C.CString(C.DW_SIGNAL_VALUE_CHANGED) defer C.free(unsafe.Pointer(csigname)) - C.go_signal_connect(unsafe.Pointer(window.hwnd), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) + C.go_signal_connect(window.GetHandle(), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) } // Connect a function or closure to a value changed event. @@ -4980,7 +4982,7 @@ csigname := C.CString(C.DW_SIGNAL_VALUE_CHANGED) defer C.free(unsafe.Pointer(csigname)) - C.go_signal_connect(unsafe.Pointer(window.hwnd), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) + C.go_signal_connect(window.GetHandle(), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) } // Connect a function or closure to a value changed event. @@ -4988,7 +4990,7 @@ csigname := C.CString(C.DW_SIGNAL_VALUE_CHANGED) defer C.free(unsafe.Pointer(csigname)) - C.go_signal_connect(unsafe.Pointer(window.hwnd), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) + C.go_signal_connect(window.GetHandle(), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) } // Connect a function or closure to a column title click event. @@ -4996,7 +4998,7 @@ csigname := C.CString(C.DW_SIGNAL_COLUMN_CLICK) defer C.free(unsafe.Pointer(csigname)) - C.go_signal_connect(unsafe.Pointer(window.hwnd), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) + C.go_signal_connect(window.GetHandle(), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) } // Connect a function or closure to a notebook switch page event. @@ -5004,7 +5006,7 @@ csigname := C.CString(C.DW_SIGNAL_SWITCH_PAGE) defer C.free(unsafe.Pointer(csigname)) - C.go_signal_connect(unsafe.Pointer(window.hwnd), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) + C.go_signal_connect(window.GetHandle(), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) } // Connect a function or closure to a tree item (node) expand event. @@ -5012,7 +5014,7 @@ csigname := C.CString(C.DW_SIGNAL_TREE_EXPAND) defer C.free(unsafe.Pointer(csigname)) - C.go_signal_connect(unsafe.Pointer(window.hwnd), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) + C.go_signal_connect(window.GetHandle(), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) } // Connect a function or closure to a menu item clicked event. @@ -5020,7 +5022,7 @@ csigname := C.CString(C.DW_SIGNAL_CLICKED) defer C.free(unsafe.Pointer(csigname)) - C.go_signal_connect(unsafe.Pointer(window.hwnd), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) + C.go_signal_connect(window.GetHandle(), csigname, unsafe.Pointer(cgo.NewHandle(sigfunc)), nil, (window.GetType()<<8)|go_flags_no_data) } // Connect a function or closure to a timer event. @@ -5039,7 +5041,7 @@ // Connect a function or closure to a print object draw page event. func (print HPRINT) Connect(drawfunc func(HPRINT, HPIXMAP, int) int, flags uint, pages int) { - if print.hprint == nil { + if print.hprint == 0 { cjobname := C.CString(print.jobname) defer C.free(unsafe.Pointer(cjobname)) @@ -5054,7 +5056,7 @@ } //export go_int_callback_basic -func go_int_callback_basic(h unsafe.Pointer, window unsafe.Pointer, data unsafe.Pointer, flags C.uint) C.int { +func go_int_callback_basic(h unsafe.Pointer, window C.uintptr_t, data unsafe.Pointer, flags C.uint) C.int { pfunc := cgo.Handle(h) switch flags { case (1 << 8): // HWND @@ -5200,7 +5202,7 @@ } //export go_int_callback_configure -func go_int_callback_configure(h unsafe.Pointer, window unsafe.Pointer, width C.int, height C.int, data unsafe.Pointer, flags C.uint) C.int { +func go_int_callback_configure(h unsafe.Pointer, window C.uintptr_t, width C.int, height C.int, data unsafe.Pointer, flags C.uint) C.int { pfunc := cgo.Handle(h) switch flags { case (1 << 8): // HWND @@ -5346,7 +5348,7 @@ } //export go_int_callback_keypress -func go_int_callback_keypress(h unsafe.Pointer, window unsafe.Pointer, ch C.char, vk C.int, state C.int, data unsafe.Pointer, utf8 *C.char, flags C.uint) C.int { +func go_int_callback_keypress(h unsafe.Pointer, window C.uintptr_t, ch C.char, vk C.int, state C.int, data unsafe.Pointer, utf8 *C.char, flags C.uint) C.int { pfunc := cgo.Handle(h) switch flags { case (1 << 8): // HWND @@ -5492,7 +5494,7 @@ } //export go_int_callback_mouse -func go_int_callback_mouse(h unsafe.Pointer, window unsafe.Pointer, x C.int, y C.int, mask C.int, data unsafe.Pointer, flags C.uint) C.int { +func go_int_callback_mouse(h unsafe.Pointer, window C.uintptr_t, x C.int, y C.int, mask C.int, data unsafe.Pointer, flags C.uint) C.int { pfunc := cgo.Handle(h) switch flags { case (1 << 8): // HWND @@ -5638,7 +5640,7 @@ } //export go_int_callback_expose -func go_int_callback_expose(h unsafe.Pointer, window unsafe.Pointer, x C.int, y C.int, width C.int, height C.int, data unsafe.Pointer, flags C.uint) C.int { +func go_int_callback_expose(h unsafe.Pointer, window C.uintptr_t, x C.int, y C.int, width C.int, height C.int, data unsafe.Pointer, flags C.uint) C.int { pfunc := cgo.Handle(h) switch flags { case (17 << 8): // HRENDER @@ -5656,7 +5658,7 @@ } //export go_int_callback_item_enter -func go_int_callback_item_enter(h unsafe.Pointer, window unsafe.Pointer, text *C.char, data unsafe.Pointer, itemdata unsafe.Pointer, flags C.uint) C.int { +func go_int_callback_item_enter(h unsafe.Pointer, window C.uintptr_t, text *C.char, data unsafe.Pointer, itemdata unsafe.Pointer, flags C.uint) C.int { pfunc := cgo.Handle(h) switch flags { case (4 << 8): // HTREE @@ -5688,7 +5690,7 @@ } //export go_int_callback_item_context -func go_int_callback_item_context(h unsafe.Pointer, window unsafe.Pointer, text *C.char, x C.int, y C.int, data unsafe.Pointer, itemdata unsafe.Pointer, flags C.uint) C.int { +func go_int_callback_item_context(h unsafe.Pointer, window C.uintptr_t, text *C.char, x C.int, y C.int, data unsafe.Pointer, itemdata unsafe.Pointer, flags C.uint) C.int { pfunc := cgo.Handle(h) switch flags { case (4 << 8): // HTREE @@ -5720,7 +5722,7 @@ } //export go_int_callback_item_select -func go_int_callback_item_select(h unsafe.Pointer, window unsafe.Pointer, item unsafe.Pointer, text *C.char, data unsafe.Pointer, itemdata unsafe.Pointer, flags C.uint) C.int { +func go_int_callback_item_select(h unsafe.Pointer, window C.uintptr_t, item C.uintptr_t, text *C.char, data unsafe.Pointer, itemdata unsafe.Pointer, flags C.uint) C.int { pfunc := cgo.Handle(h) switch flags { case (4 << 8): // HTREE @@ -5752,7 +5754,7 @@ } //export go_int_callback_numeric -func go_int_callback_numeric(h unsafe.Pointer, window unsafe.Pointer, val C.int, data unsafe.Pointer, flags C.uint) C.int { +func go_int_callback_numeric(h unsafe.Pointer, window C.uintptr_t, val C.int, data unsafe.Pointer, flags C.uint) C.int { pfunc := cgo.Handle(h) switch flags { case (1 << 8): // HWND @@ -5898,7 +5900,7 @@ } //export go_int_callback_ulong -func go_int_callback_ulong(h unsafe.Pointer, window unsafe.Pointer, val C.ulong, data unsafe.Pointer, flags C.uint) C.int { +func go_int_callback_ulong(h unsafe.Pointer, window C.uintptr_t, val C.ulong, data unsafe.Pointer, flags C.uint) C.int { pfunc := cgo.Handle(h) switch flags { case (1 << 8): // HWND @@ -6044,7 +6046,7 @@ } //export go_int_callback_notepage -func go_int_callback_notepage(h unsafe.Pointer, window unsafe.Pointer, val C.ulong, data unsafe.Pointer, flags C.uint) C.int { +func go_int_callback_notepage(h unsafe.Pointer, window C.uintptr_t, val C.ulong, data unsafe.Pointer, flags C.uint) C.int { pfunc := cgo.Handle(h) switch flags { case (9 << 8): // HNOTEBOOK @@ -6062,7 +6064,7 @@ } //export go_int_callback_tree -func go_int_callback_tree(h unsafe.Pointer, window unsafe.Pointer, tree unsafe.Pointer, data unsafe.Pointer, flags C.uint) C.int { +func go_int_callback_tree(h unsafe.Pointer, window C.uintptr_t, tree C.uintptr_t, data unsafe.Pointer, flags C.uint) C.int { pfunc := cgo.Handle(h) switch flags { case (4 << 8): // HTREE @@ -6091,7 +6093,7 @@ } //export go_int_callback_print -func go_int_callback_print(h unsafe.Pointer, print unsafe.Pointer, pixmap unsafe.Pointer, page_num C.int, data unsafe.Pointer, flags C.uint) C.int { +func go_int_callback_print(h unsafe.Pointer, print C.uintptr_t, pixmap C.uintptr_t, page_num C.int, data unsafe.Pointer, flags C.uint) C.int { pfunc := cgo.Handle(h) if (flags & go_flags_no_data) == go_flags_no_data { thisfunc := pfunc.Value().(func(HPRINT, HPIXMAP, int) int)
--- a/dw/dwglue.c Sat Nov 06 07:14:50 2021 -0500 +++ b/dw/dwglue.c Sat Nov 06 22:14:59 2021 -0500 @@ -12,741 +12,741 @@ return dw_messagebox(title, flags, message); } -static void *go_window_new(void *owner, char *title, unsigned long flags) +static uintptr_t go_window_new(uintptr_t owner, char *title, unsigned long flags) { - return (void *)dw_window_new((HWND)owner, title, flags); + return (uintptr_t)dw_window_new((HWND)owner, title, flags); } -static int go_window_show(void *handle) +static int go_window_show(uintptr_t handle) { return dw_window_show((HWND)handle); } -static int go_window_hide(void *handle) +static int go_window_hide(uintptr_t handle) { return dw_window_hide((HWND)handle); } -static int go_window_lower(void *handle) +static int go_window_lower(uintptr_t handle) { return dw_window_lower((HWND)handle); } -static int go_window_raise(void *handle) +static int go_window_raise(uintptr_t handle) { return dw_window_raise((HWND)handle); } -static int go_window_minimize(void *handle) +static int go_window_minimize(uintptr_t handle) { return dw_window_minimize((HWND)handle); } -static void go_window_set_pos(void *handle, long x, long y) +static void go_window_set_pos(uintptr_t handle, long x, long y) { dw_window_set_pos((HWND)handle, x, y); } -static void go_window_set_pos_size(void *handle, long x, long y, unsigned long width, unsigned long height) +static void go_window_set_pos_size(uintptr_t handle, long x, long y, unsigned long width, unsigned long height) { dw_window_set_pos_size((HWND)handle, x, y, width, height); } -static void go_window_set_size(void *handle, unsigned long width, unsigned long height) +static void go_window_set_size(uintptr_t handle, unsigned long width, unsigned long height) { dw_window_set_size((HWND)handle, width, height); } -static int go_window_set_color(void *handle, unsigned long fore, unsigned long back) +static int go_window_set_color(uintptr_t handle, unsigned long fore, unsigned long back) { return dw_window_set_color((HWND)handle, fore, back); } -static void go_window_set_style(void *handle, unsigned long style, unsigned long mask) +static void go_window_set_style(uintptr_t handle, unsigned long style, unsigned long mask) { dw_window_set_style((HWND)handle, style, mask); } -static void go_window_click_default(void *window, void *next) +static void go_window_click_default(uintptr_t window, uintptr_t next) { dw_window_click_default((HWND)window, (HWND)next); } -static void go_window_default(void *window, void *defaultitem) +static void go_window_default(uintptr_t window, uintptr_t defaultitem) { dw_window_default((HWND)window, (HWND)defaultitem); } -static int go_window_destroy(void *handle) +static int go_window_destroy(uintptr_t handle) { return dw_window_destroy((HWND)handle); } -static void go_window_disable(void *handle) +static void go_window_disable(uintptr_t handle) { dw_window_disable((HWND)handle); } -static void go_window_enable(void *handle) +static void go_window_enable(uintptr_t handle) { dw_window_enable((HWND)handle); } -static void *go_window_from_id(void *handle, int id) +static uintptr_t go_window_from_id(uintptr_t handle, int id) { - return dw_window_from_id((HWND)handle, id); + return (uintptr_t)dw_window_from_id((HWND)handle, id); } -static void *go_window_get_data(void *handle, char *dataname) +static void *go_window_get_data(uintptr_t handle, char *dataname) { return dw_window_get_data((HWND)handle, dataname); } -static void go_window_set_data(void *handle, char *dataname, void *data) +static void go_window_set_data(uintptr_t handle, char *dataname, void *data) { dw_window_set_data((HWND)handle, dataname, data); } -static char *go_window_get_font(void *handle) +static char *go_window_get_font(uintptr_t handle) { return dw_window_get_font((HWND)handle); } -static int go_window_set_font(void *handle, char *fontname) +static int go_window_set_font(uintptr_t handle, char *fontname) { return dw_window_set_font((HWND)handle, fontname); } -static void go_window_get_pos_size(void *handle, long *x, long *y, unsigned long *width, unsigned long *height) +static void go_window_get_pos_size(uintptr_t handle, long *x, long *y, unsigned long *width, unsigned long *height) { dw_window_get_pos_size((HWND)handle, x, y, width, height); } -static void go_window_get_preferred_size(void *handle, int *width, int *height) +static void go_window_get_preferred_size(uintptr_t handle, int *width, int *height) { dw_window_get_preferred_size((HWND)handle, width, height); } -static char *go_window_get_text(void *handle) +static char *go_window_get_text(uintptr_t handle) { return dw_window_get_text((HWND)handle); } -static void go_window_set_text(void *handle, char *text) +static void go_window_set_text(uintptr_t handle, char *text) { dw_window_set_text((HWND)handle, text); } -static void go_window_set_tooltip(void *handle, char *bubbletext) +static void go_window_set_tooltip(uintptr_t handle, char *bubbletext) { dw_window_set_tooltip((HWND)handle, bubbletext); } -static void go_window_redraw(void *handle) +static void go_window_redraw(uintptr_t handle) { dw_window_redraw((HWND)handle); } -static void go_window_capture(void *handle) +static void go_window_capture(uintptr_t handle) { dw_window_capture((HWND)handle); } -static void go_window_set_bitmap(void *handle, unsigned long cid, char *filename) +static void go_window_set_bitmap(uintptr_t handle, unsigned long cid, char *filename) { dw_window_set_bitmap((HWND)handle, cid, filename); } -static int go_window_set_border(void *handle, int border) +static int go_window_set_border(uintptr_t handle, int border) { return dw_window_set_border((HWND)handle, border); } -static void go_window_set_focus(void *handle) +static void go_window_set_focus(uintptr_t handle) { dw_window_set_focus((HWND)handle); } -static void go_window_set_gravity(void *handle, int horz, int vert) +static void go_window_set_gravity(uintptr_t handle, int horz, int vert) { dw_window_set_gravity((HWND)handle, horz, vert); } -static void go_window_set_icon(void *handle, void *icon) +static void go_window_set_icon(uintptr_t handle, uintptr_t icon) { dw_window_set_icon((HWND)handle, (HICN)icon); } -static void go_window_set_pointer(void *handle, int cursortype) +static void go_window_set_pointer(uintptr_t handle, int cursortype) { dw_window_set_pointer((HWND)handle, cursortype); } -static void *go_box_new(int type, int pad) +static uintptr_t go_box_new(int type, int pad) { - return (void *)dw_box_new(type, pad); + return (uintptr_t)dw_box_new(type, pad); } -static void go_box_pack_at_index(void *box, void *item, int index, int width, int height, int hsize, int vsize, int pad) +static void go_box_pack_at_index(uintptr_t box, uintptr_t item, int index, int width, int height, int hsize, int vsize, int pad) { dw_box_pack_at_index((HWND)box, (HWND)item, index, width, height, hsize, vsize, pad); } -static void go_box_pack_end(void *box, void *item, int width, int height, int hsize, int vsize, int pad) +static void go_box_pack_end(uintptr_t box, uintptr_t item, int width, int height, int hsize, int vsize, int pad) { dw_box_pack_end((HWND)box, (HWND)item, width, height, hsize, vsize, pad); } -static void go_box_pack_start(void *box, void *item, int width, int height, int hsize, int vsize, int pad) +static void go_box_pack_start(uintptr_t box, uintptr_t item, int width, int height, int hsize, int vsize, int pad) { dw_box_pack_start((HWND)box, (HWND)item, width, height, hsize, vsize, pad); } -static int go_box_unpack(void *handle) +static int go_box_unpack(uintptr_t handle) { return dw_box_unpack((HWND)handle); } -static void *go_box_unpack_at_index(void *handle, int index) +static uintptr_t go_box_unpack_at_index(uintptr_t handle, int index) { - return (void *)dw_box_unpack_at_index((HWND)handle, index); + return (uintptr_t)dw_box_unpack_at_index((HWND)handle, index); } -static void *go_text_new(char *text, unsigned long id) +static uintptr_t go_text_new(char *text, unsigned long id) { - return (void *)dw_text_new(text, id); + return (uintptr_t)dw_text_new(text, id); } -static void *go_status_text_new(char *text, unsigned long id) +static uintptr_t go_status_text_new(char *text, unsigned long id) { - return (void *)dw_status_text_new(text, id); + return (uintptr_t)dw_status_text_new(text, id); } -static void *go_entryfield_new(char *text, unsigned long id) +static uintptr_t go_entryfield_new(char *text, unsigned long id) { - return (void *)dw_entryfield_new(text, id); + return (uintptr_t)dw_entryfield_new(text, id); } -static void *go_entryfield_password_new(char *text, unsigned long id) +static uintptr_t go_entryfield_password_new(char *text, unsigned long id) { - return (void *)dw_entryfield_password_new(text, id); + return (uintptr_t)dw_entryfield_password_new(text, id); } -static void go_entryfield_set_limit(void *handle, int limit) +static void go_entryfield_set_limit(uintptr_t handle, int limit) { dw_entryfield_set_limit((HWND)handle, limit); } -static void *go_button_new(char *text, unsigned long id) +static uintptr_t go_button_new(char *text, unsigned long id) { - return (void *)dw_button_new(text, id); + return (uintptr_t)dw_button_new(text, id); } -static void *go_menu_new(unsigned long cid) +static uintptr_t go_menu_new(unsigned long cid) { - return (void *)dw_menu_new(cid); + return (uintptr_t)dw_menu_new(cid); } -static void *go_menubar_new(void *location) +static uintptr_t go_menubar_new(uintptr_t location) { - return (void *)dw_menubar_new((HWND)location); + return (uintptr_t)dw_menubar_new((HWND)location); } -static void *go_menu_append_item(void *menu, char *title, unsigned long id, unsigned long flags, int end, int check, void *submenu) +static uintptr_t go_menu_append_item(uintptr_t menu, char *title, unsigned long id, unsigned long flags, int end, int check, uintptr_t submenu) { - return dw_menu_append_item((HMENUI)menu, title, id, flags, end, check, submenu); + return (uintptr_t)dw_menu_append_item((HMENUI)menu, title, id, flags, end, check, (HMENUI)submenu); } -static int go_menu_delete_item(void *menu, unsigned long cid) +static int go_menu_delete_item(uintptr_t menu, unsigned long cid) { return dw_menu_delete_item((HMENUI)menu, cid); } -static void go_menu_destroy(void *menu) +static void go_menu_destroy(uintptr_t menu) { HMENUI thismenu = (HMENUI)menu; dw_menu_destroy(&thismenu); } -static void go_menu_item_set_state(void *menu, unsigned long cid, unsigned long flags) +static void go_menu_item_set_state(uintptr_t menu, unsigned long cid, unsigned long flags) { dw_menu_item_set_state((HMENUI)menu, cid, flags); } -static void go_menu_popup(void *menu, void *parent, int x, int y) +static void go_menu_popup(uintptr_t menu, uintptr_t parent, int x, int y) { HMENUI thismenu = (HMENUI)menu; dw_menu_popup(&thismenu, (HWND)parent, x, y); } -static void *go_notebook_new(unsigned long cid, int top) +static uintptr_t go_notebook_new(unsigned long cid, int top) { - return (void *)dw_notebook_new(cid, top); + return (uintptr_t)dw_notebook_new(cid, top); } -static void go_notebook_pack(void *handle, unsigned long pageid, void *page) +static void go_notebook_pack(uintptr_t handle, unsigned long pageid, uintptr_t page) { dw_notebook_pack((HWND)handle, pageid, (HWND)page); } -static void go_notebook_page_destroy(void *handle, unsigned long pageid) +static void go_notebook_page_destroy(uintptr_t handle, unsigned long pageid) { dw_notebook_page_destroy((HWND)handle, (unsigned int)pageid); } -static unsigned long go_notebook_page_get(void *handle) +static unsigned long go_notebook_page_get(uintptr_t handle) { return dw_notebook_page_get((HWND)handle); } -static unsigned long go_notebook_page_new(void *handle, unsigned long flags, int front) +static unsigned long go_notebook_page_new(uintptr_t handle, unsigned long flags, int front) { return dw_notebook_page_new((HWND)handle, flags, front); } -static void go_notebook_page_set(void *handle, unsigned long pageid) +static void go_notebook_page_set(uintptr_t handle, unsigned long pageid) { dw_notebook_page_set((HWND)handle, (unsigned int)pageid); } -static void go_notebook_page_set_text(void *handle, unsigned long pageid, char *text) +static void go_notebook_page_set_text(uintptr_t handle, unsigned long pageid, char *text) { dw_notebook_page_set_text((HWND)handle, pageid, text); } -static void *go_icon_load_from_file(char *filename) +static uintptr_t go_icon_load_from_file(char *filename) { - return (void *)dw_icon_load_from_file(filename); + return (uintptr_t)dw_icon_load_from_file(filename); } -static void *go_icon_load(unsigned long module, unsigned long cid) +static uintptr_t go_icon_load(unsigned long module, unsigned long cid) { - return (void *)dw_icon_load(module, cid); + return (uintptr_t)dw_icon_load(module, cid); } -static void go_taskbar_delete(void *handle, void *icon) +static void go_taskbar_delete(uintptr_t handle, uintptr_t icon) { dw_taskbar_delete((HWND)handle, (HICN)icon); } -static void go_taskbar_insert(void *handle, void *icon, char *bubbletext) +static void go_taskbar_insert(uintptr_t handle, uintptr_t icon, char *bubbletext) { dw_taskbar_insert((HWND)handle, (HICN)icon, bubbletext); } -static void *go_combobox_new(char *text, unsigned long id) +static uintptr_t go_combobox_new(char *text, unsigned long id) { - return (void *)dw_combobox_new(text, id); + return (uintptr_t)dw_combobox_new(text, id); } -static void *go_listbox_new(unsigned long id, int multi) +static uintptr_t go_listbox_new(unsigned long id, int multi) { - return (void *)dw_listbox_new(id, multi); + return (uintptr_t)dw_listbox_new(id, multi); } -static void go_listbox_append(void *handle, char *text) +static void go_listbox_append(uintptr_t handle, char *text) { dw_listbox_append((HWND)handle, text); } -static void go_listbox_list_append(void *handle, char **text, int count) +static void go_listbox_list_append(uintptr_t handle, char **text, int count) { dw_listbox_list_append((HWND)handle, text, count); } -static void go_listbox_insert(void *handle, char *text, int pos) +static void go_listbox_insert(uintptr_t handle, char *text, int pos) { dw_listbox_insert((HWND)handle, text, pos); } -static void go_listbox_clear(void *handle) +static void go_listbox_clear(uintptr_t handle) { dw_listbox_clear((HWND)handle); } -static int go_listbox_count(void *handle) +static int go_listbox_count(uintptr_t handle) { return dw_listbox_count((HWND)handle); } -static void go_listbox_set_top(void *handle, int top) +static void go_listbox_set_top(uintptr_t handle, int top) { dw_listbox_set_top((HWND)handle, top); } -static void go_listbox_select(void *handle, int index, int state) +static void go_listbox_select(uintptr_t handle, int index, int state) { dw_listbox_select((HWND)handle, index, state); } -static void go_listbox_delete(void *handle, int index) +static void go_listbox_delete(uintptr_t handle, int index) { dw_listbox_delete((HWND)handle, index); } -static void go_listbox_get_text(void *handle, int index, char *text, int length) +static void go_listbox_get_text(uintptr_t handle, int index, char *text, int length) { dw_listbox_get_text((HWND)handle, index, text, length); } -static void go_listbox_set_text(void *handle, int index, char *text) +static void go_listbox_set_text(uintptr_t handle, int index, char *text) { dw_listbox_set_text((HWND)handle, index, text); } -static int go_listbox_selected(void *handle) +static int go_listbox_selected(uintptr_t handle) { return dw_listbox_selected((HWND)handle); } -static int go_listbox_selected_multi(void *handle, int where) +static int go_listbox_selected_multi(uintptr_t handle, int where) { return dw_listbox_selected_multi((HWND)handle, where); } -static void *go_spinbutton_new(char *text, unsigned long id) +static uintptr_t go_spinbutton_new(char *text, unsigned long id) { - return (void *)dw_spinbutton_new(text, id); + return (uintptr_t)dw_spinbutton_new(text, id); } -static void go_spinbutton_set_pos(void *handle, long position) +static void go_spinbutton_set_pos(uintptr_t handle, long position) { dw_spinbutton_set_pos((HWND)handle, position); } -static void go_spinbutton_set_limits(void *handle, long upper, long lower) +static void go_spinbutton_set_limits(uintptr_t handle, long upper, long lower) { dw_spinbutton_set_limits((HWND)handle, upper, lower); } -static long go_spinbutton_get_pos(void *handle) +static long go_spinbutton_get_pos(uintptr_t handle) { return dw_spinbutton_get_pos((HWND)handle); } -static void *go_radiobutton_new(char *text, unsigned long id) +static uintptr_t go_radiobutton_new(char *text, unsigned long id) { - return (void *)dw_radiobutton_new(text, id); + return (uintptr_t)dw_radiobutton_new(text, id); } -static void *go_checkbox_new(char *text, unsigned long id) +static uintptr_t go_checkbox_new(char *text, unsigned long id) { - return (void *)dw_checkbox_new(text, id); + return (uintptr_t)dw_checkbox_new(text, id); } -static int go_checkbox_get(void *handle) +static int go_checkbox_get(uintptr_t handle) { return dw_checkbox_get((HWND)handle); } -static void go_checkbox_set(void *handle, int value) +static void go_checkbox_set(uintptr_t handle, int value) { return dw_checkbox_set((HWND)handle, value); } -static void *go_percent_new(unsigned long id) +static uintptr_t go_percent_new(unsigned long id) { - return (void *)dw_percent_new(id); + return (uintptr_t)dw_percent_new(id); } -static void go_percent_set_pos(void *handle, unsigned int position) +static void go_percent_set_pos(uintptr_t handle, unsigned int position) { dw_percent_set_pos((HWND)handle, position); } -static void *go_slider_new(int vertical, int increments, unsigned long id) +static uintptr_t go_slider_new(int vertical, int increments, unsigned long id) { - return (void *)dw_slider_new(vertical, increments, id); + return (uintptr_t)dw_slider_new(vertical, increments, id); } -static unsigned int go_slider_get_pos(void *handle) +static unsigned int go_slider_get_pos(uintptr_t handle) { return dw_slider_get_pos((HWND)handle); } -static void go_slider_set_pos(void *handle, unsigned int pos) +static void go_slider_set_pos(uintptr_t handle, unsigned int pos) { dw_slider_set_pos((HWND)handle, pos); } -static void *go_scrollbar_new(int vertical, unsigned long id) +static uintptr_t go_scrollbar_new(int vertical, unsigned long id) { - return (void *)dw_scrollbar_new(vertical, id); + return (uintptr_t)dw_scrollbar_new(vertical, id); } -static unsigned int go_scrollbar_get_pos(void *handle) +static unsigned int go_scrollbar_get_pos(uintptr_t handle) { return dw_scrollbar_get_pos((HWND)handle); } -static void go_scrollbar_set_pos(void *handle, unsigned int pos) +static void go_scrollbar_set_pos(uintptr_t handle, unsigned int pos) { dw_scrollbar_set_pos((HWND)handle, pos); } -static void go_scrollbar_set_range(void *handle, unsigned int range, unsigned int visible) +static void go_scrollbar_set_range(uintptr_t handle, unsigned int range, unsigned int visible) { dw_scrollbar_set_range((HWND)handle, range, visible); } -static void *go_scrollbox_new(int type, int pad) +static uintptr_t go_scrollbox_new(int type, int pad) { - return (void *)dw_scrollbox_new(type, pad); + return (uintptr_t)dw_scrollbox_new(type, pad); } -static int go_scrollbox_get_pos(void *handle, int orient) +static int go_scrollbox_get_pos(uintptr_t handle, int orient) { return dw_scrollbox_get_pos((HWND)handle, orient); } -static int go_scrollbox_get_range(void *handle, int orient) +static int go_scrollbox_get_range(uintptr_t handle, int orient) { return dw_scrollbox_get_range((HWND)handle, orient); } -static void *go_groupbox_new(int type, int pad, char *title) +static uintptr_t go_groupbox_new(int type, int pad, char *title) { - return (void *)dw_groupbox_new(type, pad, title); + return (uintptr_t)dw_groupbox_new(type, pad, title); } -static void *go_render_new(unsigned long id) +static uintptr_t go_render_new(unsigned long id) { - return (void *)dw_render_new(id); + return (uintptr_t)dw_render_new(id); } -static void go_font_text_extents_get(void *handle, void *pixmap, char *text, int *width, int *height) +static void go_font_text_extents_get(uintptr_t handle, uintptr_t pixmap, char *text, int *width, int *height) { dw_font_text_extents_get((HWND)handle, (HPIXMAP)pixmap, text, width, height); } -static void *go_pixmap_new(void *handle, unsigned long width, unsigned long height, unsigned long depth) +static uintptr_t go_pixmap_new(uintptr_t handle, unsigned long width, unsigned long height, unsigned long depth) { - return (void *)dw_pixmap_new((HWND)handle, width, height, (int)depth); + return (uintptr_t)dw_pixmap_new((HWND)handle, width, height, (int)depth); } -static void *go_pixmap_new_from_file(void *handle, char *filename) +static uintptr_t go_pixmap_new_from_file(uintptr_t handle, char *filename) { - return (void *)dw_pixmap_new_from_file((HWND)handle, filename); + return (uintptr_t)dw_pixmap_new_from_file((HWND)handle, filename); } -static void *go_pixmap_grab(void *handle, unsigned long cid) +static uintptr_t go_pixmap_grab(uintptr_t handle, unsigned long cid) { - return (void *)dw_pixmap_grab((HWND)handle, cid); + return (uintptr_t)dw_pixmap_grab((HWND)handle, cid); } -static void go_pixmap_bitblt(void *dest, void *destp, int xdest, int ydest, int width, int height, void *src, void *srcp, int xsrc, int ysrc) +static void go_pixmap_bitblt(uintptr_t dest, uintptr_t destp, int xdest, int ydest, int width, int height, uintptr_t src, uintptr_t srcp, int xsrc, int ysrc) { dw_pixmap_bitblt((HWND)dest, (HPIXMAP)destp, xdest, ydest, width, height, (HWND)src, (HPIXMAP)srcp, xsrc, ysrc); } -static int go_pixmap_stretch_bitblt(void *dest, void *destp, int xdest, int ydest, int width, int height, void *src, void *srcp, int xsrc, int ysrc, int srcwidth, int srcheight) +static int go_pixmap_stretch_bitblt(uintptr_t dest, uintptr_t destp, int xdest, int ydest, int width, int height, uintptr_t src, uintptr_t srcp, int xsrc, int ysrc, int srcwidth, int srcheight) { return dw_pixmap_stretch_bitblt((HWND)dest, (HPIXMAP)destp, xdest, ydest, width, height, (HWND)src, (HPIXMAP)srcp, xsrc, ysrc, srcwidth, srcheight); } -static void go_pixmap_set_transparent_color(void *pixmap, unsigned long color) +static void go_pixmap_set_transparent_color(uintptr_t pixmap, unsigned long color) { dw_pixmap_set_transparent_color((HPIXMAP)pixmap, color); } -static int go_pixmap_set_font(void *pixmap, char *fontname) +static int go_pixmap_set_font(uintptr_t pixmap, char *fontname) { return dw_pixmap_set_font((HPIXMAP)pixmap, fontname); } -static void go_pixmap_destroy(void *pixmap) +static void go_pixmap_destroy(uintptr_t pixmap) { dw_pixmap_destroy((HPIXMAP)pixmap); } -static int go_pixmap_width(void *pixmap) +static int go_pixmap_width(uintptr_t pixmap) { return (int)DW_PIXMAP_WIDTH(((HPIXMAP)pixmap)); } -static int go_pixmap_height(void *pixmap) +static int go_pixmap_height(uintptr_t pixmap) { return (int)DW_PIXMAP_HEIGHT(((HPIXMAP)pixmap)); } -static void go_draw_point(void *handle, void *pixmap, int x, int y) +static void go_draw_point(uintptr_t handle, uintptr_t pixmap, int x, int y) { dw_draw_point((HWND)handle, (HPIXMAP)pixmap, x, y); } -static void go_draw_line(void *handle, void *pixmap, int x1, int y1, int x2, int y2) +static void go_draw_line(uintptr_t handle, uintptr_t pixmap, int x1, int y1, int x2, int y2) { dw_draw_line((HWND)handle, (HPIXMAP)pixmap, x1, y1, x2, y2); } -static void go_draw_polygon(void *handle, void *pixmap, int fill, int count, int x[], int y[]) +static void go_draw_polygon(uintptr_t handle, uintptr_t pixmap, int fill, int count, int x[], int y[]) { dw_draw_polygon((HWND)handle, (HPIXMAP)pixmap, fill, count, x, y); } -static void go_draw_rect(void *handle, void *pixmap, int fill, int x, int y, int width, int height) +static void go_draw_rect(uintptr_t handle, uintptr_t pixmap, int fill, int x, int y, int width, int height) { dw_draw_rect((HWND)handle, (HPIXMAP)pixmap, fill, x, y, width, height); } -static void go_draw_arc(void *handle, void *pixmap, int flags, int xorigin, int yorigin, int x1, int y1, int x2, int y2) +static void go_draw_arc(uintptr_t handle, uintptr_t pixmap, int flags, int xorigin, int yorigin, int x1, int y1, int x2, int y2) { dw_draw_arc((HWND)handle, (HPIXMAP)pixmap, flags, xorigin, yorigin, x1, y1, x2, y2); } -static void go_draw_text(void *handle, void *pixmap, int x, int y, char *text) +static void go_draw_text(uintptr_t handle, uintptr_t pixmap, int x, int y, char *text) { dw_draw_text((HWND)handle, (HPIXMAP)pixmap, x, y, text); } -static void *go_tree_new(unsigned long id) +static uintptr_t go_tree_new(unsigned long id) { - return (void *)dw_tree_new(id); + return (uintptr_t)dw_tree_new(id); } -static void *go_tree_insert(void *handle, char *title, void *icon, void *parent, void *itemdata) +static uintptr_t go_tree_insert(uintptr_t handle, char *title, uintptr_t icon, uintptr_t parent, void *itemdata) { - return (void *)dw_tree_insert((HWND)handle, title, (HICN)icon, (HTREEITEM)parent, itemdata); + return (uintptr_t)dw_tree_insert((HWND)handle, title, (HICN)icon, (HTREEITEM)parent, itemdata); } -static void *go_tree_insert_after(void *handle, void *item, char *title, void *icon, void *parent, void *itemdata) +static uintptr_t go_tree_insert_after(uintptr_t handle, uintptr_t item, char *title, uintptr_t icon, uintptr_t parent, void *itemdata) { - return (void *)dw_tree_insert_after((HWND)handle, (HTREEITEM)item, title, (HICN)icon, (HTREEITEM)parent, itemdata); + return (uintptr_t)dw_tree_insert_after((HWND)handle, (HTREEITEM)item, title, (HICN)icon, (HTREEITEM)parent, itemdata); } -static void go_tree_clear(void *handle) +static void go_tree_clear(uintptr_t handle) { dw_tree_clear((HWND)handle); } -static void go_tree_item_delete(void *handle, void *item) +static void go_tree_item_delete(uintptr_t handle, uintptr_t item) { dw_tree_item_delete((HWND)handle, (HTREEITEM)item); } -static void go_tree_item_change(void *handle, void *item, char *title, void *icon) +static void go_tree_item_change(uintptr_t handle, uintptr_t item, char *title, uintptr_t icon) { dw_tree_item_change((HWND)handle, (HTREEITEM)item, title, (HICN)icon); } -static void go_tree_item_expand(void *handle, void *item) +static void go_tree_item_expand(uintptr_t handle, uintptr_t item) { dw_tree_item_expand((HWND)handle, (HTREEITEM)item); } -static void go_tree_item_collapse(void *handle, void *item) +static void go_tree_item_collapse(uintptr_t handle, uintptr_t item) { dw_tree_item_collapse((HWND)handle, (HTREEITEM)item); } -static void go_tree_item_select(void *handle, void *item) +static void go_tree_item_select(uintptr_t handle, uintptr_t item) { dw_tree_item_select((HWND)handle, (HTREEITEM)item); } -static void go_tree_item_set_data(void *handle, void *item, void *itemdata) +static void go_tree_item_set_data(uintptr_t handle, uintptr_t item, void *itemdata) { dw_tree_item_set_data((HWND)handle, (HTREEITEM)item, itemdata); } -static void *go_tree_item_get_data(void *handle, void *item) +static void *go_tree_item_get_data(uintptr_t handle, uintptr_t item) { return dw_tree_item_get_data((HWND)handle, (HTREEITEM)item); } -static char *go_tree_get_title(void *handle, void *item) +static char *go_tree_get_title(uintptr_t handle, uintptr_t item) { return dw_tree_get_title((HWND)handle, (HTREEITEM)item); } -static void *go_html_new(unsigned long id) +static uintptr_t go_html_new(unsigned long id) { - return (void *)dw_html_new(id); + return (uintptr_t)dw_html_new(id); } -static void go_html_action(void *hwnd, int action) +static void go_html_action(uintptr_t hwnd, int action) { dw_html_action((HWND)hwnd, action); } -static int go_html_raw(void *hwnd, char *string) +static int go_html_raw(uintptr_t hwnd, char *string) { return dw_html_raw((HWND)hwnd, string); } -static int go_html_url(void *hwnd, char *url) +static int go_html_url(uintptr_t hwnd, char *url) { return dw_html_url((HWND)hwnd, url); } -static void *go_mle_new(unsigned long id) +static uintptr_t go_mle_new(unsigned long id) { - return (void *)dw_mle_new(id); + return (uintptr_t)dw_mle_new(id); } -static unsigned int go_mle_import(void *handle, char *buffer, int startpoint) +static unsigned int go_mle_import(uintptr_t handle, char *buffer, int startpoint) { return dw_mle_import((HWND)handle, buffer, startpoint); } -static void go_mle_export(void *handle, char *buffer, int startpoint, int length) +static void go_mle_export(uintptr_t handle, char *buffer, int startpoint, int length) { dw_mle_export((HWND)handle, buffer, startpoint, length); } -static void go_mle_get_size(void *handle, unsigned long *bytes, unsigned long *lines) +static void go_mle_get_size(uintptr_t handle, unsigned long *bytes, unsigned long *lines) { dw_mle_get_size((HWND)handle, bytes, lines); } -static void go_mle_delete(void *handle, int startpoint, int length) +static void go_mle_delete(uintptr_t handle, int startpoint, int length) { dw_mle_delete((HWND)handle, startpoint, length); } -static void go_mle_clear(void *handle) +static void go_mle_clear(uintptr_t handle) { dw_mle_clear((HWND)handle); } -static void go_mle_freeze(void *handle) +static void go_mle_freeze(uintptr_t handle) { dw_mle_freeze((HWND)handle); } -static void go_mle_thaw(void *handle) +static void go_mle_thaw(uintptr_t handle) { dw_mle_thaw((HWND)handle); } -static void go_mle_set_cursor(void *handle, int point) +static void go_mle_set_cursor(uintptr_t handle, int point) { dw_mle_set_cursor((HWND)handle, point); } -static void go_mle_set_visible(void *handle, int line) +static void go_mle_set_visible(uintptr_t handle, int line) { dw_mle_set_visible((HWND)handle, line); } -static void go_mle_set_editable(void *handle, int state) +static void go_mle_set_editable(uintptr_t handle, int state) { dw_mle_set_editable((HWND)handle, state); } -static void go_mle_set_word_wrap(void *handle, int state) +static void go_mle_set_word_wrap(uintptr_t handle, int state) { dw_mle_set_word_wrap((HWND)handle, state); } -static int go_mle_search(void *handle, char *text, int point, unsigned long flags) +static int go_mle_search(uintptr_t handle, char *text, int point, unsigned long flags) { return dw_mle_search((HWND)handle, text, point, flags); } -static void *go_container_new(unsigned long id, int multi) +static uintptr_t go_container_new(unsigned long id, int multi) { - return (void *)dw_container_new(id, multi); + return (uintptr_t)dw_container_new(id, multi); } static char **go_string_array_make(int size) @@ -768,34 +768,34 @@ free(a); } -static int go_container_setup(void *handle, unsigned long *flags, char **titles, int count, int separator) +static int go_container_setup(uintptr_t handle, unsigned long *flags, char **titles, int count, int separator) { return dw_container_setup((HWND)handle, flags, titles, count, separator); } -static void * go_container_alloc(void *handle, int rowcount) +static uintptr_t go_container_alloc(uintptr_t handle, int rowcount) { - return dw_container_alloc((HWND)handle, rowcount); + return (uintptr_t)dw_container_alloc((HWND)handle, rowcount); } -static void go_container_set_item(void *handle, void *pointer, int column, int row, void *data) +static void go_container_set_item(uintptr_t handle, uintptr_t pointer, int column, int row, void *data) { - dw_container_set_item((HWND)handle, pointer, column, row, data); + dw_container_set_item((HWND)handle, (void *)pointer, column, row, data); } -static void go_container_set_item_ulong(void *handle, void *pointer, int column, int row, unsigned long val) +static void go_container_set_item_ulong(uintptr_t handle, uintptr_t pointer, int column, int row, unsigned long val) { if(dw_container_get_column_type((HWND)handle, column) == DW_CFA_ULONG) - dw_container_set_item((HWND)handle, pointer, column, row, &val); + dw_container_set_item((HWND)handle, (void *)pointer, column, row, &val); } -static void go_container_set_item_icon(void *handle, void *pointer, int column, int row, void *icon) +static void go_container_set_item_icon(uintptr_t handle, uintptr_t pointer, int column, int row, uintptr_t icon) { if(dw_container_get_column_type((HWND)handle, column) == DW_CFA_BITMAPORICON) - dw_container_set_item((HWND)handle, pointer, column, row, &icon); + dw_container_set_item((HWND)handle, (void *)pointer, column, row, &icon); } -static void go_container_set_item_time(void *handle, void *pointer, int column, int row, int seconds, int minutes, int hours) +static void go_container_set_item_time(uintptr_t handle, uintptr_t pointer, int column, int row, int seconds, int minutes, int hours) { CTIME time; @@ -804,10 +804,10 @@ time.hours = hours; if(dw_container_get_column_type((HWND)handle, column) == DW_CFA_TIME) - dw_container_set_item((HWND)handle, pointer, column, row, &time); + dw_container_set_item((HWND)handle, (void *)pointer, column, row, &time); } -static void go_container_set_item_date(void *handle, void *pointer, int column, int row, int day, int month, int year) +static void go_container_set_item_date(uintptr_t handle, uintptr_t pointer, int column, int row, int day, int month, int year) { CDATE date; @@ -816,27 +816,27 @@ date.year = year; if(dw_container_get_column_type((HWND)handle, column) == DW_CFA_DATE) - dw_container_set_item((HWND)handle, pointer, column, row, &date); + dw_container_set_item((HWND)handle, (void *)pointer, column, row, &date); } -static void go_container_change_item(void *handle, int column, int row, void *data) +static void go_container_change_item(uintptr_t handle, int column, int row, void *data) { dw_container_change_item((HWND)handle, column, row, data); } -static void go_container_change_item_ulong(void *handle, int column, int row, unsigned long val) +static void go_container_change_item_ulong(uintptr_t handle, int column, int row, unsigned long val) { if(dw_container_get_column_type((HWND)handle, column) == DW_CFA_ULONG) dw_container_change_item((HWND)handle, column, row, &val); } -static void go_container_change_item_icon(void *handle, int column, int row, void *icon) +static void go_container_change_item_icon(uintptr_t handle, int column, int row, uintptr_t icon) { if(dw_container_get_column_type((HWND)handle, column) == DW_CFA_BITMAPORICON) dw_container_change_item((HWND)handle, column, row, &icon); } -static void go_container_change_item_time(void *handle, int column, int row, int seconds, int minutes, int hours) +static void go_container_change_item_time(uintptr_t handle, int column, int row, int seconds, int minutes, int hours) { CTIME time; @@ -848,7 +848,7 @@ dw_container_change_item((HWND)handle, column, row, &time); } -static void go_container_change_item_date(void *handle, int column, int row, int day, int month, int year) +static void go_container_change_item_date(uintptr_t handle, int column, int row, int day, int month, int year) { CDATE date; @@ -860,109 +860,119 @@ dw_container_change_item((HWND)handle, column, row, &date); } -static void go_container_set_column_width(void *handle, int column, int width) +static void go_container_set_column_width(uintptr_t handle, int column, int width) { dw_container_set_column_width((HWND)handle, column, width); } -static void go_container_change_row_title(void *handle, int row, char *title) +static void go_container_change_row_title(uintptr_t handle, int row, char *title) { dw_container_change_row_title((HWND)handle, row, title); } -static void go_container_change_row_data(void *handle, int row, void *data) +static void go_container_change_row_data(uintptr_t handle, int row, void *data) { dw_container_change_row_title((HWND)handle, row, (char *)data); } -static void go_container_insert(void *handle, void *pointer, int rowcount) +static void go_container_set_row_title(uintptr_t pointer, int row, char *title) { - dw_container_insert((HWND)handle, pointer, rowcount); + dw_container_set_row_title((void *)pointer, row, title); } -static void go_container_clear(void *handle, int redraw) +static void go_container_set_row_data(uintptr_t pointer, int row, void *data) +{ + dw_container_set_row_title((void *)pointer, row, (char *)data); +} + +static void go_container_insert(uintptr_t handle, uintptr_t pointer, int rowcount) +{ + dw_container_insert((HWND)handle, (void *)pointer, rowcount); +} + +static void go_container_clear(uintptr_t handle, int redraw) { dw_container_clear((HWND)handle, redraw); } -static void go_container_delete(void *handle, int rowcount) +static void go_container_delete(uintptr_t handle, int rowcount) { dw_container_delete((HWND)handle, rowcount); } -static char *go_container_query_start(void *handle, unsigned long flags) +static char *go_container_query_start(uintptr_t handle, unsigned long flags) { return dw_container_query_start((HWND)handle, flags); } -static char *go_container_query_next(void *handle, unsigned long flags) +static char *go_container_query_next(uintptr_t handle, unsigned long flags) { return dw_container_query_next((HWND)handle, flags); } -static void go_container_scroll(void *handle, int direction, long rows) +static void go_container_scroll(uintptr_t handle, int direction, long rows) { dw_container_scroll((HWND)handle, direction, rows); } -static void go_container_cursor(void *handle, char *text) +static void go_container_cursor(uintptr_t handle, char *text) { dw_container_cursor((HWND)handle, text); } -static void go_container_cursor_by_data(void *handle, void *data) +static void go_container_cursor_by_data(uintptr_t handle, void *data) { dw_container_cursor_by_data((HWND)handle, data); } -static void go_container_delete_row(void *handle, char *text) +static void go_container_delete_row(uintptr_t handle, char *text) { dw_container_delete_row((HWND)handle, text); } -static void go_container_delete_row_by_data(void *handle, void *data) +static void go_container_delete_row_by_data(uintptr_t handle, void *data) { dw_container_delete_row_by_data((HWND)handle, data); } -static void go_container_optimize(void *handle) +static void go_container_optimize(uintptr_t handle) { dw_container_optimize((HWND)handle); } -static void go_container_set_stripe(void *handle, unsigned long oddcolor, unsigned long evencolor) +static void go_container_set_stripe(uintptr_t handle, unsigned long oddcolor, unsigned long evencolor) { dw_container_set_stripe((HWND)handle, oddcolor, evencolor); } -static void go_filesystem_set_column_title(void *handle, char *title) +static void go_filesystem_set_column_title(uintptr_t handle, char *title) { dw_filesystem_set_column_title((HWND)handle, title); } -static int go_filesystem_setup(void *handle, unsigned long *flags, char **titles, int count) +static int go_filesystem_setup(uintptr_t handle, unsigned long *flags, char **titles, int count) { return dw_filesystem_setup((HWND)handle, flags, titles, count); } -static void go_filesystem_set_item(void *handle, void *pointer, int column, int row, void *data) +static void go_filesystem_set_item(uintptr_t handle, uintptr_t pointer, int column, int row, void *data) { - dw_filesystem_set_item((HWND)handle, pointer, column, row, data); + dw_filesystem_set_item((HWND)handle, (void *)pointer, column, row, data); } -static void go_filesystem_set_item_ulong(void *handle, void *pointer, int column, int row, unsigned long val) +static void go_filesystem_set_item_ulong(uintptr_t handle, uintptr_t pointer, int column, int row, unsigned long val) { if(dw_filesystem_get_column_type((HWND)handle, column) == DW_CFA_ULONG) - dw_filesystem_set_item((HWND)handle, pointer, column, row, &val); + dw_filesystem_set_item((HWND)handle, (void *)pointer, column, row, &val); } -static void go_filesystem_set_item_icon(void *handle, void *pointer, int column, int row, void *icon) +static void go_filesystem_set_item_icon(uintptr_t handle, uintptr_t pointer, int column, int row, uintptr_t icon) { if(dw_filesystem_get_column_type((HWND)handle, column) == DW_CFA_BITMAPORICON) - dw_filesystem_set_item((HWND)handle, pointer, column, row, &icon); + dw_filesystem_set_item((HWND)handle, (void *)pointer, column, row, &icon); } -static void go_filesystem_set_item_time(void *handle, void *pointer, int column, int row, int seconds, int minutes, int hours) +static void go_filesystem_set_item_time(uintptr_t handle, uintptr_t pointer, int column, int row, int seconds, int minutes, int hours) { CTIME time; @@ -971,10 +981,10 @@ time.hours = hours; if(dw_filesystem_get_column_type((HWND)handle, column) == DW_CFA_TIME) - dw_filesystem_set_item((HWND)handle, pointer, column, row, &time); + dw_filesystem_set_item((HWND)handle, (void *)pointer, column, row, &time); } -static void go_filesystem_set_item_date(void *handle, void *pointer, int column, int row, int day, int month, int year) +static void go_filesystem_set_item_date(uintptr_t handle, uintptr_t pointer, int column, int row, int day, int month, int year) { CDATE date; @@ -983,32 +993,32 @@ date.year = year; if(dw_filesystem_get_column_type((HWND)handle, column) == DW_CFA_DATE) - dw_filesystem_set_item((HWND)handle, pointer, column, row, &date); + dw_filesystem_set_item((HWND)handle, (void *)pointer, column, row, &date); } -static void go_filesystem_set_file(void *handle, void *pointer, int row, char *filename, void *icon) +static void go_filesystem_set_file(uintptr_t handle, uintptr_t pointer, int row, char *filename, uintptr_t icon) { - dw_filesystem_set_file((HWND)handle, pointer, row, filename, (HICN)icon); + dw_filesystem_set_file((HWND)handle, (void *)pointer, row, filename, (HICN)icon); } -static void go_filesystem_change_item(void *handle, int column, int row, void *data) +static void go_filesystem_change_item(uintptr_t handle, int column, int row, void *data) { dw_filesystem_change_item((HWND)handle, column, row, data); } -static void go_filesystem_change_item_ulong(void *handle, int column, int row, unsigned long val) +static void go_filesystem_change_item_ulong(uintptr_t handle, int column, int row, unsigned long val) { if(dw_filesystem_get_column_type((HWND)handle, column) == DW_CFA_ULONG) dw_filesystem_change_item((HWND)handle, column, row, &val); } -static void go_filesystem_change_item_icon(void *handle, int column, int row, void *icon) +static void go_filesystem_change_item_icon(uintptr_t handle, int column, int row, uintptr_t icon) { if(dw_filesystem_get_column_type((HWND)handle, column) == DW_CFA_BITMAPORICON) dw_filesystem_change_item((HWND)handle, column, row, &icon); } -static void go_filesystem_change_item_time(void *handle, int column, int row, int seconds, int minutes, int hours) +static void go_filesystem_change_item_time(uintptr_t handle, int column, int row, int seconds, int minutes, int hours) { CTIME time; @@ -1020,7 +1030,7 @@ dw_filesystem_change_item((HWND)handle, column, row, &time); } -static void go_filesystem_change_item_date(void *handle, int column, int row, int day, int month, int year) +static void go_filesystem_change_item_date(uintptr_t handle, int column, int row, int day, int month, int year) { CDATE date; @@ -1032,155 +1042,155 @@ dw_filesystem_change_item((HWND)handle, column, row, &date); } -static void go_filesystem_change_file(void *handle, int row, char *filename, void *icon) +static void go_filesystem_change_file(uintptr_t handle, int row, char *filename, uintptr_t icon) { dw_filesystem_change_file((HWND)handle, row, filename, (HICN)icon); } -static int go_container_get_column_type(void *handle, int column) +static int go_container_get_column_type(uintptr_t handle, int column) { return dw_container_get_column_type((HWND)handle, column); } -static int go_filesystem_get_column_type(void *handle, int column) +static int go_filesystem_get_column_type(uintptr_t handle, int column) { return dw_filesystem_get_column_type((HWND)handle, column); } -static void *go_calendar_new(unsigned long id) +static uintptr_t go_calendar_new(unsigned long id) { - return (void *)dw_calendar_new(id); + return (uintptr_t)dw_calendar_new(id); } -static void go_calendar_set_date(void *handle, unsigned int year, unsigned int month, unsigned int day) +static void go_calendar_set_date(uintptr_t handle, unsigned int year, unsigned int month, unsigned int day) { dw_calendar_set_date((HWND)handle, year, month, day); } -static void go_calendar_get_date(void *handle, unsigned int *year, unsigned int *month, unsigned int *day) +static void go_calendar_get_date(uintptr_t handle, unsigned int *year, unsigned int *month, unsigned int *day) { dw_calendar_get_date((HWND)handle, year, month, day); } -static void *go_bitmap_new(unsigned long id) +static uintptr_t go_bitmap_new(unsigned long id) { - return (void *)dw_bitmap_new(id); + return (uintptr_t)dw_bitmap_new(id); } -static void *go_bitmapbutton_new(char *text, unsigned long id) +static uintptr_t go_bitmapbutton_new(char *text, unsigned long id) { - return (void *)dw_bitmapbutton_new(text, id); + return (uintptr_t)dw_bitmapbutton_new(text, id); } -static void *go_bitmapbutton_new_from_file(char *text, unsigned long id, char *filename) +static uintptr_t go_bitmapbutton_new_from_file(char *text, unsigned long id, char *filename) { - return (void *)dw_bitmapbutton_new_from_file(text, id, filename); + return (uintptr_t)dw_bitmapbutton_new_from_file(text, id, filename); } -static void *go_splitbar_new(int type, void *topleft, void *bottomright, unsigned long cid) +static uintptr_t go_splitbar_new(int type, uintptr_t topleft, uintptr_t bottomright, unsigned long cid) { - return (void *)dw_splitbar_new(type, (HWND)topleft, (HWND)bottomright, cid); + return (uintptr_t)dw_splitbar_new(type, (HWND)topleft, (HWND)bottomright, cid); } -static void go_splitbar_set(void *handle, float position) +static void go_splitbar_set(uintptr_t handle, float position) { dw_splitbar_set((HWND)handle, position); } -static float go_splitbar_get(void *handle) +static float go_splitbar_get(uintptr_t handle) { return dw_splitbar_get((HWND)handle); } -static int go_print_run(void *print, unsigned long flags) +static int go_print_run(uintptr_t print, unsigned long flags) { return dw_print_run((HPRINT)print, flags); } -static void go_print_cancel(void *print) +static void go_print_cancel(uintptr_t print) { return dw_print_cancel((HPRINT)print); } -static void *go_mutex_new(void) +static uintptr_t go_mutex_new(void) { - return (void *)dw_mutex_new(); + return (uintptr_t)dw_mutex_new(); } -static void go_mutex_close(void *mutex) +static void go_mutex_close(uintptr_t mutex) { dw_mutex_close((HMTX)mutex); } -static void go_mutex_lock(void *mutex) +static void go_mutex_lock(uintptr_t mutex) { dw_mutex_lock((HMTX)mutex); } -static void go_mutex_unlock(void *mutex) +static void go_mutex_unlock(uintptr_t mutex) { dw_mutex_unlock((HMTX)mutex); } -static int go_mutex_trylock(void *mutex) +static int go_mutex_trylock(uintptr_t mutex) { return dw_mutex_trylock((HMTX)mutex); } -static void *go_dialog_new(void) +static uintptr_t go_dialog_new(void) { - return (void *)dw_dialog_new(NULL); + return (uintptr_t)dw_dialog_new(NULL); } -static int go_dialog_dismiss(void *dialog, void *result) +static int go_dialog_dismiss(uintptr_t dialog, void *result) { return dw_dialog_dismiss((DWDialog *)dialog, result); } -static void *go_dialog_wait(void *dialog) +static void *go_dialog_wait(uintptr_t dialog) { - return (void *)dw_dialog_wait((DWDialog *)dialog); + return dw_dialog_wait((DWDialog *)dialog); } -static void *go_event_new(void) +static uintptr_t go_event_new(void) { - return (void *)dw_event_new(); + return (uintptr_t)dw_event_new(); } -static int go_event_close(void *event) +static int go_event_close(uintptr_t event) { HEV thisevent = (HEV)event; return dw_event_close(&thisevent); } -static int go_event_post(void *event) +static int go_event_post(uintptr_t event) { return dw_event_post((HEV)event); } -static int go_event_reset(void *event) +static int go_event_reset(uintptr_t event) { return dw_event_reset((HEV)event); } -static int go_event_wait(void *event, unsigned long timeout) +static int go_event_wait(uintptr_t event, unsigned long timeout) { return dw_event_wait((HEV)event, timeout); } -extern int go_int_callback_basic(void *pfunc, void* window, void *data, unsigned int flags); -extern int go_int_callback_configure(void *pfunc, void* window, int width, int height, void *data, unsigned int flags); -extern int go_int_callback_keypress(void *pfunc, void *window, char ch, int vk, int state, void *data, char *utf8, unsigned int flags); -extern int go_int_callback_mouse(void *pfunc, void* window, int x, int y, int mask, void *data, unsigned int flags); -extern int go_int_callback_expose(void *pfunc, void* window, int x, int y, int width, int height, void *data, unsigned int flags); -extern int go_int_callback_item_enter(void *pfunc, void *window, char *text, void *data, void *itemdata, unsigned int flags); -extern int go_int_callback_item_context(void *pfunc, void *window, char *text, int x, int y, void *data, void *itemdata, unsigned int flags); -extern int go_int_callback_item_select(void *pfunc, void *window, void *item, char *text, void *data, void *itemdata, unsigned int flags); -extern int go_int_callback_numeric(void *pfunc, void* window, int val, void *data, unsigned int flags); -extern int go_int_callback_ulong(void *pfunc, void* window, unsigned long val, void *data, unsigned int flags); -extern int go_int_callback_notepage(void *pfunc, void* window, unsigned long val, void *data, unsigned int flags); -extern int go_int_callback_tree(void *pfunc, void* window, void *item, void *data, unsigned int flags); +extern int go_int_callback_basic(void *pfunc, uintptr_t window, void *data, unsigned int flags); +extern int go_int_callback_configure(void *pfunc, uintptr_t window, int width, int height, void *data, unsigned int flags); +extern int go_int_callback_keypress(void *pfunc, uintptr_t window, char ch, int vk, int state, void *data, char *utf8, unsigned int flags); +extern int go_int_callback_mouse(void *pfunc, uintptr_t window, int x, int y, int mask, void *data, unsigned int flags); +extern int go_int_callback_expose(void *pfunc, uintptr_t window, int x, int y, int width, int height, void *data, unsigned int flags); +extern int go_int_callback_item_enter(void *pfunc, uintptr_t window, char *text, void *data, void *itemdata, unsigned int flags); +extern int go_int_callback_item_context(void *pfunc, uintptr_t window, char *text, int x, int y, void *data, void *itemdata, unsigned int flags); +extern int go_int_callback_item_select(void *pfunc, uintptr_t window, uintptr_t item, char *text, void *data, void *itemdata, unsigned int flags); +extern int go_int_callback_numeric(void *pfunc, uintptr_t window, int val, void *data, unsigned int flags); +extern int go_int_callback_ulong(void *pfunc, uintptr_t window, unsigned long val, void *data, unsigned int flags); +extern int go_int_callback_notepage(void *pfunc, uintptr_t window, unsigned long val, void *data, unsigned int flags); +extern int go_int_callback_tree(void *pfunc, uintptr_t window, uintptr_t item, void *data, unsigned int flags); extern int go_int_callback_timer(void *pfunc, void *data, unsigned int flags); -extern int go_int_callback_print(void *pfunc, void *print, void *pixmap, int page_num, void *data, unsigned int flags); +extern int go_int_callback_print(void *pfunc, uintptr_t print, uintptr_t pixmap, int page_num, void *data, unsigned int flags); extern void go_callback_remove(void *pfunc); static int DWSIGNAL go_callback_basic(HWND window, void *data) @@ -1188,7 +1198,7 @@ if(data) { void **param = (void **)data; - return go_int_callback_basic(param[0], (void *)window, param[1], DW_POINTER_TO_INT(param[2])); + return go_int_callback_basic(param[0], (uintptr_t)window, param[1], DW_POINTER_TO_INT(param[2])); } return 0; } @@ -1198,7 +1208,7 @@ if(data) { void **param = (void **)data; - return go_int_callback_configure(param[0], (void *)window, width, height, param[1], DW_POINTER_TO_INT(param[2])); + return go_int_callback_configure(param[0], (uintptr_t)window, width, height, param[1], DW_POINTER_TO_INT(param[2])); } return 0; } @@ -1208,7 +1218,7 @@ if(data) { void **param = (void **)data; - return go_int_callback_keypress(param[0], (void *)window, ch, vk, state, param[1], utf8, DW_POINTER_TO_INT(param[2])); + return go_int_callback_keypress(param[0], (uintptr_t)window, ch, vk, state, param[1], utf8, DW_POINTER_TO_INT(param[2])); } return 0; } @@ -1218,7 +1228,7 @@ if(data) { void **param = (void **)data; - return go_int_callback_mouse(param[0], (void *)window, x, y, mask, param[1], DW_POINTER_TO_INT(param[2])); + return go_int_callback_mouse(param[0], (uintptr_t)window, x, y, mask, param[1], DW_POINTER_TO_INT(param[2])); } return 0; } @@ -1228,7 +1238,7 @@ if(data && exp) { void **param = (void **)data; - return go_int_callback_expose(param[0], (void *)window, exp->x, exp->y, exp->width, exp->height, param[1], DW_POINTER_TO_INT(param[2])); + return go_int_callback_expose(param[0], (uintptr_t)window, exp->x, exp->y, exp->width, exp->height, param[1], DW_POINTER_TO_INT(param[2])); } return 0; } @@ -1238,7 +1248,7 @@ if(data) { void **param = (void **)data; - return go_int_callback_item_enter(param[0], (void *)window, text, param[1], itemdata, DW_POINTER_TO_INT(param[2])); + return go_int_callback_item_enter(param[0], (uintptr_t)window, text, param[1], itemdata, DW_POINTER_TO_INT(param[2])); } return 0; } @@ -1248,7 +1258,7 @@ if(data) { void **param = (void **)data; - return go_int_callback_item_context(param[0], (void *)window, text, x, y, param[1], itemdata, DW_POINTER_TO_INT(param[2])); + return go_int_callback_item_context(param[0], (uintptr_t)window, text, x, y, param[1], itemdata, DW_POINTER_TO_INT(param[2])); } return 0; } @@ -1258,7 +1268,7 @@ if(data) { void **param = (void **)data; - return go_int_callback_item_select(param[0], (void *)window, (void *)item, text, param[1], itemdata, DW_POINTER_TO_INT(param[2])); + return go_int_callback_item_select(param[0], (uintptr_t)window, (uintptr_t)item, text, param[1], itemdata, DW_POINTER_TO_INT(param[2])); } return 0; } @@ -1268,7 +1278,7 @@ if(data) { void **param = (void **)data; - return go_int_callback_numeric(param[0], (void *)window, val, param[1], DW_POINTER_TO_INT(param[2])); + return go_int_callback_numeric(param[0], (uintptr_t)window, val, param[1], DW_POINTER_TO_INT(param[2])); } return 0; } @@ -1278,7 +1288,7 @@ if(data) { void **param = (void **)data; - return go_int_callback_ulong(param[0], (void *)window, val, param[1], DW_POINTER_TO_INT(param[2])); + return go_int_callback_ulong(param[0], (uintptr_t)window, val, param[1], DW_POINTER_TO_INT(param[2])); } return 0; }*/ @@ -1288,7 +1298,7 @@ if(data) { void **param = (void **)data; - return go_int_callback_notepage(param[0], (void *)window, val, param[1], DW_POINTER_TO_INT(param[2])); + return go_int_callback_notepage(param[0], (uintptr_t)window, val, param[1], DW_POINTER_TO_INT(param[2])); } return 0; } @@ -1298,7 +1308,7 @@ if(data) { void **param = (void **)data; - return go_int_callback_tree(param[0], (void *)window, (void *)tree, param[1], DW_POINTER_TO_INT(param[2])); + return go_int_callback_tree(param[0], (uintptr_t)window, (uintptr_t)tree, param[1], DW_POINTER_TO_INT(param[2])); } return 0; } @@ -1318,12 +1328,12 @@ if(data) { void **param = (void **)data; - return go_int_callback_print(param[0], (void *)print, (void *)pixmap, page_num, param[1], DW_POINTER_TO_INT(param[2])); + return go_int_callback_print(param[0], (uintptr_t)print, (uintptr_t)pixmap, page_num, param[1], DW_POINTER_TO_INT(param[2])); } return 0; } -static void *go_print_new(char *jobname, unsigned long flags, unsigned int pages, void *drawfunc, void *drawdata, unsigned int sflags) +static uintptr_t go_print_new(char *jobname, unsigned long flags, unsigned int pages, void *drawfunc, void *drawdata, unsigned int sflags) { void **param = malloc(sizeof(void *) * 3); @@ -1332,9 +1342,9 @@ param[0] = drawfunc; param[1] = drawdata; param[2] = DW_UINT_TO_POINTER(sflags); - return (void*)dw_print_new(jobname, flags, pages, DW_SIGNAL_FUNC(go_callback_print), param); + return (uintptr_t)dw_print_new(jobname, flags, pages, DW_SIGNAL_FUNC(go_callback_print), param); } - return NULL; + return 0; } static int go_timer_connect(int interval, void *sigfunc, void *data, unsigned int flags) @@ -1361,7 +1371,7 @@ } } -static void go_signal_connect(void *window, char *signame, void *sigfunc, void *data, unsigned int flags) +static void go_signal_connect(uintptr_t window, char *signame, void *sigfunc, void *data, unsigned int flags) { void **param = malloc(sizeof(void *) * 3); void *func = (void *)go_callback_basic;
--- a/dwootest/dwootest.go Sat Nov 06 07:14:50 2021 -0500 +++ b/dwootest/dwootest.go Sat Nov 06 22:14:59 2021 -0500 @@ -950,7 +950,7 @@ thisicon = foldericon } fmt.Printf("Initial: container: %x containerinfo: %x icon: %x\n", uintptr(dw.HANDLE_TO_POINTER(container)), - dw.HANDLE_TO_UINTPTR(containerinfo), uintptr(dw.POINTER(thisicon))) + dw.HANDLE_TO_UINTPTR(containerinfo), uintptr(thisicon)) containerinfo.SetFile(z, fmt.Sprintf("Filename %d", z+1), thisicon) containerinfo.SetItemIcon(0, z, thisicon) containerinfo.SetItemULong(1, z, uint(z*100)) @@ -1395,7 +1395,7 @@ notebookpage7.SetText("html") rawhtml := dw.HtmlNew(1001) - if rawhtml.GetHandle() != nil { + if rawhtml.GetHandle() != 0 { notebookbox7.PackStart(rawhtml, 0, 100, dw.TRUE, dw.FALSE, 0) rawhtml.Raw("<html><body><center><h1>dwtest</h1></center></body></html>") html := dw.HtmlNew(1002)
--- a/dwtest/dwtest.go Sat Nov 06 07:14:50 2021 -0500 +++ b/dwtest/dwtest.go Sat Nov 06 22:14:59 2021 -0500 @@ -1335,7 +1335,7 @@ thisicon = foldericon } fmt.Printf("Initial: container: %x containerinfo: %x icon: %x\n", uintptr(dw.HANDLE_TO_POINTER(container)), - dw.HANDLE_TO_UINTPTR(containerinfo), uintptr(dw.POINTER(thisicon))) + dw.HANDLE_TO_UINTPTR(containerinfo), uintptr(thisicon)) dw.Filesystem_set_file(container, containerinfo, z, fmt.Sprintf("Filename %d", z+1), thisicon) dw.Filesystem_set_item_icon(container, containerinfo, 0, z, thisicon) dw.Filesystem_set_item_ulong(container, containerinfo, 1, z, uint(z*100)) @@ -1609,7 +1609,7 @@ dw.Notebook_page_set_text(notebook, notebookpage7, "html") rawhtml := dw.Html_new(1001) - if rawhtml.GetHandle() != nil { + if rawhtml.GetHandle() != 0 { dw.Box_pack_start(notebookbox7, rawhtml, 0, 100, TRUE, FALSE, 0) dw.Html_raw(rawhtml, "<html><body><center><h1>dwtest</h1></center></body></html>") html = dw.Html_new(1002)