editors find panel - part 3

This commit is contained in:
Vadim Lopatin 2016-02-01 12:05:36 +03:00
parent 489884c752
commit 8d5c118922
14 changed files with 114 additions and 9 deletions

View File

@ -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 /// button with image and text
class ImageTextButton : HorizontalLayout { class ImageTextButton : HorizontalLayout {
protected ImageWidget _icon; protected ImageWidget _icon;
@ -1080,4 +1100,4 @@ class CanvasWidget : Widget {
} }
import dlangui.widgets.metadata; 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)());

View File

@ -2852,8 +2852,8 @@ class LogWidget : EditBox {
class FindPanel : HorizontalLayout { class FindPanel : HorizontalLayout {
protected EditLine _edFind; protected EditLine _edFind;
protected EditLine _edReplace; protected EditLine _edReplace;
protected CheckBox _cbCaseInsensitive; protected ImageCheckButton _cbCaseSensitive;
protected CheckBox _cbWholeWords; protected ImageCheckButton _cbWholeWords;
protected CheckBox _cbSelection; protected CheckBox _cbSelection;
protected Button _btnFindNext; protected Button _btnFindNext;
protected Button _btnFindPrev; protected Button _btnFindPrev;
@ -2869,22 +2869,22 @@ class FindPanel : HorizontalLayout {
layoutWidth: fill layoutWidth: fill
HorizontalLayout { HorizontalLayout {
layoutWidth: fill layoutWidth: fill
EditLine { id: edFind; layoutWidth: fill } EditLine { id: edFind; layoutWidth: fill; alignment: vcenter }
Button { id: btnFindNext; text: EDIT_FIND_NEXT } Button { id: btnFindNext; text: EDIT_FIND_NEXT }
Button { id: btnFindPrev; text: EDIT_FIND_PREV } Button { id: btnFindPrev; text: EDIT_FIND_PREV }
} }
HorizontalLayout { HorizontalLayout {
id: replace id: replace
layoutWidth: fill; layoutWidth: fill;
EditLine { id: edReplace; layoutWidth: fill } EditLine { id: edReplace; layoutWidth: fill; alignment: vcenter }
Button { id: btnReplace; text: EDIT_REPLACE_NEXT } Button { id: btnReplace; text: EDIT_REPLACE_NEXT }
Button { id: btnReplaceAll; text: EDIT_REPLACE_ALL } Button { id: btnReplaceAll; text: EDIT_REPLACE_ALL }
} }
} }
VerticalLayout { VerticalLayout {
HorizontalLayout { HorizontalLayout {
CheckBox { id: cbCaseInsensitive; text: "Aa" } ImageCheckButton { id: cbCaseSensitive; drawableId: "find_case_sensitive"; tooltipText: EDIT_FIND_CASE_SENSITIVE; styleId: TOOLBAR_BUTTON; alignment: vcenter }
CheckBox { id: cbWholeWords; text: "Words" } ImageCheckButton { id: cbWholeWords; drawableId: "find_whole_words"; tooltipText: EDIT_FIND_WHOLE_WORDS; styleId: TOOLBAR_BUTTON; alignment: vcenter }
CheckBox { id: cbSelection; text: "Sel" } CheckBox { id: cbSelection; text: "Sel" }
} }
VSpacer {} VSpacer {}
@ -2904,8 +2904,8 @@ class FindPanel : HorizontalLayout {
_btnFindPrev = childById!Button("btnFindPrev"); _btnFindPrev = childById!Button("btnFindPrev");
_btnReplace = childById!Button("btnReplace"); _btnReplace = childById!Button("btnReplace");
_btnReplaceAll = childById!Button("btnReplaceAll"); _btnReplaceAll = childById!Button("btnReplaceAll");
_cbCaseInsensitive = childById!CheckBox("cbCaseInsinsitive"); _cbCaseSensitive = childById!ImageCheckButton("cbCaseSensitive");
_cbWholeWords = childById!CheckBox("cbWholeWords"); _cbWholeWords = childById!ImageCheckButton("cbWholeWords");
_cbSelection = childById!CheckBox("cbSelection"); _cbSelection = childById!CheckBox("cbSelection");
if (!replace) if (!replace)
childById("replace").visibility = Visibility.Gone; childById("replace").visibility = Visibility.Gone;

View File

@ -1530,6 +1530,10 @@ public:
text = UIString(value); text = UIString(value);
return true; return true;
} }
if (name.equal("tooltipText")) {
tooltipText = UIString(value);
return true;
}
return false; return false;
} }
@ -1539,6 +1543,10 @@ public:
text = UIString(value); text = UIString(value);
return true; return true;
} }
if (name.equal("tooltipText")) {
tooltipText = UIString(value);
return true;
}
return false; return false;
} }
@ -1548,6 +1556,10 @@ public:
text = value; text = value;
return true; return true;
} }
if (name.equal("tooltipText")) {
tooltipText = value;
return true;
}
return false; return false;
} }

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:drawable="@null"
android:state_enabled="false"/>
<item
android:drawable="btn_pressed"
android:state_checked="true"
android:state_focused="true" />
<item
android:drawable="@null"
android:state_focused="true" />
<item
android:drawable="btn_pressed"
android:state_pressed="true" />
<item
android:drawable="btn_pressed"
android:state_checked="true" />
<item
android:drawable="btn_hover"
android:state_hovered="true" android:state_enabled="true" />
<item
android:drawable="@null" />
</selector>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:drawable="@null"
android:state_enabled="false"/>
<item
android:drawable="btn_pressed_dark"
android:state_checked="true"
android:state_focused="true" />
<item
android:drawable="@null"
android:state_focused="true" />
<item
android:drawable="btn_pressed_dark"
android:state_pressed="true" />
<item
android:drawable="btn_pressed_dark"
android:state_checked="true" />
<item
android:drawable="btn_hover_dark"
android:state_hovered="true" android:state_enabled="true" />
<item
android:drawable="@null" />
</selector>

View File

@ -31,3 +31,7 @@ EDIT_FIND_NEXT=Find next
EDIT_FIND_PREV=Find prev EDIT_FIND_PREV=Find prev
EDIT_REPLACE_NEXT=Replace EDIT_REPLACE_NEXT=Replace
EDIT_REPLACE_ALL=Replace all EDIT_REPLACE_ALL=Replace all
EDIT_FIND_CASE_SENSITIVE=Case sensitive
EDIT_FIND_WHOLE_WORDS=Whole words
EDIT_FIND_SELECTION_ONLY=Selection only

View File

@ -25,3 +25,6 @@ EDIT_FIND_NEXT=Найти след
EDIT_FIND_PREV=Найти пред EDIT_FIND_PREV=Найти пред
EDIT_REPLACE_NEXT=Заменить EDIT_REPLACE_NEXT=Заменить
EDIT_REPLACE_ALL=Заменить все EDIT_REPLACE_ALL=Заменить все
EDIT_FIND_CASE_SENSITIVE=С учетом регистра
EDIT_FIND_WHOLE_WORDS=Только слова целиком
EDIT_FIND_SELECTION_ONLY=Только в выделенном

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 B

View File

@ -37,6 +37,10 @@
<style id="BUTTON_TRANSPARENT" <style id="BUTTON_TRANSPARENT"
backgroundImageId="btn_background_transparent_dark" backgroundImageId="btn_background_transparent_dark"
/> />
<style id="BUTTON_CHECK_TRANSPARENT"
backgroundImageId="btn_background_check_transparent_dark"
align="Center"
/>
<style id="BUTTON_LABEL" <style id="BUTTON_LABEL"
layoutWidth="FILL_PARENT" layoutWidth="FILL_PARENT"
focusRectColors="#FFF" focusRectColors="#FFF"

View File

@ -43,6 +43,10 @@
backgroundImageId="btn_background_transparent" backgroundImageId="btn_background_transparent"
align="Center" align="Center"
/> />
<style id="BUTTON_CHECK_TRANSPARENT"
backgroundImageId="btn_background_check_transparent"
align="Center"
/>
<style id="BUTTON_LABEL" <style id="BUTTON_LABEL"
layoutWidth="FILL_PARENT" layoutWidth="FILL_PARENT"
margins="2,2,2,2" margins="2,2,2,2"

View File

@ -15,6 +15,9 @@
<item <item
android:drawable="toolbar_button_pressed" android:drawable="toolbar_button_pressed"
android:state_pressed="true" /> android:state_pressed="true" />
<item
android:drawable="toolbar_button_pressed"
android:state_checked="true" />
<item <item
android:drawable="toolbar_button_hover" android:drawable="toolbar_button_hover"
android:state_hovered="true" /> android:state_hovered="true" />

View File

@ -15,6 +15,9 @@
<item <item
android:drawable="toolbar_button_pressed_dark" android:drawable="toolbar_button_pressed_dark"
android:state_pressed="true" /> android:state_pressed="true" />
<item
android:drawable="toolbar_button_pressed_dark"
android:state_checked="true" />
<item <item
android:drawable="toolbar_button_hover_dark" android:drawable="toolbar_button_hover_dark"
android:state_hovered="true" /> android:state_hovered="true" />

View File

@ -1,4 +1,6 @@
res/btn_background.xml res/btn_background.xml
res/btn_background_check_transparent.xml
res/btn_background_check_transparent_dark.xml
res/btn_background_dark.xml res/btn_background_dark.xml
res/btn_background_transparent.xml res/btn_background_transparent.xml
res/btn_background_transparent_dark.xml res/btn_background_transparent_dark.xml
@ -158,6 +160,8 @@ res/mdpi/editbox_background_focus.9.png
res/mdpi/editbox_background_focus_dark.9.png res/mdpi/editbox_background_focus_dark.9.png
res/mdpi/editbox_background_normal.9.png res/mdpi/editbox_background_normal.9.png
res/mdpi/editbox_background_normal_dark.9.png res/mdpi/editbox_background_normal_dark.9.png
res/mdpi/find_case_sensitive.png
res/mdpi/find_whole_words.png
res/mdpi/folder-blue.png res/mdpi/folder-blue.png
res/mdpi/folder-bookmark.png res/mdpi/folder-bookmark.png
res/mdpi/folder-network.png res/mdpi/folder-network.png