From 37d5f1efcd344509b3443ad8f7521e8f8dd9c95b Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Wed, 14 Jan 2015 13:21:58 +0300 Subject: [PATCH] update styles for buttons and checkboxes; refactoring - extract color related definitions to colors.d --- dlanguilib.visualdproj | 1 + examples/example1/src/main.d | 27 +++-- res/theme_default.xml | 8 +- src/dlangui/all.d | 1 + src/dlangui/graphics/colors.d | 166 +++++++++++++++++++++++++++++++ src/dlangui/graphics/drawbuf.d | 103 +------------------ src/dlangui/graphics/images.d | 1 + src/dlangui/graphics/resources.d | 18 +--- src/dlangui/widgets/controls.d | 2 +- src/dlangui/widgets/styles.d | 113 ++++++--------------- 10 files changed, 231 insertions(+), 209 deletions(-) create mode 100644 src/dlangui/graphics/colors.d diff --git a/dlanguilib.visualdproj b/dlanguilib.visualdproj index fbb01e43..68c1fdd7 100644 --- a/dlanguilib.visualdproj +++ b/dlanguilib.visualdproj @@ -355,6 +355,7 @@ + diff --git a/examples/example1/src/main.d b/examples/example1/src/main.d index 93d29374..84debfc4 100644 --- a/examples/example1/src/main.d +++ b/examples/example1/src/main.d @@ -424,15 +424,30 @@ extern (C) int UIAppMain(string[] args) { } { - LinearLayout layout3 = new LinearLayout("tab3"); + LinearLayout layout3 = new VerticalLayout("tab3"); + // 3 types of buttons: Button, ImageButton, ImageTextButton layout3.addChild(new TextWidget(null, "Buttons in HorizontalLayout"d)); WidgetGroup buttons1 = new HorizontalLayout(); - buttons1.addChild(new Button("btn1", "Button 1"d)); - buttons1.addChild(new Button("btn2", "Button 2"d)); - buttons1.addChild(new Button("btn3", "Button 3"d)); - buttons1.addChild(new ResizerWidget()); - buttons1.addChild(new Button("btn4", "Button 4"d)); + buttons1.addChild(new TextWidget(null, "Button widgets: "d)); + buttons1.addChild(new Button("btn1", "Button"d)); + buttons1.addChild((new Button("btn2", "Disabled Button"d)).enabled(false)); + buttons1.addChild(new TextWidget(null, "ImageButton widgets: "d)); + buttons1.addChild(new ImageButton("btn3", "text-plain")); + buttons1.addChild(new TextWidget(null, "disabled: "d)); + buttons1.addChild((new ImageButton("btn4", "folder")).enabled(false)); + buttons1.addChild(new TextWidget(null, "ImageTextButton widgets: "d)); + buttons1.addChild(new ImageTextButton("btn5", "text-plain", "Enabled"d)); + buttons1.addChild((new ImageTextButton("btn6", "folder", "Disabled"d)).enabled(false)); layout3.addChild(buttons1); + + WidgetGroup buttons11 = new HorizontalLayout(); + buttons11.addChild(new TextWidget(null, "Construct buttons by action: "d)); + Action FILE_OPEN_ACTION = new Action(ACTION_FILE_OPEN, "MENU_FILE_OPEN"c, "document-open", KeyCode.KEY_O, KeyFlag.Control); + buttons11.addChild(new Button(FILE_OPEN_ACTION)); + buttons11.addChild(new ImageButton(FILE_OPEN_ACTION)); + buttons11.addChild(new ImageTextButton(FILE_OPEN_ACTION)); + layout3.addChild(buttons11); + layout3.addChild(new VSpacer()); layout3.addChild(new TextWidget(null, "CheckBoxes in HorizontalLayout"d)); WidgetGroup buttons2 = new HorizontalLayout(); diff --git a/res/theme_default.xml b/res/theme_default.xml index d3fe642d..b6d952e6 100644 --- a/res/theme_default.xml +++ b/res/theme_default.xml @@ -5,6 +5,7 @@ align="Center" margins="5,5,5,5" focusRectColors="#000" + textFlags="UnderlineHotKeys" />