fix combobox style and disabled state handling for combobox

This commit is contained in:
Vadim Lopatin 2015-01-14 15:59:42 +03:00
parent 22bd6fac35
commit e7cd6a2c9d
3 changed files with 15 additions and 3 deletions

View File

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

View File

@ -190,6 +190,7 @@
fontFamily="SansSerif" fontFamily="SansSerif"
fontSize="16" fontSize="16"
/> />
<style id="COMBO_BOX" <style id="COMBO_BOX"
backgroundImageId="btn_background" backgroundImageId="btn_background"
padding="2,2,2,2" padding="2,2,2,2"
@ -213,6 +214,7 @@
backgroundImageId="btn_background_transparent" backgroundImageId="btn_background_transparent"
align="Center" align="Center"
/> />
<style id="EDIT_BOX" <style id="EDIT_BOX"
backgroundImageId="editbox_background" backgroundImageId="editbox_background"
padding="5,6,5,6" padding="5,6,5,6"

View File

@ -73,8 +73,18 @@ class ComboBoxBase : HorizontalLayout, OnClickHandler {
onItemClickListener(this, index); onItemClickListener(this, index);
} }
/// change enabled state
override @property Widget enabled(bool flg) {
super.enabled(flg);
_button.enabled = flg;
return this;
}
/// return true if state has State.Enabled flag set
override @property bool enabled() { return super.enabled; }
override bool onClick(Widget source) { override bool onClick(Widget source) {
showPopup(); if (enabled)
showPopup();
return true; return true;
} }