More go fmt.
This commit is contained in:
parent
ad8a90ec7e
commit
1e66637cd2
26
button.go
26
button.go
|
@ -11,20 +11,20 @@ type Button struct {
|
||||||
// Clicked gets a message when the button is clicked.
|
// Clicked gets a message when the button is clicked.
|
||||||
// You cannot change it once the Window containing the Button has been created.
|
// You cannot change it once the Window containing the Button has been created.
|
||||||
// If you do not respond to this signal, nothing will happen.
|
// If you do not respond to this signal, nothing will happen.
|
||||||
Clicked chan struct{}
|
Clicked chan struct{}
|
||||||
|
|
||||||
lock sync.Mutex
|
lock sync.Mutex
|
||||||
created bool
|
created bool
|
||||||
sysData *sysData
|
sysData *sysData
|
||||||
initText string
|
initText string
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewButton creates a new button with the specified text.
|
// NewButton creates a new button with the specified text.
|
||||||
func NewButton(text string) (b *Button) {
|
func NewButton(text string) (b *Button) {
|
||||||
return &Button{
|
return &Button{
|
||||||
sysData: mksysdata(c_button),
|
sysData: mksysdata(c_button),
|
||||||
initText: text,
|
initText: text,
|
||||||
Clicked: newEvent(),
|
Clicked: newEvent(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,11 +67,11 @@ func (b *Button) make(window *sysData) error {
|
||||||
|
|
||||||
func (b *Button) setRect(x int, y int, width int, height int, rr *[]resizerequest) {
|
func (b *Button) setRect(x int, y int, width int, height int, rr *[]resizerequest) {
|
||||||
*rr = append(*rr, resizerequest{
|
*rr = append(*rr, resizerequest{
|
||||||
sysData: b.sysData,
|
sysData: b.sysData,
|
||||||
x: x,
|
x: x,
|
||||||
y: y,
|
y: y,
|
||||||
width: width,
|
width: width,
|
||||||
height: height,
|
height: height,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ func our_window_delete_event_callback(widget *C.GtkWidget, event *C.GdkEvent, wh
|
||||||
// called when the user tries to close the window
|
// called when the user tries to close the window
|
||||||
s := (*sysData)(unsafe.Pointer(what))
|
s := (*sysData)(unsafe.Pointer(what))
|
||||||
s.signal()
|
s.signal()
|
||||||
return C.TRUE // do not close the window
|
return C.TRUE // do not close the window
|
||||||
}
|
}
|
||||||
|
|
||||||
var window_delete_event_callback = C.GCallback(C.our_window_delete_event_callback)
|
var window_delete_event_callback = C.GCallback(C.our_window_delete_event_callback)
|
||||||
|
@ -37,13 +37,13 @@ var window_delete_event_callback = C.GCallback(C.our_window_delete_event_callbac
|
||||||
func our_window_configure_event_callback(widget *C.GtkWidget, event *C.GdkEvent, what C.gpointer) C.gboolean {
|
func our_window_configure_event_callback(widget *C.GtkWidget, event *C.GdkEvent, what C.gpointer) C.gboolean {
|
||||||
// called when the window is resized
|
// called when the window is resized
|
||||||
s := (*sysData)(unsafe.Pointer(what))
|
s := (*sysData)(unsafe.Pointer(what))
|
||||||
if s.container != nil && s.resize != nil { // wait for init
|
if s.container != nil && s.resize != nil { // wait for init
|
||||||
width, height := gtk_window_get_size(s.widget)
|
width, height := gtk_window_get_size(s.widget)
|
||||||
// top-left is (0,0) so no need for winheight
|
// top-left is (0,0) so no need for winheight
|
||||||
s.doResize(0, 0, width, height, 0)
|
s.doResize(0, 0, width, height, 0)
|
||||||
}
|
}
|
||||||
// no need to manually redraw everything: since we use gtk_widget_set_size_request(), that queues both resize and redraw for us (thanks Company in irc.gimp.net/#gtk+)
|
// no need to manually redraw everything: since we use gtk_widget_set_size_request(), that queues both resize and redraw for us (thanks Company in irc.gimp.net/#gtk+)
|
||||||
return C.FALSE // continue the event chain
|
return C.FALSE // continue the event chain
|
||||||
}
|
}
|
||||||
|
|
||||||
var window_configure_event_callback = C.GCallback(C.our_window_configure_event_callback)
|
var window_configure_event_callback = C.GCallback(C.our_window_configure_event_callback)
|
||||||
|
@ -78,8 +78,8 @@ func g_signal_connect_pointer(obj *C.GtkWidget, sig string, callback C.GCallback
|
||||||
// 2) we need to make sure one idle function runs and finishes running before we start the next; otherwise we could wind up with weird things like the ret channel being closed early
|
// 2) we need to make sure one idle function runs and finishes running before we start the next; otherwise we could wind up with weird things like the ret channel being closed early
|
||||||
// so our_idle_callback() calls the uitask function in what and sends a message back to the dispatcher over done that it finished running; the dispatcher is still holding onto the uitask function so it won't be collected
|
// so our_idle_callback() calls the uitask function in what and sends a message back to the dispatcher over done that it finished running; the dispatcher is still holding onto the uitask function so it won't be collected
|
||||||
type gtkIdleOp struct {
|
type gtkIdleOp struct {
|
||||||
what func()
|
what func()
|
||||||
done chan struct{}
|
done chan struct{}
|
||||||
}
|
}
|
||||||
|
|
||||||
//export our_idle_callback
|
//export our_idle_callback
|
||||||
|
@ -87,7 +87,7 @@ func our_idle_callback(what C.gpointer) C.gboolean {
|
||||||
idleop := (*gtkIdleOp)(unsafe.Pointer(what))
|
idleop := (*gtkIdleOp)(unsafe.Pointer(what))
|
||||||
idleop.what()
|
idleop.what()
|
||||||
idleop.done <- struct{}{}
|
idleop.done <- struct{}{}
|
||||||
return C.FALSE // remove this idle function; we're finished
|
return C.FALSE // remove this idle function; we're finished
|
||||||
}
|
}
|
||||||
|
|
||||||
func gdk_threads_add_idle(idleop *gtkIdleOp) {
|
func gdk_threads_add_idle(idleop *gtkIdleOp) {
|
||||||
|
|
24
checkbox.go
24
checkbox.go
|
@ -8,18 +8,18 @@ import (
|
||||||
|
|
||||||
// A Checkbox is a clickable square with a label. The square can be either checked or unchecked. Checkboxes start out unchecked.
|
// A Checkbox is a clickable square with a label. The square can be either checked or unchecked. Checkboxes start out unchecked.
|
||||||
type Checkbox struct {
|
type Checkbox struct {
|
||||||
lock sync.Mutex
|
lock sync.Mutex
|
||||||
created bool
|
created bool
|
||||||
sysData *sysData
|
sysData *sysData
|
||||||
initText string
|
initText string
|
||||||
initCheck bool
|
initCheck bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewCheckbox creates a new checkbox with the specified text.
|
// NewCheckbox creates a new checkbox with the specified text.
|
||||||
func NewCheckbox(text string) (c *Checkbox) {
|
func NewCheckbox(text string) (c *Checkbox) {
|
||||||
return &Checkbox{
|
return &Checkbox{
|
||||||
sysData: mksysdata(c_checkbox),
|
sysData: mksysdata(c_checkbox),
|
||||||
initText: text,
|
initText: text,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,11 +72,11 @@ func (c *Checkbox) make(window *sysData) error {
|
||||||
|
|
||||||
func (c *Checkbox) setRect(x int, y int, width int, height int, rr *[]resizerequest) {
|
func (c *Checkbox) setRect(x int, y int, width int, height int, rr *[]resizerequest) {
|
||||||
*rr = append(*rr, resizerequest{
|
*rr = append(*rr, resizerequest{
|
||||||
sysData: c.sysData,
|
sysData: c.sysData,
|
||||||
x: x,
|
x: x,
|
||||||
y: y,
|
y: y,
|
||||||
width: width,
|
width: width,
|
||||||
height: height,
|
height: height,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
26
combobox.go
26
combobox.go
|
@ -9,16 +9,16 @@ import (
|
||||||
|
|
||||||
// A Combobox is a drop-down list of items, of which at most one can be selected at any given time. You may optionally make the combobox editable to allow custom items. Initially, no item will be selected (and no text entered in an editable Combobox's entry field). What happens to the text shown in a Combobox if its width is too small is implementation-defined.
|
// A Combobox is a drop-down list of items, of which at most one can be selected at any given time. You may optionally make the combobox editable to allow custom items. Initially, no item will be selected (and no text entered in an editable Combobox's entry field). What happens to the text shown in a Combobox if its width is too small is implementation-defined.
|
||||||
type Combobox struct {
|
type Combobox struct {
|
||||||
lock sync.Mutex
|
lock sync.Mutex
|
||||||
created bool
|
created bool
|
||||||
sysData *sysData
|
sysData *sysData
|
||||||
initItems []string
|
initItems []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func newCombobox(editable bool, items ...string) (c *Combobox) {
|
func newCombobox(editable bool, items ...string) (c *Combobox) {
|
||||||
c = &Combobox{
|
c = &Combobox{
|
||||||
sysData: mksysdata(c_combobox),
|
sysData: mksysdata(c_combobox),
|
||||||
initItems: items,
|
initItems: items,
|
||||||
}
|
}
|
||||||
c.sysData.alternate = editable
|
c.sysData.alternate = editable
|
||||||
return c
|
return c
|
||||||
|
@ -67,7 +67,7 @@ func (c *Combobox) InsertBefore(what string, before int) {
|
||||||
if before < 0 || before >= len(c.initItems) {
|
if before < 0 || before >= len(c.initItems) {
|
||||||
goto badrange
|
goto badrange
|
||||||
}
|
}
|
||||||
m = make([]string, 0, len(c.initItems) + 1)
|
m = make([]string, 0, len(c.initItems)+1)
|
||||||
m = append(m, c.initItems[:before]...)
|
m = append(m, c.initItems[:before]...)
|
||||||
m = append(m, what)
|
m = append(m, what)
|
||||||
c.initItems = append(m, c.initItems[before:]...)
|
c.initItems = append(m, c.initItems[before:]...)
|
||||||
|
@ -91,7 +91,7 @@ func (c *Combobox) Delete(index int) {
|
||||||
if index < 0 || index >= len(c.initItems) {
|
if index < 0 || index >= len(c.initItems) {
|
||||||
goto badrange
|
goto badrange
|
||||||
}
|
}
|
||||||
c.initItems = append(c.initItems[:index], c.initItems[index + 1:]...)
|
c.initItems = append(c.initItems[:index], c.initItems[index+1:]...)
|
||||||
return
|
return
|
||||||
badrange:
|
badrange:
|
||||||
panic(fmt.Errorf("index %d out of range in Combobox.Delete()", index))
|
panic(fmt.Errorf("index %d out of range in Combobox.Delete()", index))
|
||||||
|
@ -149,11 +149,11 @@ func (c *Combobox) make(window *sysData) (err error) {
|
||||||
|
|
||||||
func (c *Combobox) setRect(x int, y int, width int, height int, rr *[]resizerequest) {
|
func (c *Combobox) setRect(x int, y int, width int, height int, rr *[]resizerequest) {
|
||||||
*rr = append(*rr, resizerequest{
|
*rr = append(*rr, resizerequest{
|
||||||
sysData: c.sysData,
|
sysData: c.sysData,
|
||||||
x: x,
|
x: x,
|
||||||
y: y,
|
y: y,
|
||||||
width: width,
|
width: width,
|
||||||
height: height,
|
height: height,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,9 @@ package ui
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
"io/ioutil"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// pretty much every constant here except _WM_USER is from commctrl.h, except where noted
|
// pretty much every constant here except _WM_USER is from commctrl.h, except where noted
|
||||||
|
@ -17,7 +17,7 @@ var (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
_activateActCtx = kernel32.NewProc("ActivateActCtx")
|
_activateActCtx = kernel32.NewProc("ActivateActCtx")
|
||||||
_createActCtx = kernel32.NewProc("CreateActCtxW")
|
_createActCtx = kernel32.NewProc("CreateActCtxW")
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -43,15 +43,15 @@ func forceCommonControls6() (err error) {
|
||||||
manifestfile.Close()
|
manifestfile.Close()
|
||||||
|
|
||||||
var actctx struct {
|
var actctx struct {
|
||||||
cbSize uint32
|
cbSize uint32
|
||||||
dwFlags uint32
|
dwFlags uint32
|
||||||
lpSource *uint16
|
lpSource *uint16
|
||||||
wProcessorArchitecture uint16
|
wProcessorArchitecture uint16
|
||||||
wLangId uint16 // originally LANGID
|
wLangId uint16 // originally LANGID
|
||||||
lpAssemblyDirectory uintptr // originally LPCWSTR
|
lpAssemblyDirectory uintptr // originally LPCWSTR
|
||||||
lpResourceName uintptr // originally LPCWSTR
|
lpResourceName uintptr // originally LPCWSTR
|
||||||
lpApplicationName uintptr // originally LPCWSTR
|
lpApplicationName uintptr // originally LPCWSTR
|
||||||
hModule _HANDLE // originally HMODULE
|
hModule _HANDLE // originally HMODULE
|
||||||
}
|
}
|
||||||
|
|
||||||
actctx.cbSize = uint32(unsafe.Sizeof(actctx))
|
actctx.cbSize = uint32(unsafe.Sizeof(actctx))
|
||||||
|
@ -61,13 +61,13 @@ func forceCommonControls6() (err error) {
|
||||||
|
|
||||||
r1, _, err := _createActCtx.Call(uintptr(unsafe.Pointer(&actctx)))
|
r1, _, err := _createActCtx.Call(uintptr(unsafe.Pointer(&actctx)))
|
||||||
// don't negConst() INVALID_HANDLE_VALUE; windowsconstgen was given a pointer by windows.h, and pointers are unsigned, so converting it back to signed doesn't work
|
// don't negConst() INVALID_HANDLE_VALUE; windowsconstgen was given a pointer by windows.h, and pointers are unsigned, so converting it back to signed doesn't work
|
||||||
if r1 == _INVALID_HANDLE_VALUE { // failure
|
if r1 == _INVALID_HANDLE_VALUE { // failure
|
||||||
return fmt.Errorf("error creating activation context for synthesized manifest file: %v", err)
|
return fmt.Errorf("error creating activation context for synthesized manifest file: %v", err)
|
||||||
}
|
}
|
||||||
r1, _, err = _activateActCtx.Call(
|
r1, _, err = _activateActCtx.Call(
|
||||||
r1,
|
r1,
|
||||||
uintptr(unsafe.Pointer(&comctlManifestCookie)))
|
uintptr(unsafe.Pointer(&comctlManifestCookie)))
|
||||||
if r1 == uintptr(_FALSE) { // failure
|
if r1 == uintptr(_FALSE) { // failure
|
||||||
return fmt.Errorf("error activating activation context for synthesized manifest file: %v", err)
|
return fmt.Errorf("error activating activation context for synthesized manifest file: %v", err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@ -75,8 +75,8 @@ func forceCommonControls6() (err error) {
|
||||||
|
|
||||||
func initCommonControls() (err error) {
|
func initCommonControls() (err error) {
|
||||||
var icc struct {
|
var icc struct {
|
||||||
dwSize uint32
|
dwSize uint32
|
||||||
dwICC uint32
|
dwICC uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
err = forceCommonControls6()
|
err = forceCommonControls6()
|
||||||
|
@ -89,7 +89,7 @@ func initCommonControls() (err error) {
|
||||||
|
|
||||||
comctl32 = syscall.NewLazyDLL("comctl32.dll")
|
comctl32 = syscall.NewLazyDLL("comctl32.dll")
|
||||||
r1, _, err := comctl32.NewProc("InitCommonControlsEx").Call(uintptr(unsafe.Pointer(&icc)))
|
r1, _, err := comctl32.NewProc("InitCommonControlsEx").Call(uintptr(unsafe.Pointer(&icc)))
|
||||||
if r1 == _FALSE { // failure
|
if r1 == _FALSE { // failure
|
||||||
return fmt.Errorf("error initializing Common Controls (comctl32.dll); Windows last error: %v", err)
|
return fmt.Errorf("error initializing Common Controls (comctl32.dll); Windows last error: %v", err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -8,11 +8,11 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
user32 = syscall.NewLazyDLL("user32.dll")
|
user32 = syscall.NewLazyDLL("user32.dll")
|
||||||
kernel32 = syscall.NewLazyDLL("kernel32.dll")
|
kernel32 = syscall.NewLazyDLL("kernel32.dll")
|
||||||
gdi32 = syscall.NewLazyDLL("gdi32.dll")
|
gdi32 = syscall.NewLazyDLL("gdi32.dll")
|
||||||
comctl32 *syscall.LazyDLL // comctl32 not defined here; see comctl_windows.go
|
comctl32 *syscall.LazyDLL // comctl32 not defined here; see comctl_windows.go
|
||||||
msimg32 = syscall.NewLazyDLL("msimg32.dll")
|
msimg32 = syscall.NewLazyDLL("msimg32.dll")
|
||||||
)
|
)
|
||||||
|
|
||||||
type _HANDLE uintptr
|
type _HANDLE uintptr
|
||||||
|
@ -38,27 +38,27 @@ func (w _WPARAM) HIWORD() uint16 {
|
||||||
func (l _LPARAM) X() int32 {
|
func (l _LPARAM) X() int32 {
|
||||||
// according to windowsx.h
|
// according to windowsx.h
|
||||||
loword := uint16(l & 0xFFFF)
|
loword := uint16(l & 0xFFFF)
|
||||||
short := int16(loword) // convert to signed...
|
short := int16(loword) // convert to signed...
|
||||||
return int32(short) // ...and sign extend
|
return int32(short) // ...and sign extend
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l _LPARAM) Y() int32 {
|
func (l _LPARAM) Y() int32 {
|
||||||
// according to windowsx.h
|
// according to windowsx.h
|
||||||
hiword := uint16((l & 0xFFFF0000) >> 16)
|
hiword := uint16((l & 0xFFFF0000) >> 16)
|
||||||
short := int16(hiword) // convert to signed...
|
short := int16(hiword) // convert to signed...
|
||||||
return int32(short) // ...and sign extend
|
return int32(short) // ...and sign extend
|
||||||
}
|
}
|
||||||
|
|
||||||
type _POINT struct {
|
type _POINT struct {
|
||||||
x int32
|
x int32
|
||||||
y int32
|
y int32
|
||||||
}
|
}
|
||||||
|
|
||||||
type _RECT struct {
|
type _RECT struct {
|
||||||
left int32
|
left int32
|
||||||
top int32
|
top int32
|
||||||
right int32
|
right int32
|
||||||
bottom int32
|
bottom int32
|
||||||
}
|
}
|
||||||
|
|
||||||
// Go doesn't allow negative constants to be forced into unsigned types at compile-time; this will do it at runtime.
|
// Go doesn't allow negative constants to be forced into unsigned types at compile-time; this will do it at runtime.
|
||||||
|
@ -85,20 +85,20 @@ func utf16ToLPARAM(s *uint16) uintptr {
|
||||||
|
|
||||||
var (
|
var (
|
||||||
_adjustWindowRectEx = user32.NewProc("AdjustWindowRectEx")
|
_adjustWindowRectEx = user32.NewProc("AdjustWindowRectEx")
|
||||||
_createWindowEx = user32.NewProc("CreateWindowExW")
|
_createWindowEx = user32.NewProc("CreateWindowExW")
|
||||||
_getClientRect = user32.NewProc("GetClientRect")
|
_getClientRect = user32.NewProc("GetClientRect")
|
||||||
_moveWindow = user32.NewProc("MoveWindow")
|
_moveWindow = user32.NewProc("MoveWindow")
|
||||||
_setWindowPos = user32.NewProc("SetWindowPos")
|
_setWindowPos = user32.NewProc("SetWindowPos")
|
||||||
_setWindowText = user32.NewProc("SetWindowTextW")
|
_setWindowText = user32.NewProc("SetWindowTextW")
|
||||||
_showWindow = user32.NewProc("ShowWindow")
|
_showWindow = user32.NewProc("ShowWindow")
|
||||||
)
|
)
|
||||||
|
|
||||||
type _MINMAXINFO struct {
|
type _MINMAXINFO struct {
|
||||||
ptReserved _POINT
|
ptReserved _POINT
|
||||||
ptMaxSize _POINT
|
ptMaxSize _POINT
|
||||||
ptMaxPosition _POINT
|
ptMaxPosition _POINT
|
||||||
ptMinTrackSize _POINT
|
ptMinTrackSize _POINT
|
||||||
ptMaxTrackSize _POINT
|
ptMaxTrackSize _POINT
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l _LPARAM) MINMAXINFO() *_MINMAXINFO {
|
func (l _LPARAM) MINMAXINFO() *_MINMAXINFO {
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
|
|
||||||
package ui
|
package ui
|
||||||
|
|
||||||
import (
|
|
||||||
// ...
|
|
||||||
)
|
|
||||||
|
|
||||||
// A Control represents an UI control. Note that Control contains unexported members; this has the consequence that you can't build custom controls that interface directly with the system-specific code (fo rinstance, to import an unsupported control), or at least not without some hackery. If you want to make your own controls, create an Area and provide an AreaHandler that does what you need.
|
// A Control represents an UI control. Note that Control contains unexported members; this has the consequence that you can't build custom controls that interface directly with the system-specific code (fo rinstance, to import an unsupported control), or at least not without some hackery. If you want to make your own controls, create an Area and provide an AreaHandler that does what you need.
|
||||||
type Control interface {
|
type Control interface {
|
||||||
make(window *sysData) error
|
make(window *sysData) error
|
||||||
|
|
|
@ -26,17 +26,17 @@ func CheckRadioButton(hDlg HWND, nIDFirstButton int, nIDLastButton int, nIDCheck
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var (
|
var (
|
||||||
_getScrollInfo = user32.NewProc("GetScrollInfo")
|
_getScrollInfo = user32.NewProc("GetScrollInfo")
|
||||||
_setScrollInfo = user32.NewProc("SetScrollInfo")
|
_setScrollInfo = user32.NewProc("SetScrollInfo")
|
||||||
_scrollWindowEx = user32.NewProc("ScrollWindowEx")
|
_scrollWindowEx = user32.NewProc("ScrollWindowEx")
|
||||||
)
|
)
|
||||||
|
|
||||||
type _SCROLLINFO struct {
|
type _SCROLLINFO struct {
|
||||||
cbSize uint32
|
cbSize uint32
|
||||||
fMask uint32
|
fMask uint32
|
||||||
nMin int32 // originally int
|
nMin int32 // originally int
|
||||||
nMax int32 // originally int
|
nMax int32 // originally int
|
||||||
nPage uint32
|
nPage uint32
|
||||||
nPos int32 // originally int
|
nPos int32 // originally int
|
||||||
nTrackPos int32 // originally int
|
nTrackPos int32 // originally int
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
|
|
||||||
package ui
|
package ui
|
||||||
|
|
||||||
import (
|
|
||||||
// ...
|
|
||||||
)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This creates a class goAppDelegate that will be used as the delegate for /everything/. Specifically, it:
|
This creates a class goAppDelegate that will be used as the delegate for /everything/. Specifically, it:
|
||||||
- runs uitask requests (uitask:)
|
- runs uitask requests (uitask:)
|
||||||
|
@ -36,11 +32,11 @@ func appDelegate_windowShouldClose(win C.id) {
|
||||||
//export appDelegate_windowDidResize
|
//export appDelegate_windowDidResize
|
||||||
func appDelegate_windowDidResize(win C.id) {
|
func appDelegate_windowDidResize(win C.id) {
|
||||||
s := getSysData(win)
|
s := getSysData(win)
|
||||||
wincv := C.windowGetContentView(win) // we want the content view's size, not the window's
|
wincv := C.windowGetContentView(win) // we want the content view's size, not the window's
|
||||||
r := C.frame(wincv)
|
r := C.frame(wincv)
|
||||||
// winheight is used here because (0,0) is the bottom-left corner, not the top-left corner
|
// winheight is used here because (0,0) is the bottom-left corner, not the top-left corner
|
||||||
s.doResize(0, 0, int(r.width), int(r.height), int(r.height))
|
s.doResize(0, 0, int(r.width), int(r.height), int(r.height))
|
||||||
C.display(win) // redraw everything
|
C.display(win) // redraw everything
|
||||||
}
|
}
|
||||||
|
|
||||||
//export appDelegate_buttonClicked
|
//export appDelegate_buttonClicked
|
||||||
|
|
Loading…
Reference in New Issue