func (win *Window) CreateTrackbar(name string,
	value, count int,
	on_changed TrackbarFunc, param ...interface{}) bool {

	bar_name := C.CString(name)

	switch f := on_changed.(type) {
	case TrackbarFuncA:
		win.trackbarHandle[name] = TrackbarFunc(f)
	case TrackbarFuncB:
		win.trackbarHandle[name] = TrackbarFunc(f)
	case func(pos int):
		win.trackbarHandle[name] = TrackbarFunc(f)
	case func(pos int, param ...interface{}):
		win.trackbarHandle[name] = TrackbarFunc(f)
	default:
		panic("unknow func type!")
	}

	win.trackbarVal[name] = value
	win.trackbarMax[name] = count
	//win.trackbarHandle[name] = on_changed
	win.trackbarName[name] = bar_name

	if len(param) > 0 {
		win.trackbarParam[name] = param
	} else {
		win.trackbarParam[name] = nil
	}

	rv := C.GoOpenCV_CreateTrackbar(bar_name, win.name_c,
		C.int(value), C.int(count))
	return bool(rv != 0)
}
func (win *Window) CreateTrackbar(name string,
	value, count int,
	on_changed TrackbarFunc, param ...interface{}) bool {

	bar_name := C.CString(name)

	switch f := on_changed.(type) {
	case TrackbarFuncA:
		win.trackbarHandle[name] = TrackbarFunc(f)
	case TrackbarFuncB:
		win.trackbarHandle[name] = TrackbarFunc(f)
	case func(pos int):
		win.trackbarHandle[name] = TrackbarFunc(f)
	case func(pos int, param ...interface{}):
		win.trackbarHandle[name] = TrackbarFunc(f)
	default:
		panic("unknow func type!")
	}

	win.trackbarVal[name] = value
	win.trackbarMax[name] = count
	//win.trackbarHandle[name] = on_changed
	win.trackbarName[name] = bar_name

	if len(param) > 0 {
		win.trackbarParam[name] = param
	} else {
		win.trackbarParam[name] = nil
	}

	rv := C.GoOpenCV_CreateTrackbar(bar_name, win.name_c,
		C.int(value), C.int(count))
	return bool(rv != 0)
}
//-----------------------------------------------------------------------------
// window: track bar
//-----------------------------------------------------------------------------
/* create trackbar and display it on top of given window, set callback */