diff --git a/README.md b/README.md index 5251298..5c1cceb 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/examples/tooltip/.gitignore b/examples/tooltip/.gitignore new file mode 100644 index 0000000..60a5f2a --- /dev/null +++ b/examples/tooltip/.gitignore @@ -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 diff --git a/examples/tooltip/.vscode/launch.json b/examples/tooltip/.vscode/launch.json new file mode 100644 index 0000000..1bbaa28 --- /dev/null +++ b/examples/tooltip/.vscode/launch.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/examples/tooltip/.vscode/tasks.json b/examples/tooltip/.vscode/tasks.json new file mode 100644 index 0000000..8fbf9de --- /dev/null +++ b/examples/tooltip/.vscode/tasks.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/examples/tooltip/README.md b/examples/tooltip/README.md new file mode 100644 index 0000000..b1a86ca --- /dev/null +++ b/examples/tooltip/README.md @@ -0,0 +1,2 @@ +# Screen Shot +![screen shot](./image/screenshot.png "screen shot") diff --git a/examples/tooltip/dub.json b/examples/tooltip/dub.json new file mode 100644 index 0000000..60855d3 --- /dev/null +++ b/examples/tooltip/dub.json @@ -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"] +} \ No newline at end of file diff --git a/examples/tooltip/image/screenshot.png b/examples/tooltip/image/screenshot.png new file mode 100644 index 0000000..e9fc4d5 Binary files /dev/null and b/examples/tooltip/image/screenshot.png differ diff --git a/examples/tooltip/shell.bat b/examples/tooltip/shell.bat new file mode 100644 index 0000000..49ab56b --- /dev/null +++ b/examples/tooltip/shell.bat @@ -0,0 +1,3 @@ +set dmd_path=c:\d\dmd2\windows +set dmc_path=c:\dmc\dm +cmd diff --git a/examples/tooltip/source/tooltip_sample.d b/examples/tooltip/source/tooltip_sample.d new file mode 100644 index 0000000..ec12c1e --- /dev/null +++ b/examples/tooltip/source/tooltip_sample.d @@ -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()); +} diff --git a/examples/tooltip/tooltip.code-workspace b/examples/tooltip/tooltip.code-workspace new file mode 100644 index 0000000..7e696bc --- /dev/null +++ b/examples/tooltip/tooltip.code-workspace @@ -0,0 +1,12 @@ +{ + "folders": [ + { + "path": "." + } + ], + "settings": { + "d.projectImportPaths": [ + "..\\..\\..\\dfl\\source" + ] + } +} \ No newline at end of file