Allowed for overrides of toolbar items, so plugins can add things if they want to with different fonts. (#1157)
This commit is contained in:
parent
f06580deee
commit
3627bc01cf
|
@ -48,7 +48,7 @@ end
|
||||||
|
|
||||||
function ToolbarView:get_icon_width()
|
function ToolbarView:get_icon_width()
|
||||||
local max_width = 0
|
local max_width = 0
|
||||||
for i,v in ipairs(self.toolbar_commands) do max_width = math.max(max_width, self.toolbar_font:get_width(v.symbol)) end
|
for i,v in ipairs(self.toolbar_commands) do max_width = math.max(max_width, (v.font or self.toolbar_font):get_width(v.symbol)) end
|
||||||
return max_width
|
return max_width
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ function ToolbarView:draw()
|
||||||
|
|
||||||
for item, x, y, w, h in self:each_item() do
|
for item, x, y, w, h in self:each_item() do
|
||||||
local color = item == self.hovered_item and command.is_valid(item.command) and style.text or style.dim
|
local color = item == self.hovered_item and command.is_valid(item.command) and style.text or style.dim
|
||||||
common.draw_text(self.toolbar_font, color, item.symbol, nil, x, y, 0, h)
|
common.draw_text(item.font or self.toolbar_font, color, item.symbol, nil, x, y, 0, h)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue