From ab05bf534047eb8f7137be8375d69dd84bff4354 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Mon, 10 Oct 2016 17:12:52 +0300 Subject: [PATCH] update dark theme; fix drawable overriding in styles/themes --- examples/example1/src/example1.d | 1 + src/dlangui/widgets/groupbox.d | 20 +++--------------- src/dlangui/widgets/styles.d | 5 ++++- views/res/group_box_frame_bottom_dark.9.png | Bin 0 -> 313 bytes views/res/group_box_frame_up_left_dark.9.png | Bin 0 -> 252 bytes views/res/group_box_frame_up_right_dark.9.png | Bin 0 -> 267 bytes views/res/slider_background_dark.9.png | Bin 0 -> 247 bytes views/res/theme_dark.xml | 19 +++++++++++++++++ views/standard_resources.list | 4 ++++ 9 files changed, 31 insertions(+), 18 deletions(-) create mode 100644 views/res/group_box_frame_bottom_dark.9.png create mode 100644 views/res/group_box_frame_up_left_dark.9.png create mode 100644 views/res/group_box_frame_up_right_dark.9.png create mode 100644 views/res/slider_background_dark.9.png diff --git a/examples/example1/src/example1.d b/examples/example1/src/example1.d index 59e2416d..f23b965e 100644 --- a/examples/example1/src/example1.d +++ b/examples/example1/src/example1.d @@ -228,6 +228,7 @@ extern (C) int UIAppMain(string[] args) { Platform.instance.uiLanguage = "en"; // load theme from file "theme_default.xml" Platform.instance.uiTheme = "theme_default"; + //Platform.instance.uiTheme = "theme_dark"; // you can override default hinting mode here (Normal, AutoHint, Disabled) FontManager.hintingMode = HintingMode.Normal; diff --git a/src/dlangui/widgets/groupbox.d b/src/dlangui/widgets/groupbox.d index 7e1965e5..76fa2bb6 100644 --- a/src/dlangui/widgets/groupbox.d +++ b/src/dlangui/widgets/groupbox.d @@ -28,11 +28,7 @@ class GroupBox : LinearLayout { protected TextWidget _caption; this() { - super("GROUP_BOX", Orientation.Vertical); - styleId = STYLE_GROUP_BOX; - _caption = new TextWidget("GROUP_BOX_CAPTION"); - _caption.styleId = STYLE_GROUP_BOX_CAPTION; - + this(null, ""d, Orientation.Vertical); } this(string ID, UIString uitext, Orientation orientation = Orientation.Vertical) { @@ -45,21 +41,11 @@ class GroupBox : LinearLayout { } this(string ID, string textResourceId, Orientation orientation = Orientation.Vertical) { - super(ID, orientation); - styleId = STYLE_GROUP_BOX; - _caption = new TextWidget("GROUP_BOX_CAPTION"); - _caption.styleId = STYLE_GROUP_BOX_CAPTION; - _caption.parent = this; - textResource = textResourceId; + this(ID, UIString(textResourceId), orientation); } this(string ID, dstring rawText, Orientation orientation = Orientation.Vertical) { - super(ID, orientation); - _caption = new TextWidget("GROUP_BOX_CAPTION"); - _caption.styleId = STYLE_GROUP_BOX_CAPTION; - _caption.parent = this; - styleId = STYLE_GROUP_BOX; - text = rawText; + this(ID, UIString(rawText), orientation); } ~this() { diff --git a/src/dlangui/widgets/styles.d b/src/dlangui/widgets/styles.d index c9639617..8f76f293 100644 --- a/src/dlangui/widgets/styles.d +++ b/src/dlangui/widgets/styles.d @@ -303,6 +303,9 @@ public: s.onThemeChanged(); foreach(s; _children) s.onThemeChanged(); + foreach(d; _customDrawables) + d.clear(); + destroy(_customDrawables); } @property const(Theme) theme() const { @@ -1600,7 +1603,7 @@ public: @property ref DrawableRef drawable() const { if (!_drawable.isNull) return (cast(DrawableAttribute)this)._drawable; - (cast(DrawableAttribute)this)._drawable = drawableCache.get(_id); + (cast(DrawableAttribute)this)._drawable = drawableCache.get(_drawableId); (cast(DrawableAttribute)this)._initialized = true; return (cast(DrawableAttribute)this)._drawable; } diff --git a/views/res/group_box_frame_bottom_dark.9.png b/views/res/group_box_frame_bottom_dark.9.png new file mode 100644 index 0000000000000000000000000000000000000000..75d791cbd3cf1de65b0e13c97735b21663346b48 GIT binary patch literal 313 zcmeAS@N?(olHy`uVBq!ia0vp^PCzWh!3HFmJG+X26kC$Fy9>jA5L~c#`DCC7XMsm# zF#`j)FbFd;%$g$s6l5>)^mS!_z{SODz;}N4K?k6aY-UJAiF1B#Zfaf$kjuc}T$Gwv zlA5AWo>`Ki;O^-gkfN8$4ium3>Eaj?aro`@gPaExcwF}{^?Ph{E?MSMZp)XTgUt~K zTn4Ct!ui?&5&njdizq5vzE*a)!Suy3_B8A;uIJfRxcHBt=SM1 z@7}RuYY+=V#e2;r+a@KACZ!b(N>wthC6W(UG%np})@Gj6^NgKO@TRz+lfnN-noDiF y=h)rU(QMj(Ebq9j+mW#2s>j-T=f4kLZD{jKE|k%J@~tx|gW!U_%O?XxI14-? ziy0WWg+Z8+Vb&aw9`+JXUsv`ATwHvtibrG{z5#_~GeaUuobz*YQ}arITm}Z`qSVBa z)D(sC%#sWRcTeAd6une-pm>6(i(`nz>9|gW!U_%O?XxI14-? ziy0WWg+Z8+Vb&aw9`+JXUsv`ATwJ_{?CWbhmI8%jGeaUuobz*YQ}arITm}Z`qSVBa z)D(sC%#sWRcTeAd6une-pm@Hgi(`nz>EsjzzCZ4djg5Mm0u5>ylAWEI{Z6h9U;j@% z<-n_}t3N*DJof*8;p~eyZg^a1YHMTLBeuc7=utU?Ugw1i7yjS6b&I9BgVWp4A@qRD zV~cs{ literal 0 HcmV?d00001 diff --git a/views/res/slider_background_dark.9.png b/views/res/slider_background_dark.9.png new file mode 100644 index 0000000000000000000000000000000000000000..b465834bf1c792fc5810bc6eba90185b576a39e1 GIT binary patch literal 247 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1|-8uW1a&kwj^(N7l!{JxM1({$v_d#0*}aI z1_o|n5N2eUHAey{$X?><>&pIsi;GuZw4;U12q+|*84^+AoS&PUnpXnkGB7w7r6!i7 zrYMwWmSiZnd-?{X=%um)#iKo4978nDZ=K}GbwGiKMg7s?PpvYayzW0fdj5v@(k4;S zTa7YIyLBR&-e0L^V>xhFTYAZqj$F;9KCNkP=OiB(GOT!Iq*~xHL-u=S)1O%azhCw7 htbHzeY44$F|Coy6g?vs%*_{E|@9FC2vd$@?2>{-mP$mEX literal 0 HcmV?d00001 diff --git a/views/res/theme_dark.xml b/views/res/theme_dark.xml index cd7acaea..6b1ce4d5 100644 --- a/views/res/theme_dark.xml +++ b/views/res/theme_dark.xml @@ -98,6 +98,10 @@ + + + + + + diff --git a/views/standard_resources.list b/views/standard_resources.list index 35436585..c9c766a6 100644 --- a/views/standard_resources.list +++ b/views/standard_resources.list @@ -51,6 +51,10 @@ res/group_box_frame_bottom.9.png res/group_box_frame_up_left.9.png res/group_box_frame_up_right.9.png res/slider_background.9.png +res/group_box_frame_bottom_dark.9.png +res/group_box_frame_up_left_dark.9.png +res/group_box_frame_up_right_dark.9.png +res/slider_background_dark.9.png res/i18n/std_en.ini res/i18n/std_ru.ini res/list_item_background.xml