Author: bklaas
Date: Mon May 19 09:46:18 2008
New Revision: 2485

URL: http://svn.slimdevices.com?rev=2485&root=Jive&view=rev
Log:
Bug: 6561
Description: 

add getTitle method to jive.ui.Window, which returns the text of the title 
widget

when window.titleStyle parameter is sent from SC, restyle the title by creating 
a new title widget
use existing text from previous title widget by default, then set text as 
specified from SC by window.text param

Modified:
    
7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
    7.1/trunk/squeezeplay/src/squeezeplay/share/jive/ui/SimpleMenu.lua
    7.1/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Window.lua

Modified: 
7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
URL: 
http://svn.slimdevices.com/7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua?rev=2485&root=Jive&r1=2484&r2=2485&view=diff
==============================================================================
--- 
7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
 (original)
+++ 
7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
 Mon May 19 09:46:18 2008
@@ -812,12 +812,24 @@
                        -- update the window properties
                        step.menu:setStyle(step.db:menuStyle())
                        if data.window then
-                               if data.window.text then
+                               -- if a titleStyle is being sent, we need to 
setTitleWidget completely
+                               if data.window.titleStyle then
+                                       -- first setup the widget with the 
existing title text
+                                       local existingTitle = 
step.window:getTitle()
+                                       if not existingTitle then
+                                               existingTitle = ''
+                                       end
+                                       local newTitleWidget = Group("title", { 
text = Label("text", existingTitle), icon = Icon("icon") })     
+                                       
step.window:setTitleWidget(newTitleWidget)
+                                       -- change the title text if necessary
+                                       if data.window.text then
+                                               
step.window:setTitle(data.window.text)
+                                       end
+                                       -- after widget is created, set the 
style as directed
+                                       
step.window:setTitleStyle(data.window.titleStyle .. 'title')
+                               -- change the text as specified if no 
titleStyle param was also sent
+                               elseif data.window.text then
                                        step.window:setTitle(data.window.text)
-                               end
-                               --FIXME-- if the existing style had an icon, 
changing the style does not remove it
-                               if data.window.titleStyle then
-                                       
step.window:setTitleStyle(data.window.titleStyle .. 'title')
                                end
                        end
 

Modified: 7.1/trunk/squeezeplay/src/squeezeplay/share/jive/ui/SimpleMenu.lua
URL: 
http://svn.slimdevices.com/7.1/trunk/squeezeplay/src/squeezeplay/share/jive/ui/SimpleMenu.lua?rev=2485&root=Jive&r1=2484&r2=2485&view=diff
==============================================================================
--- 7.1/trunk/squeezeplay/src/squeezeplay/share/jive/ui/SimpleMenu.lua 
(original)
+++ 7.1/trunk/squeezeplay/src/squeezeplay/share/jive/ui/SimpleMenu.lua Mon May 
19 09:46:18 2008
@@ -242,7 +242,7 @@
 
 --[[
 
-=head2 jive.ui.Menu.itemComparatorNodeWeightAlpha
+=head2 jive.ui.Menu.itemComparatorKeyWeightAlpha
 
 Item comparator to sort items using item.sortKey as a primary key, item.weight 
as a secondary key, and
 item.text as a tertiary key.

Modified: 7.1/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Window.lua
URL: 
http://svn.slimdevices.com/7.1/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Window.lua?rev=2485&root=Jive&r1=2484&r2=2485&view=diff
==============================================================================
--- 7.1/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Window.lua (original)
+++ 7.1/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Window.lua Mon May 19 
09:46:18 2008
@@ -458,6 +458,23 @@
        -- FIXME window events
 end
 
+--[[
+
+=head2 jive.ui.Window:getTitle()
+
+Returns the text of the title widget.
+
+=cut
+--]]
+function getTitle(self)
+       if self.title then
+               if self.title:getWidget('text') then
+                       return self.title:getWidget('text'):getValue()
+               end
+       end
+       return nil
+end
+
 
 --[[
 
@@ -480,7 +497,7 @@
 
 --[[
 
-=head2 jive.ui.Window:setTitle(style)
+=head2 jive.ui.Window:setTitleStyle(style)
 
 Sets the windows title style to I<style>.
 

_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/cgi-bin/mailman/listinfo/jive-checkins

Reply via email to