Add StatusBar example code.

Fix copyright in some dub.json files.
This commit is contained in:
haru-s 2023-01-08 22:22:01 +09:00
parent 457a1e76f4
commit be5ce5ef60
10 changed files with 127 additions and 3 deletions

View file

@ -1,6 +1,6 @@
{
"authors": ["haru-s"],
"copyright": "Copyright (C) 2022 haru-s",
"copyright": "Copyright (C) 2023 haru-s",
"description": "DFL sample code.",
"name": "buttons_example",
"targetType": "executable",

View file

@ -1,6 +1,6 @@
{
"authors": ["haru-s"],
"copyright": "Copyright (C) 2022 haru-s",
"copyright": "Copyright (C) 2023 haru-s",
"description": "DFL sample code.",
"name": "label_sample",
"targetType": "executable",

16
examples/statusbar/.gitignore vendored Normal file
View file

@ -0,0 +1,16 @@
.dub
docs.json
__dummy.html
docs/
/hello_dfl
hello_dfl.so
hello_dfl.dylib
hello_dfl.dll
hello_dfl.a
hello_dfl.lib
hello_dfl-test-*
*.exe
*.pdb
*.o
*.obj
*.lst

20
examples/statusbar/.vscode/tasks.json vendored Normal file
View file

@ -0,0 +1,20 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "dub",
"run": true,
"cwd": ".",
"compiler": "$current",
"archType": "$current",
"buildType": "$current",
"configuration": "$current",
"problemMatcher": [
"$dmd"
],
"group": "build",
"label": "dub: Build statusbar_sample",
"detail": "dub build --compiler=dmd.EXE -a=x86_64 -b=debug -c=application"
}
]
}

View file

@ -0,0 +1,16 @@
{
"authors": ["haru-s"],
"copyright": "Copyright (C) 2023 haru-s",
"description": "DFL sample code.",
"name": "statusbar_sample",
"targetType": "executable",
"targetPath": "bin",
"dependencies": {
"dfl": {
"path": "../../../dfl"
}
},
"lflags-windows-x86_omf-dmd": ["/exet:nt/su:windows:6.0"],
"lflags-windows-x86_mscoff-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"],
"lflags-windows-x86_64-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"]
}

View file

@ -0,0 +1,7 @@
{
"fileVersion": 1,
"versions": {
"dfl": {"path":"../.."},
"undead": "1.1.8"
}
}

View file

@ -0,0 +1,3 @@
set dmd_path=c:\d\dmd2\windows
set dmc_path=c:\dmc\dm
cmd

View file

@ -0,0 +1,50 @@
import dfl;
import std.conv;
version(Have_dfl) // For DUB.
{
}
else
{
pragma(lib, "dfl.lib");
}
class MainForm : Form
{
private StatusBar _statusBar;
this()
{
this.text = "StatusBar example";
this.size = Size(300, 300);
_statusBar = new StatusBar();
StatusBarPanel panel1 = new StatusBarPanel("Click count:");
StatusBarPanel panel2 = new StatusBarPanel("Second panel");
StatusBarPanel panel3 = new StatusBarPanel("Third panel");
panel1.borderStyle = StatusBarPanelBorderStyle.SUNKEN;
panel2.borderStyle = StatusBarPanelBorderStyle.RAISED;
panel3.borderStyle = StatusBarPanelBorderStyle.NONE;
panel1.width = 100;
_statusBar.panels.add(panel1);
_statusBar.panels.add(panel2);
_statusBar.panels.add(panel3);
_statusBar.showPanels = true;
_statusBar.parent = this;
this.click ~= (Control c, EventArgs e) {
static int counter;
panel1.text = "Click count: " ~ to!string(++counter);
};
}
}
void main()
{
Application.run(new MainForm());
}

View file

@ -0,0 +1,12 @@
{
"folders": [
{
"path": "."
}
],
"settings": {
"d.projectImportPaths": [
"..\\..\\..\\dfl\\source"
]
}
}

View file

@ -1,6 +1,6 @@
{
"authors": ["haru-s"],
"copyright": "Copyright (C) 2022 haru-s",
"copyright": "Copyright (C) 2023 haru-s",
"description": "DFL sample code.",
"name": "tabcontrol_sample",
"targetType": "executable",