diff --git a/src/dlangui/widgets/controls.d b/src/dlangui/widgets/controls.d index 4e0e7485..0f681233 100644 --- a/src/dlangui/widgets/controls.d +++ b/src/dlangui/widgets/controls.d @@ -266,6 +266,26 @@ class ImageButton : ImageWidget { } } +/// button with image working as trigger: check / uncheck occurs when pressing +class ImageCheckButton : ImageButton { + /// constructor by id and icon resource id + this(string ID = null, string drawableId = null) { + super(ID, drawableId); + styleId = "BUTTON_CHECK_TRANSPARENT"; + } + /// constructor from action + this(const Action a) { + super(a); + styleId = "BUTTON_CHECK_TRANSPARENT"; + } + + // called to process click and notify listeners + override protected bool handleClick() { + checked = !checked; + return super.handleClick(); + } +} + /// button with image and text class ImageTextButton : HorizontalLayout { protected ImageWidget _icon; @@ -1080,4 +1100,4 @@ class CanvasWidget : Widget { } import dlangui.widgets.metadata; -mixin(registerWidgets!(Widget, TextWidget, MultilineTextWidget, Button, ImageWidget, ImageButton, ImageTextButton, RadioButton, CheckBox, ScrollBar, HSpacer, VSpacer, CanvasWidget)()); +mixin(registerWidgets!(Widget, TextWidget, MultilineTextWidget, Button, ImageWidget, ImageButton, ImageCheckButton, ImageTextButton, RadioButton, CheckBox, ScrollBar, HSpacer, VSpacer, CanvasWidget)()); diff --git a/src/dlangui/widgets/editors.d b/src/dlangui/widgets/editors.d index 76bc6821..14076cea 100644 --- a/src/dlangui/widgets/editors.d +++ b/src/dlangui/widgets/editors.d @@ -2852,8 +2852,8 @@ class LogWidget : EditBox { class FindPanel : HorizontalLayout { protected EditLine _edFind; protected EditLine _edReplace; - protected CheckBox _cbCaseInsensitive; - protected CheckBox _cbWholeWords; + protected ImageCheckButton _cbCaseSensitive; + protected ImageCheckButton _cbWholeWords; protected CheckBox _cbSelection; protected Button _btnFindNext; protected Button _btnFindPrev; @@ -2869,22 +2869,22 @@ class FindPanel : HorizontalLayout { layoutWidth: fill HorizontalLayout { layoutWidth: fill - EditLine { id: edFind; layoutWidth: fill } + EditLine { id: edFind; layoutWidth: fill; alignment: vcenter } Button { id: btnFindNext; text: EDIT_FIND_NEXT } Button { id: btnFindPrev; text: EDIT_FIND_PREV } } HorizontalLayout { id: replace layoutWidth: fill; - EditLine { id: edReplace; layoutWidth: fill } + EditLine { id: edReplace; layoutWidth: fill; alignment: vcenter } Button { id: btnReplace; text: EDIT_REPLACE_NEXT } Button { id: btnReplaceAll; text: EDIT_REPLACE_ALL } } } VerticalLayout { HorizontalLayout { - CheckBox { id: cbCaseInsensitive; text: "Aa" } - CheckBox { id: cbWholeWords; text: "Words" } + ImageCheckButton { id: cbCaseSensitive; drawableId: "find_case_sensitive"; tooltipText: EDIT_FIND_CASE_SENSITIVE; styleId: TOOLBAR_BUTTON; alignment: vcenter } + ImageCheckButton { id: cbWholeWords; drawableId: "find_whole_words"; tooltipText: EDIT_FIND_WHOLE_WORDS; styleId: TOOLBAR_BUTTON; alignment: vcenter } CheckBox { id: cbSelection; text: "Sel" } } VSpacer {} @@ -2904,8 +2904,8 @@ class FindPanel : HorizontalLayout { _btnFindPrev = childById!Button("btnFindPrev"); _btnReplace = childById!Button("btnReplace"); _btnReplaceAll = childById!Button("btnReplaceAll"); - _cbCaseInsensitive = childById!CheckBox("cbCaseInsinsitive"); - _cbWholeWords = childById!CheckBox("cbWholeWords"); + _cbCaseSensitive = childById!ImageCheckButton("cbCaseSensitive"); + _cbWholeWords = childById!ImageCheckButton("cbWholeWords"); _cbSelection = childById!CheckBox("cbSelection"); if (!replace) childById("replace").visibility = Visibility.Gone; diff --git a/src/dlangui/widgets/widget.d b/src/dlangui/widgets/widget.d index 395b323d..c351d19d 100644 --- a/src/dlangui/widgets/widget.d +++ b/src/dlangui/widgets/widget.d @@ -1530,6 +1530,10 @@ public: text = UIString(value); return true; } + if (name.equal("tooltipText")) { + tooltipText = UIString(value); + return true; + } return false; } @@ -1539,6 +1543,10 @@ public: text = UIString(value); return true; } + if (name.equal("tooltipText")) { + tooltipText = UIString(value); + return true; + } return false; } @@ -1548,6 +1556,10 @@ public: text = value; return true; } + if (name.equal("tooltipText")) { + tooltipText = value; + return true; + } return false; } diff --git a/views/res/btn_background_check_transparent.xml b/views/res/btn_background_check_transparent.xml new file mode 100644 index 00000000..101a8099 --- /dev/null +++ b/views/res/btn_background_check_transparent.xml @@ -0,0 +1,24 @@ + + + + + + + + + + diff --git a/views/res/btn_background_check_transparent_dark.xml b/views/res/btn_background_check_transparent_dark.xml new file mode 100644 index 00000000..ea2fb57a --- /dev/null +++ b/views/res/btn_background_check_transparent_dark.xml @@ -0,0 +1,24 @@ + + + + + + + + + + diff --git a/views/res/i18n/std_en.ini b/views/res/i18n/std_en.ini index cc5e8812..af1f777b 100644 --- a/views/res/i18n/std_en.ini +++ b/views/res/i18n/std_en.ini @@ -31,3 +31,7 @@ EDIT_FIND_NEXT=Find next EDIT_FIND_PREV=Find prev EDIT_REPLACE_NEXT=Replace EDIT_REPLACE_ALL=Replace all +EDIT_FIND_CASE_SENSITIVE=Case sensitive +EDIT_FIND_WHOLE_WORDS=Whole words +EDIT_FIND_SELECTION_ONLY=Selection only + diff --git a/views/res/i18n/std_ru.ini b/views/res/i18n/std_ru.ini index 7034e422..56ebe506 100644 --- a/views/res/i18n/std_ru.ini +++ b/views/res/i18n/std_ru.ini @@ -25,3 +25,6 @@ EDIT_FIND_NEXT=Найти след EDIT_FIND_PREV=Найти пред EDIT_REPLACE_NEXT=Заменить EDIT_REPLACE_ALL=Заменить все +EDIT_FIND_CASE_SENSITIVE=С учетом регистра +EDIT_FIND_WHOLE_WORDS=Только слова целиком +EDIT_FIND_SELECTION_ONLY=Только в выделенном diff --git a/views/res/mdpi/find_case_sensitive.png b/views/res/mdpi/find_case_sensitive.png new file mode 100644 index 00000000..474cb101 Binary files /dev/null and b/views/res/mdpi/find_case_sensitive.png differ diff --git a/views/res/mdpi/find_whole_words.png b/views/res/mdpi/find_whole_words.png new file mode 100644 index 00000000..0b91666f Binary files /dev/null and b/views/res/mdpi/find_whole_words.png differ diff --git a/views/res/theme_dark.xml b/views/res/theme_dark.xml index 844ad745..9317d94a 100644 --- a/views/res/theme_dark.xml +++ b/views/res/theme_dark.xml @@ -37,6 +37,10 @@