shadow properties

This commit is contained in:
airstruck
2015-11-02 23:38:51 -05:00
parent f436093380
commit 997f9c8d12
103 changed files with 88 additions and 62 deletions

View File

@@ -1,3 +1,5 @@
function love.conf (t)
t.window.resizable = true
end
love.filesystem.setSymlinksEnabled(true)

Binary file not shown.

After

Width:  |  Height:  |  Size: 546 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 618 B

BIN
example/icon/16px/Book.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 627 B

BIN
example/icon/16px/Box.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 737 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 543 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 722 B

BIN
example/icon/16px/Chat.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 655 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 466 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 640 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 685 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 443 B

BIN
example/icon/16px/Crate.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 685 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 418 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 558 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 661 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 512 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 522 B

BIN
example/icon/16px/Inbox.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 565 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 580 B

BIN
example/icon/16px/Mail.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 429 B

BIN
example/icon/16px/Map.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 583 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 B

BIN
example/icon/16px/Phone.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

BIN
example/icon/16px/Photo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 567 B

BIN
example/icon/16px/Radar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 543 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 454 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 437 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 612 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 514 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 374 B

BIN
example/icon/16px/Wand.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 671 B

BIN
example/icon/16px/iChat.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 648 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
example/icon/32px/Book.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
example/icon/32px/Box.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 993 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1000 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
example/icon/32px/Chat.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

BIN
example/icon/32px/Crate.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 713 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 901 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
example/icon/32px/Inbox.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1015 B

BIN
example/icon/32px/Mail.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 751 B

BIN
example/icon/32px/Map.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 637 B

BIN
example/icon/32px/Phone.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
example/icon/32px/Photo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
example/icon/32px/Radar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 907 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 806 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 897 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 638 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 550 B

BIN
example/icon/32px/Wand.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
example/icon/32px/iChat.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

5
example/icon/readme Normal file
View File

@@ -0,0 +1,5 @@
Aurora by MannMitDerTarnjacke
39 icons in .png and .ico format, 16px and 32px.
Free for personal and commercial use!
http://mannmitdertarnjacke.deviantart.com/art/Aurora-287069107

View File

@@ -1,5 +1,3 @@
love.filesystem.setSymlinksEnabled(true) -- for older love versions
local Layout = require 'luigi.layout'
local style = {
@@ -34,18 +32,18 @@ local style = {
height = 120,
padding = 8,
background = { 255, 255, 255 },
icon = 'icon/emblem-system.png',
icon = 'icon/32px/Box.png',
},
}
local mainForm = { title = "Test window", id = 'mainWindow', type = 'panel',
{ type = 'panel', id = 'toolbar', flow = 'x',
{ type = 'button', id = 'newButton', style = 'toolButton', key = 'z',
icon = 'icon/emblem-default.png' },
icon = 'icon/32px/Blueprint.png' },
{ type = 'button', id = 'loadButton', style = 'toolButton',
icon = 'icon/emblem-documents.png' },
icon = 'icon/32px/Calendar.png' },
{ type = 'button', id = 'saveButton', style = 'toolButton',
icon = 'icon/emblem-downloads.png' },
icon = 'icon/32px/Harddrive.png' },
},
{ flow = 'x',
{ id = 'leftSideBox', width = 200,
@@ -76,7 +74,8 @@ local mainForm = { title = "Test window", id = 'mainWindow', type = 'panel',
{ type = 'sash', height = 4, },
{ type = 'panel', flow = 'x', height = 48, padding = 2,
{ type = 'text', id = 'aTextField', text = 'a text field' },
{ type = 'button', key='return', width = 80, id = 'aButton', text = 'Styling!' },
{ type = 'button', key='return', width = 80, id = 'aButton', text = 'Styling!',
font = 'font/liberation/LiberationMono-Regular.ttf' },
},
{ type = 'panel', id = 'statusbar', height = 24, padding = 4, textColor = { 255, 0, 0 } },
}
@@ -94,26 +93,8 @@ layout.leftSideBox:addChild {
layout.slidey:onChange(function (event)
layout.progressBar:setValue(event.value)
layout.progressBar:reshape()
end)
--[[
local KEY_ESCAPE = 27
layout:onKeyboard(function(event)
if event.key == KEY_ESCAPE then
layout.window:destroy()
os.exit(0)
end
if key == GLUT_KEY_F11 then
glutFullScreen()
end
if key == GLUT_KEY_F12 then
glutPositionWindow(-1, -1)
end
end)
]]
layout:onMove(function (event)
local w = event.target
layout.statusbar.text = (w.id or '(unnamed)') .. ' ' ..
@@ -130,7 +111,11 @@ layout.newButton:onPress(function (event)
print('creating a new thing!')
end)
layout.mainCanvas.font = 'font/liberation/LiberationMono-Regular.ttf'
layout.aButton:onPress(function (event)
layout.aButton.font = nil
end)
layout.mainCanvas.font = 'font/liberation/LiberationMono-Regular.ttf'
layout.mainCanvas.text = [[Abedede sdfsdf asfdsdfdsfs sdfsdfsdf
sfsdfdfbv db er erg rth tryj ty j fgh dfgv

View File

@@ -11,15 +11,15 @@ local Layout = Base:extend()
function Layout:constructor (data)
self.accelerators = {}
self:addDefaultHandlers()
self:setStyle()
self:setTheme(require(ROOT .. 'theme.light'))
self.isMousePressed = false
self.isManagingInput = false
self.hooks = {}
self.root = Widget(self, data)
self:addDefaultHandlers()
self.root = data or {}
Widget(self, self.root)
end
-- focus a widget if it's focusable, and return success

View File

@@ -1,6 +1,7 @@
local ROOT = (...):gsub('[^.]*$', '')
local Event = require(ROOT .. 'event')
local Font = require(ROOT .. 'font')
local Widget = {}
@@ -23,30 +24,49 @@ end
local function new (Widget, layout, self)
self = self or {}
self.type = self.type or 'generic'
self.layout = layout
self.children = {}
self.position = { x = nil, y = nil }
self.dimensions = { width = nil, height = nil }
self.shadowProperties = {}
for _, property in ipairs { 'font', 'fontSize', 'textColor' } do
self.shadowProperties[property] = self[property]
self[property] = nil
end
local meta = setmetatable(self, {
__index = function (self, property)
local value = self.shadowProperties[property]
if value ~= nil then return value end
local value = Widget[property]
if value ~= nil then return value end
local style = self.layout.style
value = style and style:getProperty(self, property)
if value ~= nil and value ~= 'defer' then return value end
local theme = self.layout.theme
return theme and theme:getProperty(self, property)
end,
__newindex = function (self, property, value)
if property == 'font'
or property == 'fontSize'
or property == 'textColor' then
rawset(self.shadowProperties, property, value)
self.fontData = Font(self.font, self.fontSize, self.textColor)
return
end
rawset(self, property, value)
end
})
layout:addWidget(self)
self.type = self.type or 'generic'
self.fontData = Font(self.font, self.fontSize, self.textColor)
for k, v in ipairs(self) do
self.children[k] = v.isWidget and v or new(Widget, self.layout, v)
self.children[k].parent = self
end
layout:addWidget(self)
local decorate = Widget.typeDecorators[self.type]
@@ -54,6 +74,11 @@ local function new (Widget, layout, self)
decorate(self)
end
for k, v in ipairs(self) do
self.children[k] = v.isWidget and v or new(Widget, self.layout, v)
self.children[k].parent = self
end
return self
end
@@ -116,7 +141,8 @@ function Widget:calculateDimension (name)
local min = (name == 'width') and (self.minimumWidth or 0)
or (self.minimumHeight or 0)
local max = self.layout.root[name]
local max = name == 'width' and love.graphics.getWidth()
or love.graphics.getHeight()
if self[name] then
self.dimensions[name] = clamp(self[name], min, max)

Some files were not shown because too many files have changed in this diff Show More