improve combobox and menu design

This commit is contained in:
Eduardo Bart
2012-01-05 16:02:27 -02:00
parent 7e7050929d
commit fb20ad1ba1
17 changed files with 137 additions and 60 deletions

View File

@@ -33,6 +33,8 @@ function UIComboBox:onMousePress(mousePos, mouseButton)
end
menu:setWidth(self:getWidth())
menu:display({ x = self:getX(), y = self:getY() + self:getHeight() })
connect(menu, { onDestroy = function() self:setOn(false) end })
self:setOn(true)
return true
end

View File

@@ -10,11 +10,6 @@ function UIPopupMenu.create()
return menu
end
function UIPopupMenu:destroy()
table.removevalue(displayedMenuList, self)
UIWidget.destroy(self)
end
function UIPopupMenu:display(pos)
-- don't display if not options was added
if self:getChildCount() == 0 then
@@ -45,6 +40,10 @@ function UIPopupMenu:addSeparator()
createWidget(self:getStyleName() .. 'Separator', self)
end
function UIPopupMenu:onDestroy()
table.removevalue(displayedMenuList, self)
end
function UIPopupMenu:onMousePress(mousePos, mouseButton)
-- clicks outside self area destroys the self
if not self:containsPoint(mousePos) then