├── .gitignore ├── .vscode ├── settings.json └── tasks.json ├── README.md ├── _cmd.bat ├── dfl.code-workspace ├── dub.json ├── dubclean.ps1 ├── examples ├── buttons │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── README.md │ ├── buttons.code-workspace │ ├── dub.json │ ├── image │ │ └── screenshot.png │ ├── shell.bat │ └── source │ │ └── buttons_example.d ├── clipboard │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── README.md │ ├── clipboard.code-workspace │ ├── dub.json │ ├── image │ │ ├── sample.bmp │ │ ├── sample_1.bmp │ │ ├── sample_24.bmp │ │ ├── sample_4.bmp │ │ ├── sample_8.bmp │ │ └── screenshot.png │ ├── shell.bat │ └── source │ │ └── clipboard_sample.d ├── clippingform │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── README.md │ ├── clippingform.code-workspace │ ├── dub.json │ ├── image │ │ ├── clipping.bmp │ │ └── screenshot.png │ ├── shell.bat │ └── source │ │ └── clippingform_sample.d ├── commondialog │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── README.md │ ├── commondialog.code-workspace │ ├── dub.json │ ├── image │ │ ├── screenshot.png │ │ └── screenshot2.png │ ├── shell.bat │ └── source │ │ └── commondialog_sample.d ├── contextmenu │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── README.md │ ├── contextmenu.code-workspace │ ├── dub.json │ ├── image │ │ └── screenshot.png │ ├── shell.bat │ └── source │ │ └── contextmenu_sample.d ├── dclock │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── README.md │ ├── dclock.code-workspace │ ├── dub.json │ ├── image │ │ └── screenshot.png │ ├── shell.bat │ └── source │ │ └── dclock.d ├── draganddrop │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── README.md │ ├── draganddrop.code-workspace │ ├── dub.json │ ├── image │ │ ├── screenshot1.png │ │ └── screenshot2.png │ ├── shell.bat │ └── source │ │ └── draganddrop_sample.d ├── dragdroplistbox │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── README.md │ ├── dragdroplistbox.code-workspace │ ├── dub.json │ ├── image │ │ ├── screenshot1.png │ │ └── screenshot2.png │ ├── shell.bat │ └── source │ │ └── dragdroplistbox_sample.d ├── hello_dfl │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── README.md │ ├── build32mscoff.bat │ ├── build64.bat │ ├── dub.json │ ├── hello_dfl.code-workspace │ ├── image │ │ └── screenshot.png │ ├── shell.bat │ └── source │ │ └── hello_dfl.d ├── imagelist │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── README.md │ ├── dub.json │ ├── image │ │ ├── rgb.bmp │ │ └── screenshot.png │ ├── imagelist.code-workspace │ ├── shell.bat │ └── source │ │ └── imagelist_sample.d ├── label │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── README.md │ ├── dub.json │ ├── image │ │ └── screenshot.png │ ├── label.code-workspace │ ├── shell.bat │ └── source │ │ └── label_sample.d ├── linegraphrenderer │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── README.md │ ├── dub.json │ ├── image │ │ └── screenshot.png │ ├── linegraphrenderer.code-workspace │ ├── shell.bat │ └── source │ │ └── linegraphrenderer_sample.d ├── listview │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── README.md │ ├── dub.json │ ├── dub.selections.json │ ├── image │ │ └── screenshot.png │ ├── listview.code-workspace │ ├── shell.bat │ └── source │ │ └── listview_sample.d ├── notifyicon │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── README.md │ ├── dub.json │ ├── image │ │ ├── icon.ico │ │ ├── icon2.ico │ │ └── screenshot.png │ ├── notifyicon.code-workspace │ ├── shell.bat │ └── source │ │ └── notifyicon_sample.d ├── picturebox │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── README.md │ ├── dub.json │ ├── image │ │ ├── dman-error.bmp │ │ └── screenshot.png │ ├── picturebox.code-workspace │ ├── shell.bat │ └── source │ │ └── picturebox_sample.d ├── progressbar │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── README.md │ ├── dub.json │ ├── image │ │ ├── screenshot1.png │ │ ├── screenshot2.png │ │ ├── screenshot3.png │ │ └── screenshot4.png │ ├── progressbar.code-workspace │ ├── shell.bat │ └── source │ │ └── progressbar_sample.d ├── registry │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── README.md │ ├── dub.json │ ├── image │ │ └── screenshot.png │ ├── registry.code-workspace │ ├── shell.bat │ └── source │ │ └── registry_sample.d ├── resources │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── README.md │ ├── dub.json │ ├── image │ │ ├── d-cursor.cur │ │ ├── dman-error.bmp │ │ ├── icon.ico │ │ └── screenshot.png │ ├── make_resource.bat │ ├── resource │ │ ├── sample.rc │ │ └── sample.res │ ├── resources.code-workspace │ ├── shell.bat │ └── source │ │ └── resources_sample.d ├── richtextbox │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── README.md │ ├── dub.json │ ├── image │ │ └── screenshot.png │ ├── richtextbox.code-workspace │ ├── shell.bat │ └── source │ │ └── richtextbox_sample.d ├── scrollbar │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── README.md │ ├── dub.json │ ├── image │ │ └── screenshot.png │ ├── scrollbar.code-workspace │ ├── shell.bat │ └── source │ │ └── scrollbar_example.d ├── socket_client │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── README.md │ ├── dub.json │ ├── image │ │ └── screenshot.png │ ├── shell.bat │ ├── socket.code-workspace │ └── source │ │ └── socket_sample.d ├── socket_server │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── README.md │ ├── dub.json │ ├── image │ │ └── screenshot.png │ ├── shell.bat │ ├── socket.code-workspace │ └── source │ │ └── socket_sample.d ├── splitter │ ├── .gitignore │ ├── .vscode │ │ └── tasks.json │ ├── README.md │ ├── dub.json │ ├── image │ │ └── screenshot.png │ ├── shell.bat │ ├── source │ │ └── splitter_sample.d │ └── splitter.code-workspace ├── statusbar │ ├── .gitignore │ ├── .vscode │ │ └── tasks.json │ ├── README.md │ ├── dub.json │ ├── image │ │ └── screenshot.png │ ├── shell.bat │ ├── source │ │ └── statusbar_sample.d │ └── statusbar.code-workspace ├── tabcontrol │ ├── .gitignore │ ├── .vscode │ │ └── tasks.json │ ├── README.md │ ├── dub.json │ ├── image │ │ └── screenshot.png │ ├── shell.bat │ ├── source │ │ └── trackbar_sample.d │ └── tabcontrol.code-workspace ├── tablerenderer │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── README.md │ ├── dub.json │ ├── image │ │ └── screenshot.png │ ├── shell.bat │ ├── source │ │ └── tablerenderer_sample.d │ └── tablerenderer.code-workspace ├── textbox │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── README.md │ ├── dub.json │ ├── image │ │ └── screenshot.png │ ├── shell.bat │ ├── source │ │ └── textbox_sample.d │ └── textbox.code-workspace ├── timechartrenderer │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── README.md │ ├── dub.json │ ├── image │ │ └── screenshot.png │ ├── shell.bat │ ├── source │ │ └── timechartrenderer_sample.d │ └── timechartrenderer.code-workspace ├── timer │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── README.md │ ├── dub.json │ ├── image │ │ └── screenshot.png │ ├── shell.bat │ ├── source │ │ └── timer_sample.d │ └── timer.code-workspace ├── toolbar │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── README.md │ ├── dub.json │ ├── image │ │ ├── screenshot.png │ │ ├── screenshot2.png │ │ ├── screenshot3.png │ │ └── toolbaricon.bmp │ ├── shell.bat │ ├── source │ │ └── toolbar_sample.d │ └── toolbar.code-workspace ├── tooltip │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── README.md │ ├── dub.json │ ├── image │ │ └── screenshot.png │ ├── shell.bat │ ├── source │ │ └── tooltip_sample.d │ └── tooltip.code-workspace └── trackbar │ ├── .gitignore │ ├── .vscode │ ├── launch.json │ └── tasks.json │ ├── README.md │ ├── dub.json │ ├── image │ └── screenshot.png │ ├── shell.bat │ ├── source │ └── trackbar_sample.d │ └── trackbar.code-workspace ├── go.bat ├── go64.bat.lnk ├── image └── welcomtodfl.png ├── lgpl.txt ├── lib ├── windows-x86_64 │ ├── README.txt │ ├── advapi32.lib │ ├── comctl32.lib │ ├── comdlg32.lib │ ├── gdi32.lib │ ├── ole32.lib │ ├── oleaut32.lib │ ├── shell32.lib │ ├── user32.lib │ └── ws2_32.lib └── windows-x86_mscoff │ ├── README.txt │ ├── advapi32.lib │ ├── comctl32.lib │ ├── comdlg32.lib │ ├── gdi32.lib │ ├── ole32.lib │ ├── oleaut32.lib │ ├── shell32.lib │ ├── user32.lib │ └── ws2_32.lib ├── license.txt ├── makecoff.bat ├── makelib.bat ├── source └── dfl │ ├── all.d │ ├── application.d │ ├── base.d │ ├── button.d │ ├── chart.d │ ├── clipboard.d │ ├── clippingform.d │ ├── collections.d │ ├── colordialog.d │ ├── combobox.d │ ├── commondialog.d │ ├── control.d │ ├── data.d │ ├── drawing.d │ ├── environment.d │ ├── event.d │ ├── filedialog.d │ ├── folderdialog.d │ ├── fontdialog.d │ ├── form.d │ ├── groupbox.d │ ├── image │ └── previewprintdialog_toolbar.bmp │ ├── imagelist.d │ ├── internal │ ├── clib.d │ ├── com.d │ ├── d1.d │ ├── d2.d │ ├── dlib.d │ ├── dpiaware.d │ ├── utf.d │ ├── winapi.d │ └── wincom.d │ ├── label.d │ ├── listbox.d │ ├── listview.d │ ├── menu.d │ ├── messagebox.d │ ├── notifyicon.d │ ├── package.d │ ├── panel.d │ ├── picturebox.d │ ├── printing.d │ ├── progressbar.d │ ├── registry.d │ ├── resources.d │ ├── richtextbox.d │ ├── sharedcontrol.d │ ├── socket.d │ ├── splitter.d │ ├── statusbar.d │ ├── tabcontrol.d │ ├── textbox.d │ ├── textboxbase.d │ ├── timer.d │ ├── toolbar.d │ ├── tooltip.d │ ├── trackbar.d │ ├── treeview.d │ └── usercontrol.d └── zlib.txt /.gitignore: -------------------------------------------------------------------------------- 1 | *.info 2 | *.json 3 | *.bat 4 | *.lib 5 | *.sh 6 | *.obj 7 | *.exe 8 | *.pdb 9 | *.ilk 10 | .dub/code/ -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "dscanner.ignoredKeys": [ 3 | "dscanner.style.number_literals", 4 | "dscanner.style.phobos_naming_convention" 5 | ] 6 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "dub", 6 | "label": "dub build dfl", 7 | "run": false, 8 | "cwd": ".", 9 | "compiler": "$current", 10 | "archType": "$current", 11 | "buildType": "$current", 12 | "configuration": "library", 13 | "problemMatcher": [ 14 | "$dmd" 15 | ], 16 | "dub_args": [ 17 | "--parallel" 18 | ], 19 | "group": { 20 | "kind": "build", 21 | "isDefault": true 22 | }, 23 | "presentation": { 24 | "clear": true 25 | } 26 | }, 27 | { 28 | "type": "dub", 29 | "label": "dub test dfl", 30 | "run": true, 31 | "cwd": ".", 32 | "compiler": "$current", 33 | "archType": "$current", 34 | "buildType": "unittest", 35 | "configuration": "unittest", 36 | "problemMatcher": [ 37 | "$dmd" 38 | ], 39 | "dub_args": [ 40 | "--parallel" 41 | ], 42 | "group": { 43 | "kind": "test" 44 | }, 45 | "presentation": { 46 | "clear": true 47 | } 48 | } 49 | ] 50 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # DFL 3 | 4 | This unofficial project is a migration of [D Forms Library (DFL)](http://wiki.dprogramming.com/Dfl/HomePage "D Forms Library (DFL)") that is managed on SVN. 5 | DFL is a Win32 windowing library for the D language. 6 | 7 | ```d 8 | import dfl; 9 | 10 | void main() 11 | { 12 | Form form = new Form; 13 | form.text = "Welcome to DFL"; 14 | form.size = Size(300, 300); 15 | 16 | Button button = new Button; 17 | button.text = "OK"; 18 | button.location = Point(20, 20); 19 | button.size = Size(100, 50); 20 | button.click ~= (Control c, EventArgs e) => msgBox("OK button is clicked."); 21 | button.parent = form; 22 | 23 | Application.run(form); 24 | } 25 | ``` 26 | ![screen shot](./image/welcomtodfl.png "screen shot") 27 | 28 | ## Recent major features 29 | - **Removed dependency on undeaD library.** 30 | - Windows OMF support has been removed (for DMD v2.109.0). 31 | - Registered DFL to DUB. 32 | - Supported multiple screens. 33 | - Module "dfl.chart" is now comming. 34 | - TableRenderer (with example) 35 | - LineGraphRenderer (with example) 36 | - TimeChartRenderer (with example) 37 | - Module "dfl.printing" is now comming. 38 | - PrintDialog 39 | - PrintSetupDialog 40 | - PrintPreviewDialog 41 | - Remove dflexe. 42 | - Remove GTK-based DFL. 43 | - Remove some bundled libraries such as user32_dfl.lib etc... (From now on, use dmd-bundled libraries such as the MinGW platform library and so on.) 44 | 45 | ## Screen shots 46 | 47 | ![screen shot](./examples/buttons/image/screenshot.png "screen shot") 48 | ![screen shot](./examples/tabcontrol/image/screenshot.png "screen shot") 49 | ![screen shot](./examples/listview/image/screenshot.png "screen shot") 50 | ![screen shot](./examples/statusbar/image/screenshot.png "screen shot") 51 | ![screen shot](./examples/splitter/image/screenshot.png "screen shot") 52 | ![screen shot](./examples/scrollbar/image/screenshot.png "screen shot") 53 | ![screen shot](./examples/imagelist/image/screenshot.png "screen shot") 54 | ![screen shot](./examples/commondialog/image/screenshot.png "screen shot") 55 | ![screen shot](./examples/commondialog/image/screenshot2.png "screen shot") 56 | ![screen shot](./examples/tooltip/image/screenshot.png "screen shot") 57 | ![screen shot](./examples/progressbar/image/screenshot3.png "screen shot") 58 | ![screen shot](./examples/clipboard/image/screenshot.png "screen shot") 59 | ![screen shot](./examples/clippingform/image/screenshot.png "screen shot") 60 | ![screen shot](./examples/picturebox/image/screenshot.png "screen shot") 61 | ![screen shot](./examples/notifyicon/image/screenshot.png "screen shot") 62 | ![screen shot](./examples/timer/image/screenshot.png "screen shot") 63 | ![screen shot](./examples/contextmenu/image/screenshot.png "screen shot") 64 | ![screen shot](./examples/toolbar/image/screenshot.png "screen shot") 65 | ![screen shot](./examples/richtextbox/image/screenshot.png "screen shot") 66 | ![screen shot](./examples/dclock/image/screenshot.png "screen shot") 67 | ![screen shot](./examples/tablerenderer/image/screenshot.png "screen shot") 68 | ![screen shot](./examples/linegraphrenderer/image/screenshot.png "screen shot") 69 | ![screen shot](./examples/timechartrenderer/image/screenshot.png "screen shot") 70 | 71 | ## Usage 72 | First, you make new DUB project: 73 | ```bat 74 | > cd examples\new_project 75 | > dub init 76 | ``` 77 | Add DFL to local DUB registry: 78 | ```bat 79 | > dub add dfl 80 | > dub list 81 | Packages present in the system and known to dub: 82 | dfl 0.10.11: c:\your\path\dfl\0.10.11\dfl\ 83 | silly 1.2.0-dev.2: c:\your\path\silly\1.2.0-dev.2\silly\ 84 | ``` 85 | Build and run your GUI applications with DUB as below: 86 | ```bat 87 | > dub build -a=x86_64 88 | > dub run 89 | ``` 90 | **IMPORTANT**: DUB is building **dfl_dub.lib** that is **not** containing WINSDK libraries. 91 | 92 | ## APPENDIX: Build and Install dfl.lib and dfl_debug.lib 93 | ### 1. Set environment variables 94 | Fix the paths below: 95 | ```bat 96 | set dmd_path=c:\d\dmd2\windows 97 | set dmc_path=c:\dmc\dm 98 | ``` 99 | 100 | ### 2. Make dfl.lib and dfl_debug.lib 101 | Run **makelib.bat** (MSVC required): 102 | ```bat 103 | > cd dfl 104 | > makelib.bat # 32-bit mscoff 105 | ``` 106 | or (MSVC required) 107 | ```bat 108 | > makelib.bat 32mscoff # ditto 109 | ``` 110 | or (MSVC required) 111 | ```bat 112 | > makelib.bat 64 # 64-bit mscoff 113 | ``` 114 | Also copy **dfl.lib** and **dfl_debug.lib** in `dfl/source` to `your/lib/dir`. 115 | 116 | **IMPORTANT**: These library files are containing WINSDK libraries such as **user32.lib**, **gdi32.lib** and so on. 117 | 118 | In order to make and move *.lib to paths below: 119 | - **go.bat** (MSVC required) : Make and move *.lib to `%dmd_path%\lib32mscoff` 120 | - **go.bat 32mscoff** (MSVC required) : ditto 121 | - **go64.bat** (MSVC required) : Make and move *.lib to `%dmd_path%\lib64` 122 | 123 | ## License 124 | DFL is under the boost and/or zlib/libpng license. 125 | 126 | However, trackbar.d is covered by the MIT license. 127 | -------------------------------------------------------------------------------- /_cmd.bat: -------------------------------------------------------------------------------- 1 | @rem Double-click this file on Windows 2000/XP to open a command prompt. 2 | 3 | 4 | @start "DFL" 5 | 6 | -------------------------------------------------------------------------------- /dfl.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": {} 8 | } -------------------------------------------------------------------------------- /dub.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "various" 4 | ], 5 | "description": "D Forms Library, or DFL, is a Win32 windowing library for the D language.", 6 | "license": "in license.txt", 7 | "name": "dfl", 8 | "targetPath": "bin", 9 | "targetName": "dfl_dub", 10 | "homepage": "https://github.com/Rayerd/dfl", 11 | "versions": [ 12 | "DFL_UNICODE", 13 | "REDEFINE_UUIDS" 14 | ], 15 | "libs-windows-x86_mscoff-dmd": [ 16 | "$DFL_PACKAGE_DIR/lib/windows-x86_mscoff/user32", 17 | "$DFL_PACKAGE_DIR/lib/windows-x86_mscoff/shell32", 18 | "$DFL_PACKAGE_DIR/lib/windows-x86_mscoff/gdi32", 19 | "$DFL_PACKAGE_DIR/lib/windows-x86_mscoff/comctl32", 20 | "$DFL_PACKAGE_DIR/lib/windows-x86_mscoff/advapi32", 21 | "$DFL_PACKAGE_DIR/lib/windows-x86_mscoff/comdlg32", 22 | "$DFL_PACKAGE_DIR/lib/windows-x86_mscoff/ole32", 23 | "$DFL_PACKAGE_DIR/lib/windows-x86_mscoff/OLEAUT32", 24 | "$DFL_PACKAGE_DIR/lib/windows-x86_mscoff/ws2_32" 25 | ], 26 | "libs-windows-x86_64-dmd": [ 27 | "$DFL_PACKAGE_DIR/lib/windows-x86_64/user32", 28 | "$DFL_PACKAGE_DIR/lib/windows-x86_64/shell32", 29 | "$DFL_PACKAGE_DIR/lib/windows-x86_64/gdi32", 30 | "$DFL_PACKAGE_DIR/lib/windows-x86_64/comctl32", 31 | "$DFL_PACKAGE_DIR/lib/windows-x86_64/advapi32", 32 | "$DFL_PACKAGE_DIR/lib/windows-x86_64/comdlg32", 33 | "$DFL_PACKAGE_DIR/lib/windows-x86_64/ole32", 34 | "$DFL_PACKAGE_DIR/lib/windows-x86_64/OLEAUT32", 35 | "$DFL_PACKAGE_DIR/lib/windows-x86_64/ws2_32" 36 | ], 37 | "configurations": [ 38 | { 39 | "name" : "library", 40 | "targetType": "staticLibrary", 41 | "dependencies": { 42 | } 43 | }, 44 | { 45 | "name" : "unittest", 46 | "targetType": "staticLibrary", 47 | "dependencies": { 48 | "silly": "~>1.2.0-dev.2" 49 | } 50 | } 51 | ] 52 | } 53 | -------------------------------------------------------------------------------- /dubclean.ps1: -------------------------------------------------------------------------------- 1 | dub clean 2 | dir examples | % { cd $_ && del ./bin/* && dub clean } 3 | -------------------------------------------------------------------------------- /examples/buttons/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | docs/ 5 | /hello_dfl 6 | hello_dfl.so 7 | hello_dfl.dylib 8 | hello_dfl.dll 9 | hello_dfl.a 10 | hello_dfl.lib 11 | hello_dfl-test-* 12 | *.exe 13 | *.pdb 14 | *.o 15 | *.obj 16 | *.lst 17 | -------------------------------------------------------------------------------- /examples/buttons/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "C++ Launch (Windows) buttons", 6 | "type": "cppvsdbg", 7 | "request": "launch", 8 | "cwd": "${workspaceRoot}", 9 | "program": "./bin/buttons_example.exe", 10 | "console": "internalConsole" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /examples/buttons/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "dub", 6 | "run": false, 7 | "cwd": ".", 8 | "compiler": "$current", 9 | "archType": "$current", 10 | "buildType": "$current", 11 | "configuration": "$current", 12 | "problemMatcher": [ 13 | "$dmd" 14 | ], 15 | "group": { 16 | "kind": "build", 17 | "isDefault": true 18 | }, 19 | "label": "dub: Build buttons_sample", 20 | "detail": "dub build --compiler=dmd.EXE -a=x86_64 -b=debug -c=application" 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /examples/buttons/README.md: -------------------------------------------------------------------------------- 1 | # Screen Shot 2 | ![screen shot](./image/screenshot.png "screen shot") 3 | -------------------------------------------------------------------------------- /examples/buttons/buttons.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": { 8 | "d.projectImportPaths": [ 9 | "..\\..\\..\\dfl\\source" 10 | ] 11 | } 12 | } -------------------------------------------------------------------------------- /examples/buttons/dub.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": ["haru-s"], 3 | "copyright": "Copyright (C) 2023 haru-s", 4 | "description": "DFL sample code.", 5 | "name": "buttons_example", 6 | "targetType": "executable", 7 | "targetPath": "bin", 8 | "dependencies": { 9 | "dfl": { 10 | "path": "../../../dfl" 11 | } 12 | }, 13 | "lflags-windows-x86_mscoff-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"], 14 | "lflags-windows-x86_64-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"] 15 | } -------------------------------------------------------------------------------- /examples/buttons/image/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/buttons/image/screenshot.png -------------------------------------------------------------------------------- /examples/buttons/shell.bat: -------------------------------------------------------------------------------- 1 | set dmd_path=c:\d\dmd2\windows 2 | set dmc_path=c:\dmc\dm 3 | cmd 4 | -------------------------------------------------------------------------------- /examples/buttons/source/buttons_example.d: -------------------------------------------------------------------------------- 1 | import dfl; 2 | 3 | version(Have_dfl) // For DUB. 4 | { 5 | } 6 | else 7 | { 8 | pragma(lib, "dfl.lib"); 9 | } 10 | 11 | class MainForm : Form 12 | { 13 | private Button _okButton; 14 | private Button _cancelButton; 15 | 16 | private RadioButton _radioButton1; 17 | private RadioButton _radioButton2; 18 | private RadioButton _radioButton3; 19 | private GroupBox _groupbox1; 20 | 21 | private RadioButton _radioButton4; 22 | private RadioButton _radioButton5; 23 | private RadioButton _radioButton6; 24 | private GroupBox _groupbox2; 25 | 26 | private CheckBox _checkbox1; 27 | private CheckBox _checkbox2; 28 | private CheckBox _checkbox3; 29 | 30 | private RadioButton getSelectedRadioButton(RadioButton[] arr) 31 | { 32 | foreach (elem; arr) 33 | { 34 | if (elem.checked) 35 | { 36 | return elem; 37 | } 38 | } 39 | return null; 40 | } 41 | 42 | public this() 43 | { 44 | // Form setting 45 | this.text = "Buttons example"; 46 | this.size = Size(400,300); 47 | this.formBorderStyle = FormBorderStyle.FIXED_DIALOG; 48 | this.maximizeBox = false; 49 | 50 | // Default button 51 | _okButton = new Button(); 52 | _okButton.location = Point(10,10); 53 | _okButton.text = "Done"; 54 | _okButton.click ~= (Control c, EventArgs e) 55 | { 56 | string s; 57 | 58 | RadioButton r1 = getSelectedRadioButton([_radioButton1, _radioButton2, _radioButton3]); 59 | if (r1) 60 | s ~= _groupbox1.text ~ " = " ~ r1.text ~ "\n"; 61 | 62 | RadioButton r2 = getSelectedRadioButton([_radioButton4, _radioButton5, _radioButton6]); 63 | if (r2) 64 | s ~= _groupbox2.text ~ " = " ~ r2.text ~ "\n"; 65 | 66 | s ~= _checkbox1.text ~ " = " ~ (_checkbox1.checked ? "CHECKED" : "") ~ "\n"; 67 | s ~= _checkbox2.text ~ " = " ~ (_checkbox2.checked ? "CHECKED" : "") ~ "\n"; 68 | s ~= _checkbox3.text ~ " = " ~ (_checkbox3.checked ? "CHECKED" : "") ~ "\n"; 69 | 70 | msgBox(s); 71 | }; 72 | _okButton.parent = this; 73 | 74 | // Cancel button 75 | _cancelButton = new Button(); 76 | _cancelButton.location = Point(100,10); 77 | _cancelButton.text = "Cancel"; 78 | _cancelButton.click ~= (Control c, EventArgs e) 79 | { 80 | msgBox("Close this application."); 81 | Application.exit(); 82 | }; 83 | _cancelButton.parent = this; 84 | 85 | this.acceptButton = _okButton; // pushed by ENTER 86 | this.cancelButton = _cancelButton; // pushed by ESC 87 | 88 | // First group 89 | _groupbox1 = new GroupBox(); 90 | _groupbox1.location = Point(10, 60); 91 | _groupbox1.size = Size(90, 150); 92 | _groupbox1.text = "Color"; 93 | _groupbox1.parent = this; 94 | 95 | // Default radio button in first group 96 | _radioButton1 = new RadioButton(); 97 | _radioButton1.location = Point(10, 40+30*0); 98 | _radioButton1.text = "Red"; 99 | _radioButton1.checked = true; // Default 100 | _radioButton1.parent = _groupbox1; 101 | 102 | _radioButton2 = new RadioButton(); 103 | _radioButton2.location = Point(10, 40+30*1); 104 | _radioButton2.text = "Yellow"; 105 | _radioButton2.parent = _groupbox1; 106 | 107 | _radioButton3 = new RadioButton(); 108 | _radioButton3.location = Point(10, 40+30*2); 109 | _radioButton3.text = "Green"; 110 | _radioButton3.enabled = false; // Disable 111 | _radioButton3.parent = _groupbox1; 112 | 113 | // Second group 114 | _groupbox2 = new GroupBox(); 115 | _groupbox2.location = Point(110, 60); 116 | _groupbox2.size = Size(90, 150); 117 | _groupbox2.text = "Fruits"; 118 | _groupbox2.parent = this; 119 | 120 | // Default radio button in second group 121 | _radioButton4 = new RadioButton(); 122 | _radioButton4.location = Point(10, 40+30*0); 123 | _radioButton4.text = "Apple"; 124 | _radioButton4.checked = true; // Default 125 | _radioButton4.parent = _groupbox2; 126 | 127 | _radioButton5 = new RadioButton(); 128 | _radioButton5.location = Point(10, 40+30*1); 129 | _radioButton5.text = "Banana"; 130 | _radioButton5.parent = _groupbox2; 131 | 132 | _radioButton6 = new RadioButton(); 133 | _radioButton6.location = Point(10, 40+30*2); 134 | _radioButton6.text = "Melon"; 135 | _radioButton6.parent = _groupbox2; 136 | 137 | // CheckBox 138 | _checkbox1 = new CheckBox(); 139 | _checkbox1.location = Point(250, 100); 140 | _checkbox1.text = "Kyoto"; 141 | _checkbox1.parent = this; 142 | 143 | _checkbox2 = new CheckBox(); 144 | _checkbox2.location = Point(250, 100+30*1); 145 | _checkbox2.text = "Tokyo"; 146 | _checkbox2.parent = this; 147 | 148 | _checkbox3 = new CheckBox(); 149 | _checkbox3.location = Point(250, 100+30*2); 150 | _checkbox3.text = "Osaka"; 151 | _checkbox3.parent = this; 152 | } 153 | } 154 | 155 | static this() 156 | { 157 | Application.enableVisualStyles(); 158 | } 159 | 160 | void main() 161 | { 162 | // Don't call this here!! 163 | // Application.enableVisualStyles(); 164 | 165 | Application.run(new MainForm()); 166 | } 167 | -------------------------------------------------------------------------------- /examples/clipboard/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | docs/ 5 | /hello_dfl 6 | hello_dfl.so 7 | hello_dfl.dylib 8 | hello_dfl.dll 9 | hello_dfl.a 10 | hello_dfl.lib 11 | hello_dfl-test-* 12 | *.exe 13 | *.pdb 14 | *.o 15 | *.obj 16 | *.lst 17 | -------------------------------------------------------------------------------- /examples/clipboard/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "C++ Launch (Windows) clipboard", 6 | "type": "cppvsdbg", 7 | "request": "launch", 8 | "cwd": "${workspaceRoot}", 9 | "program": "./bin/clipboard_sample.exe", 10 | "console": "internalConsole" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /examples/clipboard/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "dub", 6 | "run": false, 7 | "cwd": ".", 8 | "compiler": "$current", 9 | "archType": "$current", 10 | "buildType": "$current", 11 | "configuration": "$current", 12 | "problemMatcher": [ 13 | "$dmd" 14 | ], 15 | "group": { 16 | "kind": "build", 17 | "isDefault": true 18 | }, 19 | "label": "dub: Build clipboard_sample", 20 | "detail": "dub build --compiler=dmd.EXE -a=x86_64 -b=debug -c=application" 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /examples/clipboard/README.md: -------------------------------------------------------------------------------- 1 | # Screen Shot 2 | ![screen shot](./image/screenshot.png "screen shot") 3 | -------------------------------------------------------------------------------- /examples/clipboard/clipboard.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": { 8 | "d.projectImportPaths": [ 9 | "..\\..\\..\\dfl\\source" 10 | ] 11 | } 12 | } -------------------------------------------------------------------------------- /examples/clipboard/dub.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": ["haru-s"], 3 | "copyright": "Copyright (C) 2023 haru-s", 4 | "description": "DFL sample code.", 5 | "name": "clipboard_sample", 6 | "targetType": "executable", 7 | "targetPath": "bin", 8 | "dependencies": { 9 | "dfl": { 10 | "path": "../../../dfl" 11 | } 12 | }, 13 | "lflags-windows-x86_mscoff-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"], 14 | "lflags-windows-x86_64-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"] 15 | } -------------------------------------------------------------------------------- /examples/clipboard/image/sample.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/clipboard/image/sample.bmp -------------------------------------------------------------------------------- /examples/clipboard/image/sample_1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/clipboard/image/sample_1.bmp -------------------------------------------------------------------------------- /examples/clipboard/image/sample_24.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/clipboard/image/sample_24.bmp -------------------------------------------------------------------------------- /examples/clipboard/image/sample_4.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/clipboard/image/sample_4.bmp -------------------------------------------------------------------------------- /examples/clipboard/image/sample_8.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/clipboard/image/sample_8.bmp -------------------------------------------------------------------------------- /examples/clipboard/image/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/clipboard/image/screenshot.png -------------------------------------------------------------------------------- /examples/clipboard/shell.bat: -------------------------------------------------------------------------------- 1 | set dmd_path=c:\d\dmd2\windows 2 | set dmc_path=c:\dmc\dm 3 | cmd 4 | -------------------------------------------------------------------------------- /examples/clippingform/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | docs/ 5 | /hello_dfl 6 | hello_dfl.so 7 | hello_dfl.dylib 8 | hello_dfl.dll 9 | hello_dfl.a 10 | hello_dfl.lib 11 | hello_dfl-test-* 12 | *.exe 13 | *.pdb 14 | *.o 15 | *.obj 16 | *.lst 17 | -------------------------------------------------------------------------------- /examples/clippingform/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "C++ Launch (Windows) clippingform", 6 | "type": "cppvsdbg", 7 | "request": "launch", 8 | "cwd": "${workspaceRoot}", 9 | "program": "./bin/clippingform_sample.exe", 10 | "console": "internalConsole" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /examples/clippingform/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "dub", 6 | "run": false, 7 | "cwd": ".", 8 | "compiler": "$current", 9 | "archType": "$current", 10 | "buildType": "$current", 11 | "configuration": "$current", 12 | "problemMatcher": [ 13 | "$dmd" 14 | ], 15 | "group": { 16 | "kind": "build", 17 | "isDefault": true 18 | }, 19 | "label": "dub: Build clippingform_sample", 20 | "detail": "dub build --compiler=dmd.EXE -a=x86_64 -b=debug -c=application" 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /examples/clippingform/README.md: -------------------------------------------------------------------------------- 1 | # Screen Shot 2 | ![screen shot](./image/screenshot.png "screen shot") 3 | -------------------------------------------------------------------------------- /examples/clippingform/clippingform.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": { 8 | "d.projectImportPaths": [ 9 | "..\\..\\..\\dfl\\source" 10 | ] 11 | } 12 | } -------------------------------------------------------------------------------- /examples/clippingform/dub.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": ["haru-s"], 3 | "copyright": "Copyright (C) 2023 haru-s", 4 | "description": "DFL sample code.", 5 | "name": "clippingform_sample", 6 | "targetType": "executable", 7 | "targetPath": "bin", 8 | "dependencies": { 9 | "dfl": { 10 | "path": "../../../dfl" 11 | } 12 | }, 13 | "lflags-windows-x86_mscoff-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"], 14 | "lflags-windows-x86_64-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"] 15 | } -------------------------------------------------------------------------------- /examples/clippingform/image/clipping.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/clippingform/image/clipping.bmp -------------------------------------------------------------------------------- /examples/clippingform/image/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/clippingform/image/screenshot.png -------------------------------------------------------------------------------- /examples/clippingform/shell.bat: -------------------------------------------------------------------------------- 1 | set dmd_path=c:\d\dmd2\windows 2 | set dmc_path=c:\dmc\dm 3 | cmd 4 | -------------------------------------------------------------------------------- /examples/clippingform/source/clippingform_sample.d: -------------------------------------------------------------------------------- 1 | import dfl; 2 | 3 | version(Have_dfl) // For DUB. 4 | { 5 | } 6 | else 7 | { 8 | pragma(lib, "dfl.lib"); 9 | } 10 | 11 | class MainForm : ClippingForm 12 | { 13 | public this() 14 | { 15 | this.text = "Clipping Form example"; 16 | this.size = Size(300, 200); 17 | this.clipping = new Bitmap(r".\image\clipping.bmp"); // White is transparent. 18 | this.click ~= (Control c, EventArgs e) { 19 | this.close(); 20 | }; 21 | } 22 | } 23 | 24 | static this() 25 | { 26 | Application.enableVisualStyles(); 27 | } 28 | 29 | void main() 30 | { 31 | Application.run(new MainForm()); 32 | } 33 | -------------------------------------------------------------------------------- /examples/commondialog/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | docs/ 5 | /hello_dfl 6 | hello_dfl.so 7 | hello_dfl.dylib 8 | hello_dfl.dll 9 | hello_dfl.a 10 | hello_dfl.lib 11 | hello_dfl-test-* 12 | *.exe 13 | *.pdb 14 | *.o 15 | *.obj 16 | *.lst 17 | -------------------------------------------------------------------------------- /examples/commondialog/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "C++ Launch (Windows) commondialog", 6 | "type": "cppvsdbg", 7 | "request": "launch", 8 | "cwd": "${workspaceRoot}", 9 | "program": "./bin/commondialog_sample.exe", 10 | "console": "internalConsole" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /examples/commondialog/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "dub", 6 | "run": false, 7 | "cwd": ".", 8 | "compiler": "$current", 9 | "archType": "$current", 10 | "buildType": "$current", 11 | "configuration": "$current", 12 | "problemMatcher": [ 13 | "$dmd" 14 | ], 15 | "group":{ 16 | "kind": "build", 17 | "isDefault": true 18 | }, 19 | "label": "dub: Build commondialog_sample", 20 | "detail": "dub build --compiler=dmd.EXE -a=x86_64 -b=debug -c=application" 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /examples/commondialog/README.md: -------------------------------------------------------------------------------- 1 | # Screen Shot 2 | ![screen shot](./image/screenshot.png "screen shot") 3 | ![screen shot](./image/screenshot2.png "screen shot") 4 | -------------------------------------------------------------------------------- /examples/commondialog/commondialog.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": { 8 | "d.projectImportPaths": [ 9 | "..\\..\\..\\dfl\\source" 10 | ] 11 | } 12 | } -------------------------------------------------------------------------------- /examples/commondialog/dub.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": ["haru-s"], 3 | "copyright": "Copyright (C) 2023 haru-s", 4 | "description": "DFL sample code.", 5 | "name": "commondialog_sample", 6 | "targetType": "executable", 7 | "targetPath": "bin", 8 | "dependencies": { 9 | "dfl": { 10 | "path": "../../../dfl" 11 | } 12 | }, 13 | "lflags-windows-x86_mscoff-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"], 14 | "lflags-windows-x86_64-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"] 15 | } -------------------------------------------------------------------------------- /examples/commondialog/image/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/commondialog/image/screenshot.png -------------------------------------------------------------------------------- /examples/commondialog/image/screenshot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/commondialog/image/screenshot2.png -------------------------------------------------------------------------------- /examples/commondialog/shell.bat: -------------------------------------------------------------------------------- 1 | set dmd_path=c:\d\dmd2\windows 2 | set dmc_path=c:\dmc\dm 3 | cmd 4 | -------------------------------------------------------------------------------- /examples/contextmenu/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | docs/ 5 | /hello_dfl 6 | hello_dfl.so 7 | hello_dfl.dylib 8 | hello_dfl.dll 9 | hello_dfl.a 10 | hello_dfl.lib 11 | hello_dfl-test-* 12 | *.exe 13 | *.pdb 14 | *.o 15 | *.obj 16 | *.lst 17 | -------------------------------------------------------------------------------- /examples/contextmenu/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "C++ Launch (Windows) contextmenu_sample", 6 | "type": "cppvsdbg", 7 | "request": "launch", 8 | "cwd": "${workspaceRoot}", 9 | "program": "./bin/contextmenu_sample.exe", 10 | "console": "internalConsole" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /examples/contextmenu/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "dub", 6 | "run": false, 7 | "cwd": ".", 8 | "compiler": "$current", 9 | "archType": "$current", 10 | "buildType": "$current", 11 | "configuration": "$current", 12 | "problemMatcher": [ 13 | "$dmd" 14 | ], 15 | "group": { 16 | "kind": "build", 17 | "isDefault": true 18 | }, 19 | "label": "dub: Build contextmenu_sample", 20 | "detail": "dub build --compiler=dmd.EXE -a=x86_64 -b=debug -c=application" 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /examples/contextmenu/README.md: -------------------------------------------------------------------------------- 1 | # Screen Shot 2 | ![screen shot](./image/screenshot.png "screen shot") 3 | -------------------------------------------------------------------------------- /examples/contextmenu/contextmenu.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": { 8 | "d.projectImportPaths": [ 9 | "..\\..\\..\\dfl\\source" 10 | ] 11 | } 12 | } -------------------------------------------------------------------------------- /examples/contextmenu/dub.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": ["haru-s"], 3 | "copyright": "Copyright (C) 2022 haru-s", 4 | "description": "DFL sample code.", 5 | "name": "contextmenu_sample", 6 | "targetType": "executable", 7 | "targetPath": "bin", 8 | "dependencies": { 9 | "dfl": { 10 | "path": "../../../dfl" 11 | } 12 | }, 13 | "lflags-windows-x86_mscoff-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"], 14 | "lflags-windows-x86_64-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"] 15 | } -------------------------------------------------------------------------------- /examples/contextmenu/image/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/contextmenu/image/screenshot.png -------------------------------------------------------------------------------- /examples/contextmenu/shell.bat: -------------------------------------------------------------------------------- 1 | set dmd_path=c:\d\dmd2\windows 2 | set dmc_path=c:\dmc\dm 3 | cmd 4 | -------------------------------------------------------------------------------- /examples/contextmenu/source/contextmenu_sample.d: -------------------------------------------------------------------------------- 1 | import dfl; 2 | import core.sys.windows.windows; 3 | 4 | version(Have_dfl) // For DUB. 5 | { 6 | } 7 | else 8 | { 9 | pragma(lib, "dfl.lib"); 10 | } 11 | 12 | enum USE_MOUSE_DOWN_EVENT = true; 13 | 14 | class MainForm : Form 15 | { 16 | private ContextMenu _contextMenu; 17 | 18 | this() 19 | { 20 | this.text = "ContextMenu example"; 21 | this.size = Size(350, 200); 22 | 23 | _contextMenu = new ContextMenu(); 24 | MenuItem contextMenuItem1 = new MenuItem("Kyoto"); 25 | contextMenuItem1.click ~= (MenuItem mi, EventArgs e) { 26 | msgBox("Kyoto"); 27 | }; 28 | MenuItem contextMenuItem2 = new MenuItem("Tokyo"); 29 | contextMenuItem2.click ~= (MenuItem mi, EventArgs e) { 30 | msgBox("Tokyo"); 31 | }; 32 | MenuItem contextMenuItem3 = new MenuItem("Osaka"); 33 | contextMenuItem3.click ~= (MenuItem mi, EventArgs e) { 34 | msgBox("Osaka"); 35 | }; 36 | _contextMenu.menuItems.add(contextMenuItem1); 37 | _contextMenu.menuItems.addRange([contextMenuItem2, contextMenuItem3]); 38 | 39 | static if (USE_MOUSE_DOWN_EVENT) 40 | { 41 | this.mouseDown ~= (Control c, MouseEventArgs e) { 42 | if (e.button & MouseButtons.RIGHT) 43 | { 44 | if (_contextMenu) 45 | { 46 | Point pt = Point(e.x, e.y); 47 | ClientToScreen(handle, &pt.point); 48 | _contextMenu.show(this, pt); 49 | } 50 | } 51 | }; 52 | } 53 | } 54 | 55 | static if (!USE_MOUSE_DOWN_EVENT) 56 | { 57 | override void wndProc(ref Message msg) 58 | { 59 | switch (msg.msg) 60 | { 61 | case WM_RBUTTONDOWN: 62 | { 63 | if (_contextMenu) 64 | { 65 | POINT pt; 66 | GetCursorPos(&pt); 67 | _contextMenu.show(this, Point(&pt)); 68 | } 69 | return; 70 | } 71 | default: 72 | { 73 | super.wndProc(msg); 74 | return; 75 | } 76 | } 77 | } 78 | } 79 | } 80 | 81 | static this() 82 | { 83 | Application.enableVisualStyles(); 84 | } 85 | 86 | void main() 87 | { 88 | Application.run(new MainForm()); 89 | } 90 | -------------------------------------------------------------------------------- /examples/dclock/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | docs/ 5 | /hello_dfl 6 | hello_dfl.so 7 | hello_dfl.dylib 8 | hello_dfl.dll 9 | hello_dfl.a 10 | hello_dfl.lib 11 | hello_dfl-test-* 12 | *.exe 13 | *.pdb 14 | *.o 15 | *.obj 16 | *.lst 17 | -------------------------------------------------------------------------------- /examples/dclock/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.1.0", 3 | "configurations": [ 4 | { 5 | "name": "C++ Launch (Windows) Dclock", 6 | "type": "cppvsdbg", 7 | "request": "launch", 8 | "cwd": "${workspaceRoot}", 9 | "program": "./bin/dclock.exe", 10 | "console": "internalConsole" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /examples/dclock/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "dub", 6 | "run": false, 7 | "cwd": ".", 8 | "compiler": "$current", 9 | "archType": "$current", 10 | "buildType": "$current", 11 | "configuration": "$current", 12 | "problemMatcher": [ 13 | "$dmd" 14 | ], 15 | "group": { 16 | "kind": "build", 17 | "isDefault": true 18 | }, 19 | "label": "dub: Build dclock", 20 | "detail": "dub build --compiler=dmd.EXE -a=x86_64 -b=debug -c=application" 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /examples/dclock/README.md: -------------------------------------------------------------------------------- 1 | # Screen Shot 2 | ![screen shot](./image/screenshot.png "screen shot") 3 | -------------------------------------------------------------------------------- /examples/dclock/dclock.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": { 8 | "d.projectImportPaths": [ 9 | "..\\..\\..\\dfl\\source" 10 | ] 11 | } 12 | } -------------------------------------------------------------------------------- /examples/dclock/dub.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": ["haru-s"], 3 | "copyright": "Copyright (C) 2024 haru-s", 4 | "description": "Dclock", 5 | "name": "dclock", 6 | "targetType": "executable", 7 | "targetPath": "bin", 8 | "dependencies": { 9 | "dfl": { 10 | "path": "../../../dfl" 11 | } 12 | }, 13 | "lflags-windows-x86_mscoff-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"], 14 | "lflags-windows-x86_64-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"] 15 | } -------------------------------------------------------------------------------- /examples/dclock/image/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/dclock/image/screenshot.png -------------------------------------------------------------------------------- /examples/dclock/shell.bat: -------------------------------------------------------------------------------- 1 | set dmd_path=c:\d\dmd2\windows 2 | set dmc_path=c:\dmc\dm 3 | cmd 4 | -------------------------------------------------------------------------------- /examples/dclock/source/dclock.d: -------------------------------------------------------------------------------- 1 | import std; 2 | import dfl; 3 | 4 | class MainForm : Form 5 | { 6 | private Label _label; 7 | private Timer _timer; 8 | 9 | public this() 10 | { 11 | this.text = "Dclock"; 12 | this.size = Size(300, 150); 13 | this.formBorderStyle = FormBorderStyle.FIXED_SINGLE; 14 | this.maximizeBox = false; 15 | this.topMost = true; 16 | 17 | void drawClock() 18 | { 19 | DateTime now = cast(DateTime)Clock.currTime(); 20 | _label.text = format( 21 | "%.4d/%.2d/%.2d\n(%s)%.2d:%.2d", 22 | now.year, now.month, now.day, 23 | ["日","月","火","水","木","金","土"][now.dayOfWeek], 24 | now.hour, now.minute); 25 | } 26 | 27 | _label = new Label; 28 | _label.location = Point(0, 0); 29 | _label.font = new Font("MS Gothic", 40f); 30 | _label.autoSize = true; 31 | _label.parent = this; 32 | drawClock(); 33 | 34 | _timer = new Timer; 35 | _timer.interval = 1000; 36 | _timer.start(); 37 | _timer.tick ~= (Timer t, EventArgs e) { 38 | drawClock(); 39 | }; 40 | } 41 | } 42 | 43 | static this() 44 | { 45 | Application.enableVisualStyles(); 46 | } 47 | 48 | void main() 49 | { 50 | Application.run(new MainForm()); 51 | } 52 | -------------------------------------------------------------------------------- /examples/draganddrop/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | docs/ 5 | /hello_dfl 6 | hello_dfl.so 7 | hello_dfl.dylib 8 | hello_dfl.dll 9 | hello_dfl.a 10 | hello_dfl.lib 11 | hello_dfl-test-* 12 | *.exe 13 | *.pdb 14 | *.o 15 | *.obj 16 | *.lst 17 | -------------------------------------------------------------------------------- /examples/draganddrop/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "C++ Launch (Windows) draganddrop", 6 | "type": "cppvsdbg", 7 | "request": "launch", 8 | "cwd": "${workspaceRoot}", 9 | "program": "./bin/draganddrop_sample.exe", 10 | "console": "internalConsole" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /examples/draganddrop/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "dub", 6 | "run": false, 7 | "cwd": ".", 8 | "compiler": "$current", 9 | "archType": "$current", 10 | "buildType": "$current", 11 | "configuration": "$current", 12 | "problemMatcher": [ 13 | "$dmd" 14 | ], 15 | "group": { 16 | "kind": "build", 17 | "isDefault": true 18 | }, 19 | "label": "dub: Build draganddrop_sample", 20 | "presentation": { 21 | "clear": true 22 | } 23 | } 24 | ] 25 | } -------------------------------------------------------------------------------- /examples/draganddrop/README.md: -------------------------------------------------------------------------------- 1 | # Screen Shot 2 | ![screen shot](./image/screenshot1.png "screen shot 1") 3 | ![screen shot](./image/screenshot2.png "screen shot 2") 4 | -------------------------------------------------------------------------------- /examples/draganddrop/draganddrop.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": { 8 | "d.projectImportPaths": [ 9 | "..\\..\\..\\dfl\\source" 10 | ] 11 | } 12 | } -------------------------------------------------------------------------------- /examples/draganddrop/dub.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": ["haru-s"], 3 | "copyright": "Copyright (C) 2023 haru-s", 4 | "description": "DFL sample code.", 5 | "name": "draganddrop_sample", 6 | "targetType": "executable", 7 | "targetPath": "bin", 8 | "dependencies": { 9 | "dfl": { 10 | "path": "../../../dfl" 11 | } 12 | }, 13 | "lflags-windows-x86_mscoff-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"], 14 | "lflags-windows-x86_64-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"] 15 | } -------------------------------------------------------------------------------- /examples/draganddrop/image/screenshot1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/draganddrop/image/screenshot1.png -------------------------------------------------------------------------------- /examples/draganddrop/image/screenshot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/draganddrop/image/screenshot2.png -------------------------------------------------------------------------------- /examples/draganddrop/shell.bat: -------------------------------------------------------------------------------- 1 | set dmd_path=c:\d\dmd2\windows 2 | set dmc_path=c:\dmc\dm 3 | cmd 4 | -------------------------------------------------------------------------------- /examples/draganddrop/source/draganddrop_sample.d: -------------------------------------------------------------------------------- 1 | import dfl; 2 | import std.conv : to; 3 | 4 | version(Have_dfl) // For DUB. 5 | { 6 | } 7 | else 8 | { 9 | pragma(lib, "dfl.lib"); 10 | } 11 | 12 | // Method 1 (DragAcceptFiles) when defined. 13 | // Method 2 (OLE-Drop) when not defined. 14 | // 15 | version = SELECT_DROP_METHOD1; 16 | 17 | version (SELECT_DROP_METHOD1) 18 | { 19 | import core.sys.windows.shellapi; 20 | import core.sys.windows.winuser; 21 | } 22 | 23 | class MainForm : Form 24 | { 25 | private Label _label; 26 | 27 | public this() 28 | { 29 | this.text = "Drag-and-Drop example"; 30 | this.size = Size(600, 300); 31 | 32 | version (SELECT_DROP_METHOD1) 33 | { 34 | // Let's trap WM_DROPFILES in wndProc(). 35 | DragAcceptFiles(handle, true); 36 | } 37 | else 38 | { 39 | this.allowDrop = true; 40 | this.dragEnter ~= (Control sender, DragEventArgs e) { 41 | // Do nothing 42 | }; 43 | this.dragOver ~= (Control sender, DragEventArgs e) { 44 | if (e.data.getDataPresent(DataFormats.fileDrop)) 45 | { 46 | if ((e.keyState & DragDropKeyStates.SHIFT_KEY) == DragDropKeyStates.SHIFT_KEY) 47 | { 48 | e.effect = DragDropEffects.MOVE; 49 | } 50 | else if ((e.keyState & DragDropKeyStates.ALT_KEY) == DragDropKeyStates.ALT_KEY) 51 | { 52 | e.effect = DragDropEffects.LINK; 53 | } 54 | else 55 | { 56 | e.effect = DragDropEffects.COPY; 57 | } 58 | assert((e.allowedEffect & e.effect) != 0); 59 | } 60 | else 61 | { 62 | e.effect = DragDropEffects.NONE; 63 | } 64 | }; 65 | this.dragDrop ~= (Control sender, DragEventArgs e) { 66 | string[] files = e.data.getData(DataFormats.fileDrop, false).getStrings; 67 | _label.text = ""; 68 | foreach (string fileName; files) 69 | { 70 | _label.text = _label.text ~ fileName ~ "\n"; 71 | } 72 | this.allowDrop = false; // Example: Accept only once. 73 | }; 74 | this.dragLeave ~= (Control sender, EventArgs e) { 75 | // Do nothing 76 | }; 77 | } 78 | 79 | _label = new Label(); 80 | _label.location = Point(0,0); 81 | _label.autoSize = true; 82 | _label.dock = DockStyle.FILL; 83 | _label.font = new Font("Meiryo UI", 14f); 84 | _label.text = "Drop files to this form."; 85 | _label.parent = this; 86 | } 87 | 88 | version (SELECT_DROP_METHOD1) 89 | { 90 | protected override void wndProc(ref Message msg) 91 | { 92 | switch (msg.msg) 93 | { 94 | case WM_DROPFILES: 95 | HDROP hDrop = cast(HDROP)msg.wParam; 96 | 97 | uint numFiles = DragQueryFile(cast(HDROP)msg.wParam, -1, null, 0); 98 | if (numFiles == 0) 99 | { 100 | _label.text = "Error"; 101 | } 102 | else 103 | { 104 | _label.text = ""; 105 | for (int i; i < numFiles; i++) 106 | { 107 | enum BUFFER_LENGTH = 260; 108 | wchar[BUFFER_LENGTH] fileName; 109 | DragQueryFile(hDrop, i, fileName.ptr, BUFFER_LENGTH); 110 | _label.text = _label.text ~ to!string(fileName); 111 | _label.text = _label.text ~ "\n"; 112 | } 113 | } 114 | DragFinish(hDrop); 115 | break; 116 | default: 117 | } 118 | super.wndProc(msg); 119 | } 120 | } 121 | } 122 | 123 | static this() 124 | { 125 | Application.enableVisualStyles(); 126 | } 127 | 128 | void main() 129 | { 130 | Application.run(new MainForm()); 131 | } 132 | -------------------------------------------------------------------------------- /examples/dragdroplistbox/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | docs/ 5 | /hello_dfl 6 | hello_dfl.so 7 | hello_dfl.dylib 8 | hello_dfl.dll 9 | hello_dfl.a 10 | hello_dfl.lib 11 | hello_dfl-test-* 12 | *.exe 13 | *.pdb 14 | *.o 15 | *.obj 16 | *.lst 17 | -------------------------------------------------------------------------------- /examples/dragdroplistbox/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "C++ Launch (Windows) dragdroplistbox", 6 | "type": "cppvsdbg", 7 | "request": "launch", 8 | "cwd": "${workspaceRoot}", 9 | "program": "./bin/dragdroplistbox_sample.exe", 10 | "console": "internalConsole" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /examples/dragdroplistbox/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "dub", 6 | "run": false, 7 | "cwd": ".", 8 | "compiler": "$current", 9 | "archType": "$current", 10 | "buildType": "$current", 11 | "configuration": "$current", 12 | "problemMatcher": [ 13 | "$dmd" 14 | ], 15 | "group": { 16 | "kind": "build", 17 | "isDefault": true 18 | }, 19 | "label": "dub: Build dragdroplistbox_sample", 20 | "presentation": { 21 | "clear": true 22 | } 23 | } 24 | ] 25 | } -------------------------------------------------------------------------------- /examples/dragdroplistbox/README.md: -------------------------------------------------------------------------------- 1 | # Screen Shot 2 | ![screen shot](./image/screenshot1.png "screen shot 1") 3 | ![screen shot](./image/screenshot2.png "screen shot 2") 4 | -------------------------------------------------------------------------------- /examples/dragdroplistbox/dragdroplistbox.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": { 8 | "d.projectImportPaths": [ 9 | "..\\..\\..\\dfl\\source" 10 | ] 11 | } 12 | } -------------------------------------------------------------------------------- /examples/dragdroplistbox/dub.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": ["haru-s"], 3 | "copyright": "Copyright (C) 2023 haru-s", 4 | "description": "DFL sample code.", 5 | "name": "dragdroplistbox_sample", 6 | "targetType": "executable", 7 | "targetPath": "bin", 8 | "dependencies": { 9 | "dfl": { 10 | "path": "../../../dfl" 11 | } 12 | }, 13 | "lflags-windows-x86_mscoff-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"], 14 | "lflags-windows-x86_64-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"] 15 | } -------------------------------------------------------------------------------- /examples/dragdroplistbox/image/screenshot1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/dragdroplistbox/image/screenshot1.png -------------------------------------------------------------------------------- /examples/dragdroplistbox/image/screenshot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/dragdroplistbox/image/screenshot2.png -------------------------------------------------------------------------------- /examples/dragdroplistbox/shell.bat: -------------------------------------------------------------------------------- 1 | set dmd_path=c:\d\dmd2\windows 2 | set dmc_path=c:\dmc\dm 3 | cmd 4 | -------------------------------------------------------------------------------- /examples/hello_dfl/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | docs/ 5 | /hello_dfl 6 | hello_dfl.so 7 | hello_dfl.dylib 8 | hello_dfl.dll 9 | hello_dfl.a 10 | hello_dfl.lib 11 | hello_dfl-test-* 12 | *.exe 13 | *.pdb 14 | *.o 15 | *.obj 16 | *.lst 17 | -------------------------------------------------------------------------------- /examples/hello_dfl/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "C++ Launch (Windows) hello_dfl", 6 | "type": "cppvsdbg", 7 | "request": "launch", 8 | "cwd": "${workspaceRoot}", 9 | "program": "./bin/hello_dfl.exe", 10 | "console": "internalConsole" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /examples/hello_dfl/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "dub", 6 | "run": false, 7 | "cwd": ".", 8 | "compiler": "$current", 9 | "archType": "$current", 10 | "buildType": "$current", 11 | "configuration": "$current", 12 | "problemMatcher": [ 13 | "$dmd" 14 | ], 15 | "group": { 16 | "kind": "build", 17 | "isDefault": true 18 | }, 19 | "label": "dub: Build hello_dfl", 20 | "detail": "dub build --compiler=dmd.EXE -a=x86_64 -b=debug -c=application" 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /examples/hello_dfl/README.md: -------------------------------------------------------------------------------- 1 | # Screen Shot 2 | ![screen shot](./image/screenshot.png "screen shot") 3 | -------------------------------------------------------------------------------- /examples/hello_dfl/build32mscoff.bat: -------------------------------------------------------------------------------- 1 | pushd source 2 | dmd -m32mscoff -L/SUBSYSTEM:WINDOWS -L/ENTRY:mainCRTStartup hello_dfl.d 3 | hello_dfl.exe 4 | popd 5 | -------------------------------------------------------------------------------- /examples/hello_dfl/build64.bat: -------------------------------------------------------------------------------- 1 | pushd source 2 | dmd -m64 -L/SUBSYSTEM:WINDOWS -L/ENTRY:mainCRTStartup hello_dfl.d 3 | hello_dfl.exe 4 | popd 5 | -------------------------------------------------------------------------------- /examples/hello_dfl/dub.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": ["haru-s"], 3 | "copyright": "Copyright (C) 2022 haru-s", 4 | "description": "DFL sample code.", 5 | "name": "hello_dfl", 6 | "targetType": "executable", 7 | "targetPath": "bin", 8 | "dependencies": { 9 | "dfl": { 10 | "path": "../../../dfl" 11 | } 12 | }, 13 | "lflags-windows-x86_mscoff-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"], 14 | "lflags-windows-x86_64-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"] 15 | } -------------------------------------------------------------------------------- /examples/hello_dfl/hello_dfl.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": { 8 | "d.projectImportPaths": [ 9 | "..\\..\\..\\dfl\\source" 10 | ] 11 | } 12 | } -------------------------------------------------------------------------------- /examples/hello_dfl/image/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/hello_dfl/image/screenshot.png -------------------------------------------------------------------------------- /examples/hello_dfl/shell.bat: -------------------------------------------------------------------------------- 1 | set dmd_path=c:\d\dmd2\windows 2 | set dmc_path=c:\dmc\dm 3 | cmd 4 | -------------------------------------------------------------------------------- /examples/hello_dfl/source/hello_dfl.d: -------------------------------------------------------------------------------- 1 | import std.conv : to; 2 | import dfl; 3 | 4 | version(Have_dfl) // For DUB. 5 | { 6 | } 7 | else 8 | { 9 | pragma(lib, "dfl.lib"); 10 | } 11 | 12 | class MainForm : Form 13 | { 14 | private Button _button; 15 | private ListBox _listbox; 16 | private MainMenu _menu; 17 | 18 | this() 19 | { 20 | this.text = "Hello DFL"; 21 | this.resizeRedraw = true; 22 | 23 | _button = new TestButton(); 24 | _button.text = "ok"; 25 | _button.parent = this; 26 | _button.location = Point(100, 100); 27 | 28 | _listbox = new ListBox(); 29 | _listbox.parent = this; 30 | _listbox.size = Size(60, 150); 31 | _listbox.items.add("foo"); 32 | _listbox.items.addRange(["hoge", "piyo"]); 33 | _listbox.click ~= (Control c, EventArgs ea) { 34 | int index = _listbox.selectedIndex; 35 | msgBox(to!string(index)); 36 | if (index >= 0) 37 | { 38 | string msg = _listbox.selectedItem.toString(); 39 | msgBox(msg); 40 | } 41 | }; 42 | 43 | _menu = new MainMenu(); 44 | MenuItem item = new MenuItem(); 45 | item.text = "File"; 46 | MenuItem subItem = new MenuItem(); 47 | subItem.text = "Open"; 48 | auto menuClickHandler = (MenuItem mi, EventArgs ea){ msgBox("open the door"); }; 49 | subItem.click.addHandler(menuClickHandler); // same =~ 50 | item.menuItems.add(subItem); 51 | _menu.menuItems.add(item); 52 | this.menu = _menu; 53 | } 54 | 55 | override void onPaint(PaintEventArgs pea) 56 | { 57 | pea.graphics.drawLine(new Pen(Color.blue, 5, PenStyle.SOLID), Point(50, 200), Point(150, 170)); 58 | pea.graphics.drawRectangle(new Pen(Color.black), 20, 170, 100, 50); 59 | pea.graphics.fillRectangle(Color.green, 200, 10, 50, 50); 60 | pea.graphics.drawEllipse(new Pen(Color.red), 100, 10, 50, 50); 61 | pea.graphics.fillEllipse(new SolidBrush(Color.purple), 200, 100, 50, 50); 62 | } 63 | } 64 | 65 | class TestButton : Button 66 | { 67 | override void onClick(EventArgs ea) 68 | { 69 | msgBox("hi"); 70 | } 71 | } 72 | 73 | static this() 74 | { 75 | Application.enableVisualStyles(); 76 | } 77 | 78 | void main() 79 | { 80 | Application.run(new MainForm()); 81 | } 82 | -------------------------------------------------------------------------------- /examples/imagelist/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | docs/ 5 | /hello_dfl 6 | hello_dfl.so 7 | hello_dfl.dylib 8 | hello_dfl.dll 9 | hello_dfl.a 10 | hello_dfl.lib 11 | hello_dfl-test-* 12 | *.exe 13 | *.pdb 14 | *.o 15 | *.obj 16 | *.lst 17 | -------------------------------------------------------------------------------- /examples/imagelist/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "C++ Launch (Windows) imagelist", 6 | "type": "cppvsdbg", 7 | "request": "launch", 8 | "cwd": "${workspaceRoot}", 9 | "program": "./bin/imagelist_sample.exe", 10 | "console": "internalConsole" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /examples/imagelist/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "dub", 6 | "run": false, 7 | "cwd": ".", 8 | "compiler": "$current", 9 | "archType": "$current", 10 | "buildType": "$current", 11 | "configuration": "$current", 12 | "problemMatcher": [ 13 | "$dmd" 14 | ], 15 | "group": { 16 | "kind": "build", 17 | "isDefault": true 18 | }, 19 | "label": "dub: Build imagelist_sample", 20 | "detail": "dub build --compiler=dmd.EXE -a=x86_64 -b=debug -c=application" 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /examples/imagelist/README.md: -------------------------------------------------------------------------------- 1 | # Screen Shot 2 | ![screen shot](./image/screenshot.png "screen shot") 3 | -------------------------------------------------------------------------------- /examples/imagelist/dub.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": ["haru-s"], 3 | "copyright": "Copyright (C) 2023 haru-s", 4 | "description": "DFL sample code.", 5 | "name": "imagelist_sample", 6 | "targetType": "executable", 7 | "targetPath": "bin", 8 | "dependencies": { 9 | "dfl": { 10 | "path": "../../../dfl" 11 | } 12 | }, 13 | "lflags-windows-x86_mscoff-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"], 14 | "lflags-windows-x86_64-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"] 15 | } -------------------------------------------------------------------------------- /examples/imagelist/image/rgb.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/imagelist/image/rgb.bmp -------------------------------------------------------------------------------- /examples/imagelist/image/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/imagelist/image/screenshot.png -------------------------------------------------------------------------------- /examples/imagelist/imagelist.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": { 8 | "d.projectImportPaths": [ 9 | "..\\..\\..\\dfl\\source" 10 | ] 11 | } 12 | } -------------------------------------------------------------------------------- /examples/imagelist/shell.bat: -------------------------------------------------------------------------------- 1 | set dmd_path=c:\d\dmd2\windows 2 | set dmc_path=c:\dmc\dm 3 | cmd 4 | -------------------------------------------------------------------------------- /examples/imagelist/source/imagelist_sample.d: -------------------------------------------------------------------------------- 1 | import dfl; 2 | import std.traits : EnumMembers; 3 | 4 | version(Have_dfl) // For DUB. 5 | { 6 | } 7 | else 8 | { 9 | pragma(lib, "dfl.lib"); 10 | } 11 | 12 | class MainForm : Form 13 | { 14 | private ListView _listView; 15 | private ComboBox _combobox; 16 | private ImageList _imagelist; 17 | private Bitmap _icons; 18 | 19 | // Helper 20 | private static string stringFromView(View v) 21 | { 22 | static string[] arr = ["LARGE_ICON", "SMALL_ICON", "LIST", "DETAILS"]; 23 | return arr[cast(int)v]; 24 | } 25 | 26 | public this() 27 | { 28 | this.text = "ImageList example"; 29 | this.size = Size(300, 300); 30 | this.formBorderStyle = FormBorderStyle.FIXED_SINGLE; 31 | 32 | // Create Bitmap 33 | _icons = new Bitmap(r".\image\rgb.bmp"); // Change by your environment. 34 | 35 | // Create ImageList 36 | _imagelist = new ImageList(); 37 | _imagelist.imageSize = Size(24, 24); // Each bitmap size in image list (W24[dots] x H24[dots] x 3[icons]). 38 | _imagelist.images.addStrip(_icons); 39 | 40 | // Create ComboBox 41 | _combobox = new ComboBox(); 42 | _combobox.parent = this; 43 | _combobox.location = Point(0, 160); 44 | _combobox.size = Size(250, 100); 45 | 46 | // _combobox.dropDownStyle = ComboBoxStyle.DROP_DOWN_LIST; 47 | _combobox.dropDownStyle = ComboBoxStyle.DROP_DOWN; 48 | // _combobox.dropDownStyle = ComboBoxStyle.SIMPLE; 49 | 50 | foreach (v; EnumMembers!View) 51 | { 52 | _combobox.items.add(stringFromView(v)); 53 | } 54 | 55 | immutable View initialViewMove = View.LIST; 56 | _combobox.text = stringFromView(initialViewMove); 57 | _combobox.selectedIndex = cast(int)initialViewMove; 58 | 59 | _combobox.textChanged ~= (Control sender, EventArgs e) 60 | { 61 | // msgBox("textChanged"); 62 | }; 63 | 64 | _combobox.selectedValueChanged ~= (Control sender, EventArgs e) 65 | { 66 | // msgBox("selectedValueChanged"); 67 | 68 | int sel = _combobox.selectedIndex(); 69 | if (sel >= 0) 70 | { 71 | _listView.view = cast(View)sel; 72 | } 73 | else 74 | { 75 | msgBox("Unknown ListView style."); 76 | } 77 | }; 78 | 79 | // Create ListView 80 | _listView = new ListView(); 81 | _listView.parent = this; 82 | _listView.location = Point(0, 0); 83 | _listView.size = Size(250, 150); 84 | 85 | _listView.largeImageList = _imagelist; // Attach image list to ListView. 86 | _listView.smallImageList = _imagelist; // ditto 87 | 88 | // Style 89 | _listView.view = initialViewMove; 90 | _listView.gridLines = true; 91 | _listView.multiSelect = false; 92 | _listView.hideSelection = false; 93 | _listView.fullRowSelect = true; 94 | _listView.checkBoxes = false; 95 | 96 | // Header 97 | ColumnHeader col1 = new ColumnHeader(); 98 | col1.text = "Color"; 99 | col1.width = 70; 100 | 101 | ColumnHeader col2 = new ColumnHeader(); 102 | col2.text = "R-G-B"; 103 | col2.width = 70; 104 | 105 | _listView.columns.addRange([col1, col2]); 106 | 107 | // Contents 108 | _listView.beginUpdate(); // Stop redraw. 109 | 110 | ListViewItem item1 = new ListViewItem("Red"); 111 | item1.subItems.add("255-0-0"); 112 | item1.imageIndex = 0; // 0 is Red icon. 113 | _listView.items.add(item1); 114 | 115 | ListViewItem item2 = new ListViewItem("Green"); 116 | item2.subItems.add("0-255-0"); 117 | item2.imageIndex = 1; // 1 is Green icon. 118 | _listView.items.add(item2); 119 | 120 | ListViewItem item3 = new ListViewItem("Blue"); 121 | item3.subItems.add("0-0-255"); 122 | item3.imageIndex = 2; // 2 is Blue icon. 123 | _listView.items.add(item3); 124 | 125 | _listView.endUpdate(); // Restart redraw. 126 | } 127 | } 128 | 129 | static this() 130 | { 131 | Application.enableVisualStyles(); 132 | } 133 | 134 | void main() 135 | { 136 | Application.run(new MainForm()); 137 | } 138 | -------------------------------------------------------------------------------- /examples/label/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | docs/ 5 | /hello_dfl 6 | hello_dfl.so 7 | hello_dfl.dylib 8 | hello_dfl.dll 9 | hello_dfl.a 10 | hello_dfl.lib 11 | hello_dfl-test-* 12 | *.exe 13 | *.pdb 14 | *.o 15 | *.obj 16 | *.lst 17 | -------------------------------------------------------------------------------- /examples/label/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "C++ Launch (Windows) label", 6 | "type": "cppvsdbg", 7 | "request": "launch", 8 | "cwd": "${workspaceRoot}", 9 | "program": "./bin/label_sample.exe", 10 | "console": "internalConsole" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /examples/label/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "dub", 6 | "run": false, 7 | "cwd": ".", 8 | "compiler": "$current", 9 | "archType": "$current", 10 | "buildType": "$current", 11 | "configuration": "$current", 12 | "problemMatcher": [ 13 | "$dmd" 14 | ], 15 | "group": { 16 | "kind": "build", 17 | "isDefault": true 18 | }, 19 | "label": "dub: Build label_sample", 20 | "detail": "dub build --compiler=dmd.EXE -a=x86_64 -b=debug -c=application" 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /examples/label/README.md: -------------------------------------------------------------------------------- 1 | # Screen Shot 2 | ![screen shot](./image/screenshot.png "screen shot") 3 | -------------------------------------------------------------------------------- /examples/label/dub.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": ["haru-s"], 3 | "copyright": "Copyright (C) 2023 haru-s", 4 | "description": "DFL sample code.", 5 | "name": "label_sample", 6 | "targetType": "executable", 7 | "targetPath": "bin", 8 | "dependencies": { 9 | "dfl": { 10 | "path": "../../../dfl" 11 | } 12 | }, 13 | "lflags-windows-x86_mscoff-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"], 14 | "lflags-windows-x86_64-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"] 15 | } -------------------------------------------------------------------------------- /examples/label/image/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/label/image/screenshot.png -------------------------------------------------------------------------------- /examples/label/label.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": { 8 | "d.projectImportPaths": [ 9 | "..\\..\\..\\dfl\\source" 10 | ] 11 | } 12 | } -------------------------------------------------------------------------------- /examples/label/shell.bat: -------------------------------------------------------------------------------- 1 | set dmd_path=c:\d\dmd2\windows 2 | set dmc_path=c:\dmc\dm 3 | cmd 4 | -------------------------------------------------------------------------------- /examples/label/source/label_sample.d: -------------------------------------------------------------------------------- 1 | import dfl; 2 | 3 | version(Have_dfl) // For DUB. 4 | { 5 | } 6 | else 7 | { 8 | pragma(lib, "dfl.lib"); 9 | } 10 | 11 | int main() 12 | { 13 | Form myForm; 14 | Label myLabel; 15 | 16 | myForm = new Form; 17 | myForm.text = "DFL Example"; 18 | 19 | myLabel = new Label; 20 | myLabel.font = new Font("Verdana", 14f); 21 | myLabel.text = "Hello, DFL World!"; 22 | myLabel.location = Point(15, 15); 23 | myLabel.autoSize = true; 24 | myLabel.parent = myForm; 25 | 26 | Application.run(myForm); 27 | 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /examples/linegraphrenderer/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | docs/ 5 | /hello_dfl 6 | hello_dfl.so 7 | hello_dfl.dylib 8 | hello_dfl.dll 9 | hello_dfl.a 10 | hello_dfl.lib 11 | hello_dfl-test-* 12 | *.exe 13 | *.pdb 14 | *.o 15 | *.obj 16 | *.lst 17 | -------------------------------------------------------------------------------- /examples/linegraphrenderer/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "C++ Launch (Windows) linegraphrenderer", 6 | "type": "cppvsdbg", 7 | "request": "launch", 8 | "cwd": "${workspaceRoot}", 9 | "program": "./bin/linegraphrenderer.exe", 10 | "console": "internalConsole" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /examples/linegraphrenderer/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "dub", 6 | "run": false, 7 | "cwd": ".", 8 | "compiler": "$current", 9 | "archType": "$current", 10 | "buildType": "$current", 11 | "configuration": "$current", 12 | "problemMatcher": [ 13 | "$dmd" 14 | ], 15 | "group": { 16 | "kind": "build", 17 | "isDefault": true 18 | }, 19 | "label": "dub: Build linegraphrenderer_sample", 20 | "detail": "dub build --compiler=dmd.EXE -a=x86_64 -b=debug -c=application" 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /examples/linegraphrenderer/README.md: -------------------------------------------------------------------------------- 1 | # Screen Shot 2 | ![screen shot](./image/screenshot.png "screen shot") 3 | -------------------------------------------------------------------------------- /examples/linegraphrenderer/dub.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": ["haru-s"], 3 | "copyright": "Copyright (C) 2024 haru-s", 4 | "description": "DFL sample code.", 5 | "name": "linegraphrenderer", 6 | "targetType": "executable", 7 | "targetPath": "bin", 8 | "dependencies": { 9 | "dfl": { 10 | "path": "../../../dfl" 11 | } 12 | }, 13 | "lflags-windows-x86_mscoff-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"], 14 | "lflags-windows-x86_64-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"] 15 | } -------------------------------------------------------------------------------- /examples/linegraphrenderer/image/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/linegraphrenderer/image/screenshot.png -------------------------------------------------------------------------------- /examples/linegraphrenderer/linegraphrenderer.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": { 8 | "d.projectImportPaths": [ 9 | "..\\..\\..\\dfl\\source" 10 | ] 11 | } 12 | } -------------------------------------------------------------------------------- /examples/linegraphrenderer/shell.bat: -------------------------------------------------------------------------------- 1 | set dmd_path=c:\d\dmd2\windows 2 | set dmc_path=c:\dmc\dm 3 | cmd 4 | -------------------------------------------------------------------------------- /examples/linegraphrenderer/source/linegraphrenderer_sample.d: -------------------------------------------------------------------------------- 1 | import dfl; 2 | 3 | version(Have_dfl) // For DUB. 4 | { 5 | } 6 | else 7 | { 8 | pragma(lib, "dfl.lib"); 9 | } 10 | 11 | class MainForm : Form 12 | { 13 | alias CustomLineGraphRenderer = LineGraphRenderer!(string,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int); 14 | CustomLineGraphRenderer _graph; 15 | 16 | alias CustomLineGraphRenderer2 = LineGraphRenderer!(int,int,int); 17 | CustomLineGraphRenderer2 _graph2; 18 | 19 | // alias CustomTableRenderer = TableRenderer!(string,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int); 20 | // CustomTableRenderer _table; 21 | 22 | // alias CustomTableRenderer2 = TableRenderer!(int,int,int); 23 | // CustomTableRenderer2 _table2; 24 | 25 | public this() 26 | { 27 | this.text = "LineGraphRenderer example"; 28 | this.size = Size(1000, 800); 29 | string csv = 30 | "教科,山田,佐藤,井上,田中,木下,藤原,山本,大森,伊藤,高橋,鈴木,中村,小林,松井,木村,近藤\n" ~ 31 | "国語,70,80,80,75,68,65,55,48,45,38,35,25,20,10,5,1\n" ~ 32 | "算数,60,90,80,75,68,65,55,48,45,38,35,25,20,10,5,1\n" ~ 33 | "理科,80,70,80,75,68,65,55,48,45,38,35,25,20,10,5,1\n" ~ 34 | "社会,90,60,80,75,68,65,55,48,45,38,35,25,20,10,5,1\n"; 35 | _graph = new CustomLineGraphRenderer(csv, 4); 36 | _graph.showLegend = true; 37 | _graph.legendLineHeight = 18; 38 | _graph.chartMargins = ChartMargins(50, 50, 50, 50); 39 | _graph.plotPointSize = 10; 40 | _graph.verticalZeroPosition = VerticalZeroPosition.BOTTOM; 41 | _graph.plotAreaAndLegendSpanX = 50; 42 | _graph.plotAreaAndHorizontalScaleSpanY = 10; 43 | _graph.plotAreaLeftPadding = 20; 44 | _graph.plotAreaRightPadding = 20; 45 | _graph.plotAreaHeightOnDisplay = 300; 46 | _graph.hasHorizontalScale = true; 47 | _graph.horizontalScaleSpan = 100; 48 | _graph.horizontalScaleLineInnerSide = 0; 49 | _graph.horizontalScaleLineOuterSide = 5; 50 | _graph.horizontalScaleHeight = 12; 51 | _graph.hasVerticalScale = true; 52 | _graph.verticalMaxScale = 110; 53 | _graph.verticalScaleLineOuterSide = 5; 54 | _graph.verticalScaleLineInnerSide = 0; 55 | _graph.verticalScaleSpan = 20; 56 | _graph.verticalScaleWidth = 40; 57 | _graph.backColor = Color.white; 58 | _graph.plotAreaBoundsColor = Color.black; 59 | _graph.plotLineColorPalette[0] = Color.black; 60 | _graph.plotPointFormList[4..8] = PlotPointForm.CROSS; 61 | _graph.plotPointFormList[8..12] = PlotPointForm.RECTANGLE; 62 | _graph.plotPointFormList[12..16] = PlotPointForm.TRIANGLE; 63 | _graph.relocate = Point(50, 50); // Relocate origin point based on top-left margins. 64 | 65 | string csv2 = 66 | "A,B,C\n" ~ 67 | "70,80,80\n" ~ 68 | "60,90,80\n" ~ 69 | "80,70,80\n" ~ 70 | "90,60,80\n"; 71 | _graph2 = new CustomLineGraphRenderer2(csv2, 4); 72 | _graph2.chartMargins = ChartMargins(10, 10, 10, 10); 73 | _graph2.relocate = Point(600, 50); 74 | 75 | // _table = new CustomTableRenderer(csv, 4); 76 | // _table.location = Point(50, 500); 77 | // _table.hasHeader = true; 78 | // _table.showHeader = true; 79 | // _table.headerLine = true; 80 | // _table.width[] = 40; 81 | 82 | // _table2 = new CustomTableRenderer2(csv2, 4); 83 | // _table2.hasHeader = true; 84 | // _table2.showHeader = true; 85 | // _table2.headerLine = true; 86 | // _table2.width[] = 40; 87 | // _table2.location = Point(680, 200); 88 | } 89 | 90 | protected override void onPaint(PaintEventArgs e) 91 | { 92 | if (_graph) 93 | _graph.draw(e.graphics); 94 | if (_graph2) 95 | _graph2.draw(e.graphics); 96 | // if (_table) 97 | // _table.draw(e.graphics); 98 | // if (_table2) 99 | // _table2.draw(e.graphics); 100 | } 101 | } 102 | 103 | static this() 104 | { 105 | Application.enableVisualStyles(); 106 | } 107 | 108 | void main() 109 | { 110 | Application.run(new MainForm()); 111 | } 112 | -------------------------------------------------------------------------------- /examples/listview/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | docs/ 5 | /hello_dfl 6 | hello_dfl.so 7 | hello_dfl.dylib 8 | hello_dfl.dll 9 | hello_dfl.a 10 | hello_dfl.lib 11 | hello_dfl-test-* 12 | *.exe 13 | *.pdb 14 | *.o 15 | *.obj 16 | *.lst 17 | -------------------------------------------------------------------------------- /examples/listview/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "C++ Launch (Windows) listvew", 6 | "type": "cppvsdbg", 7 | "request": "launch", 8 | "cwd": "${workspaceRoot}", 9 | "program": "./bin/listview_sample.exe", 10 | "console": "internalConsole" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /examples/listview/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "dub", 6 | "run": true, 7 | "cwd": ".", 8 | "compiler": "$current", 9 | "archType": "$current", 10 | "buildType": "$current", 11 | "configuration": "$current", 12 | "problemMatcher": [ 13 | "$dmd" 14 | ], 15 | "group": { 16 | "kind": "build", 17 | "isDefault": true 18 | }, 19 | "label": "dub: Build listview_sample", 20 | "detail": "dub build --compiler=dmd.EXE -a=x86_64 -b=debug -c=application" 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /examples/listview/README.md: -------------------------------------------------------------------------------- 1 | # Screen Shot 2 | ![screen shot](./image/screenshot.png "screen shot") 3 | -------------------------------------------------------------------------------- /examples/listview/dub.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": ["haru-s"], 3 | "copyright": "Copyright (C) 2023 haru-s", 4 | "description": "DFL sample code.", 5 | "name": "listview_sample", 6 | "targetType": "executable", 7 | "targetPath": "bin", 8 | "dependencies": { 9 | "dfl": { 10 | "path": "../../../dfl" 11 | } 12 | }, 13 | "lflags-windows-x86_mscoff-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"], 14 | "lflags-windows-x86_64-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"] 15 | } -------------------------------------------------------------------------------- /examples/listview/dub.selections.json: -------------------------------------------------------------------------------- 1 | { 2 | "fileVersion": 1, 3 | "versions": { 4 | "dfl": {"path":"../.."}, 5 | "silly": "1.2.0-dev.2", 6 | "undead": "1.1.8" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /examples/listview/image/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/listview/image/screenshot.png -------------------------------------------------------------------------------- /examples/listview/listview.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": { 8 | "d.projectImportPaths": [ 9 | "..\\..\\..\\dfl\\source" 10 | ] 11 | } 12 | } -------------------------------------------------------------------------------- /examples/listview/shell.bat: -------------------------------------------------------------------------------- 1 | set dmd_path=c:\d\dmd2\windows 2 | set dmc_path=c:\dmc\dm 3 | cmd 4 | -------------------------------------------------------------------------------- /examples/listview/source/listview_sample.d: -------------------------------------------------------------------------------- 1 | import dfl; 2 | import std.conv; 3 | 4 | version(Have_dfl) // For DUB. 5 | { 6 | } 7 | else 8 | { 9 | pragma(lib, "dfl.lib"); 10 | } 11 | 12 | class MainForm : Form 13 | { 14 | private ListView _listView; 15 | 16 | this() 17 | { 18 | this.text = "ListView example"; 19 | this.size = Size(300, 300); 20 | 21 | // Create 22 | _listView = new ListView(); 23 | _listView.parent = this; 24 | 25 | // Style 26 | _listView.dock = DockStyle.FILL; 27 | _listView.view = View.DETAILS; 28 | // _listView.view = View.LIST; 29 | // _listView.view = View.LARGE_ICON; 30 | // _listView.view = View.SMALL_ICON; 31 | _listView.gridLines = true; 32 | _listView.multiSelect = false; 33 | _listView.hideSelection = false; 34 | _listView.fullRowSelect = true; 35 | _listView.checkBoxes = true; 36 | 37 | // Header 38 | ColumnHeader colX = new ColumnHeader(); 39 | colX.text = "X"; 40 | colX.width = 70; 41 | 42 | ColumnHeader colY = new ColumnHeader(); 43 | colY.text = "Y"; 44 | colY.width = 70; 45 | 46 | ColumnHeader colXY = new ColumnHeader(); 47 | colXY.text = "XY"; 48 | colXY.width = 70; 49 | 50 | _listView.columns.addRange([colX, colY, colXY]); 51 | 52 | // Contents 53 | _listView.beginUpdate(); // Stop redraw. 54 | 55 | // Work around: The first column alignment setting is enabled after beginUpdate(). 56 | colX.textAlign = HorizontalAlignment.CENTER; 57 | colY.textAlign = HorizontalAlignment.RIGHT; 58 | colXY.textAlign = HorizontalAlignment.LEFT; 59 | 60 | for (int x=1; x<=3; x++) 61 | { 62 | for (int y=1; y<=3; y++) 63 | { 64 | string xstr = to!string(x); 65 | string ystr = to!string(y); 66 | string xystr = to!string(x*y); 67 | ListViewItem item = new ListViewItem(xstr); 68 | _listView.items.add(item); // Add item to first column. 69 | item.subItems.add(ystr); // Add sub item to second column. 70 | item.subItems.add(xystr); // Add sub item to third column. 71 | } 72 | } 73 | 74 | _listView.endUpdate(); // Restart redraw. 75 | } 76 | } 77 | 78 | static this() 79 | { 80 | Application.enableVisualStyles(); 81 | } 82 | 83 | void main() 84 | { 85 | Application.run(new MainForm()); 86 | } 87 | -------------------------------------------------------------------------------- /examples/notifyicon/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | docs/ 5 | /hello_dfl 6 | hello_dfl.so 7 | hello_dfl.dylib 8 | hello_dfl.dll 9 | hello_dfl.a 10 | hello_dfl.lib 11 | hello_dfl-test-* 12 | *.exe 13 | *.pdb 14 | *.o 15 | *.obj 16 | *.lst 17 | -------------------------------------------------------------------------------- /examples/notifyicon/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "C++ Launch (Windows) notifyicon", 6 | "type": "cppvsdbg", 7 | "request": "launch", 8 | "cwd": "${workspaceRoot}", 9 | "program": "./bin/notifyicon_sample.exe", 10 | "console": "internalConsole" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /examples/notifyicon/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "dub", 6 | "run": false, 7 | "cwd": ".", 8 | "compiler": "$current", 9 | "archType": "$current", 10 | "buildType": "$current", 11 | "configuration": "$current", 12 | "problemMatcher": [ 13 | "$dmd" 14 | ], 15 | "group": { 16 | "kind": "build", 17 | "isDefault": true 18 | }, 19 | "label": "dub: Build notifyicon_sample", 20 | "detail": "dub build --compiler=dmd.EXE -a=x86_64 -b=debug -c=application" 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /examples/notifyicon/README.md: -------------------------------------------------------------------------------- 1 | # Screen Shot 2 | ![screen shot](./image/screenshot.png "screen shot") 3 | -------------------------------------------------------------------------------- /examples/notifyicon/dub.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": ["haru-s"], 3 | "copyright": "Copyright (C) 2023 haru-s", 4 | "description": "DFL sample code.", 5 | "name": "notifyicon_sample", 6 | "targetType": "executable", 7 | "targetPath": "bin", 8 | "dependencies": { 9 | "dfl": { 10 | "path": "../../../dfl" 11 | } 12 | }, 13 | "lflags-windows-x86_mscoff-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"], 14 | "lflags-windows-x86_64-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"] 15 | } -------------------------------------------------------------------------------- /examples/notifyicon/image/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/notifyicon/image/icon.ico -------------------------------------------------------------------------------- /examples/notifyicon/image/icon2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/notifyicon/image/icon2.ico -------------------------------------------------------------------------------- /examples/notifyicon/image/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/notifyicon/image/screenshot.png -------------------------------------------------------------------------------- /examples/notifyicon/notifyicon.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": { 8 | "d.projectImportPaths": [ 9 | "..\\..\\..\\dfl\\source" 10 | ] 11 | } 12 | } -------------------------------------------------------------------------------- /examples/notifyicon/shell.bat: -------------------------------------------------------------------------------- 1 | set dmd_path=c:\d\dmd2\windows 2 | set dmc_path=c:\dmc\dm 3 | cmd 4 | -------------------------------------------------------------------------------- /examples/notifyicon/source/notifyicon_sample.d: -------------------------------------------------------------------------------- 1 | import dfl; 2 | import dfl.internal.dpiaware; 3 | 4 | version(Have_dfl) // For DUB. 5 | { 6 | } 7 | else 8 | { 9 | pragma(lib, "dfl.lib"); 10 | } 11 | 12 | class MainForm : Form 13 | { 14 | private NotifyIcon _notifyIcon; 15 | 16 | public this() 17 | { 18 | this.text = "NotifyIcon example"; 19 | this.size = Size(300, 200); 20 | 21 | MenuItem menuItem1 = new MenuItem("Show"); 22 | menuItem1.click ~= (MenuItem mi, EventArgs e) 23 | { 24 | msgBox("Hi!"); 25 | }; 26 | 27 | MenuItem menuItem2 = new MenuItem("Close"); 28 | menuItem2.click ~= (MenuItem mi, EventArgs e) 29 | { 30 | this.close(); 31 | }; 32 | 33 | _notifyIcon = new NotifyIcon; 34 | _notifyIcon.contextMenu = new ContextMenu; 35 | _notifyIcon.contextMenu.menuItems.add(menuItem1); 36 | _notifyIcon.contextMenu.menuItems.add(menuItem2); 37 | 38 | _notifyIcon.icon = new Icon(r".\image\icon.ico"); 39 | _notifyIcon.text = "This is tooltip text"; 40 | _notifyIcon.balloonTipTitle = "Balloon tip example"; 41 | _notifyIcon.balloonTipText = "Welcome to the D world!"; 42 | _notifyIcon.balloonTipSound = true; 43 | static if (false) 44 | { 45 | _notifyIcon.balloonTipIconStyle = BalloonTipIconStyle.INFO; 46 | // _notifyIcon.balloonTipIconStyle = BalloonTipIconStyle.ERROR; 47 | // _notifyIcon.balloonTipIconStyle = BalloonTipIconStyle.WARNING; 48 | // _notifyIcon.balloonTipIconStyle = BalloonTipIconStyle.NONE; 49 | } 50 | else 51 | { 52 | _notifyIcon.balloonTipIconStyle = BalloonTipIconStyle.USER; 53 | _notifyIcon.balloonTipIcon = new Icon(r".\image\icon2.ico"); 54 | } 55 | _notifyIcon.click ~= (NotifyIcon ni, EventArgs e) 56 | { 57 | // NOTE: Using .select() event handler is recommended. 58 | // text = "click"; 59 | }; 60 | _notifyIcon.doubleClick ~= (NotifyIcon ni, EventArgs e) 61 | { 62 | // text = "doubleClick"; 63 | }; 64 | _notifyIcon.mouseDown ~= (NotifyIcon ni, MouseEventArgs e) 65 | { 66 | // text = "mouseDown"; 67 | }; 68 | _notifyIcon.mouseUp ~= (NotifyIcon ni, MouseEventArgs e) 69 | { 70 | // text = "mouseUp"; 71 | }; 72 | _notifyIcon.mouseMove ~= (NotifyIcon ni, MouseEventArgs e) 73 | { 74 | // text = "mouseMove"; 75 | }; 76 | _notifyIcon.balloonTipShown ~= (NotifyIcon ni, EventArgs e) 77 | { 78 | text = "balloonTipShown"; 79 | }; 80 | _notifyIcon.balloonTipClosed ~= (NotifyIcon ni, EventArgs e) 81 | { 82 | text = "balloonTipClosed"; 83 | }; 84 | _notifyIcon.balloonTipClicked ~= (NotifyIcon ni, EventArgs e) 85 | { 86 | text = "balloonTipClicked"; 87 | }; 88 | _notifyIcon.balloonTipTimeout ~= (NotifyIcon ni, EventArgs e) 89 | { 90 | text = "balloonTipTimeout"; 91 | }; 92 | _notifyIcon.select ~= (NotifyIcon ni, MouseEventArgs e) 93 | { 94 | text = "select"; 95 | }; 96 | _notifyIcon.keySelect ~= (NotifyIcon ni, MouseEventArgs e) 97 | { 98 | text = "keySelect"; 99 | }; 100 | _notifyIcon.popupShown ~= (NotifyIcon ni, MouseEventArgs e) 101 | { 102 | text = "popupShown"; 103 | }; 104 | _notifyIcon.popupClosed ~= (NotifyIcon ni, EventArgs e) 105 | { 106 | text = "popupClosed"; 107 | }; 108 | _notifyIcon.show(); 109 | 110 | click ~= (Control c, EventArgs e) 111 | { 112 | _notifyIcon.showBalloonTip(); 113 | }; 114 | } 115 | 116 | override void onPaint(PaintEventArgs e) 117 | { 118 | e.graphics.drawText("asbcあいう", new Font("MS ゴシック", 12), Color.black, Rect(0, 0, width, height)); 119 | } 120 | } 121 | 122 | static this() 123 | { 124 | Application.enableVisualStyles(); 125 | 126 | // NOTE: DPI Awareness 127 | SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_UNAWARE); // OK 128 | // SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED); // OK 129 | // SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_SYSTEM_AWARE); // Windows suppresses the display of balloon tips. 130 | // SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); // ditto. 131 | } 132 | 133 | void main() 134 | { 135 | Application.run(new MainForm()); 136 | } 137 | -------------------------------------------------------------------------------- /examples/picturebox/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | docs/ 5 | /hello_dfl 6 | hello_dfl.so 7 | hello_dfl.dylib 8 | hello_dfl.dll 9 | hello_dfl.a 10 | hello_dfl.lib 11 | hello_dfl-test-* 12 | *.exe 13 | *.pdb 14 | *.o 15 | *.obj 16 | *.lst 17 | -------------------------------------------------------------------------------- /examples/picturebox/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "C++ Launch (Windows) picturebox", 6 | "type": "cppvsdbg", 7 | "request": "launch", 8 | "cwd": "${workspaceRoot}", 9 | "program": "./bin/picturebox_sample.exe", 10 | "console": "internalConsole" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /examples/picturebox/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "dub", 6 | "run": false, 7 | "cwd": ".", 8 | "compiler": "$current", 9 | "archType": "$current", 10 | "buildType": "$current", 11 | "configuration": "$current", 12 | "problemMatcher": [ 13 | "$dmd" 14 | ], 15 | "group": { 16 | "kind": "build", 17 | "isDefault": true 18 | }, 19 | "label": "dub: Build picturebox_sample", 20 | "detail": "dub build --compiler=dmd.EXE -a=x86_64 -b=debug -c=application" 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /examples/picturebox/README.md: -------------------------------------------------------------------------------- 1 | # Screen Shot 2 | ![screen shot](./image/screenshot.png "screen shot") 3 | -------------------------------------------------------------------------------- /examples/picturebox/dub.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": ["haru-s"], 3 | "copyright": "Copyright (C) 2023 haru-s", 4 | "description": "DFL sample code.", 5 | "name": "picturebox_sample", 6 | "targetType": "executable", 7 | "targetPath": "bin", 8 | "dependencies": { 9 | "dfl": { 10 | "path": "../../../dfl" 11 | } 12 | }, 13 | "lflags-windows-x86_mscoff-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"], 14 | "lflags-windows-x86_64-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"] 15 | } -------------------------------------------------------------------------------- /examples/picturebox/image/dman-error.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/picturebox/image/dman-error.bmp -------------------------------------------------------------------------------- /examples/picturebox/image/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/picturebox/image/screenshot.png -------------------------------------------------------------------------------- /examples/picturebox/picturebox.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": { 8 | "d.projectImportPaths": [ 9 | "..\\..\\..\\dfl\\source" 10 | ] 11 | } 12 | } -------------------------------------------------------------------------------- /examples/picturebox/shell.bat: -------------------------------------------------------------------------------- 1 | set dmd_path=c:\d\dmd2\windows 2 | set dmc_path=c:\dmc\dm 3 | cmd 4 | -------------------------------------------------------------------------------- /examples/picturebox/source/picturebox_sample.d: -------------------------------------------------------------------------------- 1 | import dfl; 2 | 3 | version(Have_dfl) // For DUB. 4 | { 5 | } 6 | else 7 | { 8 | pragma(lib, "dfl.lib"); 9 | } 10 | 11 | class MainForm : Form 12 | { 13 | private PictureBox _pic1; 14 | private PictureBox _pic2; 15 | private PictureBox _pic3; 16 | private PictureBox _pic4; 17 | private PictureBox _pic5; 18 | 19 | public this() 20 | { 21 | this.text = "PictureBox example"; 22 | this.size = Size(450, 450); 23 | 24 | _pic1 = new PictureBox; 25 | _pic2 = new PictureBox; 26 | _pic3 = new PictureBox; 27 | _pic4 = new PictureBox; 28 | _pic5 = new PictureBox; 29 | 30 | // Layout 31 | // 1 2 3 32 | // 4 5 33 | _pic1.location = Point(0, 0); 34 | _pic2.location = Point(110, 0); 35 | _pic3.location = Point(220, 0); 36 | _pic4.location = Point(0, 110); 37 | _pic5.location = Point(110, 110); 38 | 39 | _pic1.size = Size(100, 100); 40 | _pic2.size = Size(100, 100); 41 | _pic3.size = Size(200, 100); // wider than height 42 | _pic4.size = Size(100, 100); 43 | _pic5.size = Size(100, 100); 44 | 45 | _pic1.parent = this; 46 | _pic2.parent = this; 47 | _pic3.parent = this; 48 | _pic4.parent = this; 49 | _pic5.parent = this; 50 | 51 | _pic1.sizeMode = PictureBoxSizeMode.NORMAL; 52 | _pic2.sizeMode = PictureBoxSizeMode.STRETCH_IMAGE; 53 | _pic3.sizeMode = PictureBoxSizeMode.ZOOM; 54 | _pic4.sizeMode = PictureBoxSizeMode.CENTER_IMAGE; 55 | _pic5.sizeMode = PictureBoxSizeMode.AUTO_SIZE; 56 | 57 | _pic1.borderStyle = BorderStyle.FIXED_SINGLE; 58 | _pic2.borderStyle = BorderStyle.NONE; 59 | _pic3.borderStyle = BorderStyle.FIXED_SINGLE; 60 | _pic4.borderStyle = BorderStyle.FIXED_3D; 61 | _pic5.borderStyle = BorderStyle.FIXED_3D; 62 | 63 | // https://raw.githubusercontent.com/dlang/dlang.org/master/images/dman-error.jpg 64 | Image image = new Bitmap(r".\image\dman-error.bmp"); 65 | 66 | _pic1.image = image; 67 | _pic2.image = image; 68 | _pic3.image = image; 69 | _pic4.image = image; 70 | _pic5.image = image; 71 | } 72 | } 73 | 74 | static this() 75 | { 76 | Application.enableVisualStyles(); 77 | } 78 | 79 | void main() 80 | { 81 | Application.run(new MainForm()); 82 | } 83 | -------------------------------------------------------------------------------- /examples/progressbar/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | docs/ 5 | /hello_dfl 6 | hello_dfl.so 7 | hello_dfl.dylib 8 | hello_dfl.dll 9 | hello_dfl.a 10 | hello_dfl.lib 11 | hello_dfl-test-* 12 | *.exe 13 | *.pdb 14 | *.o 15 | *.obj 16 | *.lst 17 | -------------------------------------------------------------------------------- /examples/progressbar/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "C++ Launch (Windows) progressbar", 6 | "type": "cppvsdbg", 7 | "request": "launch", 8 | "cwd": "${workspaceRoot}", 9 | "program": "./bin/progressbar_sample.exe", 10 | "console": "internalConsole" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /examples/progressbar/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "dub", 6 | "run": false, 7 | "cwd": ".", 8 | "compiler": "$current", 9 | "archType": "$current", 10 | "buildType": "$current", 11 | "configuration": "$current", 12 | "problemMatcher": [ 13 | "$dmd" 14 | ], 15 | "group": { 16 | "kind": "build", 17 | "isDefault": true 18 | }, 19 | "label": "dub: Build progressbar_sample", 20 | "detail": "dub build --compiler=dmd.EXE -a=x86_64 -b=debug -c=application" 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /examples/progressbar/README.md: -------------------------------------------------------------------------------- 1 | # Screen Shot 2 | ![screen shot](./image/screenshot1.png "screen shot") 3 | ![screen shot](./image/screenshot2.png "screen shot") 4 | ![screen shot](./image/screenshot3.png "screen shot") 5 | ![screen shot](./image/screenshot4.png "screen shot") 6 | -------------------------------------------------------------------------------- /examples/progressbar/dub.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": ["haru-s"], 3 | "copyright": "Copyright (C) 2023 haru-s", 4 | "description": "DFL sample code.", 5 | "name": "progressbar_sample", 6 | "targetType": "executable", 7 | "targetPath": "bin", 8 | "dependencies": { 9 | "dfl": { 10 | "path": "../../../dfl" 11 | } 12 | }, 13 | "lflags-windows-x86_mscoff-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"], 14 | "lflags-windows-x86_64-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"] 15 | } -------------------------------------------------------------------------------- /examples/progressbar/image/screenshot1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/progressbar/image/screenshot1.png -------------------------------------------------------------------------------- /examples/progressbar/image/screenshot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/progressbar/image/screenshot2.png -------------------------------------------------------------------------------- /examples/progressbar/image/screenshot3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/progressbar/image/screenshot3.png -------------------------------------------------------------------------------- /examples/progressbar/image/screenshot4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/progressbar/image/screenshot4.png -------------------------------------------------------------------------------- /examples/progressbar/progressbar.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": { 8 | "d.projectImportPaths": [ 9 | "..\\..\\..\\dfl\\source" 10 | ] 11 | } 12 | } -------------------------------------------------------------------------------- /examples/progressbar/shell.bat: -------------------------------------------------------------------------------- 1 | set dmd_path=c:\d\dmd2\windows 2 | set dmc_path=c:\dmc\dm 3 | cmd 4 | -------------------------------------------------------------------------------- /examples/progressbar/source/progressbar_sample.d: -------------------------------------------------------------------------------- 1 | import dfl; 2 | 3 | version(Have_dfl) // For DUB. 4 | { 5 | } 6 | else 7 | { 8 | pragma(lib, "dfl.lib"); 9 | } 10 | 11 | class MainForm : Form 12 | { 13 | private ProgressBar _progress; 14 | private Button _incre; 15 | private Button _reset; 16 | private ComboBox _mode; 17 | 18 | public this() 19 | { 20 | this.text = "ProgressBar example"; 21 | this.size = Size(300, 300); 22 | 23 | _progress = new ProgressBar(); 24 | _progress.parent = this; 25 | _progress.location = Point(20, 100); 26 | _progress.size = Size(200, 30); 27 | _progress.minimum = 0; 28 | _progress.maximum = 100; 29 | _progress.step = 5; 30 | _progress.value = 50; 31 | _progress.marqueeAnimationSpeed = 0; // Default; 30 ms. 32 | 33 | _mode = new ComboBox(); 34 | _mode.parent = this; 35 | _mode.location = Point(20, 150); 36 | _mode.dropDownStyle = ComboBoxStyle.DROP_DOWN_LIST; 37 | _mode.items.add("BLOCKS"); 38 | _mode.items.add("CONTINUOUS"); 39 | _mode.items.add("MARQUEE"); 40 | _mode.selectedIndex = 0; 41 | _mode.selectedValueChanged ~= (Control c, EventArgs e) 42 | { 43 | if (_mode.selectedItem.toString() == "BLOCKS") 44 | { 45 | _progress.style = ProgressBarStyle.BLOCKS; // On visual styles, same as CONTINUOUS. 46 | } 47 | else if (_mode.selectedItem.toString() == "CONTINUOUS") 48 | { 49 | _progress.style = ProgressBarStyle.CONTINUOUS; // Classic Styles only. 50 | } 51 | else if (_mode.selectedItem.toString() == "MARQUEE") 52 | { 53 | _progress.style = ProgressBarStyle.MARQUEE; // Visual styles only. 54 | } 55 | }; 56 | 57 | _incre = new Button(); 58 | _incre.parent = this; 59 | _incre.location = Point(20, 20); 60 | _incre.text = "Increment"; 61 | _incre.click ~= (Control c, EventArgs e) 62 | { 63 | if (_progress.style == ProgressBarStyle.MARQUEE) 64 | msgBox("Can't increment."); 65 | else 66 | { 67 | // Advances the current position of the progress bar by the amount of the Step property. 68 | _progress.performStep(); 69 | // Advances the current position of the progress bar by the specified amount. 70 | _progress.increment(5); 71 | } 72 | }; 73 | 74 | _reset = new Button(); 75 | _reset.parent = this; 76 | _reset.location = Point(120, 20); 77 | _reset.text = "Reset"; 78 | _reset.click ~= (Control c, EventArgs e) 79 | { 80 | if (_progress.style == ProgressBarStyle.MARQUEE) 81 | msgBox("Can't reset."); 82 | else 83 | _progress.value = 50; 84 | }; 85 | } 86 | } 87 | 88 | static this() 89 | { 90 | Application.enableVisualStyles(); // Apply visual styles. 91 | } 92 | 93 | void main() 94 | { 95 | Application.run(new MainForm()); 96 | } 97 | -------------------------------------------------------------------------------- /examples/registry/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | docs/ 5 | /hello_dfl 6 | hello_dfl.so 7 | hello_dfl.dylib 8 | hello_dfl.dll 9 | hello_dfl.a 10 | hello_dfl.lib 11 | hello_dfl-test-* 12 | *.exe 13 | *.pdb 14 | *.o 15 | *.obj 16 | *.lst 17 | -------------------------------------------------------------------------------- /examples/registry/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "C++ Launch (Windows) registry", 6 | "type": "cppvsdbg", 7 | "request": "launch", 8 | "cwd": "${workspaceRoot}", 9 | "program": "./bin/registry_sample.exe", 10 | "console": "internalConsole" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /examples/registry/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "dub", 6 | "run": false, 7 | "cwd": ".", 8 | "compiler": "$current", 9 | "archType": "$current", 10 | "buildType": "$current", 11 | "configuration": "$current", 12 | "problemMatcher": [ 13 | "$dmd" 14 | ], 15 | "group": { 16 | "kind": "build", 17 | "isDefault": true 18 | }, 19 | "label": "dub: Build registry_sample", 20 | "detail": "dub build --compiler=dmd.EXE -a=x86_64 -b=debug -c=application" 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /examples/registry/README.md: -------------------------------------------------------------------------------- 1 | # Screen Shot 2 | ![screen shot](./image/screenshot.png "screen shot") 3 | -------------------------------------------------------------------------------- /examples/registry/dub.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": ["haru-s"], 3 | "copyright": "Copyright (C) 2025 haru-s", 4 | "description": "DFL sample code.", 5 | "name": "registry_sample", 6 | "targetType": "executable", 7 | "targetPath": "bin", 8 | "dependencies": { 9 | "dfl": { 10 | "path": "../../../dfl" 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /examples/registry/image/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/registry/image/screenshot.png -------------------------------------------------------------------------------- /examples/registry/registry.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": { 8 | "d.projectImportPaths": [ 9 | "..\\..\\..\\dfl\\source" 10 | ] 11 | } 12 | } -------------------------------------------------------------------------------- /examples/registry/shell.bat: -------------------------------------------------------------------------------- 1 | set dmd_path=c:\d\dmd2\windows 2 | set dmc_path=c:\dmc\dm 3 | cmd 4 | -------------------------------------------------------------------------------- /examples/registry/source/registry_sample.d: -------------------------------------------------------------------------------- 1 | import dfl.registry; 2 | import std.stdio : writeln; 3 | import std.range : take; 4 | import core.sys.windows.windef : DWORD; 5 | 6 | version(Have_dfl) // For DUB. 7 | { 8 | } 9 | else 10 | { 11 | pragma(lib, "dfl.lib"); 12 | } 13 | 14 | // helper 15 | string fromValueType(DWORD valueType) 16 | { 17 | return [ 18 | "REG_NONE", 19 | "REG_SZ", 20 | "REG_EXPAND_SZ", 21 | "REG_BINARY", 22 | "REG_DWORD_LITTLE_ENDIAN", 23 | "REG_DWORD = REG_DWORD_LITTLE_ENDIAN", 24 | "REG_DWORD_BIG_ENDIAN", 25 | "REG_LINK", 26 | "REG_MULTI_SZ", 27 | "REG_RESOURCE_LIST", 28 | "REG_FULL_RESOURCE_DESCRIPTOR", 29 | "REG_RESOURCE_REQUIREMENTS_LIST", 30 | "REG_QWORD_LITTLE_ENDIAN", 31 | "REG_QWORD = REG_QWORD_LITTLE_ENDIAN" 32 | ][valueType]; 33 | } 34 | 35 | void main() 36 | { 37 | RegistryKey key1 = Registry.currentUser(); 38 | 39 | RegistryKey key2 = key1.openSubKey("Console"); 40 | 41 | writeln("valueCount: ", key1.valueCount); 42 | writeln("getValueNames: ", key1.getValueNames.take(10)); 43 | writeln("subKeyCount: ", key1.subKeyCount); 44 | writeln("getSubKeyNames: ", key1.getSubKeyNames.take(10)); 45 | 46 | RegistryValue value1 = key2.getValue("WindowSize"); 47 | writeln("- WindowSize"); 48 | writeln("valueType: ", fromValueType(value1.valueType())); 49 | writeln("value: ", value1.toString()); 50 | 51 | RegistryValue value2 = key2.getValue("FaceName"); 52 | writeln("- FaceName"); 53 | writeln("valueType: ", fromValueType(value2.valueType())); 54 | writeln("value: ", value2.toString()); 55 | 56 | RegistryKey key3 = key2.createSubKey("_DFL_TEST_KEY_"); 57 | key3.setValue("_DFL_TEST_VALUE_", 255); 58 | RegistryValue value3 = key3.getValue("_DFL_TEST_VALUE_"); 59 | writeln("value: ", value3.toString()); 60 | 61 | key2.deleteSubKey("_DFL_TEST_KEY_", true); 62 | 63 | key1.flush(); 64 | } 65 | -------------------------------------------------------------------------------- /examples/resources/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | docs/ 5 | /hello_dfl 6 | hello_dfl.so 7 | hello_dfl.dylib 8 | hello_dfl.dll 9 | hello_dfl.a 10 | hello_dfl.lib 11 | hello_dfl-test-* 12 | *.exe 13 | *.pdb 14 | *.o 15 | *.obj 16 | *.lst 17 | -------------------------------------------------------------------------------- /examples/resources/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "C++ Launch (Windows) resources", 6 | "type": "cppvsdbg", 7 | "request": "launch", 8 | "cwd": "${workspaceRoot}", 9 | "program": "./bin/resources_sample.exe", 10 | "console": "internalConsole" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /examples/resources/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "dub", 6 | "run": false, 7 | "cwd": ".", 8 | "compiler": "$current", 9 | "archType": "$current", 10 | "buildType": "$current", 11 | "configuration": "$current", 12 | "problemMatcher": [ 13 | "$dmd" 14 | ], 15 | "group": { 16 | "kind": "build", 17 | "isDefault": true 18 | }, 19 | "label": "dub: Build resources_sample", 20 | "detail": "dub build --compiler=dmd.EXE -a=x86_64 -b=debug -c=application" 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /examples/resources/README.md: -------------------------------------------------------------------------------- 1 | # Note 2 | make_resource.bat requires MSVC. 3 | 4 | # Screen Shot 5 | ![screen shot](./image/screenshot.png "screen shot") 6 | -------------------------------------------------------------------------------- /examples/resources/dub.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": ["haru-s"], 3 | "copyright": "Copyright (C) 2025 haru-s", 4 | "description": "DFL sample code.", 5 | "name": "resources_sample", 6 | "targetType": "executable", 7 | "targetPath": "bin", 8 | "dependencies": { 9 | "dfl": { 10 | "path": "../../../dfl" 11 | } 12 | }, 13 | "lflags-windows": ["resource/sample.res"], 14 | "lflags-windows-x86_mscoff-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"], 15 | "lflags-windows-x86_64-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"] 16 | } -------------------------------------------------------------------------------- /examples/resources/image/d-cursor.cur: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/resources/image/d-cursor.cur -------------------------------------------------------------------------------- /examples/resources/image/dman-error.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/resources/image/dman-error.bmp -------------------------------------------------------------------------------- /examples/resources/image/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/resources/image/icon.ico -------------------------------------------------------------------------------- /examples/resources/image/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/resources/image/screenshot.png -------------------------------------------------------------------------------- /examples/resources/make_resource.bat: -------------------------------------------------------------------------------- 1 | rc /v resource\sample.rc 2 | -------------------------------------------------------------------------------- /examples/resources/resource/sample.rc: -------------------------------------------------------------------------------- 1 | 256 ICON "image/icon.ico" 2 | 257 BITMAP "image/dman-error.bmp" 3 | 258 RCDATA 4 | { 5 | "Here is an ANSI string\0", // explicitly null-terminated 6 | L"Here is a Unicode string\0", // explicitly null-terminated 7 | 1024, // integer, stored as WORD 8 | 7L, // integer, stored as DWORD 9 | 0x0010, // hex integer as WORD 10 | 0o010, // octal integerr as WORD 11 | } 12 | 259 CURSOR "image/d-cursor.cur" 13 | STRINGTABLE 14 | { 15 | 260, "Hoge\0" 16 | 261, "Fuga\0" 17 | } 18 | -------------------------------------------------------------------------------- /examples/resources/resource/sample.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/resources/resource/sample.res -------------------------------------------------------------------------------- /examples/resources/resources.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": { 8 | "d.projectImportPaths": [ 9 | "..\\..\\..\\dfl\\source" 10 | ] 11 | } 12 | } -------------------------------------------------------------------------------- /examples/resources/shell.bat: -------------------------------------------------------------------------------- 1 | set dmd_path=c:\d\dmd2\windows 2 | set dmc_path=c:\dmc\dm 3 | cmd 4 | -------------------------------------------------------------------------------- /examples/resources/source/resources_sample.d: -------------------------------------------------------------------------------- 1 | import dfl; 2 | 3 | import dfl.internal.dlib; 4 | 5 | import core.sys.windows.winnt; 6 | import core.sys.windows.winuser; 7 | 8 | import std.conv; 9 | 10 | version(Have_dfl) // For DUB. 11 | { 12 | } 13 | else 14 | { 15 | pragma(lib, "dfl.lib"); 16 | } 17 | 18 | struct RCData 19 | { 20 | string ansiString; 21 | wstring unicodeString; 22 | WORD wordInt; 23 | DWORD dwordInt; 24 | WORD wordHexInt; 25 | WORD wordOctInt; 26 | } 27 | 28 | RCData parseRCData(const(ubyte)* ptr, size_t size) 29 | { 30 | RCData data; 31 | size_t offset; 32 | 33 | // string ansiString: ANSI null-terminated string 34 | auto start = offset; 35 | while (offset < size && ptr[offset] != 0) 36 | offset += char.sizeof; 37 | data.ansiString = cast(string)ptr[start .. offset]; 38 | offset += char.sizeof; // skip null terminator 39 | 40 | // wstring unicodeString: Unicode null-terminated string 41 | start = offset; 42 | while (offset + 1 < size && (ptr[offset] != 0 || ptr[offset + 1] != 0)) 43 | offset += wchar.sizeof; 44 | data.unicodeString = cast(wstring)ptr[start .. offset]; 45 | offset += wchar.sizeof; // skip null terminator 46 | 47 | // WORD wordInt 48 | data.wordInt = *cast(WORD*)&ptr[offset]; 49 | offset += WORD.sizeof; 50 | 51 | // DWORD dwordInt 52 | data.dwordInt = *cast(DWORD*)&ptr[offset]; 53 | offset += DWORD.sizeof; 54 | 55 | // WORD wordHexIn 56 | data.wordHexInt = *cast(WORD*)&ptr[offset]; 57 | offset += WORD.sizeof; 58 | 59 | // WORD wordOctInt 60 | data.wordOctInt = *cast(WORD*)&ptr[offset]; 61 | offset += WORD.sizeof; 62 | 63 | return data; 64 | } 65 | 66 | class MainForm : Form 67 | { 68 | Bitmap _bmp; 69 | Cursor _cur; 70 | Icon _ico; 71 | string[] _str; 72 | RCData _rcdata; 73 | 74 | public this() 75 | { 76 | this.text = "Resources example"; 77 | this.size = Size(600, 600); 78 | 79 | Resources r = new Resources(Application.getInstance()); 80 | 81 | _bmp = r.getBitmap(257); 82 | 83 | _cur = r.getCursor(259); 84 | 85 | _ico = r.getIcon(256, 32, 32); 86 | this.icon = _ico; 87 | 88 | _str = [r.getString(260), r.getString(261)]; 89 | 90 | void[] dat = r.getData(RT_RCDATA, 258); 91 | _rcdata = parseRCData(cast(ubyte*)dat, dat.length); 92 | } 93 | 94 | override void onPaint(PaintEventArgs e) 95 | { 96 | Font fon = new Font("msgothic", 12); 97 | e.graphics.drawText(_str[0] ~ " " ~ _str[1], fon, Color.black, Rect(0, 0, width, height)); 98 | 99 | e.graphics.drawText(_rcdata.ansiString, fon, Color.black, Rect(0, 50, width, height)); 100 | e.graphics.drawText(_rcdata.unicodeString.to!string(), fon, Color.black, Rect(0, 70, width, height)); 101 | e.graphics.drawText(_rcdata.wordInt.to!string(), fon, Color.black, Rect(0, 90, width, height)); 102 | e.graphics.drawText(_rcdata.dwordInt.to!string(), fon, Color.black, Rect(0, 110, width, height)); 103 | e.graphics.drawText(_rcdata.wordHexInt.to!string(), fon, Color.black, Rect(0, 130, width, height)); 104 | e.graphics.drawText(_rcdata.wordOctInt.to!string(), fon, Color.black, Rect(0, 150, width, height)); 105 | 106 | _bmp.draw(e.graphics, Point(100, 200)); 107 | } 108 | 109 | override void wndProc(ref Message msg) 110 | { 111 | if (msg.msg == WM_SETCURSOR) 112 | { 113 | Cursor.current = _cur; 114 | return; // Returns so that the class cursor is not displayed. 115 | } 116 | super.wndProc(msg); 117 | } 118 | } 119 | 120 | static this() 121 | { 122 | Application.enableVisualStyles(); 123 | 124 | import dfl.internal.dpiaware; 125 | // SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_UNAWARE); // OK 126 | // SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED); // OK 127 | // SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_SYSTEM_AWARE); // Windows suppresses the display of balloon tips. 128 | SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); // ditto. 129 | } 130 | 131 | void main() 132 | { 133 | Application.run(new MainForm()); 134 | } 135 | -------------------------------------------------------------------------------- /examples/richtextbox/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | docs/ 5 | /hello_dfl 6 | hello_dfl.so 7 | hello_dfl.dylib 8 | hello_dfl.dll 9 | hello_dfl.a 10 | hello_dfl.lib 11 | hello_dfl-test-* 12 | *.exe 13 | *.pdb 14 | *.o 15 | *.obj 16 | *.lst 17 | -------------------------------------------------------------------------------- /examples/richtextbox/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "C++ Launch (Windows) richtextbox", 6 | "type": "cppvsdbg", 7 | "request": "launch", 8 | "cwd": "${workspaceRoot}", 9 | "program": "./bin/richtextbox_sample.exe", 10 | "console": "internalConsole" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /examples/richtextbox/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "dub", 6 | "run": false, 7 | "cwd": ".", 8 | "compiler": "$current", 9 | "archType": "$current", 10 | "buildType": "$current", 11 | "configuration": "$current", 12 | "problemMatcher": [ 13 | "$dmd" 14 | ], 15 | "group": { 16 | "kind": "build", 17 | "isDefault": true 18 | }, 19 | "label": "dub: Build richtextbox_sample", 20 | "detail": "dub build --compiler=dmd.EXE -a=x86_64 -b=debug -c=application", 21 | "presentation": { 22 | "clear": true 23 | } 24 | } 25 | ] 26 | } -------------------------------------------------------------------------------- /examples/richtextbox/README.md: -------------------------------------------------------------------------------- 1 | # Screen Shot 2 | ![screen shot](./image/screenshot.png "screen shot") 3 | -------------------------------------------------------------------------------- /examples/richtextbox/dub.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": ["haru-s"], 3 | "copyright": "Copyright (C) 2023 haru-s", 4 | "description": "DFL sample code.", 5 | "name": "richtextbox_sample", 6 | "targetType": "executable", 7 | "targetPath": "bin", 8 | "dependencies": { 9 | "dfl": { 10 | "path": "../../../dfl" 11 | } 12 | }, 13 | "lflags-windows-x86_mscoff-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"], 14 | "lflags-windows-x86_64-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"] 15 | } -------------------------------------------------------------------------------- /examples/richtextbox/image/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/richtextbox/image/screenshot.png -------------------------------------------------------------------------------- /examples/richtextbox/richtextbox.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": { 8 | "d.projectImportPaths": [ 9 | "..\\..\\..\\dfl\\source" 10 | ] 11 | } 12 | } -------------------------------------------------------------------------------- /examples/richtextbox/shell.bat: -------------------------------------------------------------------------------- 1 | set dmd_path=c:\d\dmd2\windows 2 | set dmc_path=c:\dmc\dm 3 | cmd 4 | -------------------------------------------------------------------------------- /examples/scrollbar/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | docs/ 5 | /hello_dfl 6 | hello_dfl.so 7 | hello_dfl.dylib 8 | hello_dfl.dll 9 | hello_dfl.a 10 | hello_dfl.lib 11 | hello_dfl-test-* 12 | *.exe 13 | *.pdb 14 | *.o 15 | *.obj 16 | *.lst 17 | -------------------------------------------------------------------------------- /examples/scrollbar/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "C++ Launch (Windows) scrollbar", 6 | "type": "cppvsdbg", 7 | "request": "launch", 8 | "cwd": "${workspaceRoot}", 9 | "program": "./bin/scrollbar.exe", 10 | "console": "internalConsole" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /examples/scrollbar/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "dub", 6 | "run": false, 7 | "cwd": ".", 8 | "compiler": "$current", 9 | "archType": "$current", 10 | "buildType": "$current", 11 | "configuration": "$current", 12 | "problemMatcher": [ 13 | "$dmd" 14 | ], 15 | "group": { 16 | "kind": "build", 17 | "isDefault": true 18 | }, 19 | "label": "dub: Build scrollbar_example", 20 | "detail": "dub build --compiler=dmd.EXE -a=x86_64 -b=debug -c=application" 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /examples/scrollbar/README.md: -------------------------------------------------------------------------------- 1 | # Screen Shot 2 | ![screen shot](./image/screenshot.png "screen shot") 3 | -------------------------------------------------------------------------------- /examples/scrollbar/dub.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": ["haru-s"], 3 | "copyright": "Copyright (C) 2024 haru-s", 4 | "description": "DFL sample code.", 5 | "name": "scrollbar", 6 | "targetType": "executable", 7 | "targetPath": "bin", 8 | "dependencies": { 9 | "dfl": { 10 | "path": "../../../dfl" 11 | } 12 | }, 13 | "lflags-windows-x86_mscoff-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"], 14 | "lflags-windows-x86_64-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"] 15 | } -------------------------------------------------------------------------------- /examples/scrollbar/image/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/scrollbar/image/screenshot.png -------------------------------------------------------------------------------- /examples/scrollbar/scrollbar.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": { 8 | "d.projectImportPaths": [ 9 | "..\\..\\..\\dfl\\source" 10 | ] 11 | } 12 | } -------------------------------------------------------------------------------- /examples/scrollbar/shell.bat: -------------------------------------------------------------------------------- 1 | set dmd_path=c:\d\dmd2\windows 2 | set dmc_path=c:\dmc\dm 3 | cmd 4 | -------------------------------------------------------------------------------- /examples/scrollbar/source/scrollbar_example.d: -------------------------------------------------------------------------------- 1 | import dfl; 2 | 3 | version(Have_dfl) // For DUB. 4 | { 5 | } 6 | else 7 | { 8 | pragma(lib, "dfl.lib"); 9 | } 10 | 11 | class MainForm : Form 12 | { 13 | private Label _label; 14 | 15 | public this() 16 | { 17 | this.text = "Scrollbar example"; 18 | this.size = Size(400, 200); 19 | this.hScroll = true; 20 | this.vScroll = true; 21 | Rect bounds = Screen.primaryScreen.bounds; 22 | this.scrollSize = Size(bounds.width, bounds.height); 23 | 24 | _label = new Label; 25 | _label.text = 26 | "Long long long long long long long long long\n" ~ 27 | "long long long long long long long long long\n" ~ 28 | "long long long long long long long long long\n" ~ 29 | "long long long long long long long long long text"; 30 | _label.autoSize = true; 31 | _label.location = Point(50, 50); 32 | _label.parent = this; 33 | } 34 | } 35 | 36 | static this() 37 | { 38 | Application.enableVisualStyles(); 39 | } 40 | 41 | void main() 42 | { 43 | Application.run(new MainForm()); 44 | } 45 | -------------------------------------------------------------------------------- /examples/socket_client/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | docs/ 5 | /hello_dfl 6 | hello_dfl.so 7 | hello_dfl.dylib 8 | hello_dfl.dll 9 | hello_dfl.a 10 | hello_dfl.lib 11 | hello_dfl-test-* 12 | *.exe 13 | *.pdb 14 | *.o 15 | *.obj 16 | *.lst 17 | -------------------------------------------------------------------------------- /examples/socket_client/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "C++ Launch (Windows) socket_client", 6 | "type": "cppvsdbg", 7 | "request": "launch", 8 | "cwd": "${workspaceRoot}", 9 | "program": "./bin/socket_client_sample.exe", 10 | "console": "integratedTerminal" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /examples/socket_client/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "dub", 6 | "run": false, 7 | "cwd": ".", 8 | "compiler": "$current", 9 | "archType": "$current", 10 | "buildType": "$current", 11 | "configuration": "$current", 12 | "problemMatcher": [ 13 | "$dmd" 14 | ], 15 | "group": { 16 | "kind": "build", 17 | "isDefault": true 18 | }, 19 | "label": "dub: Build socket_sample", 20 | "detail": "dub build --compiler=dmd.EXE -a=x86_64 -b=debug -c=application" 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /examples/socket_client/README.md: -------------------------------------------------------------------------------- 1 | # Screen Shot 2 | ![screen shot](./image/screenshot.png "screen shot") 3 | -------------------------------------------------------------------------------- /examples/socket_client/dub.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": ["haru-s"], 3 | "copyright": "Copyright (C) 2025 haru-s", 4 | "description": "DFL sample code.", 5 | "name": "socket_client_sample", 6 | "targetType": "executable", 7 | "targetPath": "bin", 8 | "dependencies": { 9 | "dfl": { 10 | "path": "../../../dfl" 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /examples/socket_client/image/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/socket_client/image/screenshot.png -------------------------------------------------------------------------------- /examples/socket_client/shell.bat: -------------------------------------------------------------------------------- 1 | set dmd_path=c:\d\dmd2\windows 2 | set dmc_path=c:\dmc\dm 3 | cmd 4 | -------------------------------------------------------------------------------- /examples/socket_client/socket.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": { 8 | "d.projectImportPaths": [ 9 | "..\\..\\..\\dfl\\source" 10 | ] 11 | } 12 | } -------------------------------------------------------------------------------- /examples/socket_client/source/socket_sample.d: -------------------------------------------------------------------------------- 1 | import dfl.application; 2 | import dfl.socket; 3 | import std.stdio : writeln; 4 | 5 | version (Have_dfl) // For DUB. 6 | { 7 | } 8 | else 9 | { 10 | pragma(lib, "dfl.lib"); 11 | } 12 | 13 | void main() 14 | { 15 | // Create client socket. 16 | auto address = new InternetAddress("127.0.0.1", 12345); 17 | auto socket = new AsyncTcpSocket(address.addressFamily()); 18 | 19 | // Register socket event for client. 20 | socket.event( 21 | SocketEventType.CONNECT | SocketEventType.READ | SocketEventType.CLOSE, 22 | (Socket sock, SocketEventType event, int err) { 23 | if (err != 0) 24 | { 25 | writeln("Socket error: ", err); 26 | return; 27 | } 28 | 29 | switch (event) 30 | { 31 | case SocketEventType.CONNECT: 32 | writeln("Connected!"); 33 | // Send text after connected. 34 | sock.send("Hello from D client!".dup); 35 | break; 36 | 37 | case SocketEventType.READ: 38 | ubyte[1024] buf; 39 | auto len = sock.receive(buf[]); 40 | if (len > 0) 41 | { 42 | writeln("Received: ", cast(string)buf[0 .. len]); 43 | } 44 | break; 45 | 46 | case SocketEventType.CLOSE: 47 | writeln("Connection closed by server."); 48 | break; 49 | 50 | default: 51 | break; 52 | } 53 | } 54 | ); 55 | 56 | // Start connect. 57 | socket.connect(address); 58 | 59 | // Event loop. 60 | Application.run(); 61 | } 62 | -------------------------------------------------------------------------------- /examples/socket_server/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | docs/ 5 | /hello_dfl 6 | hello_dfl.so 7 | hello_dfl.dylib 8 | hello_dfl.dll 9 | hello_dfl.a 10 | hello_dfl.lib 11 | hello_dfl-test-* 12 | *.exe 13 | *.pdb 14 | *.o 15 | *.obj 16 | *.lst 17 | -------------------------------------------------------------------------------- /examples/socket_server/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "C++ Launch (Windows) socket_server", 6 | "type": "cppvsdbg", 7 | "request": "launch", 8 | "cwd": "${workspaceRoot}", 9 | "program": "./bin/socket_server_sample.exe", 10 | "console": "integratedTerminal" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /examples/socket_server/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "dub", 6 | "run": false, 7 | "cwd": ".", 8 | "compiler": "$current", 9 | "archType": "$current", 10 | "buildType": "$current", 11 | "configuration": "$current", 12 | "problemMatcher": [ 13 | "$dmd" 14 | ], 15 | "group": { 16 | "kind": "build", 17 | "isDefault": true 18 | }, 19 | "label": "dub: Build socket_server_sample", 20 | "detail": "dub build --compiler=dmd.EXE -a=x86_64 -b=debug -c=application" 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /examples/socket_server/README.md: -------------------------------------------------------------------------------- 1 | # Screen Shot 2 | ![screen shot](./image/screenshot.png "screen shot") 3 | -------------------------------------------------------------------------------- /examples/socket_server/dub.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": ["haru-s"], 3 | "copyright": "Copyright (C) 2025 haru-s", 4 | "description": "DFL sample code.", 5 | "name": "socket_server_sample", 6 | "targetType": "executable", 7 | "targetPath": "bin", 8 | "dependencies": { 9 | "dfl": { 10 | "path": "../../../../../dfl" 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /examples/socket_server/image/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/socket_server/image/screenshot.png -------------------------------------------------------------------------------- /examples/socket_server/shell.bat: -------------------------------------------------------------------------------- 1 | set dmd_path=c:\d\dmd2\windows 2 | set dmc_path=c:\dmc\dm 3 | cmd 4 | -------------------------------------------------------------------------------- /examples/socket_server/socket.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": { 8 | "d.projectImportPaths": [ 9 | "..\\..\\..\\..\\dfl\\source" 10 | ] 11 | } 12 | } -------------------------------------------------------------------------------- /examples/socket_server/source/socket_sample.d: -------------------------------------------------------------------------------- 1 | import dfl.application; 2 | import dfl.socket; 3 | import std.stdio : writeln; 4 | 5 | version (Have_dfl) // For DUB. 6 | { 7 | } 8 | else 9 | { 10 | pragma(lib, "dfl.lib"); 11 | } 12 | 13 | // version = DONT_USE_SOCKET_QUEUE; 14 | 15 | void main() 16 | { 17 | // Create server socket. 18 | auto server = new AsyncTcpSocket(AddressFamily.INET); 19 | auto bindAddr = new InternetAddress("0.0.0.0", 12345); 20 | server.bind(bindAddr); 21 | server.listen(10); 22 | 23 | writeln("Server listening on port 12345..."); 24 | 25 | // Register socket event for server. 26 | version (DONT_USE_SOCKET_QUEUE) 27 | registerSocketEvent1(server); 28 | else 29 | registerSocketEvent2(server); 30 | 31 | // Event loop. 32 | Application.run(); 33 | } 34 | 35 | void registerSocketEvent1(AsyncSocket server) 36 | { 37 | server.event( 38 | SocketEventType.ACCEPT, 39 | (Socket sock, SocketEventType event, int err) { 40 | if (err != 0) 41 | { 42 | writeln("Accept error: ", err); 43 | return; 44 | } 45 | 46 | // Get connected socket. 47 | AsyncTcpSocket client = cast(AsyncTcpSocket)sock.accept(); 48 | writeln("Client connected: ", client.remoteAddress()); 49 | 50 | // Register event for client. 51 | client.event( 52 | SocketEventType.READ | SocketEventType.CLOSE, 53 | (s, ev, e) { 54 | if (e != 0) 55 | { 56 | writeln("Client socket error: ", e); 57 | return; 58 | } 59 | 60 | switch (ev) 61 | { 62 | case SocketEventType.READ: 63 | ubyte[1024] buf; 64 | auto len = s.receive(buf[]); 65 | if (len > 0) 66 | { 67 | auto msg = cast(string)buf[0 .. len]; 68 | writeln("Received from client: ", msg); 69 | 70 | // Echo 71 | s.send(buf[0 .. len]); 72 | } 73 | break; 74 | 75 | case SocketEventType.CLOSE: 76 | writeln("Client disconnected."); 77 | break; 78 | 79 | default: 80 | break; 81 | } 82 | } 83 | ); 84 | } 85 | ); 86 | } 87 | 88 | void registerSocketEvent2(AsyncSocket server) 89 | { 90 | server.event( 91 | SocketEventType.ACCEPT, 92 | (Socket sock, SocketEventType event, int err) { 93 | if (err != 0) 94 | { 95 | writeln("Accept error: ", err); 96 | return; 97 | } 98 | 99 | // Get connected socket. 100 | AsyncTcpSocket client = cast(AsyncTcpSocket)sock.accept(); 101 | writeln("Client connected: ", client.remoteAddress()); 102 | 103 | // Register event for client. 104 | SocketQueue queue = new SocketQueue(client); 105 | client.event( 106 | SocketEventType.READ | SocketEventType.CLOSE, 107 | (Socket socket, SocketEventType event, int err) { 108 | queue.event(socket, event, err); 109 | 110 | if (event == SocketEventType.READ && queue.receiveBytes > 0) 111 | { 112 | auto msg = cast(string)queue.receive(); 113 | writeln("Received from client: ", msg); 114 | 115 | // Echo 116 | queue.send(msg.dup); 117 | } 118 | else if (event == SocketEventType.CLOSE) 119 | { 120 | writeln("Client disconnected."); 121 | } 122 | } 123 | ); 124 | } 125 | ); 126 | } 127 | -------------------------------------------------------------------------------- /examples/splitter/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | docs/ 5 | /hello_dfl 6 | hello_dfl.so 7 | hello_dfl.dylib 8 | hello_dfl.dll 9 | hello_dfl.a 10 | hello_dfl.lib 11 | hello_dfl-test-* 12 | *.exe 13 | *.pdb 14 | *.o 15 | *.obj 16 | *.lst 17 | -------------------------------------------------------------------------------- /examples/splitter/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "dub", 6 | "run": false, 7 | "cwd": ".", 8 | "compiler": "$current", 9 | "archType": "$current", 10 | "buildType": "$current", 11 | "configuration": "$current", 12 | "problemMatcher": [ 13 | "$dmd" 14 | ], 15 | "group": { 16 | "kind": "build", 17 | "isDefault": true 18 | }, 19 | "label": "dub: Build splitter_sample", 20 | "detail": "dub build --compiler=dmd.EXE -a=x86_64 -b=debug -c=application" 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /examples/splitter/README.md: -------------------------------------------------------------------------------- 1 | # Screen Shot 2 | ![screen shot](./image/screenshot.png "screen shot") 3 | -------------------------------------------------------------------------------- /examples/splitter/dub.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": ["haru-s"], 3 | "copyright": "Copyright (C) 2023 haru-s", 4 | "description": "DFL sample code.", 5 | "name": "splitter_sample", 6 | "targetType": "executable", 7 | "targetPath": "bin", 8 | "dependencies": { 9 | "dfl": { 10 | "path": "../../../dfl" 11 | } 12 | }, 13 | "lflags-windows-x86_mscoff-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"], 14 | "lflags-windows-x86_64-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"] 15 | } -------------------------------------------------------------------------------- /examples/splitter/image/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/splitter/image/screenshot.png -------------------------------------------------------------------------------- /examples/splitter/shell.bat: -------------------------------------------------------------------------------- 1 | set dmd_path=c:\d\dmd2\windows 2 | set dmc_path=c:\dmc\dm 3 | cmd 4 | -------------------------------------------------------------------------------- /examples/splitter/source/splitter_sample.d: -------------------------------------------------------------------------------- 1 | import dfl; 2 | 3 | version(Have_dfl) // For DUB. 4 | { 5 | } 6 | else 7 | { 8 | pragma(lib, "dfl.lib"); 9 | } 10 | 11 | class MainForm : Form 12 | { 13 | private Splitter _splitter1; 14 | private Splitter _splitter2; 15 | private Panel _panel1; 16 | private Panel _panel2; 17 | private Panel _panel3; 18 | 19 | this() 20 | { 21 | this.text = "Splitter example"; 22 | this.size = Size(300, 300); 23 | 24 | _panel1 = new Panel(); 25 | _panel1.dock = DockStyle.LEFT; 26 | _panel1.width = 100; 27 | _panel1.borderStyle = BorderStyle.FIXED_3D; 28 | _panel1.backColor = Color(255, 255, 255); 29 | _panel1.resize ~= (Control c, EventArgs e) { 30 | if (_panel1.width > 250) 31 | { 32 | _panel1.width = 250; 33 | } 34 | }; 35 | _panel1.paint ~= (Control c, PaintEventArgs e) { 36 | Graphics g = e.graphics; 37 | string str = "min=25(default)\nmax=250"; 38 | Font font = new Font("Meiryo UI", 10f); 39 | Color color = Color(0, 0, 0); 40 | Size size = g.measureText(str, font); 41 | g.drawText(str, font, color, Rect(0, 0, size.width, size.height)); 42 | }; 43 | _panel1.parent = this; 44 | 45 | _splitter1 = new Splitter(); 46 | _splitter1.parent = this; 47 | 48 | _panel2 = new Panel(); 49 | _panel2.dock = DockStyle.TOP; 50 | _panel2.height = 100; 51 | _panel2.borderStyle = BorderStyle.FIXED_3D; 52 | _panel2.backColor = Color(255, 255, 255); 53 | _panel2.resize ~= (Control c, EventArgs e) { 54 | if (_panel2.height > 120) 55 | { 56 | _panel2.height = 120; 57 | } 58 | }; 59 | _panel2.paint ~= (Control c, PaintEventArgs e) { 60 | Graphics g = e.graphics; 61 | string str = "min=25(default)\nmax=120"; 62 | Font font = new Font("Meiryo UI", 10f); 63 | Color color = Color(0, 0, 0); 64 | Size size = g.measureText(str, font); 65 | g.drawText(str, font, color, Rect(0, 0, size.width, size.height)); 66 | }; 67 | _panel2.parent = this; 68 | 69 | _splitter2 = new Splitter(); 70 | _splitter2.dock = DockStyle.TOP; 71 | _splitter2.parent = this; 72 | 73 | _panel3 = new Panel(); 74 | _panel3.dock = DockStyle.FILL; 75 | _panel3.borderStyle = BorderStyle.FIXED_3D; 76 | _panel3.backColor = Color(255, 255, 255); 77 | _panel3.parent = this; 78 | } 79 | } 80 | 81 | static this() 82 | { 83 | Application.enableVisualStyles(); 84 | } 85 | 86 | void main() 87 | { 88 | Application.run(new MainForm()); 89 | } 90 | -------------------------------------------------------------------------------- /examples/splitter/splitter.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": { 8 | "d.projectImportPaths": [ 9 | "..\\..\\..\\dfl\\source" 10 | ] 11 | } 12 | } -------------------------------------------------------------------------------- /examples/statusbar/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | docs/ 5 | /hello_dfl 6 | hello_dfl.so 7 | hello_dfl.dylib 8 | hello_dfl.dll 9 | hello_dfl.a 10 | hello_dfl.lib 11 | hello_dfl-test-* 12 | *.exe 13 | *.pdb 14 | *.o 15 | *.obj 16 | *.lst 17 | -------------------------------------------------------------------------------- /examples/statusbar/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "dub", 6 | "run": true, 7 | "cwd": ".", 8 | "compiler": "$current", 9 | "archType": "$current", 10 | "buildType": "$current", 11 | "configuration": "$current", 12 | "problemMatcher": [ 13 | "$dmd" 14 | ], 15 | "group": { 16 | "kind": "build", 17 | "isDefault": true 18 | }, 19 | "label": "dub: Build statusbar_sample", 20 | "detail": "dub build --compiler=dmd.EXE -a=x86_64 -b=debug -c=application" 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /examples/statusbar/README.md: -------------------------------------------------------------------------------- 1 | # Screen Shot 2 | ![screen shot](./image/screenshot.png "screen shot") 3 | -------------------------------------------------------------------------------- /examples/statusbar/dub.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": ["haru-s"], 3 | "copyright": "Copyright (C) 2023 haru-s", 4 | "description": "DFL sample code.", 5 | "name": "statusbar_sample", 6 | "targetType": "executable", 7 | "targetPath": "bin", 8 | "dependencies": { 9 | "dfl": { 10 | "path": "../../../dfl" 11 | } 12 | }, 13 | "lflags-windows-x86_mscoff-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"], 14 | "lflags-windows-x86_64-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"] 15 | } -------------------------------------------------------------------------------- /examples/statusbar/image/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/statusbar/image/screenshot.png -------------------------------------------------------------------------------- /examples/statusbar/shell.bat: -------------------------------------------------------------------------------- 1 | set dmd_path=c:\d\dmd2\windows 2 | set dmc_path=c:\dmc\dm 3 | cmd 4 | -------------------------------------------------------------------------------- /examples/statusbar/source/statusbar_sample.d: -------------------------------------------------------------------------------- 1 | import dfl; 2 | import std.conv; 3 | 4 | version(Have_dfl) // For DUB. 5 | { 6 | } 7 | else 8 | { 9 | pragma(lib, "dfl.lib"); 10 | } 11 | 12 | class MainForm : Form 13 | { 14 | private StatusBar _statusBar; 15 | 16 | this() 17 | { 18 | this.text = "StatusBar example"; 19 | this.size = Size(300, 300); 20 | 21 | _statusBar = new StatusBar(); 22 | 23 | StatusBarPanel panel1 = new StatusBarPanel("Click count:"); 24 | StatusBarPanel panel2 = new StatusBarPanel("Second panel"); 25 | StatusBarPanel panel3 = new StatusBarPanel("Third panel"); 26 | 27 | panel1.borderStyle = StatusBarPanelBorderStyle.SUNKEN; 28 | panel2.borderStyle = StatusBarPanelBorderStyle.RAISED; 29 | panel3.borderStyle = StatusBarPanelBorderStyle.NONE; 30 | 31 | panel1.width = 100; 32 | 33 | _statusBar.panels.add(panel1); 34 | _statusBar.panels.add(panel2); 35 | _statusBar.panels.add(panel3); 36 | 37 | _statusBar.showPanels = true; 38 | _statusBar.parent = this; 39 | 40 | this.click ~= (Control c, EventArgs e) { 41 | static int counter; 42 | panel1.text = "Click count: " ~ to!string(++counter); 43 | }; 44 | } 45 | } 46 | 47 | void main() 48 | { 49 | Application.run(new MainForm()); 50 | } 51 | -------------------------------------------------------------------------------- /examples/statusbar/statusbar.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": { 8 | "d.projectImportPaths": [ 9 | "..\\..\\..\\dfl\\source" 10 | ] 11 | } 12 | } -------------------------------------------------------------------------------- /examples/tabcontrol/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | docs/ 5 | /hello_dfl 6 | hello_dfl.so 7 | hello_dfl.dylib 8 | hello_dfl.dll 9 | hello_dfl.a 10 | hello_dfl.lib 11 | hello_dfl-test-* 12 | *.exe 13 | *.pdb 14 | *.o 15 | *.obj 16 | *.lst 17 | -------------------------------------------------------------------------------- /examples/tabcontrol/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "dub", 6 | "run": false, 7 | "cwd": ".", 8 | "compiler": "$current", 9 | "archType": "$current", 10 | "buildType": "$current", 11 | "configuration": "$current", 12 | "problemMatcher": [ 13 | "$dmd" 14 | ], 15 | "group": { 16 | "kind": "build", 17 | "isDefault": true 18 | }, 19 | "label": "dub: Build tabcontrol_sample", 20 | "detail": "dub build --compiler=dmd.EXE -a=x86_64 -b=debug -c=application" 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /examples/tabcontrol/README.md: -------------------------------------------------------------------------------- 1 | # Screen Shot 2 | ![screen shot](./image/screenshot.png "screen shot") 3 | -------------------------------------------------------------------------------- /examples/tabcontrol/dub.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": ["haru-s"], 3 | "copyright": "Copyright (C) 2023 haru-s", 4 | "description": "DFL sample code.", 5 | "name": "tabcontrol_sample", 6 | "targetType": "executable", 7 | "targetPath": "bin", 8 | "dependencies": { 9 | "dfl": { 10 | "path": "../../../dfl" 11 | } 12 | }, 13 | "lflags-windows-x86_mscoff-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"], 14 | "lflags-windows-x86_64-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"] 15 | } -------------------------------------------------------------------------------- /examples/tabcontrol/image/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/tabcontrol/image/screenshot.png -------------------------------------------------------------------------------- /examples/tabcontrol/shell.bat: -------------------------------------------------------------------------------- 1 | set dmd_path=c:\d\dmd2\windows 2 | set dmc_path=c:\dmc\dm 3 | cmd 4 | -------------------------------------------------------------------------------- /examples/tabcontrol/source/trackbar_sample.d: -------------------------------------------------------------------------------- 1 | import dfl; 2 | 3 | version(Have_dfl) // For DUB. 4 | { 5 | } 6 | else 7 | { 8 | pragma(lib, "dfl.lib"); 9 | } 10 | 11 | class MainForm : Form 12 | { 13 | private TabControl _tab; 14 | private Label _label1; 15 | private Label _label2; 16 | private Button _button1; 17 | private Button _button2; 18 | 19 | this() 20 | { 21 | this.text = "TabControl example"; 22 | this.size = Size(300, 300); 23 | this.formBorderStyle = FormBorderStyle.FIXED_DIALOG; 24 | this.maximizeBox = false; 25 | 26 | _tab = new TabControl(); 27 | _tab.dock = DockStyle.FILL; 28 | _tab.parent = this; 29 | 30 | // First tab 31 | TabPage _page1 = new TabPage("tab1"); 32 | _tab.tabPages.add(_page1); 33 | 34 | _label1 = new Label(); 35 | _label1.text = "First tab"; 36 | _label1.parent = _page1; 37 | 38 | _button1 = new Button; 39 | _button1.text = "Show message box"; 40 | _button1.size = Size(200, 60); 41 | _button1.location = Point(20, 50); 42 | _button1.click ~= (Control c, EventArgs e) { 43 | msgBox("Hello."); 44 | }; 45 | _button1.parent = _page1; 46 | 47 | // Second tab 48 | TabPage _page2 = new TabPage("tab2"); 49 | _tab.tabPages.add(_page2); 50 | 51 | _label2 = new Label(); 52 | _label2.text = "Second tab"; 53 | _label2.parent = _page2; 54 | 55 | _button2 = new Button; 56 | _button2.text = "Close application"; 57 | _button2.size = Size(200, 60); 58 | _button2.location = Point(20, 50); 59 | _button2.click ~= (Control c, EventArgs e) { 60 | Application.exit(); 61 | }; 62 | _button2.parent = _page2; 63 | } 64 | } 65 | 66 | static this() 67 | { 68 | Application.enableVisualStyles(); 69 | } 70 | 71 | void main() 72 | { 73 | Application.run(new MainForm()); 74 | } 75 | -------------------------------------------------------------------------------- /examples/tabcontrol/tabcontrol.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": { 8 | "d.projectImportPaths": [ 9 | "..\\..\\..\\dfl\\source" 10 | ] 11 | } 12 | } -------------------------------------------------------------------------------- /examples/tablerenderer/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | docs/ 5 | /hello_dfl 6 | hello_dfl.so 7 | hello_dfl.dylib 8 | hello_dfl.dll 9 | hello_dfl.a 10 | hello_dfl.lib 11 | hello_dfl-test-* 12 | *.exe 13 | *.pdb 14 | *.o 15 | *.obj 16 | *.lst 17 | -------------------------------------------------------------------------------- /examples/tablerenderer/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "C++ Launch (Windows) tablerenderer", 6 | "type": "cppvsdbg", 7 | "request": "launch", 8 | "cwd": "${workspaceRoot}", 9 | "program": "./bin/tablerenderer.exe", 10 | "console": "internalConsole" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /examples/tablerenderer/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "dub", 6 | "run": false, 7 | "cwd": ".", 8 | "compiler": "$current", 9 | "archType": "$current", 10 | "buildType": "$current", 11 | "configuration": "$current", 12 | "problemMatcher": [ 13 | "$dmd" 14 | ], 15 | "group": { 16 | "kind": "build", 17 | "isDefault": true 18 | }, 19 | "label": "dub: Build tablerenderer_sample", 20 | "detail": "dub build --compiler=dmd.EXE -a=x86_64 -b=debug -c=application" 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /examples/tablerenderer/README.md: -------------------------------------------------------------------------------- 1 | # Screen Shot 2 | ![screen shot](./image/screenshot.png "screen shot") 3 | -------------------------------------------------------------------------------- /examples/tablerenderer/dub.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": ["haru-s"], 3 | "copyright": "Copyright (C) 2024 haru-s", 4 | "description": "DFL sample code.", 5 | "name": "tablerenderer", 6 | "targetType": "executable", 7 | "targetPath": "bin", 8 | "dependencies": { 9 | "dfl": { 10 | "path": "../../../dfl" 11 | } 12 | }, 13 | "lflags-windows-x86_mscoff-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"], 14 | "lflags-windows-x86_64-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"] 15 | } -------------------------------------------------------------------------------- /examples/tablerenderer/image/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/tablerenderer/image/screenshot.png -------------------------------------------------------------------------------- /examples/tablerenderer/shell.bat: -------------------------------------------------------------------------------- 1 | set dmd_path=c:\d\dmd2\windows 2 | set dmc_path=c:\dmc\dm 3 | cmd 4 | -------------------------------------------------------------------------------- /examples/tablerenderer/source/tablerenderer_sample.d: -------------------------------------------------------------------------------- 1 | import dfl; 2 | 3 | version(Have_dfl) // For DUB. 4 | { 5 | } 6 | else 7 | { 8 | pragma(lib, "dfl.lib"); 9 | } 10 | 11 | class MainForm : Form 12 | { 13 | alias CustomTableRenderer = TableRenderer!(string, int, int); 14 | CustomTableRenderer _table; 15 | 16 | public this() 17 | { 18 | this.text = "TableRenderer example"; 19 | this.size = Size(450, 450); 20 | string csv = 21 | "教科,大森,山田\n" ~ 22 | "国語,95,98\n" ~ 23 | "理科,75,80\n" ~ 24 | "算数,90,78\n" ~ 25 | "社会,80,76\n"; 26 | _table = new CustomTableRenderer(csv); 27 | _table.height = 40; 28 | _table.width[] = 80; 29 | _table.paddingX = 10; 30 | _table.paddingY = 12; 31 | _table.location = Point(20, 20); 32 | _table.hasHeader = true; // true : 1st line is header. 33 | _table.showHeader = true; 34 | _table.firstRecord = 0; 35 | _table.lastRecord = 3; 36 | _table.textColor = Color.black; 37 | _table.backColor = Color.white; 38 | _table.lineColor = Color.lightGray; 39 | _table.headerLine = true; 40 | _table.topSideLine = true; 41 | _table.leftSideLine = true; 42 | _table.bottomSideLine = true; 43 | _table.rightSideLine = true; 44 | _table.verticalLine = true; 45 | _table.horizontalLine = true; 46 | _table.headerFont = new Font("MS Gothic", 16f, FontStyle.BOLD); 47 | _table.recordFont = new Font("MS Gothic", 12f, FontStyle.REGULAR); 48 | } 49 | 50 | protected override void onPaint(PaintEventArgs e) 51 | { 52 | if (_table) 53 | _table.draw(e.graphics); 54 | } 55 | } 56 | 57 | static this() 58 | { 59 | Application.enableVisualStyles(); 60 | } 61 | 62 | void main() 63 | { 64 | Application.run(new MainForm()); 65 | } 66 | -------------------------------------------------------------------------------- /examples/tablerenderer/tablerenderer.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": { 8 | "d.projectImportPaths": [ 9 | "..\\..\\..\\dfl\\source" 10 | ] 11 | } 12 | } -------------------------------------------------------------------------------- /examples/textbox/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | docs/ 5 | /hello_dfl 6 | hello_dfl.so 7 | hello_dfl.dylib 8 | hello_dfl.dll 9 | hello_dfl.a 10 | hello_dfl.lib 11 | hello_dfl-test-* 12 | *.exe 13 | *.pdb 14 | *.o 15 | *.obj 16 | *.lst 17 | -------------------------------------------------------------------------------- /examples/textbox/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "C++ Launch (Windows) textbox", 6 | "type": "cppvsdbg", 7 | "request": "launch", 8 | "cwd": "${workspaceRoot}", 9 | "program": "./bin/textbox_sample.exe", 10 | "console": "internalConsole" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /examples/textbox/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "dub", 6 | "run": false, 7 | "cwd": ".", 8 | "compiler": "$current", 9 | "archType": "$current", 10 | "buildType": "$current", 11 | "configuration": "$current", 12 | "problemMatcher": [ 13 | "$dmd" 14 | ], 15 | "group": { 16 | "kind": "build", 17 | "isDefault": true 18 | }, 19 | "label": "dub: Build textbox_sample", 20 | "detail": "dub build --compiler=dmd.EXE -a=x86_64 -b=debug -c=application" 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /examples/textbox/README.md: -------------------------------------------------------------------------------- 1 | # Screen Shot 2 | ![screen shot](./image/screenshot.png "screen shot") 3 | -------------------------------------------------------------------------------- /examples/textbox/dub.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": ["haru-s"], 3 | "copyright": "Copyright (C) 2022 haru-s", 4 | "description": "DFL sample code.", 5 | "name": "textbox_sample", 6 | "targetType": "executable", 7 | "targetPath": "bin", 8 | "dependencies": { 9 | "dfl": { 10 | "path": "../../../dfl" 11 | } 12 | }, 13 | "lflags-windows-x86_mscoff-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"], 14 | "lflags-windows-x86_64-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"] 15 | } -------------------------------------------------------------------------------- /examples/textbox/image/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/textbox/image/screenshot.png -------------------------------------------------------------------------------- /examples/textbox/shell.bat: -------------------------------------------------------------------------------- 1 | set dmd_path=c:\d\dmd2\windows 2 | set dmc_path=c:\dmc\dm 3 | cmd 4 | -------------------------------------------------------------------------------- /examples/textbox/source/textbox_sample.d: -------------------------------------------------------------------------------- 1 | import dfl; 2 | 3 | version(Have_dfl) // For DUB. 4 | { 5 | } 6 | else 7 | { 8 | pragma(lib, "dfl.lib"); 9 | } 10 | 11 | class MainForm : Form 12 | { 13 | private TextBox _textbox1; 14 | private TextBox _textbox2; 15 | private TextBox _textbox3; 16 | private TextBox _textbox4; 17 | private TextBox _textbox5; 18 | private Button _button1; 19 | private Button _button2; 20 | 21 | this() 22 | { 23 | // Form setting 24 | text = "TextBox sample"; 25 | size = Size(500,400); 26 | resizeRedraw = true; 27 | 28 | // Button setting (Default button) 29 | _button1 = new Button(); 30 | _button1.location = Point(10,10); 31 | _button1.text = "OK"; 32 | _button1.click ~= (Control c, EventArgs e) 33 | { 34 | this.text = this.text ~ "+"; 35 | }; 36 | _button1.parent = this; 37 | 38 | // Button setting (Default button's enable/disable is switched). 39 | _button2 = new Button(); 40 | _button2.location = Point(100,10); 41 | _button2.text = "On/Off"; 42 | _button2.click ~= (Control c, EventArgs e) 43 | { 44 | if(acceptButton) 45 | { 46 | acceptButton = null; // Default button is now none. 47 | _button1.notifyDefault(false); 48 | _textbox1.text = "Now Off"; 49 | } 50 | else 51 | { 52 | acceptButton = _button1; // Set default button. 53 | _button1.notifyDefault(true); 54 | _textbox1.text = "Now On"; 55 | } 56 | }; 57 | _button2.parent = this; 58 | 59 | // TextBox setting (Single line) 60 | _textbox1 = new TextBox(); 61 | _textbox1.location = Point(200,10); 62 | _textbox1.size = Size(100,30); 63 | _textbox1.multiline = false; // false: One line textbox. 64 | _textbox1.scrollBars = ScrollBars.NONE; // NONE: Without scroll bar. 65 | _textbox1.acceptsReturn = false; // false: Disables RETURN key. 66 | _textbox1.acceptsTab = false; // false: Disables TAB key. 67 | // true: Enables TAB key. But be changed focus only 68 | // because one line textbox is not able to input TAB char. 69 | _textbox1.wordWrap = false; // false: Do not send words that span the right edge to the next line. 70 | _button1.notifyDefault(false); // false: Do not set as default button 71 | _textbox1.text = "Default Off"; 72 | _textbox1.parent = this; 73 | 74 | // TextBox setting (return:yes, tab:yes) 75 | _textbox2 = new TextBox(); 76 | _textbox2.location = Point(10,60); 77 | _textbox2.size = Size(450,50); 78 | _textbox2.multiline = true; // true: Multi line textbox. 79 | _textbox2.scrollBars = ScrollBars.VERTICAL; // VERTICAL: within vertical scroll bar. 80 | _textbox2.acceptsReturn = true; // true: Enables RETURN key. 81 | _textbox2.acceptsTab = true; // true: Enables TAB key. 82 | _textbox2.wordWrap = true; // true: Send words that span the right edge to the next line. 83 | _textbox2.text = "return:yes, tab:yes"; 84 | _textbox2.parent = this; 85 | 86 | // TextBox setting (return:yes, tab:no) 87 | _textbox3 = new TextBox(); 88 | _textbox3.location = Point(10,130); 89 | _textbox3.size = Size(450,50); 90 | _textbox3.multiline = true; // false: One line textbox. 91 | _textbox3.scrollBars = ScrollBars.VERTICAL; // VERTICAL: within vertical scroll bar. 92 | _textbox3.acceptsReturn = true; // true: Enables RETURN key. 93 | _textbox3.acceptsTab = false; // false: Disables TAB key. 94 | _textbox3.wordWrap = true; // true: Send words that span the right edge to the next line. 95 | _textbox3.text = "return:yes, tab:no"; 96 | _textbox3.parent = this; 97 | 98 | // TextBox setting (return:no, tab:yes) 99 | _textbox4 = new TextBox(); 100 | _textbox4.location = Point(10,190); 101 | _textbox4.size = Size(450,50); 102 | _textbox4.multiline = true; // true: Multi line textbox. 103 | _textbox4.scrollBars = ScrollBars.VERTICAL; // VERTICAL: within vertical scroll bar. 104 | _textbox4.acceptsReturn = false; // false: Disables RETURN key. 105 | _textbox4.acceptsTab = true; // true: Enables TAB key. 106 | _textbox4.wordWrap = true; // true: Send words that span the right edge to the next line. 107 | _textbox4.text = "return:no, tab:yes"; 108 | _textbox4.parent = this; 109 | 110 | // TextBox setting (return:no, tab:no) 111 | _textbox5 = new TextBox(); 112 | _textbox5.location = Point(10,250); 113 | _textbox5.size = Size(450,50); 114 | _textbox5.multiline = true; // true: Multi line textbox. 115 | _textbox5.scrollBars = ScrollBars.VERTICAL; // VERTICAL: within vertical scroll bar. 116 | _textbox5.acceptsReturn = false; // false: Disables RETURN key. 117 | _textbox5.acceptsTab = false; // false: Disables TAB key. 118 | _textbox5.wordWrap = true; // true: Send words that span the right edge to the next line. 119 | _textbox5.text = "return:no, tab:no"; 120 | _textbox5.parent = this; 121 | } 122 | } 123 | 124 | static this() 125 | { 126 | Application.enableVisualStyles(); 127 | } 128 | 129 | void main() 130 | { 131 | Application.run(new MainForm()); 132 | } 133 | -------------------------------------------------------------------------------- /examples/textbox/textbox.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": { 8 | "d.projectImportPaths": [ 9 | "..\\..\\..\\dfl\\source" 10 | ] 11 | } 12 | } -------------------------------------------------------------------------------- /examples/timechartrenderer/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | docs/ 5 | /hello_dfl 6 | hello_dfl.so 7 | hello_dfl.dylib 8 | hello_dfl.dll 9 | hello_dfl.a 10 | hello_dfl.lib 11 | hello_dfl-test-* 12 | *.exe 13 | *.pdb 14 | *.o 15 | *.obj 16 | *.lst 17 | -------------------------------------------------------------------------------- /examples/timechartrenderer/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "C++ Launch (Windows) timechartrenderer", 6 | "type": "cppvsdbg", 7 | "request": "launch", 8 | "cwd": "${workspaceRoot}", 9 | "program": "./bin/timechartrenderer.exe", 10 | "console": "internalConsole" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /examples/timechartrenderer/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "dub", 6 | "run": false, 7 | "cwd": ".", 8 | "compiler": "$current", 9 | "archType": "$current", 10 | "buildType": "$current", 11 | "configuration": "$current", 12 | "problemMatcher": [ 13 | "$dmd" 14 | ], 15 | "group": { 16 | "kind": "build", 17 | "isDefault": true 18 | }, 19 | "label": "dub: Build timechartrenderer_sample", 20 | "detail": "dub build --compiler=dmd.EXE -a=x86_64 -b=debug -c=application" 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /examples/timechartrenderer/README.md: -------------------------------------------------------------------------------- 1 | # Screen Shot 2 | ![screen shot](./image/screenshot.png "screen shot") 3 | -------------------------------------------------------------------------------- /examples/timechartrenderer/dub.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": ["haru-s"], 3 | "copyright": "Copyright (C) 2024 haru-s", 4 | "description": "DFL sample code.", 5 | "name": "timechartrenderer", 6 | "targetType": "executable", 7 | "targetPath": "bin", 8 | "dependencies": { 9 | "dfl": { 10 | "path": "../../../dfl" 11 | } 12 | }, 13 | "lflags-windows-x86_mscoff-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"], 14 | "lflags-windows-x86_64-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"] 15 | } -------------------------------------------------------------------------------- /examples/timechartrenderer/image/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/timechartrenderer/image/screenshot.png -------------------------------------------------------------------------------- /examples/timechartrenderer/shell.bat: -------------------------------------------------------------------------------- 1 | set dmd_path=c:\d\dmd2\windows 2 | set dmc_path=c:\dmc\dm 3 | cmd 4 | -------------------------------------------------------------------------------- /examples/timechartrenderer/source/timechartrenderer_sample.d: -------------------------------------------------------------------------------- 1 | import dfl; 2 | 3 | version(Have_dfl) // For DUB. 4 | { 5 | } 6 | else 7 | { 8 | pragma(lib, "dfl.lib"); 9 | } 10 | 11 | class MainForm : Form 12 | { 13 | alias CustomTimeChartRenderer = TimeChartRenderer!(int,int,int,int,int,int,int,int,int); 14 | CustomTimeChartRenderer _graph; 15 | 16 | alias CustomTableRenderer = TableRenderer!(int,int,int,int,int,int,int,int,int); 17 | CustomTableRenderer _table; 18 | 19 | public this() 20 | { 21 | this.text = "TimeChartRenderer example"; 22 | this.size = Size(600, 650); 23 | 24 | string csv = 25 | "Time (ms),D1,D2,D3,D4,A1,A2,A3,A4\n" ~ 26 | "0,0,0,0,0,0,0,0,0\n" ~ 27 | "100,1,0,0,0,5,2,10,2\n" ~ 28 | "200,0,1,0,0,6,3,10,-3\n" ~ 29 | "300,1,1,1,0,7,4,9,4\n" ~ 30 | "400,0,0,1,1,8,5,9,-5\n" ~ 31 | "500,1,0,1,1,9,2,8,6\n" ~ 32 | "600,0,0,0,1,8,3,8,-7\n" ~ 33 | "700,1,1,0,1,7,4,7,8\n" ~ 34 | "800,0,1,0,0,6,5,7,-9\n" ~ 35 | "900,1,0,1,0,5,2,6,10\n" ~ 36 | "1000,0,0,1,0,4,3,6,-10\n" ~ 37 | "1100,1,1,1,0,3,4,5,9\n" ~ 38 | "1200,0,1,0,1,2,5,5,-9\n" ~ 39 | "1300,1,0,0,1,1,2,4,8\n" ~ 40 | "1400,0,0,0,1,0,3,4,-8\n"; 41 | _graph = new CustomTimeChartRenderer(csv, 15); 42 | _graph.location = Point(50, 50); 43 | _graph.chartMargins = ChartMargins(50, 50, 50, 50); 44 | _graph.seriesStyleList[0..4] = TimeChartSeriesStyle(true, Color.blue, 20); // Digital 45 | _graph.seriesStyleList[4..7] = TimeChartSeriesStyle(false, Color.red, 50, 0, 10); // Analog 46 | _graph.seriesStyleList[7] = TimeChartSeriesStyle(false, Color.red, 100, -10, 20,); // Analog 47 | _graph.plotAreaTopPadding = 20; 48 | _graph.plotAreaBottomPadding = 20; 49 | _graph.plotAreaLeftPadding = 20; 50 | _graph.plotAreaRightPadding = 20; 51 | _graph.plotAreaBoundsColor = Color.black; 52 | _graph.plotAreaAndHorizontalScaleSpanY = 10; 53 | _graph.hasHorizontalScale = true; 54 | _graph.horizontalScaleSpan = 20; 55 | _graph.horizontalScaleStep = 2; 56 | _graph.horizontalScaleLineInnerSide = 5; 57 | _graph.horizontalScaleLineOuterSide = 5; 58 | _graph.horizontalScaleHeight = 20; 59 | _graph.hasVerticalScale = true; 60 | _graph.verticalScaleWidth = 40; 61 | _graph.hasZeroLine = true; 62 | _graph.backColor = Color.white; 63 | 64 | _table = new CustomTableRenderer(csv, 15); 65 | _table.location = Point(600, 50); 66 | _table.hasHeader = true; 67 | _table.showHeader = true; 68 | _table.headerLine = true; 69 | _table.width[] = 50; 70 | } 71 | 72 | protected override void onPaint(PaintEventArgs e) 73 | { 74 | if (_graph) 75 | _graph.draw(e.graphics); 76 | if (_table) 77 | _table.draw(e.graphics); 78 | } 79 | } 80 | 81 | static this() 82 | { 83 | Application.enableVisualStyles(); 84 | } 85 | 86 | void main() 87 | { 88 | Application.run(new MainForm()); 89 | } 90 | -------------------------------------------------------------------------------- /examples/timechartrenderer/timechartrenderer.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": { 8 | "d.projectImportPaths": [ 9 | "..\\..\\..\\dfl\\source" 10 | ] 11 | } 12 | } -------------------------------------------------------------------------------- /examples/timer/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | docs/ 5 | /hello_dfl 6 | hello_dfl.so 7 | hello_dfl.dylib 8 | hello_dfl.dll 9 | hello_dfl.a 10 | hello_dfl.lib 11 | hello_dfl-test-* 12 | *.exe 13 | *.pdb 14 | *.o 15 | *.obj 16 | *.lst 17 | -------------------------------------------------------------------------------- /examples/timer/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "C++ Launch (Windows) timer", 6 | "type": "cppvsdbg", 7 | "request": "launch", 8 | "cwd": "${workspaceRoot}", 9 | "program": "./bin/timer_sample.exe", 10 | "console": "internalConsole" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /examples/timer/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "dub", 6 | "run": false, 7 | "cwd": ".", 8 | "compiler": "$current", 9 | "archType": "$current", 10 | "buildType": "$current", 11 | "configuration": "$current", 12 | "problemMatcher": [ 13 | "$dmd" 14 | ], 15 | "group": { 16 | "kind": "build", 17 | "isDefault": true 18 | }, 19 | "label": "dub: Build timer_sample", 20 | "detail": "dub build --compiler=dmd.EXE -a=x86_64 -b=debug -c=application" 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /examples/timer/README.md: -------------------------------------------------------------------------------- 1 | # Screen Shot 2 | ![screen shot](./image/screenshot.png "screen shot") 3 | -------------------------------------------------------------------------------- /examples/timer/dub.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": ["haru-s"], 3 | "copyright": "Copyright (C) 2023 haru-s", 4 | "description": "DFL sample code.", 5 | "name": "timer_sample", 6 | "targetType": "executable", 7 | "targetPath": "bin", 8 | "dependencies": { 9 | "dfl": { 10 | "path": "../../../dfl" 11 | } 12 | }, 13 | "lflags-windows-x86_mscoff-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"], 14 | "lflags-windows-x86_64-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"] 15 | } -------------------------------------------------------------------------------- /examples/timer/image/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/timer/image/screenshot.png -------------------------------------------------------------------------------- /examples/timer/shell.bat: -------------------------------------------------------------------------------- 1 | set dmd_path=c:\d\dmd2\windows 2 | set dmc_path=c:\dmc\dm 3 | cmd 4 | -------------------------------------------------------------------------------- /examples/timer/source/timer_sample.d: -------------------------------------------------------------------------------- 1 | import dfl; 2 | import std.conv; 3 | 4 | version(Have_dfl) // For DUB. 5 | { 6 | } 7 | else 8 | { 9 | pragma(lib, "dfl.lib"); 10 | } 11 | 12 | class MainForm : Form 13 | { 14 | private Label _label; 15 | private Timer _timer; 16 | private Button _start; 17 | private Button _stop; 18 | private uint _count; 19 | 20 | public this() 21 | { 22 | this.text = "Timer example"; 23 | this.size = Size(300, 200); 24 | 25 | _label = new Label; 26 | _label.location = Point(100, 0); 27 | _label.font = new Font("Verdana", 50f); 28 | _label.autoSize = true; 29 | _label.text = to!string(_count); 30 | _label.parent = this; 31 | 32 | _timer = new Timer; 33 | _timer.interval = 1000; 34 | _timer.tick ~= (Timer t, EventArgs e) { 35 | _label.text = to!string(_count); 36 | _count++; 37 | }; 38 | 39 | _start = new Button; 40 | _start.text = "Start"; 41 | _start.location = Point(10, 10); 42 | _start.click ~= (Control c, EventArgs e) { 43 | _timer.start(); 44 | }; 45 | _start.parent = this; 46 | 47 | _stop = new Button; 48 | _stop.text = "Stop"; 49 | _stop.location = Point(10, 50); 50 | _stop.click ~= (Control c, EventArgs e) { 51 | _timer.stop(); 52 | }; 53 | _stop.parent = this; 54 | } 55 | } 56 | 57 | static this() 58 | { 59 | Application.enableVisualStyles(); 60 | } 61 | 62 | void main() 63 | { 64 | Application.run(new MainForm()); 65 | } 66 | -------------------------------------------------------------------------------- /examples/timer/timer.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": { 8 | "d.projectImportPaths": [ 9 | "..\\..\\..\\dfl\\source" 10 | ] 11 | } 12 | } -------------------------------------------------------------------------------- /examples/toolbar/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | docs/ 5 | /hello_dfl 6 | hello_dfl.so 7 | hello_dfl.dylib 8 | hello_dfl.dll 9 | hello_dfl.a 10 | hello_dfl.lib 11 | hello_dfl-test-* 12 | *.exe 13 | *.pdb 14 | *.o 15 | *.obj 16 | *.lst 17 | -------------------------------------------------------------------------------- /examples/toolbar/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "C++ Launch (Windows) toolbar", 6 | "type": "cppvsdbg", 7 | "request": "launch", 8 | "cwd": "${workspaceRoot}", 9 | "program": "./bin/toolbar_sample.exe", 10 | "console": "internalConsole" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /examples/toolbar/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "dub", 6 | "run": false, 7 | "cwd": ".", 8 | "compiler": "$current", 9 | "archType": "$current", 10 | "buildType": "$current", 11 | "configuration": "$current", 12 | "problemMatcher": [ 13 | "$dmd" 14 | ], 15 | "group": { 16 | "kind": "build", 17 | "isDefault": true 18 | }, 19 | "label": "dub: Build toolbar_sample", 20 | "detail": "dub build --compiler=dmd.EXE -a=x86_64 -b=debug -c=application" 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /examples/toolbar/README.md: -------------------------------------------------------------------------------- 1 | # Screen Shot 2 | ![screen shot](./image/screenshot.png "screen shot") 3 | ![screen shot](./image/screenshot2.png "screen shot") 4 | ![screen shot](./image/screenshot3.png "screen shot") 5 | -------------------------------------------------------------------------------- /examples/toolbar/dub.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": ["haru-s"], 3 | "copyright": "Copyright (C) 2023 haru-s", 4 | "description": "DFL sample code.", 5 | "name": "toolbar_sample", 6 | "targetType": "executable", 7 | "targetPath": "bin", 8 | "dependencies": { 9 | "dfl": { 10 | "path": "../../../dfl" 11 | } 12 | }, 13 | "lflags-windows-x86_mscoff-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"], 14 | "lflags-windows-x86_64-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"] 15 | } -------------------------------------------------------------------------------- /examples/toolbar/image/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/toolbar/image/screenshot.png -------------------------------------------------------------------------------- /examples/toolbar/image/screenshot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/toolbar/image/screenshot2.png -------------------------------------------------------------------------------- /examples/toolbar/image/screenshot3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/toolbar/image/screenshot3.png -------------------------------------------------------------------------------- /examples/toolbar/image/toolbaricon.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/toolbar/image/toolbaricon.bmp -------------------------------------------------------------------------------- /examples/toolbar/shell.bat: -------------------------------------------------------------------------------- 1 | set dmd_path=c:\d\dmd2\windows 2 | set dmc_path=c:\dmc\dm 3 | cmd 4 | -------------------------------------------------------------------------------- /examples/toolbar/toolbar.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": { 8 | "d.projectImportPaths": [ 9 | "..\\..\\..\\dfl\\source" 10 | ] 11 | } 12 | } -------------------------------------------------------------------------------- /examples/tooltip/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | docs/ 5 | /hello_dfl 6 | hello_dfl.so 7 | hello_dfl.dylib 8 | hello_dfl.dll 9 | hello_dfl.a 10 | hello_dfl.lib 11 | hello_dfl-test-* 12 | *.exe 13 | *.pdb 14 | *.o 15 | *.obj 16 | *.lst 17 | -------------------------------------------------------------------------------- /examples/tooltip/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "C++ Launch (Windows) tooltip", 6 | "type": "cppvsdbg", 7 | "request": "launch", 8 | "cwd": "${workspaceRoot}", 9 | "program": "./bin/tooltip_sample.exe", 10 | "console": "internalConsole" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /examples/tooltip/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "dub", 6 | "run": false, 7 | "cwd": ".", 8 | "compiler": "$current", 9 | "archType": "$current", 10 | "buildType": "$current", 11 | "configuration": "$current", 12 | "problemMatcher": [ 13 | "$dmd" 14 | ], 15 | "group": { 16 | "kind": "build", 17 | "isDefault": true 18 | }, 19 | "label": "dub: Build tooltip_sample", 20 | "detail": "dub build --compiler=dmd.EXE -a=x86_64 -b=debug -c=application" 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /examples/tooltip/README.md: -------------------------------------------------------------------------------- 1 | # Screen Shot 2 | ![screen shot](./image/screenshot.png "screen shot") 3 | -------------------------------------------------------------------------------- /examples/tooltip/dub.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": ["haru-s"], 3 | "copyright": "Copyright (C) 2023 haru-s", 4 | "description": "DFL sample code.", 5 | "name": "tooltip_sample", 6 | "targetType": "executable", 7 | "targetPath": "bin", 8 | "dependencies": { 9 | "dfl": { 10 | "path": "../../../dfl" 11 | } 12 | }, 13 | "lflags-windows-x86_mscoff-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"], 14 | "lflags-windows-x86_64-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"] 15 | } -------------------------------------------------------------------------------- /examples/tooltip/image/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/tooltip/image/screenshot.png -------------------------------------------------------------------------------- /examples/tooltip/shell.bat: -------------------------------------------------------------------------------- 1 | set dmd_path=c:\d\dmd2\windows 2 | set dmc_path=c:\dmc\dm 3 | cmd 4 | -------------------------------------------------------------------------------- /examples/tooltip/source/tooltip_sample.d: -------------------------------------------------------------------------------- 1 | import dfl; 2 | 3 | version(Have_dfl) // For DUB. 4 | { 5 | } 6 | else 7 | { 8 | pragma(lib, "dfl.lib"); 9 | } 10 | 11 | class MainForm : Form 12 | { 13 | private ToolTip _tip1; 14 | private ToolTip _tip2; 15 | private ToolTip _tip3; 16 | private Button _button1; 17 | private Button _button2; 18 | private Button _button3; 19 | 20 | public this() 21 | { 22 | this.text = "ToolTip example"; 23 | this.size = Size(350, 300); 24 | 25 | _button1 = new Button(); 26 | _button1.parent = this; 27 | _button1.location = Point(10,10); 28 | _button1.text = "Button 1"; 29 | 30 | _button2 = new Button(); 31 | _button2.parent = this; 32 | _button2.location = Point(10,50); 33 | _button2.text = "Button 2"; 34 | 35 | _button3 = new Button(); 36 | _button3.parent = this; 37 | _button3.location = Point(10,90); 38 | _button3.text = "Button 3"; 39 | 40 | _tip1 = new ToolTip(); 41 | _tip1.initialDelay = 500; 42 | _tip1.reshowDelay = 100; 43 | _tip1.autoPopDelay = 2000; 44 | _tip1.showAlways = true; 45 | _tip1.isBalloon = true; 46 | _tip1.setToolTip(_button1, 47 | "This unofficial project is a migration of D Forms Library (DFL) that is managed on SVN. \n" ~ 48 | "DFL is a Win32 windowing library for the D language."); 49 | 50 | _tip2 = new ToolTip(); 51 | _tip2.showAlways = true; 52 | _tip2.automaticDelay(100); // initialDelay = 100, autoPopDelay = 1000, reshowDelay = 20 53 | _tip2.stripAmpersands = true; // bye (&X) => bye (X) 54 | _tip2.useAnimation = false; 55 | _tip2.useFading = false; 56 | _tip2.setToolTip(_button2, "bye (&X)"); 57 | 58 | _tip3 = new ToolTip(); 59 | _tip3.showAlways = true; 60 | _tip3.isBalloon = true; 61 | _tip3.toolTipIcon = ToolTipIcon.INFO_LARGE; 62 | _tip3.toolTipTitle = "Link"; 63 | _tip3.setToolTip(_button3, "https://github.com/Rayerd/dfl"); 64 | } 65 | } 66 | 67 | static this() 68 | { 69 | Application.enableVisualStyles(); 70 | } 71 | 72 | void main() 73 | { 74 | Application.run(new MainForm()); 75 | } 76 | -------------------------------------------------------------------------------- /examples/tooltip/tooltip.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": { 8 | "d.projectImportPaths": [ 9 | "..\\..\\..\\dfl\\source" 10 | ] 11 | } 12 | } -------------------------------------------------------------------------------- /examples/trackbar/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | docs/ 5 | /hello_dfl 6 | hello_dfl.so 7 | hello_dfl.dylib 8 | hello_dfl.dll 9 | hello_dfl.a 10 | hello_dfl.lib 11 | hello_dfl-test-* 12 | *.exe 13 | *.pdb 14 | *.o 15 | *.obj 16 | *.lst 17 | -------------------------------------------------------------------------------- /examples/trackbar/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "C++ Launch (Windows) trackbar", 6 | "type": "cppvsdbg", 7 | "request": "launch", 8 | "cwd": "${workspaceRoot}", 9 | "program": "./bin/trackbar_sample.exe", 10 | "console": "internalConsole" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /examples/trackbar/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "dub", 6 | "run": false, 7 | "cwd": ".", 8 | "compiler": "$current", 9 | "archType": "$current", 10 | "buildType": "$current", 11 | "configuration": "$current", 12 | "problemMatcher": [ 13 | "$dmd" 14 | ], 15 | "group": { 16 | "kind": "build", 17 | "isDefault": true 18 | }, 19 | "label": "dub: Build trackbar_sample", 20 | "detail": "dub build --compiler=dmd.EXE -a=x86_64 -b=debug -c=application" 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /examples/trackbar/README.md: -------------------------------------------------------------------------------- 1 | # Screen Shot 2 | ![screen shot](./image/screenshot.png "screen shot") 3 | -------------------------------------------------------------------------------- /examples/trackbar/dub.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": ["haru-s"], 3 | "copyright": "Copyright (C) 2022 haru-s", 4 | "description": "DFL sample code.", 5 | "name": "trackbar_sample", 6 | "targetType": "executable", 7 | "targetPath": "bin", 8 | "dependencies": { 9 | "dfl": { 10 | "path": "../../../dfl" 11 | } 12 | }, 13 | "lflags-windows-x86_mscoff-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"], 14 | "lflags-windows-x86_64-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"] 15 | } -------------------------------------------------------------------------------- /examples/trackbar/image/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/examples/trackbar/image/screenshot.png -------------------------------------------------------------------------------- /examples/trackbar/shell.bat: -------------------------------------------------------------------------------- 1 | set dmd_path=c:\d\dmd2\windows 2 | set dmc_path=c:\dmc\dm 3 | cmd 4 | -------------------------------------------------------------------------------- /examples/trackbar/source/trackbar_sample.d: -------------------------------------------------------------------------------- 1 | import dfl; 2 | 3 | import std.conv; 4 | 5 | version(Have_dfl) // For DUB. 6 | { 7 | } 8 | else 9 | { 10 | pragma(lib, "dfl.lib"); 11 | } 12 | 13 | class MainForm : Form 14 | { 15 | private Button _button1; 16 | private Button _button2; 17 | private TrackBar _trackbar1; 18 | private TrackBar _trackbar2; 19 | 20 | private enum TRACKBAR_INITIAL_POSITION = 5; 21 | private enum TRACKBAR_LONG_SIDE = 200; 22 | private enum TRACKBAR_SHORT_SIDE = 50; 23 | 24 | this() 25 | { 26 | // Form setting 27 | text = "TrackBar sample"; 28 | size = Size(500,400); 29 | resizeRedraw = true; 30 | 31 | // Button setting 1 32 | _button1 = new Button(); 33 | _button1.location = Point(10,10); 34 | _button1.text = "Reset"; 35 | _button1.click ~= (Control c, EventArgs ea) 36 | { 37 | // Initialize TrackBar position 38 | _trackbar1.value = TRACKBAR_INITIAL_POSITION; 39 | _trackbar2.value = TRACKBAR_INITIAL_POSITION; 40 | 41 | // Even if TrackBar position is the outside of range, it is safe. 42 | // _trackbar1.setRange(10, 20); 43 | // _trackbar2.setRange(90, 100); 44 | }; 45 | _button1.parent = this; 46 | 47 | // Button setting 2 48 | _button2 = new Button(); 49 | _button2.location = Point(100,10); 50 | _button2.text = "Rotate"; 51 | _button2.click ~= (Control c, EventArgs ea) 52 | { 53 | // Switch orientation of two TrackBars 54 | static bool sw = true; 55 | if (sw) 56 | { 57 | _trackbar1.orientation = Orientation.VERTICAL; 58 | _trackbar2.orientation = Orientation.HORIZONTAL; 59 | _trackbar1.size = Size(TRACKBAR_SHORT_SIDE, TRACKBAR_LONG_SIDE); 60 | _trackbar2.size = Size(TRACKBAR_LONG_SIDE, TRACKBAR_SHORT_SIDE); 61 | } 62 | else 63 | { 64 | _trackbar1.orientation = Orientation.HORIZONTAL; 65 | _trackbar2.orientation = Orientation.VERTICAL; 66 | _trackbar1.size = Size(TRACKBAR_LONG_SIDE, TRACKBAR_SHORT_SIDE); 67 | _trackbar2.size = Size(TRACKBAR_SHORT_SIDE, TRACKBAR_LONG_SIDE); 68 | } 69 | sw = !sw; 70 | }; 71 | _button2.parent = this; 72 | 73 | // TrackBar setting 1 74 | _trackbar1 = new TrackBar(); 75 | // _trackbar1.orientation = Orientation.HORIZONTAL; // same as default 76 | // _trackbar1.autoSize = true; // same as default 77 | _trackbar1.location = Point(10, 80); 78 | _trackbar1.size = Size(TRACKBAR_LONG_SIDE, TRACKBAR_SHORT_SIDE); 79 | // _trackbar1.setRange(0, 10); // same as default 80 | // _trackbar1.smallChange = 1; // same as default 81 | // _trackbar1.largeChange = 5; // same as default 82 | // _trackbar1.tickFrequency = 1; // same as default 83 | // _trackbar1.tickStyle = TickStyle.BottomRight; // same as default 84 | // _trackbar1.value = 0; // same as default 85 | // _trackbar1.scroll ~= (TrackBar tb, EventArgs ea) // same as default 86 | // { 87 | // // Do nothing 88 | // }; 89 | _trackbar1.valueChanged ~= (TrackBar tb, EventArgs ea) { 90 | this.text = "TrackBar 1 ValueChanged = " ~ tb.value.to!string(); 91 | }; 92 | _trackbar1.parent = this; 93 | 94 | // TrackBar setting 2 95 | _trackbar2 = new TrackBar(); 96 | _trackbar2.orientation = Orientation.VERTICAL; 97 | _trackbar2.autoSize = true; // same as default 98 | _trackbar2.location = Point(250, 80); 99 | _trackbar2.size = Size(TRACKBAR_SHORT_SIDE, TRACKBAR_LONG_SIDE); 100 | _trackbar2.setRange(0, 100); 101 | _trackbar2.smallChange = 5; 102 | _trackbar2.largeChange = 10; 103 | _trackbar2.tickFrequency = 10; 104 | _trackbar2.tickStyle = TickStyle.BOTH; 105 | _trackbar2.value = TRACKBAR_INITIAL_POSITION; 106 | _trackbar2.valueChanged ~= &_onTrackbarValueChanged; 107 | _trackbar2.parent = this; 108 | } 109 | 110 | private void _onTrackbarValueChanged(TrackBar tb, EventArgs ea) 111 | { 112 | this.text = "TrackBar 2 ValueChanged = " ~ tb.value.to!string(); 113 | } 114 | } 115 | 116 | static this() 117 | { 118 | Application.enableVisualStyles(); 119 | } 120 | 121 | void main() 122 | { 123 | Application.run(new MainForm()); 124 | } 125 | -------------------------------------------------------------------------------- /examples/trackbar/trackbar.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": { 8 | "d.projectImportPaths": [ 9 | "..\\..\\..\\dfl\\source" 10 | ] 11 | } 12 | } -------------------------------------------------------------------------------- /go.bat: -------------------------------------------------------------------------------- 1 | @rem How to use: 2 | @rem go.bat # Same as 32mscoff 3 | @rem go.bat 32mscoff # 32-Bit COFF 4 | @rem go.bat 64 # 64-Bit 5 | 6 | call makelib "%~1" 7 | @rem This errorlevel check fails on Win9x because of the previous delete. 8 | @rem @if errorlevel 1 goto fail 9 | @if not "%dfl_failed%" == "" goto fail 10 | 11 | 12 | @if "%dmd_path%" == "" goto no_dmd 13 | 14 | @set dmd_path_windows=%dmd_path%\windows 15 | @if not exist %dmd_path_windows%\bin\dmd.exe set dmd_path_windows=%dmd_path% 16 | 17 | @if "%dmd_lib_path%" == "" set dmd_lib_path=%dmd_path_windows%\lib 18 | 19 | @echo. 20 | 21 | @if not "%dfl_go_move%" == "" goto do_move 22 | 23 | @echo About to move DFL lib files to %dmd_lib_path% (Close window or Ctrl+C to stop) 24 | @pause 25 | 26 | :do_move 27 | 28 | @rem @move /Y dfl_debug.lib %dmd_lib_path% 29 | @rem @if errorlevel 1 goto fail 30 | @rem @move /Y dfl.lib %dmd_lib_path% 31 | @rem @if errorlevel 1 goto fail 32 | 33 | @pushd source\dfl 34 | 35 | @move /Y dfl*.lib %dmd_lib_path% 36 | @if errorlevel 1 goto fail 37 | 38 | 39 | @goto done 40 | 41 | :no_dmd 42 | @echo dmd_path environment variable not set; cannot copy lib files. 43 | @goto done 44 | 45 | :fail 46 | @echo Failed. 47 | @pause 48 | 49 | :done 50 | @echo Done. 51 | 52 | @popd 53 | -------------------------------------------------------------------------------- /go64.bat.lnk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/go64.bat.lnk -------------------------------------------------------------------------------- /image/welcomtodfl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/image/welcomtodfl.png -------------------------------------------------------------------------------- /lib/windows-x86_64/README.txt: -------------------------------------------------------------------------------- 1 | Windows SDK Libraries from \dmd2\windows\lib64 2 | advapi32.lib 3 | COMCTL32.LIB 4 | comdlg32.lib 5 | gdi32.lib 6 | ole32.lib 7 | OLEAUT32.LIB 8 | shell32.lib 9 | user32.lib 10 | WS2_32.LIB 11 | -------------------------------------------------------------------------------- /lib/windows-x86_64/advapi32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/lib/windows-x86_64/advapi32.lib -------------------------------------------------------------------------------- /lib/windows-x86_64/comctl32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/lib/windows-x86_64/comctl32.lib -------------------------------------------------------------------------------- /lib/windows-x86_64/comdlg32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/lib/windows-x86_64/comdlg32.lib -------------------------------------------------------------------------------- /lib/windows-x86_64/gdi32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/lib/windows-x86_64/gdi32.lib -------------------------------------------------------------------------------- /lib/windows-x86_64/ole32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/lib/windows-x86_64/ole32.lib -------------------------------------------------------------------------------- /lib/windows-x86_64/oleaut32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/lib/windows-x86_64/oleaut32.lib -------------------------------------------------------------------------------- /lib/windows-x86_64/shell32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/lib/windows-x86_64/shell32.lib -------------------------------------------------------------------------------- /lib/windows-x86_64/user32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/lib/windows-x86_64/user32.lib -------------------------------------------------------------------------------- /lib/windows-x86_64/ws2_32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/lib/windows-x86_64/ws2_32.lib -------------------------------------------------------------------------------- /lib/windows-x86_mscoff/README.txt: -------------------------------------------------------------------------------- 1 | Windows SDK Libraries from \dmd2\windows\lib32mscoff\mingw 2 | advapi32.lib 3 | COMCTL32.LIB 4 | comdlg32.lib 5 | gdi32.lib 6 | ole32.lib 7 | OLEAUT32.LIB 8 | shell32.lib 9 | user32.lib 10 | WS2_32.LIB 11 | -------------------------------------------------------------------------------- /lib/windows-x86_mscoff/advapi32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/lib/windows-x86_mscoff/advapi32.lib -------------------------------------------------------------------------------- /lib/windows-x86_mscoff/comctl32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/lib/windows-x86_mscoff/comctl32.lib -------------------------------------------------------------------------------- /lib/windows-x86_mscoff/comdlg32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/lib/windows-x86_mscoff/comdlg32.lib -------------------------------------------------------------------------------- /lib/windows-x86_mscoff/gdi32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/lib/windows-x86_mscoff/gdi32.lib -------------------------------------------------------------------------------- /lib/windows-x86_mscoff/ole32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/lib/windows-x86_mscoff/ole32.lib -------------------------------------------------------------------------------- /lib/windows-x86_mscoff/oleaut32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/lib/windows-x86_mscoff/oleaut32.lib -------------------------------------------------------------------------------- /lib/windows-x86_mscoff/shell32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/lib/windows-x86_mscoff/shell32.lib -------------------------------------------------------------------------------- /lib/windows-x86_mscoff/user32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/lib/windows-x86_mscoff/user32.lib -------------------------------------------------------------------------------- /lib/windows-x86_mscoff/ws2_32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/lib/windows-x86_mscoff/ws2_32.lib -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | The DFL License Agreement 2 | 3 | 4 | DFL is Copyright (C) 2004-2010 Christopher E. Miller 5 | Official DFL website: http://www.dprogramming.com/dfl.php 6 | 7 | 8 | The DFL library is under a 3-choice license. 9 | You may choose any of the below based on your use of the code. 10 | 11 | License Choice 1) 12 | LGPL (GNU Lesser General Public License) described in lgpl.txt 13 | 14 | License Choice 2) 15 | zlib license (libpng/zlib license) described in zlib.txt may be 16 | used if the code in no way depends on the Windows Win32 API. 17 | This allows the code to be translated to another API. 18 | 19 | License Choice 3) 20 | Unmodified versions of the DFL library obtained directly from the 21 | official DFL package at http://www.dprogramming.com/dfl.php may 22 | be used, including redistributions in source or binary form and 23 | commercial applications, subject to the following: 24 | 25 | 3a) This software is provided 'as-is', without any express or 26 | implied warranty. In no event will the authors be held liable 27 | for any damages arising from the use of this software. 28 | 29 | 3b) The origin of this software must not be misrepresented; 30 | you must not claim that you wrote the original software. 31 | 32 | 3c) Source redistributions must include the DFL license 33 | in the source code directory, and the above copyright notice 34 | and official software website address must be included in 35 | supporting documentation. 36 | 37 | 3d) For source redistributions, any accompanying files not 38 | from the original package must reside in separate file 39 | directories. 40 | 41 | 42 | Terminology: 43 | 44 | "the code" refers to the source code of the DFL library. 45 | 46 | "binary form" refers to the resulting executable code when the DFL 47 | source code is compiled. 48 | 49 | "Win32 API" refers to the Microsoft Windows API, including Win32 for 50 | 64-bit Windows (Win64), or any of the user32, kernel32 or gdi32 DLLs 51 | or any future version counterparts designed for the Windows platform. 52 | 53 | -------------------------------------------------------------------------------- /source/dfl/all.d: -------------------------------------------------------------------------------- 1 | // Written by Christopher E. Miller 2 | // See the included license.txt for copyright and license details. 3 | 4 | 5 | /// Imports all of DFL's public interface. 6 | module dfl.all; 7 | 8 | 9 | public import dfl; 10 | 11 | -------------------------------------------------------------------------------- /source/dfl/clippingform.d: -------------------------------------------------------------------------------- 1 | module dfl.clippingform; 2 | 3 | import dfl.base; 4 | import dfl.form; 5 | import dfl.control; 6 | import dfl.event; 7 | import dfl.drawing; 8 | 9 | import dfl.internal.dlib : toI32; 10 | 11 | import core.memory; 12 | import core.sys.windows.windows; 13 | 14 | /// 15 | struct RegionRects 16 | { 17 | private: 18 | RGNDATA* _rgn = null; 19 | size_t _capacity = 0; 20 | size_t _width = 0; 21 | size_t _height = 0; 22 | 23 | public: 24 | @property size_t width() const 25 | { 26 | return _width; 27 | } 28 | 29 | 30 | /// 31 | @property size_t height() const 32 | { 33 | return _height; 34 | } 35 | 36 | 37 | /// 38 | void clear() 39 | { 40 | if (_rgn) 41 | { 42 | GC.free(_rgn); 43 | } 44 | _rgn = null; 45 | _capacity = 0; 46 | _width = 0; 47 | _height = 0; 48 | } 49 | 50 | 51 | /// 52 | void add(RECT rc) 53 | { 54 | if (_capacity == 0) 55 | { 56 | _capacity = 1024; 57 | _rgn = cast(RGNDATA*) GC.malloc( 58 | RGNDATAHEADER.sizeof + RECT.sizeof * _capacity); 59 | _rgn.rdh.nCount = 0; 60 | } 61 | else if (_rgn.rdh.nCount == _capacity) 62 | { 63 | _capacity *= 2; 64 | _rgn = cast(RGNDATA*) GC.realloc(cast(void*)_rgn, 65 | RGNDATAHEADER.sizeof + RECT.sizeof * _capacity); 66 | } 67 | (cast(RECT*)_rgn.Buffer.ptr)[_rgn.rdh.nCount++] = rc; 68 | } 69 | 70 | 71 | /// ditto 72 | void add(int l, int t, int r, int b) 73 | { 74 | add(RECT(l, t, r, b)); 75 | } 76 | 77 | 78 | /// ditto 79 | void opOpAssign(string op)(RECT rc) if (op == "~") 80 | { 81 | add(rc); 82 | } 83 | 84 | 85 | /// 86 | @property Region region() 87 | { 88 | if (_rgn is null) return null; 89 | with (_rgn.rdh) 90 | { 91 | dwSize = RGNDATAHEADER.sizeof; 92 | iType = RDH_RECTANGLES; 93 | nRgnSize = RGNDATAHEADER.sizeof.toI32 + RECT.sizeof.toI32*nCount.toI32; 94 | rcBound = RECT(0,0,_width.toI32,_height.toI32); 95 | } 96 | if (auto hRgn = ExtCreateRegion(null, _rgn.rdh.nRgnSize, _rgn)) 97 | { 98 | return new Region(hRgn); 99 | } 100 | throw new Exception("Failed to make a region data."); 101 | } 102 | 103 | 104 | private Region createClippingRegionFromHDC(HBITMAP hBitmap) 105 | { 106 | HDC hDC = CreateCompatibleDC(null); 107 | auto h = _height; 108 | auto w = _width; 109 | if (!hDC) throw new Exception("Failed to get device context data."); 110 | BITMAPINFOHEADER bi; 111 | with(bi) 112 | { 113 | biSize = BITMAPINFOHEADER.sizeof; 114 | biWidth = w.toI32; 115 | biHeight = h.toI32; 116 | biPlanes = 1; 117 | biBitCount = 32; 118 | biCompression = BI_RGB; 119 | } 120 | auto pxs = new COLORREF[w]; 121 | COLORREF tr; 122 | for (int y = 1; y < h; ++y) 123 | { 124 | GetDIBits(hDC, hBitmap, h.toI32-y, 1, pxs.ptr, cast(BITMAPINFO*)&bi, DIB_RGB_COLORS); 125 | if (y == 1) tr = pxs[0]; 126 | for (int x = 0; x < w; x++) 127 | { 128 | if (pxs[x] == tr) continue; 129 | int sx = x; 130 | while (x < w) 131 | { 132 | if (pxs[x++] == tr) break; 133 | } 134 | add(sx, y-1, x-1, y); 135 | } 136 | } 137 | DeleteDC(hDC); 138 | return region; 139 | } 140 | 141 | 142 | /// 143 | Region create(MemoryGraphics g) 144 | { 145 | clear(); 146 | _width = g.width; 147 | _height = g.height; 148 | return createClippingRegionFromHDC(g.hbitmap); 149 | } 150 | 151 | 152 | /// ditto 153 | Region create(Image img) 154 | { 155 | clear(); 156 | _width = img.width; 157 | _height = img.height; 158 | if (auto bmp = cast(Bitmap)img) 159 | { 160 | return createClippingRegionFromHDC(bmp.handle); 161 | } 162 | auto g = new MemoryGraphics(img.width, img.height); 163 | img.draw(g, Point(0,0)); 164 | return create(g); 165 | } 166 | } 167 | 168 | 169 | /// 170 | class ClippingForm : Form 171 | { 172 | private: 173 | Image _image; 174 | RegionRects _regionRects; 175 | 176 | protected: 177 | override void createParams(ref CreateParams cp) 178 | { 179 | super.createParams(cp); 180 | cp.style = WS_POPUP; 181 | cp.exStyle |= WS_EX_TOPMOST; 182 | } 183 | 184 | public: 185 | /// 186 | @property Image clipping() 187 | { 188 | return _image; 189 | } 190 | 191 | 192 | /// ditto 193 | @property void clipping(Image img) 194 | { 195 | _image = img; 196 | } 197 | 198 | 199 | /// 200 | override void onHandleCreated(EventArgs ea) 201 | { 202 | if (_image) 203 | { 204 | region = _regionRects.create(_image); 205 | } 206 | super.onHandleCreated(ea); 207 | } 208 | 209 | 210 | /// 211 | override void onPaint(PaintEventArgs pea) 212 | { 213 | if (_image) 214 | { 215 | _image.draw(pea.graphics, Point(0,0)); 216 | } 217 | else 218 | { 219 | super.onPaint(pea); 220 | } 221 | } 222 | } 223 | -------------------------------------------------------------------------------- /source/dfl/commondialog.d: -------------------------------------------------------------------------------- 1 | // Written by Christopher E. Miller 2 | // See the included license.txt for copyright and license details. 3 | 4 | 5 | /// 6 | module dfl.commondialog; 7 | 8 | import dfl.application; 9 | import dfl.base; 10 | import dfl.control; 11 | import dfl.drawing; 12 | import dfl.event; 13 | 14 | import dfl.internal.winapi; 15 | import dfl.internal.utf; 16 | 17 | public import dfl.filedialog; 18 | public import dfl.folderdialog; 19 | public import dfl.colordialog; 20 | public import dfl.fontdialog; 21 | 22 | 23 | /// 24 | abstract class CommonDialog // docmain 25 | { 26 | /// 27 | abstract void reset(); 28 | 29 | /// 30 | // Uses currently active window of the application as owner. 31 | abstract DialogResult showDialog(); 32 | 33 | /// ditto 34 | abstract DialogResult showDialog(IWindow owner); 35 | 36 | 37 | /// 38 | Event!(CommonDialog, HelpEventArgs) helpRequest; 39 | 40 | 41 | protected: 42 | 43 | /// 44 | // See the CDN_* Windows notification messages. 45 | UINT_PTR hookProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) 46 | { 47 | switch(msg) 48 | { 49 | case WM_NOTIFY: 50 | { 51 | NMHDR* nmhdr; 52 | nmhdr = cast(NMHDR*)lparam; 53 | switch(nmhdr.code) 54 | { 55 | case CDN_HELP: 56 | { 57 | Point pt; 58 | GetCursorPos(&pt.point); 59 | onHelpRequest(new HelpEventArgs(pt)); 60 | } 61 | break; 62 | 63 | default: 64 | } 65 | } 66 | break; 67 | 68 | default: 69 | } 70 | 71 | return 0; 72 | } 73 | 74 | 75 | // TODO: implement. 76 | //LRESULT ownerWndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) 77 | 78 | 79 | /// 80 | void onHelpRequest(HelpEventArgs ea) 81 | { 82 | helpRequest(this, ea); 83 | } 84 | 85 | 86 | /// 87 | abstract bool runDialog(HWND owner); 88 | 89 | 90 | package final void _cantrun() 91 | { 92 | throw new DflException("Error running dialog"); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /source/dfl/image/previewprintdialog_toolbar.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayerd/dfl/2798d130443a06542c18c16c81292cf93c4dbb13/source/dfl/image/previewprintdialog_toolbar.bmp -------------------------------------------------------------------------------- /source/dfl/internal/clib.d: -------------------------------------------------------------------------------- 1 | // Public domain. 2 | 3 | 4 | module dfl.internal.clib; 5 | 6 | 7 | public import core.stdc.stdlib; 8 | public import core.stdc.string; 9 | public import core.stdc.stdint; // Mostly the same as the C interface. 10 | public import core.stdc.stdio; 11 | 12 | alias cprintf = core.stdc.stdio.printf; 13 | -------------------------------------------------------------------------------- /source/dfl/internal/d1.d: -------------------------------------------------------------------------------- 1 | // Written by Christopher E. Miller 2 | // See the included license.txt for copyright and license details. 3 | 4 | 5 | module dfl.internal.d1; 6 | 7 | 8 | /// Gets the const type of a type, or the type itself if not supported. 9 | template ConstType(T) 10 | { 11 | alias ConstType = T; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /source/dfl/internal/d2.d: -------------------------------------------------------------------------------- 1 | // Written by Christopher E. Miller 2 | // See the included license.txt for copyright and license details. 3 | 4 | 5 | module dfl.internal.d2; 6 | 7 | 8 | /// Gets the const type of a type, or the type itself if not supported. 9 | template ConstType(T) 10 | { 11 | alias ConstType = const(T); 12 | } 13 | 14 | -------------------------------------------------------------------------------- /source/dfl/messagebox.d: -------------------------------------------------------------------------------- 1 | // Written by Christopher E. Miller 2 | // See the included license.txt for copyright and license details. 3 | 4 | 5 | /// 6 | module dfl.messagebox; 7 | 8 | import dfl.base; 9 | 10 | import dfl.internal.dlib; 11 | import dfl.internal.winapi; 12 | static import dfl.internal.utf; 13 | 14 | /// 15 | enum MsgBoxButtons 16 | { 17 | ABORT_RETRY_IGNORE = MB_ABORTRETRYIGNORE, /// 18 | OK = MB_OK, /// ditto 19 | OK_CANCEL = MB_OKCANCEL, /// ditto 20 | RETRY_CANCEL = MB_RETRYCANCEL, /// ditto 21 | YES_NO = MB_YESNO, /// ditto 22 | YES_NO_CANCEL = MB_YESNOCANCEL, /// ditto 23 | } 24 | 25 | 26 | /// 27 | enum MsgBoxIcon 28 | { 29 | NONE = 0, /// 30 | 31 | ASTERISK = MB_ICONASTERISK, /// ditto 32 | ERROR = MB_ICONERROR, /// ditto 33 | EXCLAMATION = MB_ICONEXCLAMATION, /// ditto 34 | HAND = MB_ICONHAND, /// ditto 35 | INFORMATION = MB_ICONINFORMATION, /// ditto 36 | QUESTION = MB_ICONQUESTION, /// ditto 37 | STOP = MB_ICONSTOP, /// ditto 38 | WARNING = MB_ICONWARNING, /// ditto 39 | } 40 | 41 | 42 | enum MsgBoxDefaultButton 43 | { 44 | BUTTON1 = MB_DEFBUTTON1, /// 45 | BUTTON2 = MB_DEFBUTTON2, /// ditto 46 | BUTTON3 = MB_DEFBUTTON3, /// ditto 47 | 48 | // Extra. 49 | BUTTON4 = MB_DEFBUTTON4, 50 | } 51 | 52 | 53 | /// 54 | enum MsgBoxOptions 55 | { 56 | DEFAULT_DESKTOP_ONLY = MB_DEFAULT_DESKTOP_ONLY, /// 57 | RIGHT_ALIGN = MB_RIGHT, /// ditto 58 | LEFT_ALIGN = MB_RTLREADING, /// ditto 59 | SERVICE_NOTIFICATION = MB_SERVICE_NOTIFICATION, /// ditto 60 | } 61 | 62 | 63 | /// 64 | DialogResult msgBox(Dstring txt) // docmain 65 | { 66 | return cast(DialogResult)dfl.internal.utf.messageBox(GetActiveWindow(), txt, "\0", MB_OK); 67 | } 68 | 69 | /// ditto 70 | DialogResult msgBox(IWindow owner, Dstring txt) // docmain 71 | { 72 | return cast(DialogResult)dfl.internal.utf.messageBox(owner ? owner.handle : GetActiveWindow(), 73 | txt, "\0", MB_OK); 74 | } 75 | 76 | /// ditto 77 | DialogResult msgBox(Dstring txt, Dstring caption) // docmain 78 | { 79 | return cast(DialogResult)dfl.internal.utf.messageBox(GetActiveWindow(), txt, caption, MB_OK); 80 | } 81 | 82 | /// ditto 83 | DialogResult msgBox(IWindow owner, Dstring txt, Dstring caption) // docmain 84 | { 85 | return cast(DialogResult)dfl.internal.utf.messageBox(owner ? owner.handle : GetActiveWindow(), 86 | txt, caption, MB_OK); 87 | } 88 | 89 | /// ditto 90 | DialogResult msgBox(Dstring txt, Dstring caption, MsgBoxButtons buttons) // docmain 91 | { 92 | return cast(DialogResult)dfl.internal.utf.messageBox(GetActiveWindow(), txt, caption, buttons); 93 | } 94 | 95 | /// ditto 96 | DialogResult msgBox(IWindow owner, Dstring txt, Dstring caption, 97 | MsgBoxButtons buttons) // docmain 98 | { 99 | return cast(DialogResult)dfl.internal.utf.messageBox(owner ? owner.handle : GetActiveWindow(), 100 | txt, caption, buttons); 101 | } 102 | 103 | /// ditto 104 | DialogResult msgBox(Dstring txt, Dstring caption, MsgBoxButtons buttons, 105 | MsgBoxIcon icon) // docmain 106 | { 107 | return cast(DialogResult)dfl.internal.utf.messageBox(GetActiveWindow(), txt, 108 | caption, buttons | icon); 109 | } 110 | 111 | /// ditto 112 | DialogResult msgBox(IWindow owner, Dstring txt, Dstring caption, MsgBoxButtons buttons, 113 | MsgBoxIcon icon) // docmain 114 | { 115 | return cast(DialogResult)dfl.internal.utf.messageBox(owner ? owner.handle : GetActiveWindow(), 116 | txt, caption, buttons | icon); 117 | } 118 | 119 | /// ditto 120 | DialogResult msgBox(Dstring txt, Dstring caption, MsgBoxButtons buttons, MsgBoxIcon icon, 121 | MsgBoxDefaultButton defaultButton) // docmain 122 | { 123 | return cast(DialogResult)dfl.internal.utf.messageBox(GetActiveWindow(), txt, 124 | caption, buttons | icon | defaultButton); 125 | } 126 | 127 | /// ditto 128 | DialogResult msgBox(IWindow owner, Dstring txt, Dstring caption, MsgBoxButtons buttons, 129 | MsgBoxIcon icon, MsgBoxDefaultButton defaultButton) // docmain 130 | { 131 | return cast(DialogResult)dfl.internal.utf.messageBox(owner ? owner.handle : GetActiveWindow(), 132 | txt, caption, buttons | icon | defaultButton); 133 | } 134 | 135 | /// ditto 136 | DialogResult msgBox(IWindow owner, Dstring txt, Dstring caption, MsgBoxButtons buttons, 137 | MsgBoxIcon icon, MsgBoxDefaultButton defaultButton, MsgBoxOptions options) // docmain 138 | { 139 | return cast(DialogResult)dfl.internal.utf.messageBox(owner ? owner.handle : GetActiveWindow(), 140 | txt, caption, buttons | icon | defaultButton | options); 141 | } 142 | 143 | 144 | deprecated final class MessageBox 145 | { 146 | private this() {} 147 | 148 | 149 | static: 150 | deprecated alias show = msgBox; 151 | } 152 | 153 | 154 | deprecated alias messageBox = msgBox; 155 | 156 | deprecated alias MessageBoxOptions = MsgBoxOptions; 157 | deprecated alias MessageBoxDefaultButton = MsgBoxDefaultButton; 158 | deprecated alias MessageBoxButtons = MsgBoxButtons; 159 | deprecated alias MessageBoxIcon = MsgBoxIcon; 160 | 161 | -------------------------------------------------------------------------------- /source/dfl/package.d: -------------------------------------------------------------------------------- 1 | // Written by Christopher E. Miller 2 | // See the included license.txt for copyright and license details. 3 | 4 | 5 | /// Imports all of DFL's public interface. 6 | module dfl; 7 | 8 | public import dfl.application; 9 | public import dfl.base; 10 | public import dfl.button; 11 | public import dfl.chart; 12 | public import dfl.clipboard; 13 | public import dfl.clippingform; 14 | public import dfl.collections; 15 | public import dfl.combobox; 16 | public import dfl.commondialog; 17 | public import dfl.control; 18 | public import dfl.data; 19 | public import dfl.drawing; 20 | public import dfl.environment; 21 | public import dfl.event; 22 | public import dfl.form; 23 | public import dfl.groupbox; 24 | public import dfl.imagelist; 25 | public import dfl.label; 26 | public import dfl.listbox; 27 | public import dfl.listview; 28 | public import dfl.menu; 29 | public import dfl.messagebox; 30 | public import dfl.notifyicon; 31 | public import dfl.panel; 32 | public import dfl.picturebox; 33 | public import dfl.printing; 34 | public import dfl.progressbar; 35 | public import dfl.registry; 36 | public import dfl.resources; 37 | public import dfl.richtextbox; 38 | public import dfl.sharedcontrol; 39 | public import dfl.socket; 40 | public import dfl.splitter; 41 | public import dfl.statusbar; 42 | public import dfl.tabcontrol; 43 | public import dfl.textbox; 44 | public import dfl.textboxbase; 45 | public import dfl.timer; 46 | public import dfl.toolbar; 47 | public import dfl.tooltip; 48 | public import dfl.trackbar; 49 | public import dfl.treeview; 50 | public import dfl.usercontrol; 51 | -------------------------------------------------------------------------------- /source/dfl/panel.d: -------------------------------------------------------------------------------- 1 | // Written by Christopher E. Miller 2 | // See the included license.txt for copyright and license details. 3 | 4 | 5 | /// 6 | module dfl.panel; 7 | 8 | import dfl.base; 9 | import dfl.control; 10 | 11 | import dfl.internal.winapi; 12 | 13 | 14 | /// 15 | class Panel: ContainerControl // docmain 16 | { 17 | /// 18 | @property void borderStyle(BorderStyle bs) // setter 19 | { 20 | final switch(bs) 21 | { 22 | case BorderStyle.FIXED_3D: 23 | _style(_style() & ~WS_BORDER); 24 | _exStyle(_exStyle() | WS_EX_CLIENTEDGE); 25 | break; 26 | 27 | case BorderStyle.FIXED_SINGLE: 28 | _exStyle(_exStyle() & ~WS_EX_CLIENTEDGE); 29 | _style(_style() | WS_BORDER); 30 | break; 31 | 32 | case BorderStyle.NONE: 33 | _style(_style() & ~WS_BORDER); 34 | _exStyle(_exStyle() & ~WS_EX_CLIENTEDGE); 35 | break; 36 | } 37 | 38 | if(created) 39 | { 40 | redrawEntire(); 41 | } 42 | } 43 | 44 | /// ditto 45 | @property BorderStyle borderStyle() // getter 46 | { 47 | if(_exStyle() & WS_EX_CLIENTEDGE) 48 | return BorderStyle.FIXED_3D; 49 | else if(_style() & WS_BORDER) 50 | return BorderStyle.FIXED_SINGLE; 51 | return BorderStyle.NONE; 52 | } 53 | 54 | 55 | this() 56 | { 57 | //ctrlStyle |= ControlStyles.SELECTABLE | ControlStyles.CONTAINER_CONTROL; 58 | ctrlStyle |= ControlStyles.CONTAINER_CONTROL; 59 | /+ wstyle |= WS_TABSTOP; +/ // Should WS_TABSTOP be set? 60 | //wexstyle |= WS_EX_CONTROLPARENT; // Allow tabbing through children. ? 61 | } 62 | } 63 | 64 | -------------------------------------------------------------------------------- /source/dfl/timer.d: -------------------------------------------------------------------------------- 1 | // Written by Christopher E. Miller 2 | // See the included license.txt for copyright and license details. 3 | 4 | 5 | /// 6 | module dfl.timer; 7 | 8 | import dfl.application; 9 | import dfl.base; 10 | import dfl.event; 11 | 12 | import dfl.internal.dlib; 13 | 14 | debug(APP_PRINT) 15 | { 16 | import dfl.internal.clib; 17 | } 18 | 19 | import core.sys.windows.windows; 20 | 21 | 22 | /// 23 | class Timer // docmain 24 | { 25 | public: 26 | Event!(Timer, EventArgs) tick; /// 27 | 28 | 29 | /// 30 | @property void enabled(bool on) // setter 31 | { 32 | if(on) 33 | start(); 34 | else 35 | stop(); 36 | } 37 | 38 | /// ditto 39 | @property bool enabled() const // getter 40 | { 41 | return timerId != 0; 42 | } 43 | 44 | 45 | /// 46 | final @property void interval(uint timeout) // setter 47 | { 48 | if(!timeout) 49 | throw new DflException("Invalid timer interval"); 50 | 51 | if(this._timeout != timeout) 52 | { 53 | this._timeout = timeout; 54 | 55 | if(timerId) 56 | { 57 | // I don't know if this is the correct behavior. 58 | // Reset the timer for the new timeout... 59 | stop(); 60 | start(); 61 | } 62 | } 63 | } 64 | 65 | /// ditto 66 | final @property uint interval() const // getter 67 | { 68 | return _timeout; 69 | } 70 | 71 | 72 | /// 73 | final void start() 74 | { 75 | if(timerId) 76 | return; 77 | 78 | assert(_timeout > 0); 79 | 80 | timerId = SetTimer(null, 0, _timeout, &timerProc); 81 | if(!timerId) 82 | throw new DflException("Unable to start timer"); 83 | allTimers[timerId] = this; 84 | } 85 | 86 | /// ditto 87 | final void stop() 88 | { 89 | if(timerId) 90 | { 91 | //delete allTimers[timerId]; 92 | allTimers.remove(timerId); 93 | KillTimer(null, timerId); 94 | timerId = 0; 95 | } 96 | } 97 | 98 | 99 | /// 100 | this() 101 | { 102 | } 103 | 104 | /// ditto 105 | this(void delegate(Timer) dg) 106 | { 107 | this(); 108 | if(dg) 109 | { 110 | this._dg = dg; 111 | tick ~= &_dgcall; 112 | } 113 | } 114 | 115 | /// ditto 116 | this(void delegate(Object, EventArgs) dg) 117 | { 118 | assert(dg !is null); 119 | 120 | this(); 121 | tick ~= dg; 122 | } 123 | 124 | /// ditto 125 | this(void delegate(Timer, EventArgs) dg) 126 | { 127 | assert(dg !is null); 128 | 129 | this(); 130 | tick ~= dg; 131 | } 132 | 133 | 134 | ~this() 135 | { 136 | dispose(); 137 | } 138 | 139 | 140 | protected: 141 | void dispose() 142 | { 143 | stop(); 144 | } 145 | 146 | 147 | /// 148 | void onTick(EventArgs ea) 149 | { 150 | tick(this, ea); 151 | } 152 | 153 | 154 | private: 155 | DWORD _timeout = 100; 156 | UINT_PTR timerId = 0; 157 | void delegate(Timer) _dg; 158 | 159 | 160 | void _dgcall(Object sender, EventArgs ea) 161 | { 162 | assert(_dg !is null); 163 | _dg(this); 164 | } 165 | } 166 | 167 | 168 | private: 169 | 170 | Timer[UINT_PTR] allTimers; 171 | 172 | 173 | extern(Windows) void timerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) nothrow 174 | { 175 | try 176 | { 177 | if(idEvent in allTimers) 178 | { 179 | allTimers[idEvent].onTick(EventArgs.empty); 180 | } 181 | else 182 | { 183 | debug(APP_PRINT) 184 | cprintf("Unknown timer 0x%X.\n", idEvent.toI32); 185 | } 186 | } 187 | catch(DThrowable e) 188 | { 189 | Application.onThreadException(e); 190 | } 191 | } 192 | 193 | -------------------------------------------------------------------------------- /source/dfl/usercontrol.d: -------------------------------------------------------------------------------- 1 | // Written by Christopher E. Miller 2 | // See the included license.txt for copyright and license details. 3 | 4 | 5 | /// 6 | module dfl.usercontrol; 7 | 8 | import dfl.control; 9 | 10 | 11 | /// 12 | class UserControl: ContainerControl // docmain 13 | { 14 | // ? 15 | } 16 | 17 | -------------------------------------------------------------------------------- /zlib.txt: -------------------------------------------------------------------------------- 1 | DFL License Choice 2. 2 | 3 | This license may be used if the used code in no way depends on the 4 | Windows Win32 API. 5 | 6 | 7 | This software is provided 'as-is', without any express or implied 8 | warranty. In no event will the authors be held liable for any damages 9 | arising from the use of this software. 10 | 11 | Permission is granted to anyone to use this software for any purpose, 12 | including commercial applications, and to alter it and redistribute it 13 | freely, subject to the following restrictions: 14 | 15 | 1. The origin of this software must not be misrepresented; you must not 16 | claim that you wrote the original software. If you use this software 17 | in a product, an acknowledgment in the product documentation would be 18 | appreciated but is not required. 19 | 20 | 2. Altered source versions must be plainly marked as such, and must not be 21 | misrepresented as being the original software. 22 | 23 | 3. This notice may not be removed or altered from any source 24 | distribution. 25 | --------------------------------------------------------------------------------