New elements; Fixes
This commit is contained in:
@@ -10,7 +10,6 @@ require("/koptilnya/libs/utils.txt")
|
||||
|
||||
EPanel = class("EPanel", Element)
|
||||
|
||||
accessorFunc(EPanel, "_backgroundColor", "BackgroundColor", Color(23, 23, 23))
|
||||
accessorFunc(EPanel, "_parentLock", "ParentLock", false)
|
||||
|
||||
function EPanel:initialize()
|
||||
@@ -22,23 +21,46 @@ function EPanel:initialize()
|
||||
self.title:setPos(12, 8)
|
||||
self:addChild(self.title)
|
||||
|
||||
local colorScheme = {
|
||||
bg = {
|
||||
Color(0, 0, 0),
|
||||
hover = Color(25, 25, 25),
|
||||
disabled = Color(0, 0, 0)
|
||||
}
|
||||
}
|
||||
|
||||
self.minimizeButton = EButton:new()
|
||||
self.minimizeButton:setFont(GUI.fonts["icons"])
|
||||
self.minimizeButton:setText("_")
|
||||
self.minimizeButton:setSize(32, 32)
|
||||
self.minimizeButton:setRadius(0)
|
||||
self.minimizeButton:setColor(Color(0, 0, 0))
|
||||
self.minimizeButton:setHoveredColor(Color(25, 25, 25))
|
||||
self.minimizeButton:setColorScheme(colorScheme)
|
||||
self.minimizeButton:setEnabled(false)
|
||||
self:addChild(self.minimizeButton)
|
||||
|
||||
self.closeButton = EButton:new()
|
||||
self.closeButton:setFont(GUI.fonts["icons"])
|
||||
self.closeButton:setText("X")
|
||||
self.closeButton:setSize(32, 32)
|
||||
self.closeButton:setRadius(0)
|
||||
self.closeButton:setColor(Color(0, 0, 0))
|
||||
self.closeButton:setHoveredColor(Color(25, 25, 25))
|
||||
self.closeButton:setColorScheme(colorScheme)
|
||||
self.closeButton.onClick = function()
|
||||
self:close()
|
||||
end
|
||||
self:addChild(self.closeButton)
|
||||
|
||||
self:setTitle("Panel")
|
||||
self:setColorScheme({
|
||||
border = {
|
||||
Color(255, 255, 255, 10)
|
||||
},
|
||||
header = {
|
||||
Color(0, 0, 0)
|
||||
},
|
||||
bg = {
|
||||
Color(23, 23, 23)
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
function EPanel:setTitle(title)
|
||||
@@ -57,6 +79,16 @@ function EPanel:isMinimized()
|
||||
return self._minimized
|
||||
end
|
||||
|
||||
function EPanel:close()
|
||||
self:setVisible(false)
|
||||
self:setEnabled(false)
|
||||
end
|
||||
|
||||
function EPanel:open()
|
||||
self:setVisible(false)
|
||||
self:setEnabled(false)
|
||||
end
|
||||
|
||||
function EPanel:onMousePressed(x, y, key, keyName)
|
||||
if keyName == "MOUSE1" then
|
||||
local aX, aY = self:getAbsolutePos()
|
||||
@@ -97,16 +129,13 @@ function EPanel:performLayout(w, h)
|
||||
self.minimizeButton:setPos(w - 65, 1)
|
||||
end
|
||||
|
||||
function EPanel:paint()
|
||||
local x, y = self:getAbsolutePos()
|
||||
local w, h = self:getSize()
|
||||
|
||||
render.setColor(Color(255, 255, 255, 10))
|
||||
function EPanel:paint(x, y, w, h)
|
||||
render.setColor(self:getColorFromScheme("border"))
|
||||
render.drawRectFast(x, y, w, h)
|
||||
|
||||
render.setColor(Color(0, 0, 0))
|
||||
render.setColor(self:getColorFromScheme("header"))
|
||||
render.drawRectFast(x + 1, y + 1, w - 2, 32)
|
||||
|
||||
render.setColor(self:getBackgroundColor())
|
||||
render.setColor(self:getColorFromScheme("bg"))
|
||||
render.drawRectFast(x + 1, y + 33, w - 2, h - 34)
|
||||
end
|
||||
Reference in New Issue
Block a user