diff options
| author | Pietro Gagliardi <[email protected]> | 2014-05-15 19:21:54 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-05-15 19:21:54 -0400 |
| commit | b73d4e9010a273fd4e3e0b809959387a3b020cb0 (patch) | |
| tree | 054edebfe408a2c20dbe60aac3e240133a7139d9 /prefsize_darwin.go | |
| parent | 5b5c76021eda98783f1611da66f4b2f10f09f590 (diff) | |
Migrated prefsize_darwin.go to plain Objective-C. Not much left...!
Diffstat (limited to 'prefsize_darwin.go')
| -rw-r--r-- | prefsize_darwin.go | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/prefsize_darwin.go b/prefsize_darwin.go index 8b56ef7..8cea526 100644 --- a/prefsize_darwin.go +++ b/prefsize_darwin.go @@ -4,6 +4,7 @@ package ui // #cgo LDFLAGS: -lobjc -framework Foundation -framework AppKit // #include "objc_darwin.h" +// #include "prefsize_darwin.h" import "C" /* @@ -17,14 +18,20 @@ var ( // standard case: control immediately passed in func controlPrefSize(control C.id) (width int, height int) { - C.objc_msgSend_noargs(control, _sizeToFit) - r := C.objc_msgSend_stret_rect_noargs(control, _frame) + r := C.controlPrefSize(control) return int(r.width), int(r.height) } // NSTableView is actually in a NSScrollView so we have to get it out first func listboxPrefSize(control C.id) (width int, height int) { - return controlPrefSize(listboxInScrollView(control)) + r := C.listboxPrefSize(control) + return int(r.width), int(r.height) +} + +// and for type checking reasons, progress bars are separate despite responding to -[sizeToFit] +func pbarPrefSize(control C.id) (width int, height int) { + r := C.pbarPrefSize(control) + return int(r.width), int(r.height) } var prefsizefuncs = [nctypes]func(C.id) (int, int){ @@ -34,7 +41,7 @@ var prefsizefuncs = [nctypes]func(C.id) (int, int){ c_lineedit: controlPrefSize, c_label: controlPrefSize, c_listbox: listboxPrefSize, - c_progressbar: controlPrefSize, + c_progressbar: pbarPrefSize, } func (s *sysData) preferredSize() (width int, height int) { |
