Preparation for adding tracking areas to Mac OS X Areas: we need to now pass in the sysData to each control's make() function so Area can save the tracking area somewhere (this will also come in handy when I change alternate from a bool to an integer index).
This commit is contained in:
parent
d8d671b0b0
commit
5819e52f8d
|
@ -74,7 +74,7 @@ func mkAreaClass() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeArea(parentWindow C.id, alternate bool) C.id {
|
func makeArea(parentWindow C.id, alternate bool, s *sysData) C.id {
|
||||||
area := C.objc_msgSend_noargs(_goArea, _alloc)
|
area := C.objc_msgSend_noargs(_goArea, _alloc)
|
||||||
area = initWithDummyFrame(area)
|
area = initWithDummyFrame(area)
|
||||||
// TODO others?
|
// TODO others?
|
||||||
|
|
|
@ -234,7 +234,7 @@ var (
|
||||||
_deselectAll = sel_getUid("deselectAll:")
|
_deselectAll = sel_getUid("deselectAll:")
|
||||||
)
|
)
|
||||||
|
|
||||||
func makeListbox(parentWindow C.id, alternate bool) C.id {
|
func makeListbox(parentWindow C.id, alternate bool, s *sysData) C.id {
|
||||||
listbox := C.objc_msgSend_noargs(_NSTableView, _alloc)
|
listbox := C.objc_msgSend_noargs(_NSTableView, _alloc)
|
||||||
listbox = initWithDummyFrame(listbox)
|
listbox = initWithDummyFrame(listbox)
|
||||||
C.objc_msgSend_id(listbox, _addTableColumn, newListboxTableColumn())
|
C.objc_msgSend_id(listbox, _addTableColumn, newListboxTableColumn())
|
||||||
|
|
|
@ -15,11 +15,12 @@ import "C"
|
||||||
type sysData struct {
|
type sysData struct {
|
||||||
cSysData
|
cSysData
|
||||||
|
|
||||||
id C.id
|
id C.id
|
||||||
|
trackingArea C.id // for Area
|
||||||
}
|
}
|
||||||
|
|
||||||
type classData struct {
|
type classData struct {
|
||||||
make func(parentWindow C.id, alternate bool) C.id
|
make func(parentWindow C.id, alternate bool, s *sysData) C.id
|
||||||
getinside func(scrollview C.id) C.id
|
getinside func(scrollview C.id) C.id
|
||||||
show func(what C.id)
|
show func(what C.id)
|
||||||
hide func(what C.id)
|
hide func(what C.id)
|
||||||
|
@ -125,7 +126,7 @@ func applyStandardControlFont(id C.id) {
|
||||||
|
|
||||||
var classTypes = [nctypes]*classData{
|
var classTypes = [nctypes]*classData{
|
||||||
c_window: &classData{
|
c_window: &classData{
|
||||||
make: func(parentWindow C.id, alternate bool) C.id {
|
make: func(parentWindow C.id, alternate bool, s *sysData) C.id {
|
||||||
const (
|
const (
|
||||||
_NSBorderlessWindowMask = 0
|
_NSBorderlessWindowMask = 0
|
||||||
_NSTitledWindowMask = 1 << 0
|
_NSTitledWindowMask = 1 << 0
|
||||||
|
@ -160,7 +161,7 @@ var classTypes = [nctypes]*classData{
|
||||||
textsel: _title,
|
textsel: _title,
|
||||||
},
|
},
|
||||||
c_button: &classData{
|
c_button: &classData{
|
||||||
make: func(parentWindow C.id, alternate bool) C.id {
|
make: func(parentWindow C.id, alternate bool, s *sysData) C.id {
|
||||||
const (
|
const (
|
||||||
_NSRoundedBezelStyle = 1
|
_NSRoundedBezelStyle = 1
|
||||||
)
|
)
|
||||||
|
@ -180,7 +181,7 @@ var classTypes = [nctypes]*classData{
|
||||||
textsel: _title,
|
textsel: _title,
|
||||||
},
|
},
|
||||||
c_checkbox: &classData{
|
c_checkbox: &classData{
|
||||||
make: func(parentWindow C.id, alternate bool) C.id {
|
make: func(parentWindow C.id, alternate bool, s *sysData) C.id {
|
||||||
const (
|
const (
|
||||||
_NSSwitchButton = 3
|
_NSSwitchButton = 3
|
||||||
)
|
)
|
||||||
|
@ -198,7 +199,7 @@ var classTypes = [nctypes]*classData{
|
||||||
textsel: _title,
|
textsel: _title,
|
||||||
},
|
},
|
||||||
c_combobox: &classData{
|
c_combobox: &classData{
|
||||||
make: func(parentWindow C.id, alternate bool) C.id {
|
make: func(parentWindow C.id, alternate bool, s *sysData) C.id {
|
||||||
var combobox C.id
|
var combobox C.id
|
||||||
|
|
||||||
if alternate {
|
if alternate {
|
||||||
|
@ -262,7 +263,7 @@ var classTypes = [nctypes]*classData{
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
c_lineedit: &classData{
|
c_lineedit: &classData{
|
||||||
make: func(parentWindow C.id, alternate bool) C.id {
|
make: func(parentWindow C.id, alternate bool, s *sysData) C.id {
|
||||||
var lineedit C.id
|
var lineedit C.id
|
||||||
|
|
||||||
if alternate {
|
if alternate {
|
||||||
|
@ -282,7 +283,7 @@ var classTypes = [nctypes]*classData{
|
||||||
alttextsel: _stringValue,
|
alttextsel: _stringValue,
|
||||||
},
|
},
|
||||||
c_label: &classData{
|
c_label: &classData{
|
||||||
make: func(parentWindow C.id, alternate bool) C.id {
|
make: func(parentWindow C.id, alternate bool, s *sysData) C.id {
|
||||||
const (
|
const (
|
||||||
_NSLineBreakByWordWrapping = iota
|
_NSLineBreakByWordWrapping = iota
|
||||||
_NSLineBreakByCharWrapping
|
_NSLineBreakByCharWrapping
|
||||||
|
@ -324,7 +325,7 @@ var classTypes = [nctypes]*classData{
|
||||||
selectIndices: selectListboxIndices,
|
selectIndices: selectListboxIndices,
|
||||||
},
|
},
|
||||||
c_progressbar: &classData{
|
c_progressbar: &classData{
|
||||||
make: func(parentWindow C.id, alternate bool) C.id {
|
make: func(parentWindow C.id, alternate bool, s *sysData) C.id {
|
||||||
const (
|
const (
|
||||||
_NSProgressIndicatorBarStyle = 0
|
_NSProgressIndicatorBarStyle = 0
|
||||||
)
|
)
|
||||||
|
@ -382,7 +383,7 @@ func (s *sysData) make(window *sysData) error {
|
||||||
ret := make(chan C.id)
|
ret := make(chan C.id)
|
||||||
defer close(ret)
|
defer close(ret)
|
||||||
uitask <- func() {
|
uitask <- func() {
|
||||||
ret <- ct.make(parentWindow, s.alternate)
|
ret <- ct.make(parentWindow, s.alternate, s)
|
||||||
}
|
}
|
||||||
s.id = <-ret
|
s.id = <-ret
|
||||||
if ct.getinside != nil {
|
if ct.getinside != nil {
|
||||||
|
|
Loading…
Reference in New Issue