Bug 11775 - Applets cannot extend skin with their own extensions
: Applets cannot extend skin with their own extensions
Status: REOPENED
Product: SqueezePlay
Classification: Unclassified
Component: UI
: unspecified
: PC Other
: P5 normal (vote)
: Future
Assigned To: Ben Klaas
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-04-12 12:34 UTC by andrew
Modified: 2011-01-21 14:37 UTC (History)
4 users (show)

See Also:
Category: Feature


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description andrew 2009-04-12 12:34:57 UTC
svn info
Path: .
URL: http://svn.slimdevices.com/repos/jive/7.4/trunk/squeezeplay/src
Repository Root: http://svn.slimdevices.com/repos/jive
Repository UUID: bbe22326-0783-4b3a-ac2b-7ab96b24c8d9
Revision: 5284

There does not appear to be a way for an Applet to extend the skin's with there own icons etc. 

It would be nice if in the applets Meta.lua you could have something like:

jiveMain:registerAppletSkin(skinName, skinExtensionFunction)

Where skinExtensionFunction takes the usual parameters for a skin function:

skin(self, s, reload, useDefaultSize)

A typical applet would have:

jiveMain:registerAppletSkin("DefaultSkin", "defSkin")
jiveMain:registerAppletSkin("FullscreenSkin", "fullSkin")

The function JiveMain:_loadSkin() after loading of a skin would then iterate over all the registered skinExtensionFunctions for the skin which has just been loaded.
Comment 1 Chris Owens 2009-04-13 09:57:07 UTC
Ben seems to have some ideas about this.
Comment 2 Ben Klaas 2009-04-13 10:37:08 UTC
I think we need a good solution for this to help 3rd party developers write applets. Moving off of enhancement to normal, as I feel this is important enough to be considered a bug.

FYI, on a per-window basis I think this may already be possible with a combination of window:getSkin() and window:setSkin()

local theSkin = window:getSkin()

local myExtension = {
   someNewStyle = {
      ...
   }
}

table.insert(theSkin, myExtension)

window:setSkin(theSkin)

Obviously that's not very streamlined, but it might be worth experimenting with if you want a short-term fix before this is fixed in earnest.
Comment 3 andrew 2009-04-13 12:23:49 UTC
Thanks for the tip.

Does the Framework have a window? Can i get its window? 

What i would like to implement is something like the iconbar but only in some of my menus. I'd splat my iconbar over the top of the Iconbar, or better still, hide the Iconbar somehow. Or maybe i would put my iconbar above the Iconbar. Its all the same problem, i need to getSkin() on the Framework:window, if there is such a thing.
Comment 4 Ben Klaas 2009-04-13 12:31:28 UTC
Framework doesn't have those methods available, but they may work if you put them in. Try adding these methods to squeezeplay/share/jive/ui/Framework.lua

function setSkin(self, skin)
         self.skin = skin
end


function getSkin(self)
         return self.skin
end


note: I'm just giving some pointers if you want to tinker a bit, I'm not even entirely sure that setSkin()/getSkin() will work in Framework (but my hunch is that it will). 

This needs a more thoroughly thought out solution, but since I'm not going to have time to work on that in the immediate future I thought this might help.
Comment 5 Richard Titmuss 2009-07-23 06:51:07 UTC
I think the existing UI works as described by Ben works. Please reopen if you disagree.
Comment 6 andrew 2009-07-23 07:00:53 UTC
I re-opened it because of this comment from Ben:

Obviously that's not very streamlined, but it might be worth experimenting with
if you want a short-term fix before this is fixed in earnest.

Lets have this bug for keeping track of "Fixed in earnest", not a quick and dirty workaround.
Comment 7 Ben Klaas 2009-08-26 07:46:53 UTC
this is an administrative shuffle on priority fields to help make better judgment on the top end of the priority list. P4->P5, P3->P4, and P2->P3.
Comment 8 Ben Klaas 2011-01-14 10:16:12 UTC
there may be a full fix for this in 7.6.0 if a particular feature is approved for that release. set this to 7.6.0 for now, push it to future if that feature is pulled from the release.
Comment 9 Mickey Gee 2011-01-20 11:18:54 UTC
Hey Ben, can you review this bug for an update and your perspective on priority?
Comment 10 Ben Klaas 2011-01-21 14:37:30 UTC
There is work for this completed, but it's on a feature branch that we are not including in 7.6.0. I think for that reason the correct target for this right now is "Future"

the new method to be introduced is called getSelectedSkinTable(), which will return the entire table for the currently selected skin.

Eventually, developer could potentially do something like this:

-- retrieve the skin as a table that can be manipulated
local theSkin = jiveMain:getSelectedSkinTable()

-- add a new window style to the skin
theSkin.MyNewWindowStyle = {
 -- window skin parameters
}

-- create a new window object with the newly created style
local newWindow = Window('MyNewWindowStyle')

-- set the manipulated skin to the new variable
newWindow:setSkin(theSkin)
newWindow:reSkin()

This work hasn't been vetted in any meaningful way though, and really needs to be. There probably should be some protections built into this, as there's potential for UI harm.