示例#1
0
func (v *ScaledView) init() (err error) {
	v.layoutBox, err = gtk.BoxNew(gtk.ORIENTATION_VERTICAL, 0)
	if err != nil {
		return
	}
	const (
		initialWidth  = 800
		initialHeight = 600
	)
	v.scene, err = ScrolledViewNew(initialWidth, initialHeight)
	if err != nil {
		return
	}
	var adj *gtk.Adjustment
	adj, err = gtk.AdjustmentNew(0.0, scaleMin, scaleMax, scaleStep, scalePStep, scalePage)
	v.scaler, err = gtk.ScaleNew(gtk.ORIENTATION_HORIZONTAL, adj)
	if err != nil {
		return
	}
	v.scaler.Connect("value-changed", scalerValueCallback, v)
	v.layoutBox.Add(v.scene.Widget())
	v.layoutBox.Add(v.scaler)
	return
}
示例#2
0
文件: newgtk.go 项目: sqp/godock
// Scale creates a *gtk.Scale.
func Scale(orientation gtk.Orientation, adjustment *gtk.Adjustment) *gtk.Scale {
	w, _ := gtk.ScaleNew(orientation, adjustment)
	return w
}