mirror of
https://github.com/Rayerd/dfl.git
synced 2025-04-26 13:09:57 +03:00
Add NotifyIcon example
This commit is contained in:
parent
5c50f00721
commit
e8487df076
10 changed files with 126 additions and 0 deletions
16
examples/notifyicon/.gitignore
vendored
Normal file
16
examples/notifyicon/.gitignore
vendored
Normal 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/notifyicon/.vscode/launch.json
vendored
Normal file
13
examples/notifyicon/.vscode/launch.json
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "C++ Launch (Windows) notifyicon",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"cwd": "${workspaceRoot}",
|
||||
"program": "./bin/notifyicon_sample.exe",
|
||||
"console": "internalConsole"
|
||||
}
|
||||
]
|
||||
}
|
20
examples/notifyicon/.vscode/tasks.json
vendored
Normal file
20
examples/notifyicon/.vscode/tasks.json
vendored
Normal 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 notifyicon_sample",
|
||||
"detail": "dub build --compiler=dmd.EXE -a=x86_64 -b=debug -c=application"
|
||||
}
|
||||
]
|
||||
}
|
2
examples/notifyicon/README.md
Normal file
2
examples/notifyicon/README.md
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Screen Shot
|
||||

|
16
examples/notifyicon/dub.json
Normal file
16
examples/notifyicon/dub.json
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"authors": ["haru-s"],
|
||||
"copyright": "Copyright (C) 2023 haru-s",
|
||||
"description": "DFL sample code.",
|
||||
"name": "notifyicon_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"]
|
||||
}
|
BIN
examples/notifyicon/image/icon.ico
Normal file
BIN
examples/notifyicon/image/icon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
examples/notifyicon/image/screenshot.png
Normal file
BIN
examples/notifyicon/image/screenshot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.3 KiB |
12
examples/notifyicon/notifyicon.code-workspace
Normal file
12
examples/notifyicon/notifyicon.code-workspace
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "."
|
||||
}
|
||||
],
|
||||
"settings": {
|
||||
"d.projectImportPaths": [
|
||||
"..\\..\\..\\dfl\\source"
|
||||
]
|
||||
}
|
||||
}
|
3
examples/notifyicon/shell.bat
Normal file
3
examples/notifyicon/shell.bat
Normal file
|
@ -0,0 +1,3 @@
|
|||
set dmd_path=c:\d\dmd2\windows
|
||||
set dmc_path=c:\dmc\dm
|
||||
cmd
|
44
examples/notifyicon/source/notifyicon_sample.d
Normal file
44
examples/notifyicon/source/notifyicon_sample.d
Normal file
|
@ -0,0 +1,44 @@
|
|||
import dfl;
|
||||
|
||||
version(Have_dfl) // For DUB.
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
pragma(lib, "dfl.lib");
|
||||
}
|
||||
|
||||
class MainForm : Form
|
||||
{
|
||||
private NotifyIcon _notifyIcon;
|
||||
|
||||
public this()
|
||||
{
|
||||
this.text = "NotifyIcon example";
|
||||
this.size = Size(300, 200);
|
||||
|
||||
MenuItem _menuItem1 = new MenuItem("Show");
|
||||
_menuItem1.click ~= (MenuItem mi, EventArgs e) { msgBox("Hi!"); };
|
||||
|
||||
MenuItem _menuItem2 = new MenuItem("Close");
|
||||
_menuItem2.click ~= (MenuItem mi, EventArgs e) { this.close(); };
|
||||
|
||||
_notifyIcon = new NotifyIcon;
|
||||
_notifyIcon.icon = new Icon(r".\image\icon.ico");
|
||||
_notifyIcon.text = "This is tooltip text";
|
||||
_notifyIcon.contextMenu = new ContextMenu;
|
||||
_notifyIcon.contextMenu.menuItems.add(_menuItem1);
|
||||
_notifyIcon.contextMenu.menuItems.add(_menuItem2);
|
||||
_notifyIcon.show();
|
||||
}
|
||||
}
|
||||
|
||||
static this()
|
||||
{
|
||||
Application.enableVisualStyles();
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
Application.run(new MainForm());
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue