diff --git a/res/btn_check.xml b/res/btn_check.xml index c8c2bee0..c38e9325 100644 --- a/res/btn_check.xml +++ b/res/btn_check.xml @@ -1,65 +1,38 @@ - - - - - + android:drawable="@drawable/btn_check_on_pressed" /> + android:drawable="@drawable/btn_check_off_pressed" /> + android:drawable="@drawable/btn_check_on_focused" /> + android:drawable="@drawable/btn_check_off_focused" /> + android:drawable="@drawable/btn_check_off" /> + android:drawable="@drawable/btn_check_on" /> - - + + - - - - - + + diff --git a/res/btn_check_holo_light.xml b/res/btn_check_holo_light.xml new file mode 100644 index 00000000..c8c2bee0 --- /dev/null +++ b/res/btn_check_holo_light.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/mdpi/btn_check_off.png b/res/mdpi/btn_check_off.png new file mode 100644 index 00000000..ae0bd562 Binary files /dev/null and b/res/mdpi/btn_check_off.png differ diff --git a/res/mdpi/btn_check_off_disabled.png b/res/mdpi/btn_check_off_disabled.png new file mode 100644 index 00000000..7f9630a7 Binary files /dev/null and b/res/mdpi/btn_check_off_disabled.png differ diff --git a/res/mdpi/btn_check_off_focused.png b/res/mdpi/btn_check_off_focused.png new file mode 100644 index 00000000..d248d50d Binary files /dev/null and b/res/mdpi/btn_check_off_focused.png differ diff --git a/res/mdpi/btn_check_off_pressed.png b/res/mdpi/btn_check_off_pressed.png new file mode 100644 index 00000000..1dc226ad Binary files /dev/null and b/res/mdpi/btn_check_off_pressed.png differ diff --git a/res/mdpi/btn_check_on.png b/res/mdpi/btn_check_on.png new file mode 100644 index 00000000..816fcbf0 Binary files /dev/null and b/res/mdpi/btn_check_on.png differ diff --git a/res/mdpi/btn_check_on_disabled.png b/res/mdpi/btn_check_on_disabled.png new file mode 100644 index 00000000..683aaeb7 Binary files /dev/null and b/res/mdpi/btn_check_on_disabled.png differ diff --git a/res/mdpi/btn_check_on_focused.png b/res/mdpi/btn_check_on_focused.png new file mode 100644 index 00000000..84b5e2c4 Binary files /dev/null and b/res/mdpi/btn_check_on_focused.png differ diff --git a/res/mdpi/btn_check_on_pressed.png b/res/mdpi/btn_check_on_pressed.png new file mode 100644 index 00000000..6e782667 Binary files /dev/null and b/res/mdpi/btn_check_on_pressed.png differ diff --git a/src/dlangui/widgets/styles.d b/src/dlangui/widgets/styles.d index 926badc6..78dd3ff1 100644 --- a/src/dlangui/widgets/styles.d +++ b/src/dlangui/widgets/styles.d @@ -49,7 +49,6 @@ immutable int SIZE_UNSPECIFIED = int.max; immutable uint TEXT_FLAGS_UNSPECIFIED = uint.max; /// use text flags from parent widget immutable uint TEXT_FLAGS_USE_PARENT = uint.max - 1; - /// layout option, to occupy all available place immutable int FILL_PARENT = int.max - 1; /// layout option, for size based on content @@ -57,6 +56,11 @@ immutable int WRAP_CONTENT = int.max - 2; /// to take layout weight from parent immutable int WEIGHT_UNSPECIFIED = -1; +/// returns true for WRAP_CONTENT, WRAP_CONTENT, SIZE_UNSPECIFIED +bool isSpecialSize(int sz) { + return sz >= WRAP_CONTENT; +} + /// Align option bit constants enum Align : ubyte { /// alignment is not specified diff --git a/src/dlangui/widgets/widget.d b/src/dlangui/widgets/widget.d index bed6141a..71ed5051 100644 --- a/src/dlangui/widgets/widget.d +++ b/src/dlangui/widgets/widget.d @@ -1056,6 +1056,13 @@ class Widget { // summarize margins, padding, and content size int dx = m.left + m.right + p.left + p.right + contentWidth; int dy = m.top + m.bottom + p.top + p.bottom + contentHeight; + // check for fixed size set in layoutWidth, layoutHeight + int lh = layoutHeight; + int lw = layoutWidth; + if (!isSpecialSize(lh)) + dy = lh; + if (!isSpecialSize(lw)) + dx = lw; // apply min/max width and height constraints int minw = minWidth; int maxw = maxWidth;