2012-01-08 16:42:23 +01:00
|
|
|
Mouse = {}
|
|
|
|
|
2012-02-06 05:39:52 +01:00
|
|
|
function Mouse.setTargetCursor()
|
2012-03-18 14:34:39 +01:00
|
|
|
g_window.setMouseCursor('/core_styles/cursors/targetcursor.png', {x=9,y=9})
|
2012-02-06 05:39:52 +01:00
|
|
|
end
|
|
|
|
|
2012-03-23 02:52:31 +01:00
|
|
|
function Mouse.setHorizontalCursor()
|
|
|
|
g_window.setMouseCursor('/core_styles/cursors/horizontal.png', {x=9,y=4})
|
|
|
|
end
|
|
|
|
|
|
|
|
function Mouse.setVerticalCursor()
|
|
|
|
g_window.setMouseCursor('/core_styles/cursors/vertical.png', {x=4,y=9})
|
|
|
|
end
|
|
|
|
|
2012-02-06 05:39:52 +01:00
|
|
|
function Mouse.restoreCursor()
|
|
|
|
g_window.restoreMouseCursor()
|
|
|
|
end
|
2012-03-25 16:10:15 +02:00
|
|
|
|
2012-03-26 00:14:00 +02:00
|
|
|
function Mouse.isPressed()
|
2012-03-26 15:34:43 +02:00
|
|
|
return g_ui.getPressedWidget() ~= nil
|
2012-03-26 00:14:00 +02:00
|
|
|
end
|
|
|
|
|
2012-03-25 16:10:15 +02:00
|
|
|
function Mouse.bindAutoPress(widget, callback)
|
|
|
|
connect(widget, { onMousePress = function(widget, mousePos, mouseButton)
|
|
|
|
callback()
|
|
|
|
periodicalEvent(function()
|
|
|
|
callback()
|
|
|
|
end, function()
|
|
|
|
return widget:isPressed()
|
|
|
|
end, 30, 300)
|
|
|
|
return true
|
|
|
|
end })
|
|
|
|
end
|
|
|
|
|
|
|
|
function Mouse.bindPressMove(widget, callback)
|
|
|
|
connect(widget, { onMouseMove = function(widget, mousePos, mouseMoved)
|
|
|
|
if widget:isPressed() then
|
|
|
|
callback(mousePos, mouseMoved)
|
|
|
|
end
|
|
|
|
return true
|
|
|
|
end })
|
|
|
|
end
|