New properties: skin.controls.smallfont and skin.controls.imagebuttonfont

This commit is contained in:
João Lopes 2020-04-28 17:50:42 +01:00
parent 5d2bbd3695
commit d34874e892
3 changed files with 23 additions and 17 deletions

View File

@ -1,3 +1,8 @@
================================================
Version 11.3 - Alpha (Apr 28 - 2020)
================================================
[ADDED] New properties: skin.controls.smallfont and skin.controls.imagebuttonfont
================================================ ================================================
Version 11.2 - Alpha (Mar 6 - 2019) Version 11.2 - Alpha (Mar 6 - 2019)
================================================ ================================================

View File

@ -14,8 +14,6 @@ skin.name = "Blue"
skin.author = "Nikolai Resokav" skin.author = "Nikolai Resokav"
skin.version = "1.0" skin.version = "1.0"
local smallfont = love.graphics.newFont(10)
local imagebuttonfont = love.graphics.newFont(15)
local bordercolor = {0.56, 0.56, 0.56, 1} local bordercolor = {0.56, 0.56, 0.56, 1}
-- add skin directives to this table -- add skin directives to this table
@ -23,24 +21,26 @@ skin.directives = {}
-- controls -- controls
skin.controls = {} skin.controls = {}
skin.controls.smallfont = love.graphics.newFont(11)
skin.controls.imagebuttonfont = love.graphics.newFont(15)
-- frame -- frame
skin.controls.frame_body_color = {0.91, 0.91, 0.91, 1} skin.controls.frame_body_color = {0.91, 0.91, 0.91, 1}
skin.controls.frame_name_color = {1, 1, 1, 1} skin.controls.frame_name_color = {1, 1, 1, 1}
skin.controls.frame_name_font = smallfont skin.controls.frame_name_font = skin.controls.smallfont
-- button -- button
skin.controls.button_text_down_color = {1, 1, 1, 1} skin.controls.button_text_down_color = {1, 1, 1, 1}
skin.controls.button_text_nohover_color = {0, 0, 0, 0.78} skin.controls.button_text_nohover_color = {0, 0, 0, 0.78}
skin.controls.button_text_hover_color = {1, 1, 1, 1} skin.controls.button_text_hover_color = {1, 1, 1, 1}
skin.controls.button_text_nonclickable_color = {0, 0, 0, 0.39} skin.controls.button_text_nonclickable_color = {0, 0, 0, 0.39}
skin.controls.button_text_font = smallfont skin.controls.button_text_font = skin.controls.smallfont
-- imagebutton -- imagebutton
skin.controls.imagebutton_text_down_color = {1, 1, 1, 1} skin.controls.imagebutton_text_down_color = {1, 1, 1, 1}
skin.controls.imagebutton_text_nohover_color = {1, 1, 1, 0.78} skin.controls.imagebutton_text_nohover_color = {1, 1, 1, 0.78}
skin.controls.imagebutton_text_hover_color = {1, 1, 1, 1} skin.controls.imagebutton_text_hover_color = {1, 1, 1, 1}
skin.controls.imagebutton_text_font = imagebuttonfont skin.controls.imagebutton_text_font = skin.controls.imagebuttonfont
-- closebutton -- closebutton
skin.controls.closebutton_body_down_color = {1, 1, 1, 1} skin.controls.closebutton_body_down_color = {1, 1, 1, 1}
@ -50,7 +50,7 @@ skin.controls.closebutton_body_hover_color = {1, 1, 1, 1}
-- progressbar -- progressbar
skin.controls.progressbar_body_color = {1, 1, 1, 1} skin.controls.progressbar_body_color = {1, 1, 1, 1}
skin.controls.progressbar_text_color = {0, 0, 0, 1} skin.controls.progressbar_text_color = {0, 0, 0, 1}
skin.controls.progressbar_text_font = smallfont skin.controls.progressbar_text_font = skin.controls.smallfont
-- list -- list
skin.controls.list_body_color = {0.91, 0.91, 0.91, 1} skin.controls.list_body_color = {0.91, 0.91, 0.91, 1}
@ -70,12 +70,12 @@ skin.controls.tabpanel_body_color = {0.91, 0.91, 0.91, 1}
-- tabbutton -- tabbutton
skin.controls.tab_text_nohover_color = {0, 0, 0, 0.78} skin.controls.tab_text_nohover_color = {0, 0, 0, 0.78}
skin.controls.tab_text_hover_color = {1, 1, 1, 1} skin.controls.tab_text_hover_color = {1, 1, 1, 1}
skin.controls.tab_text_font = smallfont skin.controls.tab_text_font = skin.controls.smallfont
-- multichoice -- multichoice
skin.controls.multichoice_body_color = {0.94, 0.94, 0.94, 1} skin.controls.multichoice_body_color = {0.94, 0.94, 0.94, 1}
skin.controls.multichoice_text_color = {0, 0, 0, 1} skin.controls.multichoice_text_color = {0, 0, 0, 1}
skin.controls.multichoice_text_font = smallfont skin.controls.multichoice_text_font = skin.controls.smallfont
-- multichoicelist -- multichoicelist
skin.controls.multichoicelist_body_color = {0.94, 0.94, 0.94, 0.78} skin.controls.multichoicelist_body_color = {0.94, 0.94, 0.94, 0.78}
@ -85,7 +85,7 @@ skin.controls.multichoicerow_body_nohover_color = {0.94, 0.94, 0.94, 1}
skin.controls.multichoicerow_body_hover_color = {0.2, 0.8, 1, 1} skin.controls.multichoicerow_body_hover_color = {0.2, 0.8, 1, 1}
skin.controls.multichoicerow_text_nohover_color = {0, 0, 0, 0.59} skin.controls.multichoicerow_text_nohover_color = {0, 0, 0, 0.59}
skin.controls.multichoicerow_text_hover_color = {1, 1, 1, 1} skin.controls.multichoicerow_text_hover_color = {1, 1, 1, 1}
skin.controls.multichoicerow_text_font = smallfont skin.controls.multichoicerow_text_font = skin.controls.smallfont
-- tooltip -- tooltip
skin.controls.tooltip_body_color = {1, 1, 1, 1} skin.controls.tooltip_body_color = {1, 1, 1, 1}
@ -104,13 +104,13 @@ skin.controls.slider_bar_outline_color = {0.86, 0.86, 0.86, 1}
-- checkbox -- checkbox
skin.controls.checkbox_body_color = {1, 1, 1, 1} skin.controls.checkbox_body_color = {1, 1, 1, 1}
skin.controls.checkbox_check_color = {0.5, 0.8, 1, 1} skin.controls.checkbox_check_color = {0.5, 0.8, 1, 1}
skin.controls.checkbox_text_font = smallfont skin.controls.checkbox_text_font = skin.controls.smallfont
-- radiobutton -- radiobutton
skin.controls.radiobutton_body_color = {1, 1, 1, 1} skin.controls.radiobutton_body_color = {1, 1, 1, 1}
skin.controls.radiobutton_check_color = {0.5, 0.8, 1, 1} skin.controls.radiobutton_check_color = {0.5, 0.8, 1, 1}
skin.controls.radiobutton_inner_border_color = {0.3, 0.72, 1, 1} skin.controls.radiobutton_inner_border_color = {0.3, 0.72, 1, 1}
skin.controls.radiobutton_text_font = smallfont skin.controls.radiobutton_text_font = skin.controls.smallfont
-- collapsiblecategory -- collapsiblecategory
skin.controls.collapsiblecategory_text_color = {1, 1, 1, 1} skin.controls.collapsiblecategory_text_color = {1, 1, 1, 1}
@ -125,7 +125,7 @@ skin.controls.columnlistarea_body_color = {0.91, 0.91, 0.91, 1}
skin.controls.columnlistheader_text_down_color = {1, 1, 1, 1} skin.controls.columnlistheader_text_down_color = {1, 1, 1, 1}
skin.controls.columnlistheader_text_nohover_color = {0, 0, 0, 0.78} skin.controls.columnlistheader_text_nohover_color = {0, 0, 0, 0.78}
skin.controls.columnlistheader_text_hover_color = {1, 1, 1, 1} skin.controls.columnlistheader_text_hover_color = {1, 1, 1, 1}
skin.controls.columnlistheader_text_font = smallfont skin.controls.columnlistheader_text_font = skin.controls.smallfont
-- columnlistrow -- columnlistrow
skin.controls.columnlistrow_body1_color = {0.96, 0.96, 0.96, 1} skin.controls.columnlistrow_body1_color = {0.96, 0.96, 0.96, 1}
@ -148,7 +148,7 @@ skin.controls.grid_body_color = {0.9, 0.9, 0.9, 1}
-- form -- form
skin.controls.form_text_color = {0, 0, 0, 1} skin.controls.form_text_color = {0, 0, 0, 1}
skin.controls.form_text_font = smallfont skin.controls.form_text_font = skin.controls.smallfont
-- menu -- menu
skin.controls.menu_body_color = {1, 1, 1, 1} skin.controls.menu_body_color = {1, 1, 1, 1}
@ -1576,7 +1576,7 @@ function skin.collapsiblecategory(object)
local text = object:GetText() local text = object:GetText()
local open = object:GetOpen() local open = object:GetOpen()
local textcolor = skin.controls.collapsiblecategory_text_color local textcolor = skin.controls.collapsiblecategory_text_color
local font = smallfont local font = skin.controls.smallfont
local image = skin.images["button-nohover.png"] local image = skin.images["button-nohover.png"]
local topbarimage = skin.images["frame-topbar.png"] local topbarimage = skin.images["frame-topbar.png"]
local topbarimage_width = topbarimage:getWidth() local topbarimage_width = topbarimage:getWidth()
@ -2003,7 +2003,7 @@ function skin.menuoption(object)
local body_hover_color = skin.controls.menuoption_body_hover_color local body_hover_color = skin.controls.menuoption_body_hover_color
local text_hover_color = skin.controls.menuoption_text_hover_color local text_hover_color = skin.controls.menuoption_text_hover_color
local text_color = skin.controls.menuoption_text_color local text_color = skin.controls.menuoption_text_color
local twidth = smallfont:getWidth(text) local twidth = skin.controls.smallfont:getWidth(text)
if option_type == "divider" then if option_type == "divider" then
@ -2011,7 +2011,7 @@ function skin.menuoption(object)
love.graphics.rectangle("fill", x + 4, y + 2, width - 8, 1) love.graphics.rectangle("fill", x + 4, y + 2, width - 8, 1)
object.contentheight = 10 object.contentheight = 10
else else
love.graphics.setFont(smallfont) love.graphics.setFont(skin.controls.smallfont)
if hover then if hover then
love.graphics.setColor(body_hover_color) love.graphics.setColor(body_hover_color)
love.graphics.rectangle("fill", x + 2, y + 2, width - 4, height - 4) love.graphics.rectangle("fill", x + 2, y + 2, width - 4, height - 4)

View File

@ -19,6 +19,7 @@ local color = function(s, a) return {loveframes.Color(s, a)} end
-- Controls -- Controls
skin.controls = {} skin.controls = {}
skin.controls.smallfont = love.graphics.newFont(11) skin.controls.smallfont = love.graphics.newFont(11)
skin.controls.imagebuttonfont = love.graphics.newFont(15)
skin.controls.color_image = color"FFFFFF" skin.controls.color_image = color"FFFFFF"
skin.controls.color_back0 = color"f0f0f0" skin.controls.color_back0 = color"f0f0f0"
@ -343,7 +344,7 @@ function skin.imagebutton(object)
local image = object:GetImage() local image = object:GetImage()
local imagecolor = object.imagecolor or skin.controls.color_image local imagecolor = object.imagecolor or skin.controls.color_image
local down = object.down local down = object.down
local font = skin.controls.smallfont local font = skin.controls.imagebuttonfont
local twidth = font:getWidth(object.text) local twidth = font:getWidth(object.text)
local theight = font:getHeight(object.text) local theight = font:getHeight(object.text)
local checked = object.checked local checked = object.checked