#define CHUI_THEME_CHROMELESS 1
#define CHUI_THEME_SCROLLBARS 2
client/var/list/receivedThemes = list()
chui/theme
//Unique name for the theme. Windows reference their desired based on this name. (and defaults to the base if it doesn't exist)
var/name = "example"
//A list of 'file's to send to clients. Make sure they're singlequoted files.
//If CHUI_VERBOSITY is at least 1, files in here will automatically be reloaded into the cache
//at runtime for utility of testing new themes.
//var/list/send = list()
//Stream the theme's resources to the client; it will bail if they have already received it.
/*
proc/streamToClient( var/client/c )
if( !c.receivedThemes[ name ] )
c.receivedThemes[ name ] = 1
chui.RscStream( c, send )
*/
//Generates a header based on a set of parameters
proc/generateHeader(var/list/params)
var/generated = {"
"}
if( params["js"] )
//Common to all themes
generated += ""
generated += ""
generated += ""
generated += "\n"
//Theme specific
for( var/key in params["js"] )
generated += ""
if( params["css"] )
generated += ""
for( var/key in params["css"] )
generated += ""
if( params["title"] )
generated += "[html_encode(params["title"])]"
if( params["data"] )
var/data = params["data"]
for( var/key in data )
generated += ""
return "[generated]"
//Generates a body based on parameters and desired body content.
proc/generateBody(var/body, var/list/params)
return body
//Generates a footer based on parameters.
proc/generateFooter(var/list/params)
return ""
//Renders a button. The elements ID must be set to id in order for the javascript portion of Chui to function properly.
proc/generateButton( var/id, var/display )
return ""
chui/theme/base
name = "base"
//send = list('chui/themes/default/default.css', 'chui/chui.js', 'chui/themes/default/images/bl.gif', 'chui/themes/default/images/borderSlants.png', 'chui/themes/default/images/br.gif', 'chui/themes/default/images/scanLine.png', 'chui/themes/default/images/tl.gif', 'chui/themes/default/images/topShadow.png', 'chui/themes/default/images/tr.gif', 'chui/themes/default/images/buttons/btn-contrast-active-br.gif','chui/themes/default/images/buttons/btn-contrast-active-tl.gif','chui/themes/default/images/buttons/btn-contrast-br.gif','chui/themes/default/images/buttons/btn-contrast-hover-br.gif','chui/themes/default/images/buttons/btn-contrast-tl.gif','chui/themes/default/images/buttons/btn-standard-active-br.gif','chui/themes/default/images/buttons/btn-standard-active-tl.gif','chui/themes/default/images/buttons/btn-standard-br.gif','chui/themes/default/images/buttons/btn-standard-hover-br.gif','chui/themes/default/images/buttons/btn-standard-tl.gif')
generateHeader(var/list/params)
params["css"] += list("css/chui/themes/default/default.css")
return ..(params) //todo, remember if this matters
generateBody( var/body, var/list/params )
var/resizable = 1
var/rendered = {"
"}
if (resizable)
rendered += {"
"}
rendered += {"
[body]
"}
return rendered
generateFooter()
return ..()
generateButton( var/id, var/label )
return {"[label]"}
proc/generateSwitch( var/id, var/list/options )
return "IDK"//have the switch, when an option is selected, chui.onSwitchSelected( id, optionName )
//the key of the list is the name, the value is the label. these labels cannot be changed at runtime so don't worry about that