2017-04-26 14:21:36 +00:00
|
|
|
--[[--
|
|
|
|
Button with a big icon image! Designed for touch devices.
|
|
|
|
--]]
|
|
|
|
|
2022-12-26 18:23:05 +00:00
|
|
|
local BD = require("ui/bidi")
|
2017-09-28 19:26:16 +00:00
|
|
|
local Device = require("device")
|
2017-09-13 08:12:29 +00:00
|
|
|
local HorizontalGroup = require("ui/widget/horizontalgroup")
|
|
|
|
local HorizontalSpan = require("ui/widget/horizontalspan")
|
2013-10-18 20:38:07 +00:00
|
|
|
local InputContainer = require("ui/widget/container/inputcontainer")
|
2020-12-19 11:18:30 +00:00
|
|
|
local IconWidget = require("ui/widget/iconwidget")
|
2013-10-18 20:38:07 +00:00
|
|
|
local GestureRange = require("ui/gesturerange")
|
|
|
|
local UIManager = require("ui/uimanager")
|
2017-09-27 16:15:11 +00:00
|
|
|
local VerticalGroup = require("ui/widget/verticalgroup")
|
|
|
|
local VerticalSpan = require("ui/widget/verticalspan")
|
2020-12-19 11:18:30 +00:00
|
|
|
local Screen = Device.screen
|
2013-03-14 02:52:09 +00:00
|
|
|
|
2022-09-27 23:10:50 +00:00
|
|
|
local DGENERIC_ICON_SIZE = G_defaults:readSetting("DGENERIC_ICON_SIZE")
|
|
|
|
|
Clarify our OOP semantics across the codebase (#9586)
Basically:
* Use `extend` for class definitions
* Use `new` for object instantiations
That includes some minor code cleanups along the way:
* Updated `Widget`'s docs to make the semantics clearer.
* Removed `should_restrict_JIT` (it's been dead code since https://github.com/koreader/android-luajit-launcher/pull/283)
* Minor refactoring of LuaSettings/LuaData/LuaDefaults/DocSettings to behave (mostly, they are instantiated via `open` instead of `new`) like everything else and handle inheritance properly (i.e., DocSettings is now a proper LuaSettings subclass).
* Default to `WidgetContainer` instead of `InputContainer` for stuff that doesn't actually setup key/gesture events.
* Ditto for explicit `*Listener` only classes, make sure they're based on `EventListener` instead of something uselessly fancier.
* Unless absolutely necessary, do not store references in class objects, ever; only values. Instead, always store references in instances, to avoid both sneaky inheritance issues, and sneaky GC pinning of stale references.
* ReaderUI: Fix one such issue with its `active_widgets` array, with critical implications, as it essentially pinned *all* of ReaderUI's modules, including their reference to the `Document` instance (i.e., that was a big-ass leak).
* Terminal: Make sure the shell is killed on plugin teardown.
* InputText: Fix Home/End/Del physical keys to behave sensibly.
* InputContainer/WidgetContainer: If necessary, compute self.dimen at paintTo time (previously, only InputContainers did, which might have had something to do with random widgets unconcerned about input using it as a baseclass instead of WidgetContainer...).
* OverlapGroup: Compute self.dimen at *init* time, because for some reason it needs to do that, but do it directly in OverlapGroup instead of going through a weird WidgetContainer method that it was the sole user of.
* ReaderCropping: Under no circumstances should a Document instance member (here, self.bbox) risk being `nil`ed!
* Kobo: Minor code cleanups.
2022-10-06 00:14:48 +00:00
|
|
|
local IconButton = InputContainer:extend{
|
2020-12-19 11:18:30 +00:00
|
|
|
icon = "notice-warning",
|
2022-01-10 18:14:45 +00:00
|
|
|
icon_rotation_angle = 0,
|
2014-03-13 13:52:43 +00:00
|
|
|
dimen = nil,
|
|
|
|
-- show_parent is used for UIManager:setDirty, so we can trigger repaint
|
|
|
|
show_parent = nil,
|
2020-12-19 11:18:30 +00:00
|
|
|
width = Screen:scaleBySize(DGENERIC_ICON_SIZE), -- our icons are square
|
|
|
|
height = Screen:scaleBySize(DGENERIC_ICON_SIZE),
|
2017-09-27 16:15:11 +00:00
|
|
|
padding = 0,
|
|
|
|
padding_top = nil,
|
|
|
|
padding_right = nil,
|
|
|
|
padding_bottom = nil,
|
|
|
|
padding_left = nil,
|
2017-09-28 19:26:16 +00:00
|
|
|
enabled = true,
|
|
|
|
callback = nil,
|
2022-01-08 15:58:30 +00:00
|
|
|
allow_flash = true, -- set to false for any IconButton that may close its container
|
2013-03-14 02:52:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function IconButton:init()
|
2020-12-19 11:18:30 +00:00
|
|
|
self.image = IconWidget:new{
|
|
|
|
icon = self.icon,
|
2022-01-10 18:14:45 +00:00
|
|
|
rotation_angle = self.icon_rotation_angle,
|
2017-09-23 20:01:30 +00:00
|
|
|
width = self.width,
|
|
|
|
height = self.height,
|
2014-03-13 13:52:43 +00:00
|
|
|
}
|
2013-03-14 02:52:09 +00:00
|
|
|
|
2014-03-13 13:52:43 +00:00
|
|
|
self.show_parent = self.show_parent or self
|
2013-03-14 02:52:09 +00:00
|
|
|
|
2017-09-27 16:15:11 +00:00
|
|
|
self.horizontal_group = HorizontalGroup:new{}
|
|
|
|
table.insert(self.horizontal_group, HorizontalSpan:new{})
|
|
|
|
table.insert(self.horizontal_group, self.image)
|
|
|
|
table.insert(self.horizontal_group, HorizontalSpan:new{})
|
|
|
|
|
|
|
|
self.button = VerticalGroup:new{}
|
|
|
|
table.insert(self.button, VerticalSpan:new{})
|
|
|
|
table.insert(self.button, self.horizontal_group)
|
|
|
|
table.insert(self.button, VerticalSpan:new{})
|
2017-09-13 08:12:29 +00:00
|
|
|
|
|
|
|
self[1] = self.button
|
|
|
|
self:update()
|
|
|
|
end
|
|
|
|
|
|
|
|
function IconButton:update()
|
2017-09-27 16:15:11 +00:00
|
|
|
if not self.padding_top then self.padding_top = self.padding end
|
|
|
|
if not self.padding_right then self.padding_right = self.padding end
|
|
|
|
if not self.padding_bottom then self.padding_bottom = self.padding end
|
|
|
|
if not self.padding_left then self.padding_left = self.padding end
|
|
|
|
|
|
|
|
self.horizontal_group[1].width = self.padding_left
|
|
|
|
self.horizontal_group[3].width = self.padding_right
|
2017-09-13 08:12:29 +00:00
|
|
|
self.dimen = self.image:getSize()
|
2017-09-27 16:15:11 +00:00
|
|
|
self.dimen.w = self.dimen.w + self.padding_left+self.padding_right
|
2013-03-14 02:52:09 +00:00
|
|
|
|
2017-09-27 16:15:11 +00:00
|
|
|
self.button[1].width = self.padding_top
|
|
|
|
self.button[3].width = self.padding_bottom
|
|
|
|
self.dimen.h = self.dimen.h + self.padding_top+self.padding_bottom
|
|
|
|
self:initGesListener()
|
2013-03-14 02:52:09 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function IconButton:initGesListener()
|
2022-01-25 00:32:46 +00:00
|
|
|
self.ges_events = {
|
|
|
|
TapIconButton = {
|
|
|
|
GestureRange:new{
|
|
|
|
ges = "tap",
|
|
|
|
range = self.dimen,
|
2017-09-28 19:26:16 +00:00
|
|
|
},
|
2022-01-25 00:32:46 +00:00
|
|
|
},
|
|
|
|
HoldIconButton = {
|
|
|
|
GestureRange:new{
|
|
|
|
ges = "hold",
|
|
|
|
range = self.dimen,
|
2022-01-08 15:58:30 +00:00
|
|
|
},
|
2022-01-25 00:32:46 +00:00
|
|
|
},
|
|
|
|
HoldReleaseIconButton = {
|
|
|
|
GestureRange:new{
|
|
|
|
ges = "hold_release",
|
|
|
|
range = self.dimen,
|
|
|
|
},
|
2017-09-28 19:26:16 +00:00
|
|
|
}
|
2022-01-25 00:32:46 +00:00
|
|
|
}
|
2013-03-14 02:52:09 +00:00
|
|
|
end
|
|
|
|
|
2017-09-28 19:26:16 +00:00
|
|
|
function IconButton:onTapIconButton()
|
2019-04-07 17:00:15 +00:00
|
|
|
if not self.callback then return end
|
2022-01-08 15:58:30 +00:00
|
|
|
if G_reader_settings:isFalse("flash_ui") or not self.allow_flash then
|
2014-03-13 13:52:43 +00:00
|
|
|
self.callback()
|
2017-10-10 21:50:45 +00:00
|
|
|
else
|
2022-12-26 18:23:05 +00:00
|
|
|
-- Mimic BiDi left/right switcheroos...
|
|
|
|
local h_padding
|
|
|
|
if BD.mirroredUILayout() then
|
|
|
|
h_padding = self.padding_right
|
|
|
|
else
|
|
|
|
h_padding = self.padding_left
|
|
|
|
end
|
Revamp flash_ui handling, once more, with feeling ;) (#7262)
* Simplify flash_ui handling (by handling the unhighlight pre-callback, c.f., #7262 for more details).
* UIManager: Handle translucent window-level widgets (and those wrapped in a translucent MovableContainer) properly in setDirty directly, making sure what's *underneath* them gets repainted to avoid alpha layering glitches. (This was previously handled via localized hacks).
* Update UIManager's documentation, and format it properly for ldoc parsing, making the HTML docs more useful.
* ReaderView: Reinitialize the various page areas when opening a new document, to prevent poisoning from the previous document.
* Event: Handle nils in an event's arguments.
* CheckButton/RadioButton: Switch to simple inversion to handle highlighting
* CheckButton: Make the highlight span the inner frame's width, instead of just the text's width, if possible.
* AlphaContainer: Fix & simplify, given the UIManager alpha handling.
* MovableContainer: When translucent, cache the canvas bb used for composition.
* Avoid spurious refreshes in a few widgets using various dummy *TextWidgets in order to first compute a text height.
* KeyValuePage: Avoid floats in size computations.
2021-02-20 17:22:48 +00:00
|
|
|
-- c.f., ui/widget/button for more gnarly details about the implementation, but the flow of the flash_ui codepath essentially goes like this:
|
|
|
|
-- 1. Paint the highlight
|
|
|
|
-- 2. Refresh the highlighted item (so we can see the highlight)
|
|
|
|
-- 3. Paint the unhighlight
|
|
|
|
-- 4. Do NOT refresh the highlighted item, but enqueue a refresh request
|
|
|
|
-- 5. Run the callback
|
|
|
|
-- 6. Explicitly drain the paint & refresh queues; i.e., refresh (so we get to see both the callback results, and the unhighlight).
|
|
|
|
|
|
|
|
-- Highlight
|
|
|
|
--
|
2018-06-02 16:10:55 +00:00
|
|
|
self.image.invert = true
|
2022-12-26 18:23:05 +00:00
|
|
|
UIManager:widgetInvert(self.image, self.dimen.x + h_padding, self.dimen.y + self.padding_top)
|
Revamp flash_ui handling, once more, with feeling ;) (#7262)
* Simplify flash_ui handling (by handling the unhighlight pre-callback, c.f., #7262 for more details).
* UIManager: Handle translucent window-level widgets (and those wrapped in a translucent MovableContainer) properly in setDirty directly, making sure what's *underneath* them gets repainted to avoid alpha layering glitches. (This was previously handled via localized hacks).
* Update UIManager's documentation, and format it properly for ldoc parsing, making the HTML docs more useful.
* ReaderView: Reinitialize the various page areas when opening a new document, to prevent poisoning from the previous document.
* Event: Handle nils in an event's arguments.
* CheckButton/RadioButton: Switch to simple inversion to handle highlighting
* CheckButton: Make the highlight span the inner frame's width, instead of just the text's width, if possible.
* AlphaContainer: Fix & simplify, given the UIManager alpha handling.
* MovableContainer: When translucent, cache the canvas bb used for composition.
* Avoid spurious refreshes in a few widgets using various dummy *TextWidgets in order to first compute a text height.
* KeyValuePage: Avoid floats in size computations.
2021-02-20 17:22:48 +00:00
|
|
|
UIManager:setDirty(nil, "fast", self.dimen)
|
Revamp "flash_ui" handling (#7118)
* Wherever possible, do an actual dumb invert on the Screen BB instead of repainting the widget, *then* inverting it (which is what the "invert" flag does).
* Instead of playing with nextTick/tickAfterNext delays, explicitly fence stuff with forceRePaint
* And, in the few cases where said Mk. 7 quirk kicks in, make the fences more marked by using a well-placed WAIT_FOR_UPDATE_COMPLETE
* Fix an issue in Button where show/hide & enable/disable where actually all toggles, which meant that duplicate calls or timing issues would do the wrong thing. (This broke dimming some icons, and mistakenly dropped the background from FM chevrons, for example).
* Speaking of, fix Button's hide/show to actually restore the background properly (there was a stupid typo in the variable name)
* Still in Button, fix the insanity of the double repaint on rounded buttons. Turns out it made sense, after all (and was related to said missing background, and bad interaction with invert & text with no background).
* KeyValuePage suffered from a similar issue with broken highlights (all black) because of missing backgrounds.
* In ConfigDialog, only instanciate IconButtons once (because every tab switch causes a full instantiation; and the initial display implies a full instanciation and an initial tab switch). Otherwise, both instances linger, and catch taps, and as such, double highlights.
* ConfigDialog: Restore the "don't repaint ReaderUI" when switching between similarly sized tabs (re #6131). I never could reproduce that on eInk, and I can't now on the emulator, so I'm assuming @poire-z fixed it during the swap to SVG icons.
* KeyValuePage: Only instanciate Buttons once (again, this is a widget that goes through a full init every page). Again, caused highlight/dimming issues because buttons were stacked.
* Menu: Ditto.
* TouchMenu: Now home of the gnarliest unhilight heuristics, because of the sheer amount of different things that can happen (and/or thanks to stuff not flagged covers_fullscreen properly ;p).
* Bump base
https://github.com/koreader/koreader-base/pull/1280
https://github.com/koreader/koreader-base/pull/1282
https://github.com/koreader/koreader-base/pull/1283
https://github.com/koreader/koreader-base/pull/1284
* Bump android-luajit-launcher
https://github.com/koreader/android-luajit-launcher/pull/284
https://github.com/koreader/android-luajit-launcher/pull/285
https://github.com/koreader/android-luajit-launcher/pull/286
https://github.com/koreader/android-luajit-launcher/pull/287
2021-01-10 00:51:09 +00:00
|
|
|
|
|
|
|
UIManager:forceRePaint()
|
2021-02-22 01:09:44 +00:00
|
|
|
UIManager:yieldToEPDC()
|
Revamp "flash_ui" handling (#7118)
* Wherever possible, do an actual dumb invert on the Screen BB instead of repainting the widget, *then* inverting it (which is what the "invert" flag does).
* Instead of playing with nextTick/tickAfterNext delays, explicitly fence stuff with forceRePaint
* And, in the few cases where said Mk. 7 quirk kicks in, make the fences more marked by using a well-placed WAIT_FOR_UPDATE_COMPLETE
* Fix an issue in Button where show/hide & enable/disable where actually all toggles, which meant that duplicate calls or timing issues would do the wrong thing. (This broke dimming some icons, and mistakenly dropped the background from FM chevrons, for example).
* Speaking of, fix Button's hide/show to actually restore the background properly (there was a stupid typo in the variable name)
* Still in Button, fix the insanity of the double repaint on rounded buttons. Turns out it made sense, after all (and was related to said missing background, and bad interaction with invert & text with no background).
* KeyValuePage suffered from a similar issue with broken highlights (all black) because of missing backgrounds.
* In ConfigDialog, only instanciate IconButtons once (because every tab switch causes a full instantiation; and the initial display implies a full instanciation and an initial tab switch). Otherwise, both instances linger, and catch taps, and as such, double highlights.
* ConfigDialog: Restore the "don't repaint ReaderUI" when switching between similarly sized tabs (re #6131). I never could reproduce that on eInk, and I can't now on the emulator, so I'm assuming @poire-z fixed it during the swap to SVG icons.
* KeyValuePage: Only instanciate Buttons once (again, this is a widget that goes through a full init every page). Again, caused highlight/dimming issues because buttons were stacked.
* Menu: Ditto.
* TouchMenu: Now home of the gnarliest unhilight heuristics, because of the sheer amount of different things that can happen (and/or thanks to stuff not flagged covers_fullscreen properly ;p).
* Bump base
https://github.com/koreader/koreader-base/pull/1280
https://github.com/koreader/koreader-base/pull/1282
https://github.com/koreader/koreader-base/pull/1283
https://github.com/koreader/koreader-base/pull/1284
* Bump android-luajit-launcher
https://github.com/koreader/android-luajit-launcher/pull/284
https://github.com/koreader/android-luajit-launcher/pull/285
https://github.com/koreader/android-luajit-launcher/pull/286
https://github.com/koreader/android-luajit-launcher/pull/287
2021-01-10 00:51:09 +00:00
|
|
|
|
Revamp flash_ui handling, once more, with feeling ;) (#7262)
* Simplify flash_ui handling (by handling the unhighlight pre-callback, c.f., #7262 for more details).
* UIManager: Handle translucent window-level widgets (and those wrapped in a translucent MovableContainer) properly in setDirty directly, making sure what's *underneath* them gets repainted to avoid alpha layering glitches. (This was previously handled via localized hacks).
* Update UIManager's documentation, and format it properly for ldoc parsing, making the HTML docs more useful.
* ReaderView: Reinitialize the various page areas when opening a new document, to prevent poisoning from the previous document.
* Event: Handle nils in an event's arguments.
* CheckButton/RadioButton: Switch to simple inversion to handle highlighting
* CheckButton: Make the highlight span the inner frame's width, instead of just the text's width, if possible.
* AlphaContainer: Fix & simplify, given the UIManager alpha handling.
* MovableContainer: When translucent, cache the canvas bb used for composition.
* Avoid spurious refreshes in a few widgets using various dummy *TextWidgets in order to first compute a text height.
* KeyValuePage: Avoid floats in size computations.
2021-02-20 17:22:48 +00:00
|
|
|
-- Unhighlight
|
|
|
|
--
|
Tame some ButtonTable users into re-using Buttontable instances if possible (#7166)
* QuickDictLookup, ImageViewer, NumberPicker: Smarter `update` that will re-use most of the widget's layout instead of re-instantiating all the things.
* SpinWidget/DoubleSpinWidget: The NumberPicker change above renders a hack to preserve alpha on these widgets almost unnecessary. Also fixed said hack to also apply to the center, value button.
* Button: Don't re-instantiate the frame in setText/setIcon when unnecessary (e.g., no change at all, or no layout change).
* Button: Add a refresh method that repaints and refreshes a *specific* Button (provided it's been painted once) all on its lonesome.
* ConfigDialog: Free everything that's going to be re-instatiated on update
* A few more post #7118 fixes:
* SkimTo: Always flag the chapter nav buttons as vsync
* Button: Fix the highlight on rounded buttons when vsync is enabled (e.g., it's now entirely visible, instead of showing a weird inverted corner glitch).
* Some more heuristic tweaks in Menu/TouchMenu/Button/IconButton
* ButtonTable: fix the annoying rounding issue I'd noticed in #7054 ;).
* Enable dithering in TextBoxWidget (e.g., in the Wikipedia full view). This involved moving the HW dithering align fixup to base, where it always ought to have been ;).
* Switch a few widgets that were using "partial" on close to "ui", or, more rarely, "flashui". The intent being to limit "partial" purely to the Reader, because it has a latency cost when mixed with other refreshes, which happens often enough in UI ;).
* Minor documentation tweaks around UIManager's `setDirty` to reflect that change.
* ReaderFooter: Force a footer repaint on resume if it is visible (otherwise, just update it).
* ReaderBookmark: In the same vein, don't repaint an invisible footer on bookmark count changes.
2021-01-28 23:20:15 +00:00
|
|
|
self.image.invert = false
|
2022-12-26 18:23:05 +00:00
|
|
|
UIManager:widgetInvert(self.image, self.dimen.x + h_padding, self.dimen.y + self.padding_top)
|
Revamp flash_ui handling, once more, with feeling ;) (#7262)
* Simplify flash_ui handling (by handling the unhighlight pre-callback, c.f., #7262 for more details).
* UIManager: Handle translucent window-level widgets (and those wrapped in a translucent MovableContainer) properly in setDirty directly, making sure what's *underneath* them gets repainted to avoid alpha layering glitches. (This was previously handled via localized hacks).
* Update UIManager's documentation, and format it properly for ldoc parsing, making the HTML docs more useful.
* ReaderView: Reinitialize the various page areas when opening a new document, to prevent poisoning from the previous document.
* Event: Handle nils in an event's arguments.
* CheckButton/RadioButton: Switch to simple inversion to handle highlighting
* CheckButton: Make the highlight span the inner frame's width, instead of just the text's width, if possible.
* AlphaContainer: Fix & simplify, given the UIManager alpha handling.
* MovableContainer: When translucent, cache the canvas bb used for composition.
* Avoid spurious refreshes in a few widgets using various dummy *TextWidgets in order to first compute a text height.
* KeyValuePage: Avoid floats in size computations.
2021-02-20 17:22:48 +00:00
|
|
|
|
|
|
|
-- Callback
|
|
|
|
--
|
|
|
|
self.callback()
|
|
|
|
|
|
|
|
-- NOTE: plugins/coverbrowser.koplugin/covermenu (ab)uses UIManager:clearRenderStack,
|
|
|
|
-- so we need to enqueue the actual refresh request for the unhighlight post-callback,
|
|
|
|
-- otherwise, it's lost.
|
|
|
|
-- This changes nothing in practice, since we follow by explicitly requesting to drain the refresh queue ;).
|
|
|
|
UIManager:setDirty(nil, "fast", self.dimen)
|
|
|
|
|
|
|
|
UIManager:forceRePaint()
|
2017-10-10 21:50:45 +00:00
|
|
|
end
|
2014-03-13 13:52:43 +00:00
|
|
|
return true
|
2013-03-14 02:52:09 +00:00
|
|
|
end
|
|
|
|
|
2017-09-28 19:26:16 +00:00
|
|
|
function IconButton:onHoldIconButton()
|
2022-01-08 15:58:30 +00:00
|
|
|
-- If we're going to process this hold, we must make
|
|
|
|
-- sure to also handle its hold_release below, so it's
|
|
|
|
-- not propagated up to a MovableContainer
|
|
|
|
self._hold_handled = nil
|
2017-09-28 19:26:16 +00:00
|
|
|
if self.enabled and self.hold_callback then
|
|
|
|
self.hold_callback()
|
|
|
|
elseif self.hold_input then
|
|
|
|
self:onInput(self.hold_input)
|
|
|
|
elseif type(self.hold_input_func) == "function" then
|
|
|
|
self:onInput(self.hold_input_func())
|
2022-01-12 17:41:52 +00:00
|
|
|
elseif not self.hold_callback then -- nil or false
|
|
|
|
return
|
|
|
|
end
|
2022-01-08 15:58:30 +00:00
|
|
|
self._hold_handled = true
|
2017-09-28 19:26:16 +00:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
2022-01-08 15:58:30 +00:00
|
|
|
function IconButton:onHoldReleaseIconButton()
|
|
|
|
if self._hold_handled then
|
|
|
|
self._hold_handled = nil
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
|
2018-03-14 21:16:38 +00:00
|
|
|
function IconButton:onFocus()
|
|
|
|
--quick and dirty, need better way to show focus
|
2018-06-02 16:10:55 +00:00
|
|
|
self.image.invert = true
|
2018-03-14 21:16:38 +00:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
function IconButton:onUnfocus()
|
2018-06-02 16:10:55 +00:00
|
|
|
self.image.invert = false
|
2018-03-14 21:16:38 +00:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
function IconButton:onTapSelect()
|
|
|
|
self:onTapIconButton()
|
|
|
|
end
|
|
|
|
|
2021-12-16 11:12:25 +00:00
|
|
|
function IconButton:setIcon(icon)
|
|
|
|
if icon ~= self.icon then
|
|
|
|
self.icon = icon
|
2021-12-24 11:21:12 +00:00
|
|
|
self:free()
|
2021-12-16 11:12:25 +00:00
|
|
|
self:init()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-10-18 20:38:07 +00:00
|
|
|
return IconButton
|