diff --git a/examples/themetest/dub.json b/examples/themetest/dub.json new file mode 100644 index 00000000..bdd6b0d1 --- /dev/null +++ b/examples/themetest/dub.json @@ -0,0 +1,13 @@ +{ + "name": "themetest", + "targetPath": "bin", + "targetType": "executable", + + "stringImportPaths": ["views", "views/res"], + + "sourceFiles-windows": ["$PACKAGE_DIR/src/win_app.def"], + + "dependencies": { + "dlangui": {"path": "../../"} + } +} diff --git a/examples/themetest/src/app.d b/examples/themetest/src/app.d new file mode 100644 index 00000000..d7844e9a --- /dev/null +++ b/examples/themetest/src/app.d @@ -0,0 +1,29 @@ +module app; +import dlangui; +mixin APP_ENTRY_POINT; +/// entry point for dlangui based application +extern (C) int UIAppMain(string[] args) { + // embed and register app resources listed in file views/resources.list + embeddedResourceList.addResources(embedResourcesFromList!("resources.list")()); + // load theme from file "theme_custom.xml" + Platform.instance.uiTheme = "theme_custom"; + // create window + Window window = Platform.instance.createWindow("DlangUI example - HelloWorld", null); + // create some widget to show in window + window.mainWidget = parseML(q{ + VerticalLayout { + margins: 10pt + padding: 10pt + layoutWidth: fill + // red bold text with size = 150% of base style size and font face Arial + TextWidget { text: "Theme test for ThemeTest" } + Button { text: "Sample button 1 (enabled)" } + Button { text: "Sample button 2 (enabled)" } + Button { text: "Sample button 3 (disabled)"; enabled: false } + } + }); + // show window ; styleId: CUSTOM_BUTTON + window.show(); + // run message loop + return Platform.instance.enterMessageLoop(); +} diff --git a/examples/themetest/src/win_app.def b/examples/themetest/src/win_app.def new file mode 100644 index 00000000..40b796c7 --- /dev/null +++ b/examples/themetest/src/win_app.def @@ -0,0 +1,2 @@ +EXETYPE NT +SUBSYSTEM WINDOWS diff --git a/examples/themetest/views/res/theme_custom.xml b/examples/themetest/views/res/theme_custom.xml new file mode 100644 index 00000000..4308c8b6 --- /dev/null +++ b/examples/themetest/views/res/theme_custom.xml @@ -0,0 +1,20 @@ + + + + diff --git a/examples/themetest/views/resources.list b/examples/themetest/views/resources.list new file mode 100644 index 00000000..22c89c98 --- /dev/null +++ b/examples/themetest/views/resources.list @@ -0,0 +1,2 @@ +res/theme_custom.xml +