2012-02-07 01:41:53 +01:00
|
|
|
UIMiniWindow = extends(UIWindow)
|
|
|
|
|
|
|
|
function UIMiniWindow.create()
|
|
|
|
local miniwindow = UIMiniWindow.internalCreate()
|
|
|
|
return miniwindow
|
|
|
|
end
|
|
|
|
|
|
|
|
function UIMiniWindow:onDragEnter(mousePos)
|
|
|
|
local parent = self:getParent()
|
2012-02-20 03:27:08 +01:00
|
|
|
if not parent then return false end
|
|
|
|
|
2012-02-07 01:41:53 +01:00
|
|
|
if parent:getClassName() == 'UIMiniWindowContainer' then
|
|
|
|
local containerParent = parent:getParent()
|
|
|
|
parent:removeChild(self)
|
|
|
|
containerParent:addChild(self)
|
|
|
|
end
|
|
|
|
|
|
|
|
local oldPos = self:getPosition()
|
|
|
|
self.movingReference = { x = mousePos.x - oldPos.x, y = mousePos.y - oldPos.y }
|
|
|
|
self:setPosition(oldPos)
|
2012-02-09 19:38:50 +01:00
|
|
|
return true
|
2012-02-07 01:41:53 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
function UIMiniWindow:onDragLeave(droppedWidget, mousePos)
|
|
|
|
-- TODO: drop on other interfaces
|
|
|
|
end
|
2012-02-20 03:27:08 +01:00
|
|
|
|
|
|
|
function UIMiniWindow:onFocusChange(focused)
|
|
|
|
-- miniwindows only raises when its outside MiniWindowContainers
|
|
|
|
if not focused then return end
|
|
|
|
local parent = self:getParent()
|
|
|
|
if parent and parent:getClassName() ~= 'UIMiniWindowContainer' then
|
|
|
|
self:raise()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|