diff --git a/examples/example1/main.d b/examples/example1/main.d index ac7e3ec0..24ad9f60 100644 --- a/examples/example1/main.d +++ b/examples/example1/main.d @@ -35,7 +35,7 @@ extern (C) int UIAppMain(string[] args) { string i18nDir = exePath() ~ "..\\res\\i18n\\"; } else { string resourceDir = exePath() ~ "../../res/"; - string i18nDir = exePath() ~ "../res/i18n/"; + string i18nDir = exePath() ~ "../../res/i18n/"; } string[] imageDirs = [ resourceDir @@ -133,14 +133,14 @@ extern (C) int UIAppMain(string[] args) { tabs.addTab(layout, "Tab 1"d); - static if (false) { + static if (true) { ListWidget list = new ListWidget("tab2", Orientation.Vertical); WidgetListAdapter listAdapter = new WidgetListAdapter(); - for (int i = 0; i < 3000; i++) - listAdapter.widgets.add((new TextWidget()).text("List item "d ~ to!dstring(i))); + for (int i = 0; i < 1000; i++) + listAdapter.widgets.add((new TextWidget()).text("List item "d ~ to!dstring(i)).styleId("LIST_ITEM")); list.ownAdapter = listAdapter; list.layoutWidth(FILL_PARENT).layoutHeight(FILL_PARENT); - tabs.addTab(list, "Lists"d); + tabs.addTab(list, "Long List"d); } tabs.addTab((new TextWidget()).id("tab3").textColor(0x00802000).text("Tab 3 contents"), "Tab 3"d); diff --git a/src/dlangui/widgets/styles.d b/src/dlangui/widgets/styles.d index 1bc2930a..bd1883f8 100644 --- a/src/dlangui/widgets/styles.d +++ b/src/dlangui/widgets/styles.d @@ -674,6 +674,9 @@ Theme createDefaultTheme() { Style poopupMenu = res.createSubstyle("POPUP_MENU").backgroundImageId("popup_menu_background_normal"); + Style listItem = res.createSubstyle("LIST_ITEM"); + listItem.createState(State.Selected, State.Selected).backgroundColor(0xC04040FF).textColor(0x000000); + return res; } diff --git a/src/dlangui/widgets/widget.d b/src/dlangui/widgets/widget.d index 1f3fd303..e67d13d8 100644 --- a/src/dlangui/widgets/widget.d +++ b/src/dlangui/widgets/widget.d @@ -161,7 +161,7 @@ class Widget { /// returns widget style id, null if not set @property string styleId() const { return _styleId; } /// set widget style id - @property void styleId(string id) { _styleId = id; } + @property Widget styleId(string id) { _styleId = id; return this; } /// get margins (between widget bounds and its background) @property Rect margins() const { return style.margins; } /// set margins for widget - override one from style