diff options
| author | Pietro Gagliardi <[email protected]> | 2014-03-30 11:19:13 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-03-30 11:19:13 -0400 |
| commit | 08dfb5da2034c33b68d7247dd16925960b3b88a3 (patch) | |
| tree | 054e95178635037bfdc8d78959a4f2bb957fab9c /area_darwin.go | |
| parent | f2d6daa9ea2203a897ee3af77105273531622aaf (diff) | |
Attempted to add the Area bare bones and resizing code to the Mac OS X backend. It complains that initWithFrame: is not implemented...
Diffstat (limited to 'area_darwin.go')
| -rw-r--r-- | area_darwin.go | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/area_darwin.go b/area_darwin.go index 4f27554..a767411 100644 --- a/area_darwin.go +++ b/area_darwin.go @@ -15,15 +15,17 @@ import ( import "C" const ( - _goArea = "goArea" + __goArea = "goArea" ) var ( + _goArea C.id + _drawRect = sel_getUid("drawRect:") ) func mkAreaClass() error { - areaclass, err := makeAreaClass(_goArea) + areaclass, err := makeAreaClass(__goArea) if err != nil { return fmt.Errorf("error creating Area backend class: %v", err) } @@ -33,12 +35,43 @@ func mkAreaClass() error { if ok != C.BOOL(C.YES) { return fmt.Errorf("error overriding Area drawRect: method; reason unknown") } + _goArea = objc_getClass(__goArea) return nil } //export areaView_drawRect func areaView_drawRect(self C.id, rect C.struct_xrect) { // TODO +fmt.Println(rect) +} + +// TODO combine these with the listbox functions? + +func newAreaScrollView(area C.id) C.id { + scrollview := objc_alloc(_NSScrollView) + scrollview = objc_msgSend_rect(scrollview, _initWithFrame, + 0, 0, 100, 100) + C.objc_msgSend_bool(scrollview, _setHasHorizontalScroller, C.BOOL(C.YES)) + C.objc_msgSend_bool(scrollview, _setHasVerticalScroller, C.BOOL(C.YES)) + C.objc_msgSend_bool(scrollview, _setAutohidesScrollers, C.BOOL(C.YES)) + C.objc_msgSend_id(scrollview, _setDocumentView, area) + return scrollview +} + +func areaInScrollView(scrollview C.id) C.id { + return C.objc_msgSend_noargs(scrollview, _documentView) +} + +func makeArea(parentWindow C.id, alternate bool) C.id { + area := objc_alloc(_goArea) +println(area) + area = objc_msgSend_rect(area, _initWithFrame, + 0, 0, 100, 100) +println("out") + // TODO others? + area = newAreaScrollView(area) + addControl(parentWindow, area) + return area } // TODO combine the below with the delegate stuff |
