Add ToolTip example

This commit is contained in:
haru-s 2023-02-07 16:34:03 +09:00
parent f69baae4c9
commit ffa5cea7ca
10 changed files with 158 additions and 0 deletions

View file

@ -10,6 +10,7 @@ DFL is a Win32 windowing library for the D language.
![screen shot](./examples/splitter/image/screenshot.png "screen shot")
![screen shot](./examples/imagelist/image/screenshot.png "screen shot")
![screen shot](./examples/commondialog/image/screenshot.png "screen shot")
![screen shot](./examples/tooltip/image/screenshot.png "screen shot")
## Recent major features
- DUB is available for DFL.

16
examples/tooltip/.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

13
examples/tooltip/.vscode/launch.json vendored Normal file
View file

@ -0,0 +1,13 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "C++ Launch (Windows) imagelist",
"type": "cppvsdbg",
"request": "launch",
"cwd": "${workspaceRoot}",
"program": "./bin/tooltip_sample.exe",
"console": "internalConsole"
}
]
}

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

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

View file

@ -0,0 +1,2 @@
# Screen Shot
![screen shot](./image/screenshot.png "screen shot")

16
examples/tooltip/dub.json Normal file
View file

@ -0,0 +1,16 @@
{
"authors": ["haru-s"],
"copyright": "Copyright (C) 2023 haru-s",
"description": "DFL sample code.",
"name": "tooltip_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"]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

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,75 @@
import dfl;
version(Have_dfl) // For DUB.
{
}
else
{
pragma(lib, "dfl.lib");
}
class MainForm : Form
{
private ToolTip _tip1;
private ToolTip _tip2;
private ToolTip _tip3;
private Button _button1;
private Button _button2;
private Button _button3;
public this()
{
this.text = "ToolTip example";
this.size = Size(350, 300);
_button1 = new Button();
_button1.parent = this;
_button1.location = Point(10,10);
_button1.text = "Button 1";
_button2 = new Button();
_button2.parent = this;
_button2.location = Point(10,50);
_button2.text = "Button 2";
_button3 = new Button();
_button3.parent = this;
_button3.location = Point(10,90);
_button3.text = "Button 3";
_tip1 = new ToolTip();
_tip1.initialDelay = 500;
_tip1.reshowDelay = 100;
_tip1.autoPopDelay = 2000;
_tip1.showAlways = true;
_tip1.isBalloon = true;
_tip1.setToolTip(_button1,
"This unofficial project is a migration of D Forms Library (DFL) that is managed on SVN. \n" ~
"DFL is a Win32 windowing library for the D language.");
_tip2 = new ToolTip();
_tip2.showAlways = true;
_tip2.automaticDelay(100); // initialDelay = 100, autoPopDelay = 1000, reshowDelay = 20
_tip2.stripAmpersands = true; // bye (&X) => bye (X)
_tip2.useAnimation = false;
_tip2.useFading = false;
_tip2.setToolTip(_button2, "bye (&X)");
_tip3 = new ToolTip();
_tip3.showAlways = true;
_tip3.isBalloon = true;
_tip3.toolTipIcon = ToolTipIcon.INFO_LARGE;
_tip3.toolTipTitle = "Link";
_tip3.setToolTip(_button3, "https://github.com/Rayerd/dfl");
}
}
static this()
{
Application.enableVisualStyles();
}
void main()
{
Application.run(new MainForm());
}

View file

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