mirror of
https://github.com/Rayerd/dfl.git
synced 2025-04-25 20:49:58 +03:00
Add scrollbar example
This commit is contained in:
parent
86c88840e9
commit
000ba4ea27
10 changed files with 128 additions and 1 deletions
|
@ -25,6 +25,7 @@ DFL is a Win32 windowing library for the D language.
|
|||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
@ -41,7 +42,7 @@ DFL is a Win32 windowing library for the D language.
|
|||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
## Build and Install (dfl.lib and dfl_debug.lib)
|
||||
### 1. Set environment variables
|
||||
|
|
16
examples/scrollbar/.gitignore
vendored
Normal file
16
examples/scrollbar/.gitignore
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
.dub
|
||||
docs.json
|
||||
__dummy.html
|
||||
docs/
|
||||
/hello_dfl
|
||||
hello_dfl.so
|
||||
hello_dfl.dylib
|
||||
hello_dfl.dll
|
||||
hello_dfl.a
|
||||
hello_dfl.lib
|
||||
hello_dfl-test-*
|
||||
*.exe
|
||||
*.pdb
|
||||
*.o
|
||||
*.obj
|
||||
*.lst
|
13
examples/scrollbar/.vscode/launch.json
vendored
Normal file
13
examples/scrollbar/.vscode/launch.json
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "C++ Launch (Windows) scrollbar",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"cwd": "${workspaceRoot}",
|
||||
"program": "./bin/scrollbar.exe",
|
||||
"console": "internalConsole"
|
||||
}
|
||||
]
|
||||
}
|
20
examples/scrollbar/.vscode/tasks.json
vendored
Normal file
20
examples/scrollbar/.vscode/tasks.json
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "dub",
|
||||
"run": false,
|
||||
"cwd": ".",
|
||||
"compiler": "$current",
|
||||
"archType": "$current",
|
||||
"buildType": "$current",
|
||||
"configuration": "$current",
|
||||
"problemMatcher": [
|
||||
"$dmd"
|
||||
],
|
||||
"group": "build",
|
||||
"label": "dub: Build scrollbar_example",
|
||||
"detail": "dub build --compiler=dmd.EXE -a=x86_64 -b=debug -c=application"
|
||||
}
|
||||
]
|
||||
}
|
2
examples/scrollbar/README.md
Normal file
2
examples/scrollbar/README.md
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Screen Shot
|
||||

|
16
examples/scrollbar/dub.json
Normal file
16
examples/scrollbar/dub.json
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"authors": ["haru-s"],
|
||||
"copyright": "Copyright (C) 2024 haru-s",
|
||||
"description": "DFL sample code.",
|
||||
"name": "scrollbar",
|
||||
"targetType": "executable",
|
||||
"targetPath": "bin",
|
||||
"dependencies": {
|
||||
"dfl": {
|
||||
"path": "../../../dfl"
|
||||
}
|
||||
},
|
||||
"lflags-windows-x86_omf-dmd": ["/exet:nt/su:windows:6.0"],
|
||||
"lflags-windows-x86_mscoff-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"],
|
||||
"lflags-windows-x86_64-dmd": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"]
|
||||
}
|
BIN
examples/scrollbar/image/screenshot.png
Normal file
BIN
examples/scrollbar/image/screenshot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
12
examples/scrollbar/scrollbar.code-workspace
Normal file
12
examples/scrollbar/scrollbar.code-workspace
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "."
|
||||
}
|
||||
],
|
||||
"settings": {
|
||||
"d.projectImportPaths": [
|
||||
"..\\..\\..\\dfl\\source"
|
||||
]
|
||||
}
|
||||
}
|
3
examples/scrollbar/shell.bat
Normal file
3
examples/scrollbar/shell.bat
Normal file
|
@ -0,0 +1,3 @@
|
|||
set dmd_path=c:\d\dmd2\windows
|
||||
set dmc_path=c:\dmc\dm
|
||||
cmd
|
44
examples/scrollbar/source/scrollbar_example.d
Normal file
44
examples/scrollbar/source/scrollbar_example.d
Normal file
|
@ -0,0 +1,44 @@
|
|||
import dfl;
|
||||
|
||||
version(Have_dfl) // For DUB.
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
pragma(lib, "dfl.lib");
|
||||
}
|
||||
|
||||
class MainForm : Form
|
||||
{
|
||||
private Label _label;
|
||||
|
||||
public this()
|
||||
{
|
||||
this.text = "Scrollbar example";
|
||||
this.size = Size(400, 200);
|
||||
this.hScroll = true;
|
||||
this.vScroll = true;
|
||||
Rect bounds = Screen.primaryScreen.bounds;
|
||||
this.scrollSize = Size(bounds.width, bounds.height);
|
||||
|
||||
_label = new Label;
|
||||
_label.text =
|
||||
"Long long long long long long long long long\n" ~
|
||||
"long long long long long long long long long\n" ~
|
||||
"long long long long long long long long long\n" ~
|
||||
"long long long long long long long long long text";
|
||||
_label.autoSize = true;
|
||||
_label.location = Point(50, 50);
|
||||
_label.parent = this;
|
||||
}
|
||||
}
|
||||
|
||||
static this()
|
||||
{
|
||||
Application.enableVisualStyles();
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
Application.run(new MainForm());
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue