mirror of https://github.com/buggins/dlangui.git
fix #219
This commit is contained in:
parent
de968f3618
commit
8912be6208
|
@ -27,6 +27,8 @@ immutable uint COLOR_UNSPECIFIED = 0xFFDEADFF;
|
|||
/// transparent color constant
|
||||
immutable uint COLOR_TRANSPARENT = 0xFFFFFFFF;
|
||||
|
||||
immutable string COLOR_DRAWABLE = "#color";
|
||||
|
||||
|
||||
immutable uint COLOR_TRANSFORM_OFFSET_NONE = 0x80808080;
|
||||
immutable uint COLOR_TRANSFORM_MULTIPLY_NONE = 0x40404040;
|
||||
|
|
|
@ -530,7 +530,9 @@ public:
|
|||
|
||||
/// font size
|
||||
@property string backgroundImageId() const {
|
||||
if (_backgroundImageId !is null)
|
||||
if (_backgroundImageId == COLOR_DRAWABLE)
|
||||
return null;
|
||||
else if (_backgroundImageId !is null)
|
||||
return _backgroundImageId;
|
||||
else
|
||||
return parentStyle.backgroundImageId;
|
||||
|
@ -702,7 +704,7 @@ public:
|
|||
|
||||
@property Style backgroundColor(uint color) {
|
||||
_backgroundColor = color;
|
||||
_backgroundImageId = null;
|
||||
_backgroundImageId = COLOR_DRAWABLE;
|
||||
_backgroundDrawable.clear();
|
||||
return this;
|
||||
}
|
||||
|
@ -853,6 +855,20 @@ public:
|
|||
return createState(stateMask, stateValue);
|
||||
}
|
||||
|
||||
/// find substyle based on widget state (e.g. focused, pressed, ...)
|
||||
Style forState(uint state) {
|
||||
if (state == State.Normal)
|
||||
return this;
|
||||
//Log.d("forState ", state, " styleId=", _id, " substates=", _substates.length);
|
||||
if (parentStyle !is null && _substates.length == 0 && parentStyle._substates.length > 0) //id is null &&
|
||||
return parentStyle.forState(state);
|
||||
foreach(item; _substates) {
|
||||
if ((item._stateMask & state) == item._stateValue)
|
||||
return item;
|
||||
}
|
||||
return this; // fallback to current style
|
||||
}
|
||||
|
||||
/// find substyle based on widget state (e.g. focused, pressed, ...)
|
||||
const(Style) forState(uint state) const {
|
||||
if (state == State.Normal)
|
||||
|
@ -1016,6 +1032,11 @@ class Theme : Style {
|
|||
return this;
|
||||
}
|
||||
|
||||
/// find substyle based on widget state (e.g. focused, pressed, ...)
|
||||
override Style forState(uint state) {
|
||||
return this;
|
||||
}
|
||||
|
||||
void dumpStats() {
|
||||
Log.d("Theme ", _id, ": children:", _children.length, ", substates:", _substates.length, ", mapsize:", _byId.length);
|
||||
}
|
||||
|
|
|
@ -252,7 +252,7 @@ public:
|
|||
}
|
||||
|
||||
/// enforces widget's own style - allows override some of style properties
|
||||
protected @property Style ownStyle() {
|
||||
@property Style ownStyle() {
|
||||
if (_ownStyle is null)
|
||||
_ownStyle = currentTheme.modifyStyle(_styleId);
|
||||
return _ownStyle;
|
||||
|
|
Loading…
Reference in New Issue