Interface IThemeResourceStore
- Namespace
- BSGameLib.UI
- Assembly
- BSGameLib.UI.dll
Holds the named values (<Color>, <String>) declared by a view's
<Resources> or by a shared template pulled in through <References>,
so attributes elsewhere can refer to them as {Resource id}.
public interface IThemeResourceStore
Remarks
Deliberately string-in/string-out: the stored value is substituted for the reference and then parsed by whatever already parsed that attribute, so a resource works anywhere the literal would have, with no per-attribute special casing.
Methods
Add(string, string)
Stores value under id. A value already stored under
the id is kept.
void Add(string id, string value)
Parameters
AddGradient(string, Gradient)
Stores gradient under id. A gradient already stored
under the id is kept.
void AddGradient(string id, Gradient gradient)
Parameters
AddStyle(string, StyleResource)
Stores style under id. A style already stored under
the id is kept.
void AddStyle(string id, StyleResource style)
Parameters
idstringstyleStyleResource
Clear()
Empties the store - every value, gradient and style.
void Clear()
Remarks
Add(string, string) is first-writer-wins so that a view's own <Resources>
can override one value from a shared template without restating the rest of it. That
only makes sense within a single view build: across builds it means the first view to
register an id owns it for the lifetime of the process, so a later view's own
<Resources> - or a different theme template registering the same names -
silently does nothing. The builder factory clears the store as each build starts,
which scopes the semantics to where they were intended.
ExistsById(string)
Whether a value is stored under id.
bool ExistsById(string id)
Parameters
idstring
Returns
TryGet(string, out string)
Gets the value stored under id. Returns false when there is none.
bool TryGet(string id, out string value)
Parameters
Returns
TryGetGradient(string, out Gradient)
Gets the gradient stored under id. Returns false when there is none.
bool TryGetGradient(string id, out Gradient gradient)
Parameters
Returns
TryGetStyle(string, out StyleResource)
Gets the style stored under id. Returns false when there is none.
bool TryGetStyle(string id, out StyleResource style)
Parameters
idstringstyleStyleResource