Update to dmd 2.101.0 (https://github.com/dlang/undeaD is requwired)

This commit is contained in:
haru-s 2022-11-19 21:12:29 +09:00
parent efbf03f644
commit 5e61bb79d1
32 changed files with 168 additions and 4375 deletions

View file

@ -2,8 +2,8 @@
This unofficial project is a migration of D Forms Library (DFL) that is managed on SVN.
DFL is a Win32 windowing library for the D language.
# Deprecated
I had a single project utilizing this library. I have moved on to utilizing DWT.
# ~~Deprecated~~
~~I had a single project utilizing this library. I have moved on to utilizing DWT.~~
For this reason I will not be working to keep this project compiling in the latest Compiler version.
I would hand this off to other active participants, but as their are none...
~~For this reason I will not be working to keep this project compiling in the latest Compiler version.~~
~~I would hand this off to other active participants, but as their are none...~~

View file

@ -61,7 +61,7 @@ class ApplicationContext // docmain
this(Form mainForm)
{
mform = mainForm;
mainForm.closed ~= &onMainFormClosed;
mainForm.closed.addHandler(&onMainFormClosed);
}
@ -74,7 +74,7 @@ class ApplicationContext // docmain
mform = mainForm;
if(mainForm)
mainForm.closed ~= &onMainFormClosed;
mainForm.closed.addHandler(&onMainFormClosed);
}
/// ditto
@ -428,7 +428,7 @@ final class Application // docmain
scope tmr = new TMR.Timer();
bool keep = true;
tmr.interval = msDelay;
tmr.tick ~= (TMR.Timer sender, EventArgs ea) { sender.stop(); keep = false; };
tmr.tick.addHandler((TMR.Timer sender, EventArgs ea) { sender.stop(); keep = false; });
tmr.start();
while(keep)
{
@ -497,7 +497,7 @@ final class Application // docmain
ctx = appcon;
ctx.threadExit ~= &threadJustExited;
ctx.threadExit.addHandler(&threadJustExited);
try
{
threadFlags = threadFlags | TF.RUNNING;
@ -704,7 +704,7 @@ final class Application // docmain
this.clientSize.height - height - PADDING);
text = "&Continue";
parent = this;
click ~= &onOkClick;
click.addHandler(&onOkClick);
}
acceptButton = okBtn;
@ -715,7 +715,7 @@ final class Application // docmain
this.clientSize.height - height - PADDING);
text = "&Quit";
parent = this;
click ~= &onCancelClick;
click.addHandler(&onCancelClick);
}
autoScale = true;
@ -936,7 +936,7 @@ final class Application // docmain
if (auto pkid = k in hotkeyId)
{
immutable kid = *pkid;
hotkeyHandler[kid] ~= dg;
hotkeyHandler[kid].addHandler(dg);
}
else
{
@ -957,12 +957,12 @@ final class Application // docmain
hotkeyId[k] = kid;
if (auto h = kid in hotkeyHandler)
{
*h ~= dg;
(*h).addHandler(dg);
}
else
{
typeof(hotkeyHandler[kid]) e;
e ~= dg;
e.addHandler(dg);
hotkeyHandler[kid] = e;
}
}
@ -1114,7 +1114,7 @@ final class Application // docmain
assert(c.isHandleCreated);
assert(lookupHwnd(c.handle));
}
body
do
{
SetPropA(c.handle, ZOMBIE_PROP.ptr, cast(HANDLE)cast(void*)c);
removeHwnd(c.handle);
@ -1128,7 +1128,7 @@ final class Application // docmain
assert(c.isHandleCreated);
assert(!lookupHwnd(c.handle));
}
body
do
{
RemovePropA(c.handle, ZOMBIE_PROP.ptr);
controls[c.handle] = c;
@ -1141,7 +1141,7 @@ final class Application // docmain
{
assert(c !is null);
}
body
do
{
if(c.isHandleCreated)
{
@ -2317,7 +2317,7 @@ in
assert(!Application.hinst);
assert(inst);
}
body
do
{
Application.hinst = inst;

View file

@ -967,7 +967,7 @@ class KeyPressEventArgs: KeyEventArgs
{
assert((modifiers & Keys.MODIFIERS) == modifiers, "modifiers parameter can only contain modifiers");
}
body
do
{
_keych = ch;

View file

@ -404,7 +404,7 @@ class Button: ButtonBase, IButtonControl // docmain
if(img)
assert(!this.text.length, "Button image with text not supported");
}
body
do
{
/+
if(_picbm)
@ -472,7 +472,7 @@ class Button: ButtonBase, IButtonControl // docmain
{
assert(isHandleCreated);
}
body
do
{
WPARAM wparam = 0;
LPARAM lparam = 0;

View file

@ -809,7 +809,7 @@ class ComboBox: ListControl // docmain
assert(dis.hwndItem == handle);
assert(dis.CtlType == ODT_COMBOBOX);
}
body
do
{
DrawItemState state;
state = cast(DrawItemState)dis.itemState;
@ -849,7 +849,7 @@ class ComboBox: ListControl // docmain
{
assert(mis.CtlType == ODT_COMBOBOX);
}
body
do
{
MeasureItemEventArgs miea;
scope Graphics gpx = new CommonGraphics(handle(), GetDC(handle));

View file

@ -1073,8 +1073,7 @@ class Control: DObject, IWindow // docmain
}
else
{
delete droptarget;
droptarget = null;
destroy(droptarget); // delete is deprecated.
RevokeDragDrop(hwnd);
}
}
@ -1301,7 +1300,7 @@ class Control: DObject, IWindow // docmain
assert(isHandleCreated);
}
}
body
do
{
// All parent controls need to be visible and enabled, too.
// Don't need to check -isHandleCreated- because IsWindowVisible() will fail from a null HWND.
@ -2623,7 +2622,7 @@ class Control: DObject, IWindow // docmain
{
assert(result >= 0);
}
body
do
{
if(!parent)
return 0;
@ -6065,7 +6064,7 @@ class Control: DObject, IWindow // docmain
{
assert(hwnd);
}
body
do
{
this.hwnd = hwnd;
owned = false;
@ -6480,7 +6479,7 @@ class Control: DObject, IWindow // docmain
{
assert(!recreatingHandle);
}
body
do
{
if(!isHandleCreated)
return;
@ -7149,7 +7148,7 @@ class Control: DObject, IWindow // docmain
assert(!_hbrBg);
}
}
body
do
{
_hbrBg = hbr;
ownedbg = true;
@ -7409,7 +7408,7 @@ class ScrollableControl: Control // docmain
assert(newSize.width > 0);
assert(newSize.height > 0);
}
body
do
{
autossz = newSize;
}
@ -7443,7 +7442,7 @@ class ScrollableControl: Control // docmain
assert(fromScale.width);
assert(fromScale.height);
}
body
do
{
area.width = cast(int)(cast(float)area.width / cast(float)fromScale.width * cast(float)toScale.width);
area.height = cast(int)(cast(float)area.height / cast(float)fromScale.height * cast(float)toScale.height);

View file

@ -246,7 +246,7 @@ class DataFormats // docmain
{
assert(!(id in fmts));
}
body
do
{
Format fmt;
fmt = new Format;
@ -482,11 +482,6 @@ class DataFormats // docmain
return data.value; // ?
}
}
this()
{
}
}
@ -529,7 +524,7 @@ struct Data // docmain
{
assert(_arguments.length == 1);
}
body
do
{
Data result;
result._info = _arguments[0];

View file

@ -1632,7 +1632,7 @@ class Picture: Image // docmain
{
assert(stm !is null);
}
body
do
{
scope DStreamToIStream istm = new DStreamToIStream(stm);
return _fromIStream(istm);

View file

@ -34,7 +34,7 @@ template Event(T1, T2) // docmain
{
assert(handler);
}
body
do
{
if(!_array.length)
{
@ -63,7 +63,7 @@ template Event(T1, T2) // docmain
{
assert(handler);
}
body
do
{
mixin _validateHandler!(TDG);

View file

@ -560,7 +560,7 @@ abstract class FileDialog: CommonDialog // docmain
{
assert(ofn.lpstrFile !is null);
}
body
do
{
if(ofn.Flags & OFN_ALLOWMULTISELECT)
{
@ -790,7 +790,7 @@ class OpenFileDialog: FileDialog // docmain
}
private import dfl.internal.stream; // TO-DO: remove this import; use dfl.internal.dlib.
private import undead.stream;
///
final Stream openFile()
@ -902,7 +902,7 @@ class SaveFileDialog: FileDialog // docmain
}
private import dfl.internal.stream; // TO-DO: remove this import; use dfl.internal.dlib.
private import undead.stream;
///
// Opens and creates with read and write access.

View file

@ -174,7 +174,7 @@ class Form: ContainerControl, IDialogResult // docmain
assert(shortcut & Keys.KEY_CODE); // At least one key code.
assert(pressed !is null);
}
body
do
{
if(shortcut in _shortcuts)
throw new DflException("Shortcut key conflict");
@ -1043,7 +1043,7 @@ class Form: ContainerControl, IDialogResult // docmain
assert(found);
}
}+/
body
do
{
if(wmdiparent is frm)
return;
@ -1496,7 +1496,7 @@ class Form: ContainerControl, IDialogResult // docmain
assert(found);
}
}+/
body
do
{
if(wowner is frm)
return;

View file

@ -1,4 +1,4 @@
call makelib
call makelib "%~1"
@rem This errorlevel check fails on Win9x because of the previous delete.
@rem @if errorlevel 1 goto fail
@if not "%dfl_failed%" == "" goto fail

BIN
win32/dfl/go32omf.bat.lnk Normal file

Binary file not shown.

View file

@ -227,7 +227,9 @@ else
}
}
alias std.algorithm.find charFindInString;
private import std.algorithm.searching;
alias std.algorithm.searching.find charFindInString;
alias std.string.toStringz stringToStringz;
@ -333,13 +335,13 @@ private import std.ascii;
alias std.ascii.isHexDigit charIsHexDigit;
private import dfl.internal.stream;
private import undead.stream;// dfl.internal.stream is deprecated.
alias dfl.internal.stream.Stream DStream;
alias undead.stream.Stream DStream;// dfl.internal.stream.Stream is deprecated.
alias dfl.internal.stream.OutputStream DOutputStream;
alias undead.stream.OutputStream DOutputStream;//dfl.internal.stream.OutputStream is deprecated.
alias dfl.internal.stream.StreamException DStreamException;
alias undead.stream.StreamException DStreamException;//dfl.internal.stream.StreamException is deprecated.
alias Object DObject;

File diff suppressed because it is too large Load diff

View file

@ -149,7 +149,7 @@ template _getlen(T)
{
assert(tz);
}
body
do
{
T* p;
for(p = tz; *p; p++)

View file

@ -1266,7 +1266,7 @@ class ListBox: ListControl // docmain
assert(dis.hwndItem == handle);
assert(dis.CtlType == ODT_LISTBOX);
}
body
do
{
DrawItemState state;
state = cast(DrawItemState)dis.itemState;
@ -1307,7 +1307,7 @@ class ListBox: ListControl // docmain
{
assert(mis.CtlType == ODT_LISTBOX);
}
body
do
{
MeasureItemEventArgs miea;
scope Graphics gpx = new CommonGraphics(handle(), GetDC(handle));

View file

@ -192,7 +192,7 @@ class ListViewItem: DObject
{
assert(!owner.isubs);
}
body
do
{
_item = owner;
}
@ -706,7 +706,7 @@ class ListView: ControlSuperClass // docmain
{
assert(lv.litems is null);
}
body
do
{
this.lv = lv;
}
@ -802,7 +802,7 @@ class ListView: ControlSuperClass // docmain
{
assert(created);
}
body
do
{
int ii;
foreach(int i, ListViewItem item; _items)
@ -884,7 +884,7 @@ class ListView: ControlSuperClass // docmain
{
assert(!owner.cols);
}
body
do
{
lv = owner;
}
@ -913,7 +913,7 @@ class ListView: ControlSuperClass // docmain
{
assert(created);
}
body
do
{
int ii;
foreach(int i, ColumnHeader header; _headers)
@ -2560,7 +2560,7 @@ class ListView: ControlSuperClass // docmain
{
assert(mask);
}
body
do
{
wlvexstyle = (wlvexstyle & ~mask) | (flags & mask);
if(created)
@ -2580,7 +2580,7 @@ class ListView: ControlSuperClass // docmain
{
assert(created);
}
body
do
{
/+
cprintf("^ Insert item: index=%d, lparam=0x%X, text='%.*s', subItemIndex=%d\n",
@ -2628,7 +2628,7 @@ class ListView: ControlSuperClass // docmain
{
assert(subItemIndex > 0);
}
body
do
{
return _ins(index, cast(LPARAM)cast(void*)subItem, subItem.text, subItemIndex).toI32;
}
@ -2677,7 +2677,7 @@ class ListView: ControlSuperClass // docmain
{
assert(created);
}
body
do
{
return prevwproc(LVM_REDRAWITEMS, cast(WPARAM)index, cast(LPARAM)index);
}

View file

@ -12,6 +12,8 @@ if "%~1"=="32mscoff" (
@call makecoff.bat %1
goto done
)
if "%~1"=="32omf" set dmd_omf_flag=-m32omf
else set dmd_omf_flag=
@echo off
@cls
@ -42,18 +44,18 @@ set _stdcwindowsd=internal/_stdcwindows.d
set _stdcwindowsobj=_stdcwindows.obj
:dfl_not_tango_files
set dfl_files=package.d all.d base.d application.d internal/stream.d internal/dlib.d internal/clib.d internal/utf.d internal/com.d control.d clippingform.d form.d registry.d drawing.d menu.d notifyicon.d commondialog.d filedialog.d folderdialog.d panel.d textbox.d richtextbox.d picturebox.d listbox.d groupbox.d splitter.d usercontrol.d button.d label.d collections.d internal/winapi.d internal/wincom.d event.d socket.d timer.d environment.d messagebox.d tooltip.d combobox.d treeview.d tabcontrol.d colordialog.d listview.d data.d clipboard.d fontdialog.d progressbar.d resources.d statusbar.d imagelist.d toolbar.d %_stdcwindowsd%
set dfl_files=package.d all.d base.d application.d internal/dlib.d internal/clib.d internal/utf.d internal/com.d control.d clippingform.d form.d registry.d drawing.d menu.d notifyicon.d commondialog.d filedialog.d folderdialog.d panel.d textbox.d richtextbox.d picturebox.d listbox.d groupbox.d splitter.d usercontrol.d button.d label.d collections.d internal/winapi.d internal/wincom.d event.d socket.d timer.d environment.d messagebox.d tooltip.d combobox.d treeview.d tabcontrol.d colordialog.d listview.d data.d clipboard.d fontdialog.d progressbar.d resources.d statusbar.d imagelist.d toolbar.d %_stdcwindowsd%
set dfl_objs=package.obj all.obj base.obj application.obj stream.obj dlib.obj clib.obj utf.obj com.obj control.obj clippingform.obj form.obj registry.obj drawing.obj menu.obj notifyicon.obj commondialog.obj filedialog.obj folderdialog.obj panel.obj textbox.obj richtextbox.obj picturebox.obj listbox.obj groupbox.obj splitter.obj usercontrol.obj button.obj label.obj collections.obj winapi.obj wincom.obj event.obj socket.obj timer.obj environment.obj messagebox.obj tooltip.obj combobox.obj treeview.obj tabcontrol.obj colordialog.obj listview.obj data.obj clipboard.obj fontdialog.obj progressbar.obj resources.obj statusbar.obj imagelist.obj toolbar.obj %_stdcwindowsobj%
set dfl_objs=package.obj all.obj base.obj application.obj dlib.obj clib.obj utf.obj com.obj control.obj clippingform.obj form.obj registry.obj drawing.obj menu.obj notifyicon.obj commondialog.obj filedialog.obj folderdialog.obj panel.obj textbox.obj richtextbox.obj picturebox.obj listbox.obj groupbox.obj splitter.obj usercontrol.obj button.obj label.obj collections.obj winapi.obj wincom.obj event.obj socket.obj timer.obj environment.obj messagebox.obj tooltip.obj combobox.obj treeview.obj tabcontrol.obj colordialog.obj listview.obj data.obj clipboard.obj fontdialog.obj progressbar.obj resources.obj statusbar.obj imagelist.obj toolbar.obj %_stdcwindowsobj%
@rem Also update link pragmas for build.
set dfl_libs_dfl=user32_dfl.lib shell32_dfl.lib olepro32_dfl.lib
set dfl_libs_dfl=user32_dfl.lib shell32_dfl.lib olepro32_dfl.lib %dmd_path%\lib\undead.lib
set dfl_libs=%dmc_path%\lib\gdi32.lib %dmc_path%\lib\comctl32.lib %dmc_path%\lib\advapi32.lib %dmc_path%\lib\comdlg32.lib %dmc_path%\lib\ole32.lib %dmc_path%\lib\uuid.lib %dmd_path_windows%\lib\ws2_32.lib %dfl_libs_dfl%
@rem -version=NO_DRAG_DROP -version=NO_MDI
@rem -debug=SHOW_MESSAGE_INFO -debug=MESSAGE_PAUSE
@rem set dfl_flags=%dfl_flags% -debug=SHOW_MESSAGENFO
set _dfl_flags=%dfl_flags% -wi
set _dfl_flags=%dfl_flags% -wi %dmd_omf_flag%
if not "%dfl_debug_flags%" == "" goto dfl_debug_flags_set
set dfl_debug_flags=-debug -version=DFL_UNICODE

View file

@ -336,7 +336,7 @@ out(result)
assert(charIsHexDigit(ch));
}
}
body
do
{
char[] result;
Dstring stmp;

View file

@ -69,7 +69,7 @@ else
{
assert(id >= WORD.min && id <= WORD.max);
}
body
do
{
/+
HICON hi;
@ -110,7 +110,7 @@ else
{
assert(id >= WORD.min && id <= WORD.max);
}
body
do
{
// Can't have size 0 (plus causes Windows to use the actual size).
//if(width <= 0 || height <= 0)
@ -146,7 +146,7 @@ else
{
assert(id >= WORD.min && id <= WORD.max);
}
body
do
{
HBITMAP h;
h = cast(HBITMAP)LoadImageA(hinst, cast(LPCSTR)cast(WORD)id, IMAGE_BITMAP,
@ -176,7 +176,7 @@ else
{
assert(id >= WORD.min && id <= WORD.max);
}
body
do
{
HCURSOR h;
h = cast(HCURSOR)LoadImageA(hinst, cast(LPCSTR)cast(WORD)id, IMAGE_CURSOR,
@ -206,7 +206,7 @@ else
{
assert(id >= WORD.min && id <= WORD.max);
}
body
do
{
// Not casting to wDstring because a resource isn't guaranteed to be the same size.
wchar* ws = cast(wchar*)_getData(cast(LPCWSTR)RT_STRING, cast(LPCWSTR)cast(WORD)(id / 16 + 1)).ptr;
@ -250,7 +250,7 @@ else
assert(type >= WORD.min && type <= WORD.max);
assert(id >= WORD.min && id <= WORD.max);
}
body
do
{
return _getData(cast(LPCWSTR)type, cast(LPCWSTR)id);
}
@ -261,7 +261,7 @@ else
{
assert(id >= WORD.min && id <= WORD.max);
}
body
do
{
return _getData(utf8stringToUtf16stringz(type), cast(LPCWSTR)id);
}
@ -272,7 +272,7 @@ else
{
assert(type >= WORD.min && type <= WORD.max);
}
body
do
{
return _getData(cast(LPCWSTR)type, utf8stringToUtf16stringz(name));
}

View file

@ -80,11 +80,11 @@ class RichTextBox: TextBoxBase // docmain
with(miredo = new MenuItem)
{
text = "&Redo";
click ~= &menuRedo;
click.addHandler(&menuRedo);
contextMenu.menuItems.insert(1, miredo);
}
contextMenu.popup ~= &menuPopup2;
contextMenu.popup.addHandler(&menuPopup2);
}
}
@ -748,7 +748,7 @@ class RichTextBox: TextBoxBase // docmain
{
assert(created);
}
body
do
{
//SendMessageA(handle, EM_GETCHARFORMAT, selection, cast(LPARAM)cf);
//CallWindowProcA(richtextboxPrevWndProc, hwnd, EM_GETCHARFORMAT, selection, cast(LPARAM)cf);
@ -761,7 +761,7 @@ class RichTextBox: TextBoxBase // docmain
{
assert(created);
}
body
do
{
/+
//if(!SendMessageA(handle, EM_SETCHARFORMAT, scf, cast(LPARAM)cf))
@ -787,7 +787,7 @@ class RichTextBox: TextBoxBase // docmain
{
assert(created);
}
body
do
{
_StreamStr si;
EDITSTREAM es;
@ -808,7 +808,7 @@ class RichTextBox: TextBoxBase // docmain
{
assert(created);
}
body
do
{
_StreamStr so;
EDITSTREAM es;
@ -927,7 +927,7 @@ class RichTextBox: TextBoxBase // docmain
assert(max >= 0);
assert(max >= min);
}
body
do
{
if(min == max)
return null;

View file

@ -160,7 +160,7 @@ class AsyncSocket: DflSocket // docmain
}
override void close()
override void close() @nogc scope @trusted
{
unregisterEvent(this);
super.close();
@ -426,7 +426,7 @@ class SocketQueue // docmain
{
assert(sock !is null);
}
body
do
{
this.sock = sock;
}
@ -560,7 +560,7 @@ class SocketQueue // docmain
{
assert(_sock is sock);
}
body
do
{
switch(type)
{

View file

@ -172,7 +172,7 @@ class StatusBarPanel: DObject
{
assert(mw >= 0);
}
body
do
{
}
@ -286,7 +286,7 @@ class StatusBar: ControlSuperClass // docmain
{
assert(sb.lpanels is null);
}
body
do
{
this.sb = sb;
}

View file

@ -182,7 +182,7 @@ class TabPageCollection
{
assert(owner.tchildren is null);
}
body
do
{
tc = owner;
}
@ -199,7 +199,7 @@ class TabPageCollection
{
assert(created);
}
body
do
{
Rect area;
area = tc.displayRectangle;
@ -988,7 +988,7 @@ class TabControl: TabControlBase // docmain
{
assert(created);
}
body
do
{
int i;
i = tabPages.indexOf(page);

View file

@ -724,11 +724,11 @@ abstract class TextBoxBase: ControlSuperClass // docmain
MenuItem mi;
cmenu = new ContextMenu;
cmenu.popup ~= &menuPopup;
cmenu.popup.addHandler(&menuPopup);
miundo = new MenuItem;
miundo.text = "&Undo";
miundo.click ~= &menuUndo;
miundo.click.addHandler(&menuUndo);
miundo.index = 0;
cmenu.menuItems.add(miundo);
@ -739,25 +739,25 @@ abstract class TextBoxBase: ControlSuperClass // docmain
micut = new MenuItem;
micut.text = "Cu&t";
micut.click ~= &menuCut;
micut.click.addHandler(&menuCut);
micut.index = 2;
cmenu.menuItems.add(micut);
micopy = new MenuItem;
micopy.text = "&Copy";
micopy.click ~= &menuCopy;
micopy.click.addHandler(&menuCopy);
micopy.index = 3;
cmenu.menuItems.add(micopy);
mipaste = new MenuItem;
mipaste.text = "&Paste";
mipaste.click ~= &menuPaste;
mipaste.click.addHandler(&menuPaste);
mipaste.index = 4;
cmenu.menuItems.add(mipaste);
midel = new MenuItem;
midel.text = "&Delete";
midel.click ~= &menuDelete;
midel.click.addHandler(&menuDelete);
midel.index = 5;
cmenu.menuItems.add(midel);
@ -768,7 +768,7 @@ abstract class TextBoxBase: ControlSuperClass // docmain
misel = new MenuItem;
misel.text = "Select &All";
misel.click ~= &menuSelectAll;
misel.click.addHandler(&menuSelectAll);
misel.index = 7;
cmenu.menuItems.add(misel);
}

View file

@ -101,7 +101,7 @@ class Timer // docmain
if(dg)
{
this._dg = dg;
tick ~= &_dgcall;
tick.addHandler(&_dgcall);
}
}
@ -111,7 +111,7 @@ class Timer // docmain
assert(dg !is null);
this();
tick ~= dg;
tick.addHandler(dg);
}
/// ditto
@ -120,7 +120,7 @@ class Timer // docmain
assert(dg !is null);
this();
tick ~= dg;
tick.addHandler(dg);
}

View file

@ -214,7 +214,7 @@ class ToolTip // docmain
//throw o;
}
}
body
do
{
TOOLINFOA tool;
tool.cbSize = TOOLINFOA.sizeof;

View file

@ -861,7 +861,7 @@ class TreeNodeCollection
{
assert(created);
}
body
do
{
TV_INSERTSTRUCTA tis;
Message m;

View file

@ -0,0 +1,2 @@
dmd -m32omf hello_dfl.d
hello_dfl.exe

View file

@ -0,0 +1,60 @@
import std.conv : to;
import dfl;
pragma(lib, "dfl.lib");
class MainForm : Form {
private Button _button;
private ListBox _listbox;
private MainMenu _menu;
this() {
text = "Hello DFL";
_button = new TestButton();
_button.text = "ok";
_button.parent = this;
_button.location = Point(100, 100);
_listbox = new ListBox();
_listbox.parent = this;
_listbox.size = Size(60, 150);
_listbox.items.add("foo");
_listbox.items.addRange(["hoge", "piyo"]);
_listbox.click.addHandler(
(Control c, EventArgs ea) {
int index = _listbox.selectedIndex;
msgBox(to!string(index));
if(index >= 0) {
string msg = _listbox.selectedItem.toString();
msgBox(msg);
}
}
);
_menu = new MainMenu();
MenuItem item = new MenuItem();
item.text = "File";
MenuItem subItem = new MenuItem();
subItem.text = "Open";
auto menuClickHandler = (MenuItem mi, EventArgs ea){ msgBox("open the door"); };
subItem.click.addHandler(menuClickHandler);
item.menuItems.add(subItem);
_menu.menuItems.add(item);
this.menu = _menu;
}
override void onResize(EventArgs ea) {
refresh();
}
}
class TestButton : Button {
override void onClick(EventArgs ea) {
msgBox("hi");
}
}
void main() {
Application.run(new MainForm());
}

View file

@ -0,0 +1,3 @@
set dmd_path=c:\d\dmd2\windows
set dmc_path=c:\dmc\dm
cmd