// AddMouse add mouse event hook
//
// mouse arguments: left, center, right, wheelDown, wheelUp,
// wheelLeft, wheelRight.
//
// robotgo.AddMouse("left")
// robotgo.AddMouse("left", 100, 100)
432857
func AddMouse(btn string, x ...int16) bool {
	s := hook.Start()
	ukey := mouseMap[btn]

	ct := false
	for {
		e := <-s

		if len(x) > 1 {
			if e.Kind == hook.MouseMove && e.X == x[0] && e.Y == x[1] {
				ct = true
			}
		} else {
			ct = true
		}

		if ct && e.Kind == hook.MouseDown && int(e.Button) == ukey {
			hook.End()
			break
		}
	}

	return true
}
655061
func (d *DropDown) AddOption(text string, selected func()) *DropDown {
	d.options = append(d.options, &dropDownOption{Text: text, Selected: selected})
	d.list.AddItem(text, "", 0, nil)
	return d
}
1181785
func (s *Application) AddEvent(eventName string, handler interface{}) *Application {
	if h, ok := handler.(func(func(bool), ...interface{})); ok {
		events.AddEvent(eventName, h)
		return s
	}
	if h, ok := handler.(func(...interface{}) bool); ok {
		events.AddEvent(eventName, func(next func(bool), sessions ...interface{}) {
			next(h(sessions...))
		})
		return s
	}
	s.Core.Logger().Warnf(`Invalid event function: %T`, handler)
	return s
}
651334
func (r *registerer) addHandler(puType common.PUType, event common.Event, handler common.EventHandler) {
	r.handlers[puType][event] = handler
}
628828
func DragMouse(x, y int, args ...string) {
	Drag(x, y, args...)
}
170426
func (cl *CoLog) AddHook(hook Hook) {
	cl.mu.Lock()
	defer cl.mu.Unlock()

	for _, l := range hook.Levels() {
		cl.hooks[l] = append(cl.hooks[l], hook)
	}
}
446210
func (g *Master) AddRobot(r *Robot) *Robot {
	*g.robots = append(*g.robots, r)
	return r
}
1226317
func (d *Driver) Hover() {
	d.cmdMutex.Lock()
	defer d.cmdMutex.Unlock()

	d.rx = float32(0)
	d.ry = float32(0)
	d.lx = float32(0)
	d.ly = float32(0)
}
1083929
func MouseOver(listener func(*vecty.Event)) *vecty.EventListener {
	return &vecty.EventListener{Name: "mouseover", Listener: listener}
}
652368
func NewAxisMouse(d AxisMouseDirection) *AxisMouse {
	old := Input.Mouse.Y
	if d == AxisMouseHori {
		old = Input.Mouse.X
	}

	return &AxisMouse{
		direction: d,
		old:       old,
	}
}
422717
func (rtm *Client) AddEventListener(event Event, handler EventListener) {
	rtm.EventListeners[event] = append(rtm.EventListeners[event], handler)
}
894799
func (em *EventManager) AddEvent(eo EventSubs) bool {
	id := GetEventID(eo)

	if em.HasEvent(id) {
		return false
	}

	em.ro.Lock()
	em.events[id] = eo
	em.ro.Unlock()
	return true
}
1163828
func (_m *DBClient) AddEvent(e models.Event) (string, error) {
	ret := _m.Called(e)

	var r0 string
	if rf, ok := ret.Get(0).(func(models.Event) string); ok {
		r0 = rf(e)
	} else {
		r0 = ret.Get(0).(string)
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(models.Event) error); ok {
		r1 = rf(e)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
746806
func (m *MouseSystem) AddByInterface(i ecs.Identifier) {
	o, _ := i.(Mouseable)
	m.Add(o.GetBasicEntity(), o.GetMouseComponent(), o.GetSpaceComponent(), o.GetRenderComponent())
}
1201245
func (e *SimpleEventHandler) Add(s string) {
	e.items = append(e.items, s)
	e.levels = append(e.levels, e.current)
}
411022
func (m *Machine) AddAction(name string, payload map[string]interface{}) (Action, error) {
	spec, ok := actions.PredefinedActionsSpec[name]
	if !ok {
		return nil, errors.Errorf("cannot add action %q to a machine; only predefined actions allowed", name)
	}

	// Reject bad payloads before attempting to insert defaults.
	err := spec.ValidateParams(payload)
	if err != nil {
		return nil, err
	}
	payloadWithDefaults, err := spec.InsertDefaults(payload)
	if err != nil {
		return nil, err
	}

	model, err := m.st.Model()
	if err != nil {
		return nil, errors.Trace(err)
	}

	return model.EnqueueAction(m.Tag(), name, payloadWithDefaults)
}
752273
func (this *Manidator) Add(dators ...Dator) {
	this.dators = append(this.dators, dators...)
}