fix default theme; fix groupbox; better example1

This commit is contained in:
Vadim Lopatin 2016-10-10 13:45:22 +03:00
parent 36eda44f3d
commit 3dc06f6057
4 changed files with 36 additions and 7 deletions

View File

@ -421,20 +421,44 @@ extern (C) int UIAppMain(string[] args) {
{
LinearLayout controls = new VerticalLayout("controls");
controls.padding = Rect(5,5,5,5);
HorizontalLayout line1 = new HorizontalLayout();
controls.addChild(line1);
GroupBox gb = new GroupBox("checkboxes", "Check boxes"d);
gb.addChild(new CheckBox("cb1", "Check Box 1"d));
gb.addChild(new CheckBox("cb2", "Check Box 2"d).checked(true));
gb.addChild(new CheckBox("cb3", "Check Box 3 (disabled)"d).enabled(false));
gb.addChild(new CheckBox("cb1", "CheckBox 1"d));
gb.addChild(new CheckBox("cb2", "CheckBox 2"d).checked(true));
gb.addChild(new CheckBox("cb3", "CheckBox disabled"d).enabled(false));
line1.addChild(gb);
GroupBox gb2 = new GroupBox("radiobuttons", "Radio buttons"d);
gb2.addChild(new RadioButton("rb1", "Radio button 1"d).checked(true));
gb2.addChild(new RadioButton("rb2", "Radio button 2"d));
gb2.addChild(new RadioButton("rb3", "Radio button (disabled)"d).enabled(false));
gb2.addChild(new RadioButton("rb1", "RadioButton 1"d).checked(true));
gb2.addChild(new RadioButton("rb2", "RadioButton 2"d));
gb2.addChild(new RadioButton("rb3", "RadioButton disabled"d).enabled(false));
line1.addChild(gb2);
VerticalLayout col1 = new VerticalLayout();
GroupBox gb3 = new GroupBox("textbuttons", "Text buttons"d, Orientation.Horizontal);
gb3.addChild(new Button("tb1", "Button"d));
gb3.addChild(new Button("tb2", "Button disabled"d).enabled(false));
col1.addChild(gb3);
GroupBox gb4 = new GroupBox("imagetextbuttons", "ImageTextButton"d, Orientation.Horizontal);
gb4.addChild(new ImageTextButton("itb1", "document-open", "Enabled"d));
gb4.addChild(new ImageTextButton("itb2", "document-save", "Disabled"d).enabled(false));
col1.addChild(gb4);
line1.addChild(col1);
HorizontalLayout line2 = new HorizontalLayout();
controls.addChild(line2);
GroupBox gb5 = new GroupBox("scrollbar", "horizontal ScrollBar"d, Orientation.Horizontal);
gb5.addChild(new ScrollBar("sb1", Orientation.Horizontal).layoutWidth(FILL_PARENT));
line2.addChild(gb5);
GroupBox gb6 = new GroupBox("scrollbar", "horizontal SliderWidget"d, Orientation.Horizontal);
gb6.addChild(new SliderWidget("sb2", Orientation.Horizontal).layoutWidth(FILL_PARENT));
line2.addChild(gb6);
tabs.addTab(controls, "Controls"d);
}

View File

@ -151,7 +151,7 @@ class GroupBox : LinearLayout {
override protected void measuredContent(int parentWidth, int parentHeight, int contentWidth, int contentHeight) {
_caption.measure(parentWidth, parentHeight);
calcFrame();
int w = _caption.measuredWidth;
int w = _caption.measuredWidth + _topFrameLeft + _topFrameRight;
if (contentWidth < w)
contentWidth = w;
super.measuredContent(parentWidth, parentHeight, contentWidth, contentHeight);

View File

@ -514,6 +514,7 @@ class LinearLayout : WidgetGroupDefaultDrawing {
this(string ID, Orientation orientation = Orientation.Vertical) {
super(ID);
_layoutItems = new LayoutItems();
_orientation = orientation;
}
LayoutItems _layoutItems;

View File

@ -86,6 +86,7 @@
focusRectColors="#000"
>
<state state_enabled="true" state_hovered="true" textColor="#006080"/>
<state state_enabled="false" textColor="#909090"/>
</style>
<style id="RADIOBUTTON" parent="CHECKBOX"
margins="2,2,2,2"
@ -100,6 +101,7 @@
focusRectColors="#000"
>
<state state_enabled="true" state_hovered="true" textColor="#006080"/>
<state state_enabled="false" textColor="#909090"/>
</style>
<style id="TEXT"
margins="2,2,2,2"
@ -492,8 +494,10 @@
<drawable id="group_box_frame_up_right" value="group_box_frame_up_right"/>
<drawable id="group_box_frame_bottom" value="group_box_frame_bottom"/>
</style>
<style id="GROUP_BOX_CAPTION"
align="Left|VCenter"
textColor="#504840"
padding="1pt,1pt,1pt,1pt">
</style>