mirror of https://github.com/buggins/dlangui.git
example with custom theme - #353
This commit is contained in:
parent
47615966db
commit
e1dafeddfd
|
@ -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": "../../"}
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
EXETYPE NT
|
||||
SUBSYSTEM WINDOWS
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<theme
|
||||
id="theme_custom"
|
||||
parent="theme_default"
|
||||
>
|
||||
<style id="BUTTON"
|
||||
align="Center"
|
||||
margins="5pt,5pt,5pt,5pt"
|
||||
padding="5pt,5pt,5pt,5pt"
|
||||
fontSize="200%"
|
||||
fontWeight="bold"
|
||||
backgroundColor="#C0D8FF"
|
||||
>
|
||||
<state state_enabled="false" textColor="#C0000000"/>
|
||||
<state state_pressed="true" backgroundColor="#8080FF"/>
|
||||
<state state_focused="true" state_hovered="true" backgroundColor="#C0E0FF" textColor="#FF8000"/>
|
||||
<state state_focused="true" backgroundColor="#C0E0FF"/>
|
||||
<state state_focused="false" state_hovered="true" textColor="#FF8000"/>
|
||||
</style>
|
||||
</theme>
|
|
@ -0,0 +1,2 @@
|
|||
res/theme_custom.xml
|
||||
|
Loading…
Reference in New Issue