Some changes
-reworked monitor support -fixed small draw bugs -changed focus behaviour -added some events -fixed offset bug -added border -added shadow -reworkd anchor system -added possibility to remove background by setting the value to false
This commit is contained in:
@@ -35,9 +35,11 @@ local function Button(name)
|
||||
local obx, oby = self:getAnchorPosition()
|
||||
local verticalAlign = getTextVerticalAlign(self.height, textVerticalAlign)
|
||||
|
||||
self.parent:drawBackgroundBox(obx, oby, self.width, self.height, self.bgColor)
|
||||
self.parent:drawForegroundBox(obx, oby, self.width, self.height, self.fgColor)
|
||||
self.parent:drawTextBox(obx, oby, self.width, self.height, " ")
|
||||
if(self.bgColor~=false)then
|
||||
self.parent:drawBackgroundBox(obx, oby, self.width, self.height, self.bgColor)
|
||||
self.parent:drawTextBox(obx, oby, self.width, self.height, " ")
|
||||
end
|
||||
if(self.fgColor~=false)then self.parent:drawForegroundBox(obx, oby, self.width, self.height, self.fgColor) end
|
||||
for n = 1, self.height do
|
||||
if (n == verticalAlign) then
|
||||
self.parent:setText(obx, oby + (n - 1), getTextHorizontalAlign(self:getValue(), self.width, textHorizontalAlign))
|
||||
|
||||
@@ -37,7 +37,7 @@ local function Checkbox(name)
|
||||
local obx, oby = self:getAnchorPosition()
|
||||
local verticalAlign = getTextVerticalAlign(self.height, "center")
|
||||
|
||||
self.parent:drawBackgroundBox(obx, oby, self.width, self.height, self.bgColor)
|
||||
if(self.bgColor~=false)then self.parent:drawBackgroundBox(obx, oby, self.width, self.height, self.bgColor) end
|
||||
for n = 1, self.height do
|
||||
if (n == verticalAlign) then
|
||||
if (self:getValue() == true) then
|
||||
|
||||
@@ -140,7 +140,7 @@ local function Dropdown(name)
|
||||
if (base.draw(self)) then
|
||||
local obx, oby = self:getAnchorPosition()
|
||||
if (self.parent ~= nil) then
|
||||
self.parent:drawBackgroundBox(obx, oby, self.width, self.height, self.bgColor)
|
||||
if(self.bgColor~=false)then self.parent:drawBackgroundBox(obx, oby, self.width, self.height, self.bgColor) end
|
||||
local val = self:getValue()
|
||||
local text = getTextHorizontalAlign((val~=nil and val.text or ""), self.width, align):sub(1, self.width - 1) .. (isOpened and openedSymbol or closedSymbol)
|
||||
self.parent:writeText(obx, oby, text, self.bgColor, self.fgColor)
|
||||
|
||||
@@ -142,7 +142,7 @@ local function Image(name)
|
||||
|
||||
loadBlittleImage = function(self, path) -- not done yet
|
||||
--image = paintutils.loadImage(path)
|
||||
imageGotShrinked = true
|
||||
--imageGotShrinked = true
|
||||
return self
|
||||
end;
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ local function Input(name)
|
||||
local obx, oby = self:getAnchorPosition()
|
||||
showingText = ""
|
||||
if (self.parent ~= nil) then
|
||||
self.parent:setCursor(true, obx + textX - wIndex, oby, self.fgColor)
|
||||
self.parent:setCursor(true, obx + textX - wIndex, oby+math.floor(self.height/2), self.fgColor)
|
||||
end
|
||||
end
|
||||
end;
|
||||
@@ -181,7 +181,7 @@ local function Input(name)
|
||||
cursorX = self.x + self.width - 1
|
||||
end
|
||||
if (self.parent ~= nil) then
|
||||
self.parent:setCursor(true, obx + cursorX, oby, self.fgColor)
|
||||
self.parent:setCursor(true, obx + cursorX, oby+math.floor(self.height/2), self.fgColor)
|
||||
end
|
||||
internalValueChange = false
|
||||
end
|
||||
@@ -203,7 +203,7 @@ local function Input(name)
|
||||
local obx, oby = self:getAnchorPosition()
|
||||
local verticalAlign = getTextVerticalAlign(self.height, "center")
|
||||
|
||||
self.parent:drawBackgroundBox(obx, oby, self.width, self.height, self.bgColor)
|
||||
if(self.bgColor~=false)then self.parent:drawBackgroundBox(obx, oby, self.width, self.height, self.bgColor) end
|
||||
for n = 1, self.height do
|
||||
if (n == verticalAlign) then
|
||||
local val = tostring(base.getValue())
|
||||
|
||||
@@ -57,9 +57,10 @@ local function Label(name)
|
||||
if (self.parent ~= nil) then
|
||||
local obx, oby = self:getAnchorPosition()
|
||||
local verticalAlign = getTextVerticalAlign(self.height, textVerticalAlign)
|
||||
self.parent:drawBackgroundBox(obx, oby, self.width, self.height, self.bgColor)
|
||||
self.parent:drawForegroundBox(obx, oby, self.width, self.height, self.fgColor)
|
||||
self.parent:drawTextBox(obx, oby, self.width, self.height, " ")
|
||||
if(self.bgColor~=false)then
|
||||
self.parent:drawBackgroundBox(obx, oby, self.width, self.height, self.bgColor)
|
||||
self.parent:drawTextBox(obx, oby, self.width, self.height, " ") end
|
||||
if(self.bgColor~=false)then self.parent:drawForegroundBox(obx, oby, self.width, self.height, self.fgColor) end
|
||||
if(fontsize==0)then
|
||||
for n = 1, self.height do
|
||||
if (n == verticalAlign) then
|
||||
|
||||
@@ -135,7 +135,9 @@ local function List(name)
|
||||
if (base.draw(self)) then
|
||||
if (self.parent ~= nil) then
|
||||
local obx, oby = self:getAnchorPosition()
|
||||
self.parent:drawBackgroundBox(obx, oby, self.width, self.height, self.bgColor)
|
||||
if(self.bgColor~=false)then
|
||||
self.parent:drawBackgroundBox(obx, oby, self.width, self.height, self.bgColor)
|
||||
end
|
||||
for n = 1, self.height do
|
||||
if (list[n + yOffset] ~= nil) then
|
||||
if (list[n + yOffset] == self:getValue()) then
|
||||
|
||||
@@ -170,7 +170,9 @@ local function Menubar(name)
|
||||
if (base.draw(self)) then
|
||||
if (self.parent ~= nil) then
|
||||
local obx, oby = self:getAnchorPosition()
|
||||
self.parent:drawBackgroundBox(obx, oby, self.width, self.height, self.bgColor)
|
||||
if(self.bgColor~=false)then
|
||||
self.parent:drawBackgroundBox(obx, oby, self.width, self.height, self.bgColor)
|
||||
end
|
||||
local text = ""
|
||||
local textBGCol = ""
|
||||
local textFGCol = ""
|
||||
|
||||
@@ -543,6 +543,7 @@ local function Program(name)
|
||||
if not (paused) then
|
||||
local absX, absY = self:getAbsolutePosition(self:getAnchorPosition(nil, nil, true))
|
||||
curProcess:resume(event, button, x - (absX - 1), y - (absY - 1))
|
||||
basalt.debug(event, button, x - (absX - 1), y - (absY - 1))
|
||||
end
|
||||
end
|
||||
return true
|
||||
@@ -630,7 +631,9 @@ local function Program(name)
|
||||
if (self.parent ~= nil) then
|
||||
local obx, oby = self:getAnchorPosition()
|
||||
pWindow.basalt_reposition(obx, oby)
|
||||
self.parent:drawBackgroundBox(obx, oby, self.width, self.height, self.bgColor)
|
||||
if(self.bgColor~=false)then
|
||||
self.parent:drawBackgroundBox(obx, oby, self.width, self.height, self.bgColor)
|
||||
end
|
||||
pWindow.basalt_update()
|
||||
end
|
||||
self:setVisualChanged(false)
|
||||
|
||||
@@ -312,8 +312,12 @@ local function Textfield(name)
|
||||
if (base.draw(self)) then
|
||||
if (self.parent ~= nil) then
|
||||
local obx, oby = self:getAnchorPosition()
|
||||
self.parent:drawBackgroundBox(obx, oby, self.width, self.height, self.bgColor)
|
||||
self.parent:drawForegroundBox(obx, oby, self.width, self.height, self.fgColor)
|
||||
if(self.bgColor~=false)then
|
||||
self.parent:drawBackgroundBox(obx, oby, self.width, self.height, self.bgColor)
|
||||
end
|
||||
if(self.fgColor~=false)then
|
||||
self.parent:drawForegroundBox(obx, oby, self.width, self.height, self.fgColor)
|
||||
end
|
||||
for n = 1, self.height do
|
||||
local text = ""
|
||||
if (lines[n + hIndex - 1] ~= nil) then
|
||||
|
||||
Reference in New Issue
Block a user