mirror of
https://github.com/Rayerd/dfl.git
synced 2025-04-27 22:00:29 +03:00
Compare commits
5 commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
4509e7309e | ||
![]() |
d5ed9baf4e | ||
![]() |
2cbd47fa98 | ||
![]() |
e26ea5fe78 | ||
![]() |
bf168783ef |
57 changed files with 1290 additions and 871 deletions
BIN
examples/notifyicon/image/icon2.ico
Normal file
BIN
examples/notifyicon/image/icon2.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 23 KiB |
|
@ -30,6 +30,23 @@ class MainForm : Form
|
||||||
_notifyIcon.contextMenu.menuItems.add(menuItem1);
|
_notifyIcon.contextMenu.menuItems.add(menuItem1);
|
||||||
_notifyIcon.contextMenu.menuItems.add(menuItem2);
|
_notifyIcon.contextMenu.menuItems.add(menuItem2);
|
||||||
_notifyIcon.show();
|
_notifyIcon.show();
|
||||||
|
|
||||||
|
_notifyIcon.balloonTipTitle = "Balloon tip example";
|
||||||
|
_notifyIcon.balloonTipText = "Welcome to the D world!";
|
||||||
|
static if (false)
|
||||||
|
{
|
||||||
|
_notifyIcon.balloonTipIconStyle = BalloonTipIconStyle.INFO;
|
||||||
|
// _notifyIcon.balloonTipIconStyle = BalloonTipIconStyle.ERROR;
|
||||||
|
// _notifyIcon.balloonTipIconStyle = BalloonTipIconStyle.WARNING;
|
||||||
|
// _notifyIcon.balloonTipIconStyle = BalloonTipIconStyle.NONE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_notifyIcon.balloonTipIconStyle = BalloonTipIconStyle.USER;
|
||||||
|
_notifyIcon.balloonTipIcon = new Icon(r".\image\icon2.ico");
|
||||||
|
}
|
||||||
|
_notifyIcon.balloonTipSound = true;
|
||||||
|
_notifyIcon.showBalloonTip();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,19 +5,22 @@
|
||||||
///
|
///
|
||||||
module dfl.application;
|
module dfl.application;
|
||||||
|
|
||||||
private import dfl.internal.dlib, dfl.internal.clib;
|
import dfl.base;
|
||||||
|
import dfl.button;
|
||||||
private import dfl.base, dfl.form, dfl.internal.winapi, dfl.event;
|
import dfl.control;
|
||||||
private import dfl.control, dfl.drawing, dfl.label;
|
import dfl.drawing;
|
||||||
private import dfl.button, dfl.textbox, dfl.internal.wincom, dfl.environment;
|
import dfl.environment;
|
||||||
private import dfl.internal.utf;
|
import dfl.event;
|
||||||
|
import dfl.form;
|
||||||
|
import dfl.label;
|
||||||
|
import dfl.textbox;
|
||||||
|
|
||||||
version(DFL_NO_RESOURCES)
|
version(DFL_NO_RESOURCES)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
private import dfl.resources;
|
import dfl.resources;
|
||||||
}
|
}
|
||||||
|
|
||||||
version(DFL_NO_MENUS)
|
version(DFL_NO_MENUS)
|
||||||
|
@ -25,9 +28,15 @@ version(DFL_NO_MENUS)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
private import dfl.menu;
|
import dfl.menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
import dfl.internal.clib;
|
||||||
|
import dfl.internal.dlib;
|
||||||
|
import dfl.internal.utf;
|
||||||
|
import dfl.internal.winapi;
|
||||||
|
import dfl.internal.wincom;
|
||||||
|
|
||||||
|
|
||||||
version = DFL_NO_ZOMBIE_FORM;
|
version = DFL_NO_ZOMBIE_FORM;
|
||||||
|
|
||||||
|
@ -362,7 +371,7 @@ final class Application // docmain
|
||||||
{
|
{
|
||||||
if(!i)
|
if(!i)
|
||||||
filters = filters[1 .. $];
|
filters = filters[1 .. $];
|
||||||
else if(i == filters.length - 1)
|
else if(i + 1 == filters.length)
|
||||||
filters = filters[0 .. i];
|
filters = filters[0 .. i];
|
||||||
else
|
else
|
||||||
filters = filters[0 .. i] ~ filters[i + 1 .. $];
|
filters = filters[0 .. i] ~ filters[i + 1 .. $];
|
||||||
|
@ -1684,7 +1693,7 @@ extern(Windows) void _gcTimeout(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dw
|
||||||
// Note: phobos-only.
|
// Note: phobos-only.
|
||||||
debug(SHOW_MESSAGE_INFO)
|
debug(SHOW_MESSAGE_INFO)
|
||||||
{
|
{
|
||||||
private import std.stdio, std.string;
|
import std.stdio, std.string;
|
||||||
|
|
||||||
|
|
||||||
void showMessageInfo(ref Message m)
|
void showMessageInfo(ref Message m)
|
||||||
|
@ -1866,20 +1875,18 @@ extern(Windows) LRESULT dflWndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp
|
||||||
{
|
{
|
||||||
switch(wparam)
|
switch(wparam)
|
||||||
{
|
{
|
||||||
case WPARAM_DFL_INVOKE:
|
case WPARAM_DFL_INVOKE_PARAMS:
|
||||||
{
|
{
|
||||||
InvokeData* pinv;
|
DflInvokeParam* p = cast(DflInvokeParam*)lparam;
|
||||||
pinv = cast(InvokeData*)lparam;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pinv.result = pinv.dg(pinv.args);
|
p.fp(Application.lookupHwnd(hwnd), p.params.ptr[0 .. p.nparams]);
|
||||||
}
|
}
|
||||||
catch(DThrowable e)
|
catch(DThrowable e)
|
||||||
{
|
{
|
||||||
//Application.onThreadException(e);
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pinv.exception = e;
|
p.exception = e;
|
||||||
}
|
}
|
||||||
catch(DThrowable e2)
|
catch(DThrowable e2)
|
||||||
{
|
{
|
||||||
|
@ -1889,20 +1896,18 @@ extern(Windows) LRESULT dflWndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp
|
||||||
}
|
}
|
||||||
return LRESULT_DFL_INVOKE;
|
return LRESULT_DFL_INVOKE;
|
||||||
|
|
||||||
case WPARAM_DFL_INVOKE_SIMPLE:
|
case WPARAM_DFL_INVOKE_NOPARAMS:
|
||||||
{
|
{
|
||||||
InvokeSimpleData* pinv;
|
DflInvokeParam* p = cast(DflInvokeParam*)lparam;
|
||||||
pinv = cast(InvokeSimpleData*)lparam;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pinv.dg();
|
p.fp(Application.lookupHwnd(hwnd), p.params);
|
||||||
}
|
}
|
||||||
catch(DThrowable e)
|
catch(DThrowable e)
|
||||||
{
|
{
|
||||||
//Application.onThreadException(e);
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pinv.exception = e;
|
p.exception = e;
|
||||||
}
|
}
|
||||||
catch(DThrowable e2)
|
catch(DThrowable e2)
|
||||||
{
|
{
|
||||||
|
@ -1912,21 +1917,24 @@ extern(Windows) LRESULT dflWndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp
|
||||||
}
|
}
|
||||||
return LRESULT_DFL_INVOKE;
|
return LRESULT_DFL_INVOKE;
|
||||||
|
|
||||||
case WPARAM_DFL_DELAY_INVOKE:
|
case WPARAM_DFL_DELAY_INVOKE_NOPARAMS:
|
||||||
try
|
|
||||||
{
|
{
|
||||||
(cast(void function())lparam)();
|
DflInvokeParam* p = cast(DflInvokeParam*)lparam;
|
||||||
}
|
try
|
||||||
catch(DThrowable e)
|
{
|
||||||
{
|
p.fp(Application.lookupHwnd(hwnd), p.params);
|
||||||
Application.onThreadException(e);
|
}
|
||||||
|
catch(DThrowable e)
|
||||||
|
{
|
||||||
|
Application.onThreadException(e);
|
||||||
|
}
|
||||||
|
dfl.internal.clib.free(p);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WPARAM_DFL_DELAY_INVOKE_PARAMS:
|
case WPARAM_DFL_DELAY_INVOKE_PARAMS:
|
||||||
{
|
{
|
||||||
DflInvokeParam* p;
|
DflInvokeParam* p = cast(DflInvokeParam*)lparam;
|
||||||
p = cast(DflInvokeParam*)lparam;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
p.fp(Application.lookupHwnd(hwnd), p.params.ptr[0 .. p.nparams]);
|
p.fp(Application.lookupHwnd(hwnd), p.params.ptr[0 .. p.nparams]);
|
||||||
|
@ -2044,36 +2052,20 @@ else
|
||||||
|
|
||||||
enum LRESULT LRESULT_DFL_INVOKE = 0x95FADF; // Magic number.
|
enum LRESULT LRESULT_DFL_INVOKE = 0x95FADF; // Magic number.
|
||||||
|
|
||||||
|
UINT wmDfl; // TODO: shared?
|
||||||
struct InvokeData
|
|
||||||
{
|
|
||||||
Object delegate(Object[]) dg;
|
|
||||||
Object[] args;
|
|
||||||
Object result;
|
|
||||||
DThrowable exception = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
struct InvokeSimpleData
|
|
||||||
{
|
|
||||||
void delegate() dg;
|
|
||||||
DThrowable exception = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
UINT wmDfl;
|
|
||||||
|
|
||||||
enum: WPARAM
|
enum: WPARAM
|
||||||
{
|
{
|
||||||
WPARAM_DFL_INVOKE = 78,
|
WPARAM_DFL_INVOKE_PARAMS = 78,
|
||||||
WPARAM_DFL_DELAY_INVOKE = 79,
|
WPARAM_DFL_DELAY_INVOKE_NOPARAMS = 79,
|
||||||
WPARAM_DFL_DELAY_INVOKE_PARAMS = 80,
|
WPARAM_DFL_DELAY_INVOKE_PARAMS = 80,
|
||||||
WPARAM_DFL_INVOKE_SIMPLE = 81,
|
WPARAM_DFL_INVOKE_NOPARAMS = 81,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DflInvokeParam
|
struct DflInvokeParam
|
||||||
{
|
{
|
||||||
void function(Control, size_t[]) fp;
|
void function(Control, size_t[]) fp;
|
||||||
|
DThrowable exception;
|
||||||
size_t nparams;
|
size_t nparams;
|
||||||
size_t[1] params;
|
size_t[1] params;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,15 @@
|
||||||
///
|
///
|
||||||
module dfl.base;
|
module dfl.base;
|
||||||
|
|
||||||
private import dfl.internal.dlib, dfl.internal.clib;
|
import dfl.drawing;
|
||||||
|
import dfl.event;
|
||||||
|
|
||||||
private import dfl.internal.winapi, dfl.drawing, dfl.event;
|
import dfl.internal.clib;
|
||||||
|
import dfl.internal.dlib;
|
||||||
|
import dfl.internal.winapi;
|
||||||
|
|
||||||
|
import core.internal.hash;
|
||||||
|
import core.stdcpp.new_;
|
||||||
|
|
||||||
|
|
||||||
alias HWindow = HWND;
|
alias HWindow = HWND;
|
||||||
|
@ -68,6 +74,12 @@ class StringObject: DObject
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override size_t toHash() const nothrow @safe
|
||||||
|
{
|
||||||
|
return hashOf(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
override int opCmp(Object o) const
|
override int opCmp(Object o) const
|
||||||
{
|
{
|
||||||
return stringICmp(value, getObjectString(o)); // ?
|
return stringICmp(value, getObjectString(o)); // ?
|
||||||
|
@ -395,26 +407,28 @@ abstract class WaitHandle
|
||||||
|
|
||||||
private static DWORD _wait(WaitHandle[] handles, BOOL waitall, DWORD msTimeout)
|
private static DWORD _wait(WaitHandle[] handles, BOOL waitall, DWORD msTimeout)
|
||||||
{
|
{
|
||||||
DWORD result;
|
void fail()
|
||||||
HANDLE* hs;
|
{
|
||||||
|
throw new DflException("Wait failure");
|
||||||
|
}
|
||||||
|
|
||||||
// Some implementations fail with > 64 handles, but that will return WAIT_FAILED;
|
// Some implementations fail with > 64 handles, but that will return WAIT_FAILED;
|
||||||
// all implementations fail with >= 128 handles due to WAIT_ABANDONED_0 being 128.
|
// all implementations fail with >= 128 handles due to WAIT_ABANDONED_0 being 128.
|
||||||
if(handles.length >= 128)
|
if(handles.length >= 128)
|
||||||
goto fail;
|
fail();
|
||||||
|
|
||||||
//hs = new HANDLE[handles.length];
|
//HANDLE* hs = new HANDLE[handles.length];
|
||||||
hs = cast(HANDLE*)alloca(HANDLE.sizeof * handles.length);
|
HANDLE* hs = cast(HANDLE*)alloca(HANDLE.sizeof * handles.length);
|
||||||
|
|
||||||
foreach(size_t i, WaitHandle wh; handles)
|
foreach(size_t i, WaitHandle wh; handles)
|
||||||
{
|
{
|
||||||
hs[i] = wh.handle;
|
hs[i] = wh.handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = WaitForMultipleObjects(handles.length.toI32, hs, waitall, msTimeout);
|
DWORD result = WaitForMultipleObjects(handles.length.toI32, hs, waitall, msTimeout);
|
||||||
if(WAIT_FAILED == result)
|
if(WAIT_FAILED == result)
|
||||||
{
|
{
|
||||||
fail:
|
fail();
|
||||||
throw new DflException("Wait failure");
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -440,8 +454,7 @@ abstract class WaitHandle
|
||||||
|
|
||||||
static int waitAny(WaitHandle[] handles, DWORD msTimeout)
|
static int waitAny(WaitHandle[] handles, DWORD msTimeout)
|
||||||
{
|
{
|
||||||
DWORD result;
|
DWORD result = _wait(handles, false, msTimeout);
|
||||||
result = _wait(handles, false, msTimeout);
|
|
||||||
return cast(int)result; // Same return info.
|
return cast(int)result; // Same return info.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,8 +467,7 @@ abstract class WaitHandle
|
||||||
|
|
||||||
void waitOne(DWORD msTimeout)
|
void waitOne(DWORD msTimeout)
|
||||||
{
|
{
|
||||||
DWORD result;
|
DWORD result = WaitForSingleObject(handle, msTimeout);
|
||||||
result = WaitForSingleObject(handle, msTimeout);
|
|
||||||
if(WAIT_FAILED == result)
|
if(WAIT_FAILED == result)
|
||||||
throw new DflException("Wait failure");
|
throw new DflException("Wait failure");
|
||||||
}
|
}
|
||||||
|
@ -1461,6 +1473,12 @@ class Cursor // docmain
|
||||||
{
|
{
|
||||||
return hcur == cur.hcur;
|
return hcur == cur.hcur;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override size_t toHash() const nothrow @safe
|
||||||
|
{
|
||||||
|
return hashOf(hcur);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Show/hide the current mouse cursor; reference counted.
|
/// Show/hide the current mouse cursor; reference counted.
|
||||||
|
@ -1540,35 +1558,36 @@ class Cursors // docmain
|
||||||
hcurHand = LoadCursorA(HINSTANCE.init, IDC_HAND);
|
hcurHand = LoadCursorA(HINSTANCE.init, IDC_HAND);
|
||||||
if(!hcurHand) // Must be Windows 95, so load the cursor from winhlp32.exe.
|
if(!hcurHand) // Must be Windows 95, so load the cursor from winhlp32.exe.
|
||||||
{
|
{
|
||||||
UINT len;
|
char[MAX_PATH] winhlpPath = void;
|
||||||
char[MAX_PATH] winhlppath = void;
|
|
||||||
|
string filePath = "\\winhlp32.exe";
|
||||||
len = GetWindowsDirectoryA(winhlppath.ptr, winhlppath.length - 16);
|
UINT len = GetWindowsDirectoryA(winhlpPath.ptr, winhlpPath.length);
|
||||||
if(!len || len > winhlppath.length - 16)
|
if (len == 0 || len + filePath.length > winhlpPath.length)
|
||||||
{
|
{
|
||||||
load_failed:
|
|
||||||
return arrow; // Just fall back to a normal arrow.
|
return arrow; // Just fall back to a normal arrow.
|
||||||
}
|
}
|
||||||
strcpy(winhlppath.ptr + len, "\\winhlp32.exe");
|
winhlpPath[len .. len + filePath.length] = filePath;
|
||||||
|
winhlpPath[len + filePath.length] = '\0';
|
||||||
|
|
||||||
HINSTANCE hinstWinhlp;
|
HINSTANCE hinstWinhlp = LoadLibraryExA(winhlpPath.ptr, HANDLE.init, LOAD_LIBRARY_AS_DATAFILE);
|
||||||
hinstWinhlp = LoadLibraryExA(winhlppath.ptr, HANDLE.init, LOAD_LIBRARY_AS_DATAFILE);
|
|
||||||
if(!hinstWinhlp)
|
if(!hinstWinhlp)
|
||||||
goto load_failed;
|
{
|
||||||
|
return arrow; // Just fall back to a normal arrow.
|
||||||
|
}
|
||||||
|
|
||||||
HCURSOR hcur;
|
HCURSOR hcur = LoadCursorA(hinstWinhlp, cast(char*)106);
|
||||||
hcur = LoadCursorA(hinstWinhlp, cast(char*)106);
|
|
||||||
if(!hcur) // No such cursor resource.
|
if(!hcur) // No such cursor resource.
|
||||||
{
|
{
|
||||||
FreeLibrary(hinstWinhlp);
|
FreeLibrary(hinstWinhlp);
|
||||||
goto load_failed;
|
return arrow; // Just fall back to a normal arrow.
|
||||||
}
|
}
|
||||||
|
|
||||||
hcurHand = CopyCursor(hcur);
|
hcurHand = CopyCursor(hcur);
|
||||||
if(!hcurHand)
|
if(!hcurHand)
|
||||||
{
|
{
|
||||||
FreeLibrary(hinstWinhlp);
|
FreeLibrary(hinstWinhlp);
|
||||||
//throw new DflException("Unable to copy cursor resource");
|
//throw new DflException("Unable to copy cursor resource");
|
||||||
goto load_failed;
|
return arrow; // Just fall back to a normal arrow.
|
||||||
}
|
}
|
||||||
|
|
||||||
FreeLibrary(hinstWinhlp);
|
FreeLibrary(hinstWinhlp);
|
||||||
|
@ -1584,8 +1603,7 @@ class Cursors // docmain
|
||||||
///
|
///
|
||||||
@property Cursor help() // getter
|
@property Cursor help() // getter
|
||||||
{
|
{
|
||||||
HCURSOR hcur;
|
HCURSOR hcur = LoadCursorA(HINSTANCE.init, IDC_HELP);
|
||||||
hcur = LoadCursorA(HINSTANCE.init, IDC_HELP);
|
|
||||||
if(!hcur) // IDC_HELP might not be supported on Windows 95, so fall back to a normal arrow.
|
if(!hcur) // IDC_HELP might not be supported on Windows 95, so fall back to a normal arrow.
|
||||||
return arrow;
|
return arrow;
|
||||||
return new Cursor(hcur);
|
return new Cursor(hcur);
|
||||||
|
@ -1608,32 +1626,45 @@ class Cursors // docmain
|
||||||
|
|
||||||
///
|
///
|
||||||
@property Cursor iBeam() // getter
|
@property Cursor iBeam() // getter
|
||||||
{ return new Cursor(LoadCursorA(HINSTANCE.init, IDC_IBEAM), false); }
|
{
|
||||||
|
return new Cursor(LoadCursorA(HINSTANCE.init, IDC_IBEAM), false);
|
||||||
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@property Cursor no() // getter
|
@property Cursor no() // getter
|
||||||
{ return new Cursor(LoadCursorA(HINSTANCE.init, IDC_NO), false); }
|
{
|
||||||
|
return new Cursor(LoadCursorA(HINSTANCE.init, IDC_NO), false);
|
||||||
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@property Cursor sizeAll() // getter
|
@property Cursor sizeAll() // getter
|
||||||
{ return new Cursor(LoadCursorA(HINSTANCE.init, IDC_SIZEALL), false); }
|
{
|
||||||
|
return new Cursor(LoadCursorA(HINSTANCE.init, IDC_SIZEALL), false);
|
||||||
|
}
|
||||||
|
|
||||||
/// ditto
|
/// ditto
|
||||||
@property Cursor sizeNESW() // getter
|
@property Cursor sizeNESW() // getter
|
||||||
{ return new Cursor(LoadCursorA(HINSTANCE.init, IDC_SIZENESW), false); }
|
{
|
||||||
|
return new Cursor(LoadCursorA(HINSTANCE.init, IDC_SIZENESW), false);
|
||||||
|
}
|
||||||
|
|
||||||
/// ditto
|
/// ditto
|
||||||
@property Cursor sizeNS() // getter
|
@property Cursor sizeNS() // getter
|
||||||
{ return new Cursor(LoadCursorA(HINSTANCE.init, IDC_SIZENS), false); }
|
{
|
||||||
|
return new Cursor(LoadCursorA(HINSTANCE.init, IDC_SIZENS), false);
|
||||||
|
}
|
||||||
|
|
||||||
/// ditto
|
/// ditto
|
||||||
@property Cursor sizeNWSE() // getter
|
@property Cursor sizeNWSE() // getter
|
||||||
{ return new Cursor(LoadCursorA(HINSTANCE.init, IDC_SIZENWSE), false); }
|
{
|
||||||
|
return new Cursor(LoadCursorA(HINSTANCE.init, IDC_SIZENWSE), false);
|
||||||
|
}
|
||||||
|
|
||||||
/// ditto
|
/// ditto
|
||||||
@property Cursor sizeWE() // getter
|
@property Cursor sizeWE() // getter
|
||||||
{ return new Cursor(LoadCursorA(HINSTANCE.init, IDC_SIZEWE), false); }
|
{
|
||||||
|
return new Cursor(LoadCursorA(HINSTANCE.init, IDC_SIZEWE), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/+
|
/+
|
||||||
|
@ -1647,7 +1678,9 @@ class Cursors // docmain
|
||||||
|
|
||||||
///
|
///
|
||||||
@property Cursor waitCursor() // getter
|
@property Cursor waitCursor() // getter
|
||||||
{ return new Cursor(LoadCursorA(HINSTANCE.init, IDC_WAIT), false); }
|
{
|
||||||
|
return new Cursor(LoadCursorA(HINSTANCE.init, IDC_WAIT), false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
|
|
|
@ -5,9 +5,14 @@
|
||||||
///
|
///
|
||||||
module dfl.button;
|
module dfl.button;
|
||||||
|
|
||||||
private import dfl.base, dfl.control, dfl.application, dfl.internal.winapi;
|
import dfl.application;
|
||||||
private import dfl.event, dfl.drawing, dfl.internal.dlib;
|
import dfl.base;
|
||||||
|
import dfl.control;
|
||||||
|
import dfl.drawing;
|
||||||
|
import dfl.event;
|
||||||
|
|
||||||
|
import dfl.internal.dlib;
|
||||||
|
import dfl.internal.winapi;
|
||||||
static import dfl.internal.utf;
|
static import dfl.internal.utf;
|
||||||
|
|
||||||
|
|
||||||
|
@ -452,7 +457,7 @@ class Button: ButtonBase, IButtonControl // docmain
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new DflException("Unsupported image format");
|
throw new DflException("Unsupported image format");
|
||||||
not_unsupported: ;
|
// not_unsupported: ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,14 +5,14 @@
|
||||||
///
|
///
|
||||||
module dfl.chart;
|
module dfl.chart;
|
||||||
|
|
||||||
private import dfl.base;
|
import dfl.base;
|
||||||
private import dfl.drawing;
|
import dfl.drawing;
|
||||||
|
|
||||||
private import std.csv;
|
import std.csv;
|
||||||
private import std.typecons;
|
import std.typecons;
|
||||||
private import std.conv;
|
import std.conv;
|
||||||
private import std.algorithm;
|
import std.algorithm;
|
||||||
private import std.range;
|
import std.range;
|
||||||
|
|
||||||
///
|
///
|
||||||
class TableRenderer(T...)
|
class TableRenderer(T...)
|
||||||
|
@ -37,7 +37,7 @@ class TableRenderer(T...)
|
||||||
_lastRecord = last;
|
_lastRecord = last;
|
||||||
}
|
}
|
||||||
/// ditto
|
/// ditto
|
||||||
this(string csv) // deprecated
|
private this(string csv)
|
||||||
{
|
{
|
||||||
_csv = csv;
|
_csv = csv;
|
||||||
_columns = T.length;
|
_columns = T.length;
|
||||||
|
@ -383,7 +383,7 @@ private:
|
||||||
|
|
||||||
///
|
///
|
||||||
class LineGraphRenderer(T...)
|
class LineGraphRenderer(T...)
|
||||||
if (is(T[0] == string) && T.length <= 17 || !is(T[0] == string) && T.length <= 16) // Supported number of colors is 16.
|
if ((is(T[0] == string) && T.length <= 17) || (!is(T[0] == string) && T.length <= 16)) // Supported number of colors is 16.
|
||||||
{
|
{
|
||||||
///
|
///
|
||||||
this(string csv, int numRecords)
|
this(string csv, int numRecords)
|
||||||
|
@ -400,7 +400,7 @@ class LineGraphRenderer(T...)
|
||||||
_lastRecord = last;
|
_lastRecord = last;
|
||||||
}
|
}
|
||||||
/// ditto
|
/// ditto
|
||||||
this(string csv) // deprecated
|
private this(string csv)
|
||||||
{
|
{
|
||||||
_csv = csv;
|
_csv = csv;
|
||||||
_vZeroPos = VerticalZeroPosition.BOTTOM;
|
_vZeroPos = VerticalZeroPosition.BOTTOM;
|
||||||
|
@ -980,7 +980,7 @@ class TimeChartRenderer(T...)
|
||||||
_lastRecord = last;
|
_lastRecord = last;
|
||||||
}
|
}
|
||||||
/// ditto
|
/// ditto
|
||||||
this(string csv) // deprecated
|
private this(string csv)
|
||||||
{
|
{
|
||||||
_csv = csv;
|
_csv = csv;
|
||||||
_chartMargins = ChartMargins(50, 50, 50, 50);
|
_chartMargins = ChartMargins(50, 50, 50, 50);
|
||||||
|
|
|
@ -5,12 +5,12 @@
|
||||||
/// Interfacing with the system clipboard for copy and paste operations.
|
/// Interfacing with the system clipboard for copy and paste operations.
|
||||||
module dfl.clipboard;
|
module dfl.clipboard;
|
||||||
|
|
||||||
private import dfl.base;
|
import dfl.base;
|
||||||
private import dfl.data;
|
import dfl.data;
|
||||||
private import dfl.drawing;
|
import dfl.drawing;
|
||||||
|
|
||||||
private import dfl.internal.dlib;
|
import dfl.internal.dlib;
|
||||||
private import dfl.internal.wincom;
|
import dfl.internal.wincom;
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
|
|
|
@ -1,9 +1,15 @@
|
||||||
module dfl.clippingform;
|
module dfl.clippingform;
|
||||||
|
|
||||||
private import dfl.all;
|
import dfl.base;
|
||||||
private import dfl.internal.dlib : toI32;
|
import dfl.form;
|
||||||
private import core.memory;
|
import dfl.control;
|
||||||
private import core.sys.windows.windows;
|
import dfl.event;
|
||||||
|
import dfl.drawing;
|
||||||
|
|
||||||
|
import dfl.internal.dlib : toI32;
|
||||||
|
|
||||||
|
import core.memory;
|
||||||
|
import core.sys.windows.windows;
|
||||||
|
|
||||||
///
|
///
|
||||||
struct RegionRects
|
struct RegionRects
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
///
|
///
|
||||||
module dfl.collections;
|
module dfl.collections;
|
||||||
|
|
||||||
private import dfl.internal.dlib;
|
import dfl.base;
|
||||||
|
|
||||||
private import dfl.base;
|
import dfl.internal.dlib;
|
||||||
|
|
||||||
|
|
||||||
void _blankListCallback(TValue)(size_t idx, TValue val) // package
|
void _blankListCallback(TValue)(size_t idx, TValue val) // package
|
||||||
|
@ -404,7 +404,7 @@ template ListWrapArray(TValue, alias Array,
|
||||||
ItemRemovingCallback(index, oldval); // Removing.
|
ItemRemovingCallback(index, oldval); // Removing.
|
||||||
if(!index)
|
if(!index)
|
||||||
Array = Array[1 .. $];
|
Array = Array[1 .. $];
|
||||||
else if(index == Array.length - 1)
|
else if(index + 1 == Array.length)
|
||||||
Array = Array[0 .. index];
|
Array = Array[0 .. index];
|
||||||
else if(index > 0 && index < cast(int)Array.length)
|
else if(index > 0 && index < cast(int)Array.length)
|
||||||
Array = Array[0 .. index] ~ Array[index + 1 .. $];
|
Array = Array[0 .. index] ~ Array[index + 1 .. $];
|
||||||
|
@ -534,7 +534,7 @@ template removeIndex(T) // package
|
||||||
{
|
{
|
||||||
if(!index)
|
if(!index)
|
||||||
array = array[1 .. array.length];
|
array = array[1 .. array.length];
|
||||||
else if(index == array.length - 1)
|
else if(index + 1 == array.length)
|
||||||
array = array[0 .. index];
|
array = array[0 .. index];
|
||||||
else
|
else
|
||||||
array = array[0 .. index] ~ array[index + 1 .. $];
|
array = array[0 .. index] ~ array[index + 1 .. $];
|
||||||
|
|
|
@ -5,15 +5,15 @@
|
||||||
///
|
///
|
||||||
module dfl.colordialog;
|
module dfl.colordialog;
|
||||||
|
|
||||||
private import dfl.application;
|
import dfl.application;
|
||||||
private import dfl.base;
|
import dfl.base;
|
||||||
private import dfl.drawing;
|
import dfl.drawing;
|
||||||
private import dfl.commondialog;
|
import dfl.commondialog;
|
||||||
|
|
||||||
private import dfl.internal.dlib;
|
import dfl.internal.dlib;
|
||||||
private import dfl.internal.utf;
|
import dfl.internal.utf;
|
||||||
private import dfl.internal.winapi;
|
import dfl.internal.winapi;
|
||||||
private import dfl.internal.wincom;
|
import dfl.internal.wincom;
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
|
|
|
@ -5,17 +5,17 @@
|
||||||
///
|
///
|
||||||
module dfl.combobox;
|
module dfl.combobox;
|
||||||
|
|
||||||
private import dfl.internal.dlib;
|
import dfl.application;
|
||||||
private import dfl.internal.winapi;
|
import dfl.base;
|
||||||
private import dfl.internal.utf;
|
import dfl.control;
|
||||||
|
import dfl.event;
|
||||||
|
import dfl.drawing;
|
||||||
|
import dfl.collections;
|
||||||
|
import dfl.listbox;
|
||||||
|
|
||||||
private import dfl.application;
|
import dfl.internal.dlib;
|
||||||
private import dfl.base;
|
import dfl.internal.winapi;
|
||||||
private import dfl.control;
|
import dfl.internal.utf;
|
||||||
private import dfl.event;
|
|
||||||
private import dfl.drawing;
|
|
||||||
private import dfl.collections;
|
|
||||||
private import dfl.listbox;
|
|
||||||
|
|
||||||
|
|
||||||
private extern(Windows) void _initCombobox();
|
private extern(Windows) void _initCombobox();
|
||||||
|
@ -513,7 +513,7 @@ class ComboBox: ListControl // docmain
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
static class ObjectCollection
|
static final class ObjectCollection
|
||||||
{
|
{
|
||||||
protected this(ComboBox lbox)
|
protected this(ComboBox lbox)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,14 +5,14 @@
|
||||||
///
|
///
|
||||||
module dfl.commondialog;
|
module dfl.commondialog;
|
||||||
|
|
||||||
private import dfl.application;
|
import dfl.application;
|
||||||
private import dfl.base;
|
import dfl.base;
|
||||||
private import dfl.control;
|
import dfl.control;
|
||||||
private import dfl.drawing;
|
import dfl.drawing;
|
||||||
private import dfl.event;
|
import dfl.event;
|
||||||
|
|
||||||
private import dfl.internal.winapi;
|
import dfl.internal.winapi;
|
||||||
private import dfl.internal.utf;
|
import dfl.internal.utf;
|
||||||
|
|
||||||
public import dfl.filedialog;
|
public import dfl.filedialog;
|
||||||
public import dfl.folderdialog;
|
public import dfl.folderdialog;
|
||||||
|
|
|
@ -5,15 +5,13 @@
|
||||||
///
|
///
|
||||||
module dfl.control;
|
module dfl.control;
|
||||||
|
|
||||||
private import dfl.base, dfl.form, dfl.drawing;
|
import dfl.application;
|
||||||
private import dfl.application, dfl.event, dfl.label;
|
import dfl.base;
|
||||||
private import dfl.collections;
|
import dfl.collections;
|
||||||
private import core.memory;
|
import dfl.drawing;
|
||||||
|
import dfl.event;
|
||||||
private import dfl.internal.dlib, dfl.internal.clib;
|
import dfl.form;
|
||||||
private import dfl.internal.winapi, dfl.internal.wincom;
|
import dfl.label;
|
||||||
private import dfl.internal.utf;
|
|
||||||
private import dfl.internal.com;
|
|
||||||
|
|
||||||
version(NO_DRAG_DROP)
|
version(NO_DRAG_DROP)
|
||||||
version = DFL_NO_DRAG_DROP;
|
version = DFL_NO_DRAG_DROP;
|
||||||
|
@ -23,7 +21,7 @@ version(DFL_NO_DRAG_DROP)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
private import dfl.data;
|
import dfl.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
version(DFL_NO_MENUS)
|
version(DFL_NO_MENUS)
|
||||||
|
@ -31,9 +29,20 @@ version(DFL_NO_MENUS)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
private import dfl.menu;
|
import dfl.menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
import dfl.internal.clib;
|
||||||
|
import dfl.internal.com;
|
||||||
|
import dfl.internal.dlib;
|
||||||
|
import dfl.internal.utf;
|
||||||
|
import dfl.internal.winapi;
|
||||||
|
import dfl.internal.wincom;
|
||||||
|
|
||||||
|
|
||||||
|
import core.memory;
|
||||||
|
|
||||||
|
|
||||||
//version = RADIO_GROUP_LAYOUT;
|
//version = RADIO_GROUP_LAYOUT;
|
||||||
version = DFL_NO_ZOMBIE_FORM;
|
version = DFL_NO_ZOMBIE_FORM;
|
||||||
|
|
||||||
|
@ -839,7 +848,7 @@ class Control: DObject, IWindow // docmain
|
||||||
{
|
{
|
||||||
if(!i)
|
if(!i)
|
||||||
children = children[1 .. $];
|
children = children[1 .. $];
|
||||||
else if(i == children.length - 1)
|
else if(i + 1 == children.length)
|
||||||
children = children[0 .. i];
|
children = children[0 .. i];
|
||||||
else
|
else
|
||||||
children = children[0 .. i] ~ children[i + 1 .. $];
|
children = children[0 .. i] ~ children[i + 1 .. $];
|
||||||
|
@ -879,7 +888,7 @@ class Control: DObject, IWindow // docmain
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected final @property Control owner() // getter
|
protected @property Control owner() // getter
|
||||||
{
|
{
|
||||||
return _owner;
|
return _owner;
|
||||||
}
|
}
|
||||||
|
@ -945,7 +954,7 @@ class Control: DObject, IWindow // docmain
|
||||||
+/
|
+/
|
||||||
|
|
||||||
|
|
||||||
final void _simple_front_one(int i)
|
void _simple_front_one(int i)
|
||||||
{
|
{
|
||||||
if(i < 0 || i >= length - 1)
|
if(i < 0 || i >= length - 1)
|
||||||
return;
|
return;
|
||||||
|
@ -954,13 +963,13 @@ class Control: DObject, IWindow // docmain
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
final void _simple_front_one(Control c)
|
void _simple_front_one(Control c)
|
||||||
{
|
{
|
||||||
return _simple_front_one(indexOf(c));
|
return _simple_front_one(indexOf(c));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
final void _simple_back_one(int i)
|
void _simple_back_one(int i)
|
||||||
{
|
{
|
||||||
if(i <= 0 || i >= length)
|
if(i <= 0 || i >= length)
|
||||||
return;
|
return;
|
||||||
|
@ -969,13 +978,13 @@ class Control: DObject, IWindow // docmain
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
final void _simple_back_one(Control c)
|
void _simple_back_one(Control c)
|
||||||
{
|
{
|
||||||
return _simple_back_one(indexOf(c));
|
return _simple_back_one(indexOf(c));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
final void _simple_back(int i)
|
void _simple_back(int i)
|
||||||
{
|
{
|
||||||
if(i <= 0 || i >= length)
|
if(i <= 0 || i >= length)
|
||||||
return;
|
return;
|
||||||
|
@ -984,13 +993,13 @@ class Control: DObject, IWindow // docmain
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
final void _simple_back(Control c)
|
void _simple_back(Control c)
|
||||||
{
|
{
|
||||||
return _simple_back(indexOf(c));
|
return _simple_back(indexOf(c));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
final void _simple_front(int i)
|
void _simple_front(int i)
|
||||||
{
|
{
|
||||||
if(i < 0 || i >= length - 1)
|
if(i < 0 || i >= length - 1)
|
||||||
return;
|
return;
|
||||||
|
@ -999,7 +1008,7 @@ class Control: DObject, IWindow // docmain
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
final void _simple_front(Control c)
|
void _simple_front(Control c)
|
||||||
{
|
{
|
||||||
return _simple_front(indexOf(c));
|
return _simple_front(indexOf(c));
|
||||||
}
|
}
|
||||||
|
@ -1792,7 +1801,7 @@ class Control: DObject, IWindow // docmain
|
||||||
alias onDockChanged = onHasLayoutChanged;
|
alias onDockChanged = onHasLayoutChanged;
|
||||||
|
|
||||||
|
|
||||||
private final void _alreadyLayout()
|
private void _alreadyLayout()
|
||||||
{
|
{
|
||||||
throw new DflException("Control already has a layout");
|
throw new DflException("Control already has a layout");
|
||||||
}
|
}
|
||||||
|
@ -2105,7 +2114,7 @@ class Control: DObject, IWindow // docmain
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
final @property bool isHandleCreated() const // getter
|
final @property bool isHandleCreated() const nothrow @safe // getter
|
||||||
{
|
{
|
||||||
return hwnd != HWND.init;
|
return hwnd != HWND.init;
|
||||||
}
|
}
|
||||||
|
@ -2356,7 +2365,7 @@ class Control: DObject, IWindow // docmain
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private final Control _fetchParent()
|
private Control _fetchParent()
|
||||||
{
|
{
|
||||||
HWND hwParent = GetParent(hwnd);
|
HWND hwParent = GetParent(hwnd);
|
||||||
return fromHandle(hwParent);
|
return fromHandle(hwParent);
|
||||||
|
@ -2391,7 +2400,7 @@ class Control: DObject, IWindow // docmain
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private final Region _fetchRegion()
|
private Region _fetchRegion()
|
||||||
{
|
{
|
||||||
HRGN hrgn = CreateRectRgn(0, 0, 1, 1);
|
HRGN hrgn = CreateRectRgn(0, 0, 1, 1);
|
||||||
GetWindowRgn(hwnd, hrgn);
|
GetWindowRgn(hwnd, hrgn);
|
||||||
|
@ -2742,7 +2751,7 @@ class Control: DObject, IWindow // docmain
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private final Dstring _fetchText() const
|
private Dstring _fetchText() const
|
||||||
{
|
{
|
||||||
return dfl.internal.utf.getWindowText(cast(void*)hwnd);
|
return dfl.internal.utf.getWindowText(cast(void*)hwnd);
|
||||||
}
|
}
|
||||||
|
@ -3418,6 +3427,12 @@ class Control: DObject, IWindow // docmain
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override size_t toHash() const nothrow @trusted
|
||||||
|
{
|
||||||
|
return hashOf(hwnd);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
override int opCmp(Object o)
|
override int opCmp(Object o)
|
||||||
{
|
{
|
||||||
Control ctrl = cast(Control)o;
|
Control ctrl = cast(Control)o;
|
||||||
|
@ -3614,16 +3629,37 @@ class Control: DObject, IWindow // docmain
|
||||||
if(!hwnd)
|
if(!hwnd)
|
||||||
badInvokeHandle();
|
badInvokeHandle();
|
||||||
|
|
||||||
InvokeData inv;
|
static assert((DflInvokeParam*).sizeof <= LPARAM.sizeof);
|
||||||
inv.dg = dg;
|
|
||||||
inv.args = args;
|
|
||||||
|
|
||||||
if(LRESULT_DFL_INVOKE != SendMessageA(hwnd, wmDfl, WPARAM_DFL_INVOKE, cast(LRESULT)&inv))
|
static struct DelegateInvokeParam
|
||||||
|
{
|
||||||
|
Object delegate(Object[]) dg;
|
||||||
|
Object result;
|
||||||
|
Object[] args;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void funcEntry(Control c, size_t[] p)
|
||||||
|
{
|
||||||
|
auto dip = cast(DelegateInvokeParam*)p[0];
|
||||||
|
dip.result = dip.dg(dip.args);
|
||||||
|
}
|
||||||
|
|
||||||
|
DelegateInvokeParam dip;
|
||||||
|
dip.dg = dg;
|
||||||
|
dip.args = args;
|
||||||
|
|
||||||
|
DflInvokeParam dflInvokeParam;
|
||||||
|
dflInvokeParam.fp = &funcEntry;
|
||||||
|
dflInvokeParam.exception = null;
|
||||||
|
dflInvokeParam.nparams = args.length;
|
||||||
|
dflInvokeParam.params[0] = cast(size_t)&dip;
|
||||||
|
|
||||||
|
if(LRESULT_DFL_INVOKE != SendMessageA(hwnd, wmDfl, WPARAM_DFL_INVOKE_PARAMS, cast(LPARAM)&dflInvokeParam))
|
||||||
throw new DflException("Invoke failure");
|
throw new DflException("Invoke failure");
|
||||||
if(inv.exception)
|
if(dflInvokeParam.exception)
|
||||||
throw inv.exception;
|
throw dflInvokeParam.exception;
|
||||||
|
|
||||||
return inv.result;
|
return dip.result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ditto
|
/// ditto
|
||||||
|
@ -3632,13 +3668,32 @@ class Control: DObject, IWindow // docmain
|
||||||
if(!hwnd)
|
if(!hwnd)
|
||||||
badInvokeHandle();
|
badInvokeHandle();
|
||||||
|
|
||||||
InvokeSimpleData inv;
|
static assert((DflInvokeParam*).sizeof <= LPARAM.sizeof);
|
||||||
inv.dg = dg;
|
|
||||||
|
static struct DelegateInvokeParam
|
||||||
|
{
|
||||||
|
void delegate() dg;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void funcEntry(Control c, size_t[] p)
|
||||||
|
{
|
||||||
|
auto dip = cast(DelegateInvokeParam*)p[0];
|
||||||
|
dip.dg();
|
||||||
|
}
|
||||||
|
|
||||||
|
DelegateInvokeParam dip;
|
||||||
|
dip.dg = dg;
|
||||||
|
|
||||||
|
DflInvokeParam dflInvokeParam;
|
||||||
|
dflInvokeParam.fp = &funcEntry;
|
||||||
|
dflInvokeParam.exception = null;
|
||||||
|
dflInvokeParam.nparams = 0;
|
||||||
|
dflInvokeParam.params[0] = cast(size_t)&dip;
|
||||||
|
|
||||||
if(LRESULT_DFL_INVOKE != SendMessageA(hwnd, wmDfl, WPARAM_DFL_INVOKE_SIMPLE, cast(LRESULT)&inv))
|
if(LRESULT_DFL_INVOKE != SendMessageA(hwnd, wmDfl, WPARAM_DFL_INVOKE_NOPARAMS, cast(LPARAM)&dflInvokeParam))
|
||||||
throw new DflException("Invoke failure");
|
throw new DflException("Invoke failure");
|
||||||
if(inv.exception)
|
if(dflInvokeParam.exception)
|
||||||
throw inv.exception;
|
throw dflInvokeParam.exception;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3654,10 +3709,24 @@ class Control: DObject, IWindow // docmain
|
||||||
if(!hwnd)
|
if(!hwnd)
|
||||||
badInvokeHandle();
|
badInvokeHandle();
|
||||||
|
|
||||||
assert(!invokeRequired);
|
static assert((DflInvokeParam*).sizeof <= LPARAM.sizeof);
|
||||||
|
|
||||||
static assert(fn.sizeof <= LPARAM.sizeof);
|
static void funcEntry(Control c, size_t[] p)
|
||||||
PostMessageA(hwnd, wmDfl, WPARAM_DFL_DELAY_INVOKE, cast(LPARAM)fn);
|
{
|
||||||
|
auto func = cast(void function())p[0];
|
||||||
|
func();
|
||||||
|
}
|
||||||
|
|
||||||
|
DflInvokeParam* dflInvokeParam = cast(DflInvokeParam*)malloc(DflInvokeParam.sizeof);
|
||||||
|
if(!dflInvokeParam)
|
||||||
|
throw new OomException();
|
||||||
|
|
||||||
|
dflInvokeParam.fp = &funcEntry;
|
||||||
|
dflInvokeParam.exception = null;
|
||||||
|
dflInvokeParam.nparams = 0;
|
||||||
|
dflInvokeParam.params[0] = cast(size_t)fn;
|
||||||
|
|
||||||
|
PostMessageA(hwnd, wmDfl, WPARAM_DFL_DELAY_INVOKE_NOPARAMS, cast(LPARAM)dflInvokeParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ditto
|
/// ditto
|
||||||
|
@ -3671,22 +3740,19 @@ class Control: DObject, IWindow // docmain
|
||||||
if(!hwnd)
|
if(!hwnd)
|
||||||
badInvokeHandle();
|
badInvokeHandle();
|
||||||
|
|
||||||
assert(!invokeRequired);
|
|
||||||
|
|
||||||
static assert((DflInvokeParam*).sizeof <= LPARAM.sizeof);
|
static assert((DflInvokeParam*).sizeof <= LPARAM.sizeof);
|
||||||
|
|
||||||
DflInvokeParam* p;
|
DflInvokeParam* dflInvokeParams = cast(DflInvokeParam*)malloc(
|
||||||
p = cast(DflInvokeParam*)dfl.internal.clib.malloc(
|
DflInvokeParam.sizeof - size_t.sizeof + params.length * size_t.sizeof);
|
||||||
(DflInvokeParam.sizeof - size_t.sizeof)
|
if(!dflInvokeParams)
|
||||||
+ params.length * size_t.sizeof);
|
|
||||||
if(!p)
|
|
||||||
throw new OomException();
|
throw new OomException();
|
||||||
|
|
||||||
p.fp = fn;
|
dflInvokeParams.fp = fn;
|
||||||
p.nparams = params.length;
|
dflInvokeParams.exception = null;
|
||||||
p.params.ptr[0 .. params.length] = params[];
|
dflInvokeParams.nparams = params.length;
|
||||||
|
dflInvokeParams.params.ptr[0 .. params.length] = params[];
|
||||||
|
|
||||||
PostMessageA(hwnd, wmDfl, WPARAM_DFL_DELAY_INVOKE_PARAMS, cast(LPARAM)p);
|
PostMessageA(hwnd, wmDfl, WPARAM_DFL_DELAY_INVOKE_PARAMS, cast(LPARAM)dflInvokeParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
deprecated alias beginInvoke = delayInvoke;
|
deprecated alias beginInvoke = delayInvoke;
|
||||||
|
@ -6415,7 +6481,7 @@ class Control: DObject, IWindow // docmain
|
||||||
///
|
///
|
||||||
// Override to change the creation parameters.
|
// Override to change the creation parameters.
|
||||||
// Be sure to call super.createParams() or all the create params will need to be filled.
|
// Be sure to call super.createParams() or all the create params will need to be filled.
|
||||||
protected void createParams(ref CreateParams cp)
|
void createParams(ref CreateParams cp)
|
||||||
{
|
{
|
||||||
with(cp)
|
with(cp)
|
||||||
{
|
{
|
||||||
|
@ -6441,7 +6507,7 @@ class Control: DObject, IWindow // docmain
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
protected void createHandle()
|
void createHandle()
|
||||||
{
|
{
|
||||||
// Note: if modified, Form.createHandle() should be modified as well.
|
// Note: if modified, Form.createHandle() should be modified as well.
|
||||||
|
|
||||||
|
@ -6579,7 +6645,7 @@ class Control: DObject, IWindow // docmain
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
protected void recreateHandle()
|
void recreateHandle()
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
assert(!recreatingHandle);
|
assert(!recreatingHandle);
|
||||||
|
@ -6625,7 +6691,7 @@ class Control: DObject, IWindow // docmain
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private final void fillRecreationData()
|
private void fillRecreationData()
|
||||||
{
|
{
|
||||||
//cprintf(" { fillRecreationData %.*s }\n", name);
|
//cprintf(" { fillRecreationData %.*s }\n", name);
|
||||||
|
|
||||||
|
@ -6645,20 +6711,20 @@ class Control: DObject, IWindow // docmain
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
protected void onDisposed(EventArgs ea)
|
void onDisposed(EventArgs ea)
|
||||||
{
|
{
|
||||||
disposed(this, ea);
|
disposed(this, ea);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
protected final bool getStyle(ControlStyles flag)
|
final bool getStyle(ControlStyles flag)
|
||||||
{
|
{
|
||||||
return (ctrlStyle & flag) != 0;
|
return (ctrlStyle & flag) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ditto
|
/// ditto
|
||||||
protected final void setStyle(ControlStyles flag, bool value)
|
final void setStyle(ControlStyles flag, bool value)
|
||||||
{
|
{
|
||||||
if(flag & ControlStyles.CACHE_TEXT)
|
if(flag & ControlStyles.CACHE_TEXT)
|
||||||
{
|
{
|
||||||
|
@ -6677,7 +6743,7 @@ class Control: DObject, IWindow // docmain
|
||||||
|
|
||||||
///
|
///
|
||||||
// Only for setStyle() styles that are part of hwnd and wndclass styles.
|
// Only for setStyle() styles that are part of hwnd and wndclass styles.
|
||||||
protected final void updateStyles()
|
final void updateStyles()
|
||||||
{
|
{
|
||||||
LONG newClassStyles = _classStyle();
|
LONG newClassStyles = _classStyle();
|
||||||
LONG newWndStyles = _style();
|
LONG newWndStyles = _style();
|
||||||
|
@ -6784,7 +6850,7 @@ class Control: DObject, IWindow // docmain
|
||||||
|
|
||||||
///
|
///
|
||||||
// Called after adding the control to a container.
|
// Called after adding the control to a container.
|
||||||
protected void initLayout()
|
void initLayout()
|
||||||
{
|
{
|
||||||
assert(wparent !is null);
|
assert(wparent !is null);
|
||||||
if(visible && created) // ?
|
if(visible && created) // ?
|
||||||
|
@ -6796,7 +6862,7 @@ class Control: DObject, IWindow // docmain
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
protected void onLayout(LayoutEventArgs lea)
|
void onLayout(LayoutEventArgs lea)
|
||||||
{
|
{
|
||||||
// Note: exception could cause failure to restore.
|
// Note: exception could cause failure to restore.
|
||||||
//suspendLayout();
|
//suspendLayout();
|
||||||
|
@ -6896,7 +6962,7 @@ class Control: DObject, IWindow // docmain
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
+/
|
+/
|
||||||
protected bool isInputChar(char charCode)
|
bool isInputChar(char charCode)
|
||||||
{
|
{
|
||||||
int mask = 0;
|
int mask = 0;
|
||||||
if (charCode == Keys.TAB)
|
if (charCode == Keys.TAB)
|
||||||
|
@ -6915,7 +6981,7 @@ class Control: DObject, IWindow // docmain
|
||||||
/// isInputKey returns true when keyData is a regular input key.
|
/// isInputKey returns true when keyData is a regular input key.
|
||||||
// If keyData is input key, then window message is sended to wndProc()
|
// If keyData is input key, then window message is sended to wndProc()
|
||||||
// such as WM_KEYDOWN, WM_KEYUP, WM_CHAR and so on.
|
// such as WM_KEYDOWN, WM_KEYUP, WM_CHAR and so on.
|
||||||
protected bool isInputKey(Keys keyData)
|
bool isInputKey(Keys keyData)
|
||||||
{
|
{
|
||||||
if ((keyData & Keys.ALT) == Keys.ALT)
|
if ((keyData & Keys.ALT) == Keys.ALT)
|
||||||
{
|
{
|
||||||
|
@ -6993,7 +7059,7 @@ class Control: DObject, IWindow // docmain
|
||||||
|
|
||||||
///
|
///
|
||||||
// Return true if processed.
|
// Return true if processed.
|
||||||
protected bool processKeyEventArgs(ref Message msg)
|
bool processKeyEventArgs(ref Message msg)
|
||||||
{
|
{
|
||||||
// TODO: implement more (IME etc...)
|
// TODO: implement more (IME etc...)
|
||||||
|
|
||||||
|
@ -7043,7 +7109,7 @@ class Control: DObject, IWindow // docmain
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
protected bool processMnemonic(dchar charCode)
|
bool processMnemonic(dchar charCode)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -7329,7 +7395,7 @@ class Control: DObject, IWindow // docmain
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
package void _classStyle(LONG cl)
|
void _classStyle(LONG cl)
|
||||||
{
|
{
|
||||||
if(isHandleCreated)
|
if(isHandleCreated)
|
||||||
{
|
{
|
||||||
|
@ -8323,15 +8389,3 @@ class ContainerControl: ScrollableControl, IContainerControl // docmain
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private template hasLocalAliasing(T...)
|
|
||||||
{
|
|
||||||
import std.traits, std.typecons;
|
|
||||||
|
|
||||||
static if( !T.length )
|
|
||||||
enum hasLocalAliasing = false;
|
|
||||||
else
|
|
||||||
enum hasLocalAliasing = std.traits.hasLocalAliasing!(T[0]) ||
|
|
||||||
dfl.control.hasLocalAliasing!(T[1 .. $]);
|
|
||||||
}
|
|
||||||
|
|
|
@ -5,18 +5,17 @@
|
||||||
///
|
///
|
||||||
module dfl.data;
|
module dfl.data;
|
||||||
|
|
||||||
private import dfl.base;
|
import dfl.base;
|
||||||
private import dfl.application;
|
import dfl.application;
|
||||||
private import dfl.drawing;
|
import dfl.drawing;
|
||||||
|
|
||||||
private import dfl.internal.dlib;
|
import dfl.internal.dlib;
|
||||||
private import dfl.internal.utf;
|
import dfl.internal.utf;
|
||||||
private import dfl.internal.com;
|
import dfl.internal.com;
|
||||||
private import dfl.internal.winapi;
|
import dfl.internal.winapi;
|
||||||
private import dfl.internal.wincom;
|
import dfl.internal.wincom;
|
||||||
|
|
||||||
private import core.sys.windows.ole2; // DATA_E_FORMATETC
|
|
||||||
|
|
||||||
|
import core.sys.windows.ole2 : DATA_E_FORMATETC;
|
||||||
public import core.sys.windows.wingdi : BITMAPINFO;
|
public import core.sys.windows.wingdi : BITMAPINFO;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,14 +5,15 @@
|
||||||
///
|
///
|
||||||
module dfl.drawing;
|
module dfl.drawing;
|
||||||
|
|
||||||
private import dfl.base;
|
import dfl.base;
|
||||||
private import std.stdio;
|
|
||||||
|
|
||||||
private import dfl.internal.dlib;
|
import dfl.internal.dlib;
|
||||||
private import dfl.internal.winapi;
|
import dfl.internal.winapi;
|
||||||
private import dfl.internal.wincom;
|
import dfl.internal.wincom;
|
||||||
private import dfl.internal.utf;
|
import dfl.internal.utf;
|
||||||
private import dfl.internal.com;
|
import dfl.internal.com;
|
||||||
|
|
||||||
|
import std.stdio;
|
||||||
|
|
||||||
version(D_Version2)
|
version(D_Version2)
|
||||||
{
|
{
|
||||||
|
@ -1383,9 +1384,9 @@ final class EnhancedMetaFile: Image
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
HENHMETAFILE handle() @property // getter
|
HENHMETAFILE handle() const @property // getter
|
||||||
{
|
{
|
||||||
return _hemf;
|
return cast(HENHMETAFILE)_hemf;
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
|
@ -2314,9 +2315,9 @@ private:
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
HMONITOR hmonitor() @property // getter
|
HMONITOR hmonitor() const @property // getter
|
||||||
{
|
{
|
||||||
return _hmonitor;
|
return cast(HMONITOR)_hmonitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3023,7 +3024,7 @@ class Graphics // docmain
|
||||||
// beziers, using the previous last point as the starting point.
|
// beziers, using the previous last point as the starting point.
|
||||||
final void drawBeziers(Pen pen, Point[] points)
|
final void drawBeziers(Pen pen, Point[] points)
|
||||||
{
|
{
|
||||||
if(points.length < 1 || (points.length - 1) % 3)
|
if(points.length < 1 || (points.length + (-1)) % 3)
|
||||||
{
|
{
|
||||||
assert(0); // Bad number of points.
|
assert(0); // Bad number of points.
|
||||||
//return; // Let PolyBezier() do what it wants with the bad number.
|
//return; // Let PolyBezier() do what it wants with the bad number.
|
||||||
|
@ -4633,9 +4634,9 @@ class Region // docmain
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
override size_t toHash() const pure nothrow
|
override size_t toHash() const nothrow @safe
|
||||||
{
|
{
|
||||||
return _hrgn.hashOf();
|
return hashOf(_hrgn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,13 +7,13 @@
|
||||||
///
|
///
|
||||||
module dfl.environment;
|
module dfl.environment;
|
||||||
|
|
||||||
private import dfl.base;
|
import dfl.base;
|
||||||
private import dfl.event;
|
import dfl.event;
|
||||||
|
|
||||||
private import dfl.internal.dlib;
|
import dfl.internal.dlib;
|
||||||
private import dfl.internal.clib;
|
import dfl.internal.clib;
|
||||||
private import dfl.internal.utf;
|
import dfl.internal.utf;
|
||||||
private import dfl.internal.winapi;
|
import dfl.internal.winapi;
|
||||||
|
|
||||||
|
|
||||||
private extern(Windows) nothrow
|
private extern(Windows) nothrow
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
module dfl.event;
|
module dfl.event;
|
||||||
|
|
||||||
import dfl.internal.dlib;
|
import dfl.internal.dlib;
|
||||||
|
|
||||||
import std.functional;
|
import std.functional;
|
||||||
|
|
||||||
|
|
||||||
|
@ -88,7 +89,7 @@ template Event(T1, T2) // docmain
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(iw == _array.length - 1)
|
if(iw + 1 == _array.length)
|
||||||
{
|
{
|
||||||
_array[iw] = null;
|
_array[iw] = null;
|
||||||
_array = _array[0 .. iw];
|
_array = _array[0 .. iw];
|
||||||
|
@ -233,7 +234,7 @@ class EventArgs // docmain
|
||||||
{
|
{
|
||||||
/+
|
/+
|
||||||
private static byte[] buf;
|
private static byte[] buf;
|
||||||
private import std.gc; // <-- ...
|
import std.gc; // <-- ...
|
||||||
|
|
||||||
|
|
||||||
new(uint sz)
|
new(uint sz)
|
||||||
|
|
|
@ -5,16 +5,16 @@
|
||||||
///
|
///
|
||||||
module dfl.filedialog;
|
module dfl.filedialog;
|
||||||
|
|
||||||
private import dfl.application;
|
import dfl.application;
|
||||||
private import dfl.base;
|
import dfl.base;
|
||||||
private import dfl.control;
|
import dfl.commondialog;
|
||||||
private import dfl.drawing;
|
import dfl.control;
|
||||||
private import dfl.event;
|
import dfl.drawing;
|
||||||
private import dfl.commondialog;
|
import dfl.event;
|
||||||
|
|
||||||
private import dfl.internal.winapi;
|
import dfl.internal.dlib;
|
||||||
private import dfl.internal.dlib;
|
import dfl.internal.utf;
|
||||||
private import dfl.internal.utf;
|
import dfl.internal.winapi;
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
|
@ -856,8 +856,8 @@ class OpenFileDialog: FileDialog // docmain
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static import undead.stream;
|
static import undead.stream;
|
||||||
private import std.stdio : File;
|
import std.stdio : File;
|
||||||
|
|
||||||
///
|
///
|
||||||
// Old openFile() is renamed openFileStream().
|
// Old openFile() is renamed openFileStream().
|
||||||
|
@ -978,8 +978,8 @@ class SaveFileDialog: FileDialog // docmain
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static import undead.stream;
|
static import undead.stream;
|
||||||
private import std.stdio : File;
|
import std.stdio : File;
|
||||||
|
|
||||||
///
|
///
|
||||||
// Opens and creates with read and write access.
|
// Opens and creates with read and write access.
|
||||||
|
|
|
@ -5,16 +5,16 @@
|
||||||
///
|
///
|
||||||
module dfl.folderdialog;
|
module dfl.folderdialog;
|
||||||
|
|
||||||
private import dfl.application;
|
import dfl.application;
|
||||||
private import dfl.base;
|
import dfl.base;
|
||||||
private import dfl.commondialog;
|
import dfl.commondialog;
|
||||||
private import dfl.environment;
|
import dfl.environment;
|
||||||
|
|
||||||
private import dfl.internal.dlib;
|
import dfl.internal.clib;
|
||||||
private import dfl.internal.clib;
|
import dfl.internal.dlib;
|
||||||
private import dfl.internal.utf;
|
import dfl.internal.utf;
|
||||||
private import dfl.internal.winapi;
|
import dfl.internal.winapi;
|
||||||
private import dfl.internal.wincom;
|
import dfl.internal.wincom;
|
||||||
|
|
||||||
|
|
||||||
private extern(Windows) nothrow
|
private extern(Windows) nothrow
|
||||||
|
|
|
@ -5,16 +5,16 @@
|
||||||
///
|
///
|
||||||
module dfl.fontdialog;
|
module dfl.fontdialog;
|
||||||
|
|
||||||
private import dfl.application;
|
import dfl.application;
|
||||||
private import dfl.base;
|
import dfl.base;
|
||||||
private import dfl.control;
|
import dfl.control;
|
||||||
private import dfl.drawing;
|
import dfl.drawing;
|
||||||
private import dfl.event;
|
import dfl.event;
|
||||||
private import dfl.commondialog;
|
import dfl.commondialog;
|
||||||
|
|
||||||
private import dfl.internal.dlib;
|
import dfl.internal.dlib;
|
||||||
private import dfl.internal.utf;
|
import dfl.internal.utf;
|
||||||
private import dfl.internal.winapi;
|
import dfl.internal.winapi;
|
||||||
|
|
||||||
|
|
||||||
private extern(Windows) nothrow
|
private extern(Windows) nothrow
|
||||||
|
|
|
@ -5,28 +5,33 @@
|
||||||
///
|
///
|
||||||
module dfl.form;
|
module dfl.form;
|
||||||
|
|
||||||
private import dfl.control, dfl.event, dfl.drawing;
|
import dfl.application;
|
||||||
private import dfl.application, dfl.base;
|
import dfl.base;
|
||||||
private import dfl.collections;
|
import dfl.collections;
|
||||||
|
import dfl.control;
|
||||||
private import dfl.internal.dlib;
|
import dfl.drawing;
|
||||||
private import dfl.internal.utf;
|
import dfl.event;
|
||||||
private import core.sys.windows.windows;
|
|
||||||
private import core.sys.windows.commctrl;
|
|
||||||
|
|
||||||
debug(APP_PRINT)
|
|
||||||
{
|
|
||||||
private import dfl.internal.clib;
|
|
||||||
}
|
|
||||||
|
|
||||||
version(DFL_NO_MENUS)
|
version(DFL_NO_MENUS)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
private import dfl.menu;
|
import dfl.menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
import dfl.internal.dlib;
|
||||||
|
import dfl.internal.utf;
|
||||||
|
|
||||||
|
debug(APP_PRINT)
|
||||||
|
{
|
||||||
|
import dfl.internal.clib;
|
||||||
|
}
|
||||||
|
|
||||||
|
import core.sys.windows.commctrl;
|
||||||
|
import core.sys.windows.windows;
|
||||||
|
|
||||||
|
|
||||||
version(NO_DFL_PARK_WINDOW)
|
version(NO_DFL_PARK_WINDOW)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -121,7 +126,7 @@ class FormShortcutEventArgs: EventArgs
|
||||||
|
|
||||||
|
|
||||||
// DMD 0.93 crashes if this is placed in Form.
|
// DMD 0.93 crashes if this is placed in Form.
|
||||||
//private import dfl.button;
|
//import dfl.button;
|
||||||
|
|
||||||
|
|
||||||
version = OLD_MODAL_CLOSE; // New version destroys control info.
|
version = OLD_MODAL_CLOSE; // New version destroys control info.
|
||||||
|
@ -3481,7 +3486,7 @@ class Form: ContainerControl, IDialogResult // docmain
|
||||||
+/
|
+/
|
||||||
|
|
||||||
|
|
||||||
final void _recalcClientSize()
|
void _recalcClientSize()
|
||||||
{
|
{
|
||||||
RECT r;
|
RECT r;
|
||||||
r.left = 0;
|
r.left = 0;
|
||||||
|
|
|
@ -5,11 +5,17 @@
|
||||||
///
|
///
|
||||||
module dfl.groupbox;
|
module dfl.groupbox;
|
||||||
|
|
||||||
private import dfl.control, dfl.base, dfl.button, dfl.drawing;
|
import dfl.application;
|
||||||
private import dfl.internal.winapi, dfl.application, dfl.event;
|
import dfl.base;
|
||||||
|
import dfl.button;
|
||||||
|
import dfl.control;
|
||||||
|
import dfl.drawing;
|
||||||
|
import dfl.event;
|
||||||
|
|
||||||
|
import dfl.internal.winapi;
|
||||||
static import dfl.internal.utf;
|
static import dfl.internal.utf;
|
||||||
|
|
||||||
|
|
||||||
private extern(Windows) void _initButton();
|
private extern(Windows) void _initButton();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,12 @@
|
||||||
///
|
///
|
||||||
module dfl.imagelist;
|
module dfl.imagelist;
|
||||||
|
|
||||||
import dfl.base, dfl.drawing, dfl.internal.winapi, dfl.internal.dlib;
|
import dfl.base;
|
||||||
import dfl.collections;
|
import dfl.collections;
|
||||||
|
import dfl.drawing;
|
||||||
|
|
||||||
|
import dfl.internal.dlib;
|
||||||
|
import dfl.internal.winapi;
|
||||||
|
|
||||||
|
|
||||||
version(DFL_NO_IMAGELIST)
|
version(DFL_NO_IMAGELIST)
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
module dfl.internal.clib;
|
module dfl.internal.clib;
|
||||||
|
|
||||||
|
|
||||||
public import core.stdc.stdlib,
|
public import core.stdc.stdlib;
|
||||||
core.stdc.string,
|
public import core.stdc.string;
|
||||||
core.stdc.stdint, // Mostly the same as the C interface.
|
public import core.stdc.stdint; // Mostly the same as the C interface.
|
||||||
core.stdc.stdio;
|
public import core.stdc.stdio;
|
||||||
|
|
||||||
alias cprintf = core.stdc.stdio.printf;
|
alias cprintf = core.stdc.stdio.printf;
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
|
|
||||||
module dfl.internal.com;
|
module dfl.internal.com;
|
||||||
|
|
||||||
private import dfl.internal.winapi, dfl.internal.wincom, dfl.internal.dlib;
|
import dfl.internal.dlib;
|
||||||
|
import dfl.internal.winapi;
|
||||||
|
import dfl.internal.wincom;
|
||||||
|
|
||||||
|
|
||||||
version(DFL_TANGO_SEEK_COMPAT)
|
version(DFL_TANGO_SEEK_COMPAT)
|
||||||
|
|
|
@ -145,7 +145,7 @@ Dstring getObjectString(Object o)
|
||||||
|
|
||||||
version(DFL_NO_USE_CORE_MEMORY)
|
version(DFL_NO_USE_CORE_MEMORY)
|
||||||
{
|
{
|
||||||
private import std.gc; // If you get "module gc cannot read file 'core\memory.d'" then use -version=DFL_NO_USE_CORE_MEMORY <http://wiki.dprogramming.com/Dfl/CompileVersions>
|
import std.gc; // If you get "module gc cannot read file 'core\memory.d'" then use -version=DFL_NO_USE_CORE_MEMORY <http://wiki.dprogramming.com/Dfl/CompileVersions>
|
||||||
|
|
||||||
void gcPin(void* p) { }
|
void gcPin(void* p) { }
|
||||||
void gcUnpin(void* p) { }
|
void gcUnpin(void* p) { }
|
||||||
|
@ -156,7 +156,7 @@ version(DFL_NO_USE_CORE_MEMORY)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
private import core.memory; // If you get "module gc cannot read file 'std\gc.d'" then use -version=DFL_USE_CORE_MEMORY <http://wiki.dprogramming.com/Dfl/CompileVersions>
|
import core.memory; // If you get "module gc cannot read file 'std\gc.d'" then use -version=DFL_USE_CORE_MEMORY <http://wiki.dprogramming.com/Dfl/CompileVersions>
|
||||||
|
|
||||||
void gcPin(void* p) { }
|
void gcPin(void* p) { }
|
||||||
void gcUnpin(void* p) { }
|
void gcUnpin(void* p) { }
|
||||||
|
@ -168,18 +168,12 @@ else
|
||||||
|
|
||||||
void gcFullCollect() nothrow
|
void gcFullCollect() nothrow
|
||||||
{
|
{
|
||||||
try
|
core.memory.GC.collect();
|
||||||
{
|
|
||||||
core.memory.GC.collect();
|
|
||||||
}
|
|
||||||
catch (Throwable e)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private import std.string;
|
import std.string;
|
||||||
|
|
||||||
alias stringICmp = std.string.icmp;
|
alias stringICmp = std.string.icmp;
|
||||||
|
|
||||||
|
@ -227,7 +221,7 @@ else
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private import std.algorithm.searching;
|
import std.algorithm.searching;
|
||||||
|
|
||||||
alias charFindInString = std.algorithm.searching.find;
|
alias charFindInString = std.algorithm.searching.find;
|
||||||
|
|
||||||
|
@ -241,7 +235,7 @@ Dstring uintToHexString(uint num)
|
||||||
alias stringSplitLines = std.string.splitLines;
|
alias stringSplitLines = std.string.splitLines;
|
||||||
|
|
||||||
|
|
||||||
private import std.path;
|
import std.path;
|
||||||
|
|
||||||
alias pathGetDirName = std.path.dirName;
|
alias pathGetDirName = std.path.dirName;
|
||||||
|
|
||||||
|
@ -257,13 +251,13 @@ alias nativePathSeparatorString = std.path.pathSeparator;
|
||||||
|
|
||||||
version(_DFL_NO_USE_CORE_EXCEPTION_OUTOFMEMORY_EXCEPTION)
|
version(_DFL_NO_USE_CORE_EXCEPTION_OUTOFMEMORY_EXCEPTION)
|
||||||
{
|
{
|
||||||
private import std.outofmemory;
|
import std.outofmemory;
|
||||||
|
|
||||||
alias OomException = std.outofmemory.OutOfMemoryException;
|
alias OomException = std.outofmemory.OutOfMemoryException;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
private import core.exception;
|
import core.exception;
|
||||||
|
|
||||||
version(_DFL_NO_USE_CORE_EXCEPTION_OUTOFMEMORY_ERROR)
|
version(_DFL_NO_USE_CORE_EXCEPTION_OUTOFMEMORY_ERROR)
|
||||||
{
|
{
|
||||||
|
@ -288,7 +282,7 @@ else
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private import std.utf;
|
import std.utf;
|
||||||
|
|
||||||
alias utf8stringGetUtf32char = std.utf.decode;
|
alias utf8stringGetUtf32char = std.utf.decode;
|
||||||
|
|
||||||
|
@ -303,12 +297,12 @@ alias utf32stringtoUtf8string = std.utf.toUTF8;
|
||||||
alias utf8stringtoUtf32string = std.utf.toUTF32;
|
alias utf8stringtoUtf32string = std.utf.toUTF32;
|
||||||
|
|
||||||
|
|
||||||
private import std.uni;
|
import std.uni;
|
||||||
|
|
||||||
alias utf32charToLower = std.uni.toLower;
|
alias utf32charToLower = std.uni.toLower;
|
||||||
|
|
||||||
|
|
||||||
private import std.conv;
|
import std.conv;
|
||||||
|
|
||||||
version(DFL_NO_CONV_TO_TEMPLATE)
|
version(DFL_NO_CONV_TO_TEMPLATE)
|
||||||
{
|
{
|
||||||
|
@ -330,12 +324,12 @@ else
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private import std.ascii;
|
import std.ascii;
|
||||||
|
|
||||||
alias charIsHexDigit = std.ascii.isHexDigit;
|
alias charIsHexDigit = std.ascii.isHexDigit;
|
||||||
|
|
||||||
|
|
||||||
private import undead.stream;// dfl.internal.stream is deprecated.
|
import undead.stream;// dfl.internal.stream is deprecated.
|
||||||
|
|
||||||
deprecated alias DStream = undead.stream.Stream;// dfl.internal.stream.Stream is deprecated.
|
deprecated alias DStream = undead.stream.Stream;// dfl.internal.stream.Stream is deprecated.
|
||||||
|
|
||||||
|
|
|
@ -21,22 +21,20 @@
|
||||||
|
|
||||||
module dfl.internal.utf;
|
module dfl.internal.utf;
|
||||||
|
|
||||||
private import dfl.internal.dlib;
|
import dfl.internal.clib;
|
||||||
private import dfl.internal.clib;
|
import dfl.internal.dlib;
|
||||||
private import dfl.internal.winapi :
|
import dfl.internal.winapi : LPCITEMIDLIST, SHGetPathFromIDListA, SHGetPathFromIDListW;
|
||||||
LPCITEMIDLIST,
|
|
||||||
SHGetPathFromIDListA, SHGetPathFromIDListW;
|
|
||||||
|
|
||||||
private import core.sys.windows.windef;
|
import core.sys.windows.richedit;
|
||||||
private import core.sys.windows.winuser;
|
import core.sys.windows.shellapi;
|
||||||
private import core.sys.windows.winreg;
|
import core.sys.windows.winbase;
|
||||||
private import core.sys.windows.wingdi;
|
import core.sys.windows.windef;
|
||||||
private import core.sys.windows.winbase;
|
import core.sys.windows.wingdi;
|
||||||
private import core.sys.windows.shellapi;
|
import core.sys.windows.winnls;
|
||||||
private import core.sys.windows.winnls;
|
import core.sys.windows.winreg;
|
||||||
private import core.sys.windows.richedit;
|
import core.sys.windows.winuser;
|
||||||
|
|
||||||
private import std.windows.charset;
|
import std.windows.charset;
|
||||||
|
|
||||||
|
|
||||||
version(DFL_NO_D2_AND_ABOVE)
|
version(DFL_NO_D2_AND_ABOVE)
|
||||||
|
@ -176,8 +174,7 @@ Dstringz unsafeStringz(Dstring s) nothrow pure
|
||||||
return s.ptr;
|
return s.ptr;
|
||||||
|
|
||||||
// Need to duplicate with null terminator.
|
// Need to duplicate with null terminator.
|
||||||
char[] result;
|
char[] result = new char[s.length + 1];
|
||||||
result = new char[s.length + 1];
|
|
||||||
result[0 .. s.length] = s[];
|
result[0 .. s.length] = s[];
|
||||||
result[s.length] = 0;
|
result[s.length] = 0;
|
||||||
//return result.ptr;
|
//return result.ptr;
|
||||||
|
@ -190,14 +187,10 @@ Dstring unicodeToAnsi(Dwstringz unicode, size_t ulen)
|
||||||
if(!ulen)
|
if(!ulen)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
wchar* wsz;
|
int len = WideCharToMultiByte(0, 0, unicode, ulen.toI32, null, 0, null, null);
|
||||||
char[] result;
|
|
||||||
int len;
|
|
||||||
|
|
||||||
len = WideCharToMultiByte(0, 0, unicode, ulen.toI32, null, 0, null, null);
|
|
||||||
assert(len > 0);
|
assert(len > 0);
|
||||||
|
|
||||||
result = new char[len];
|
char[] result = new char[len];
|
||||||
len = WideCharToMultiByte(0, 0, unicode, ulen.toI32, result.ptr, len, null, null);
|
len = WideCharToMultiByte(0, 0, unicode, ulen.toI32, result.ptr, len, null, null);
|
||||||
assert(len == result.length);
|
assert(len == result.length);
|
||||||
//return result[0 .. len - 1];
|
//return result[0 .. len - 1];
|
||||||
|
@ -207,10 +200,8 @@ Dstring unicodeToAnsi(Dwstringz unicode, size_t ulen)
|
||||||
|
|
||||||
Dwstring ansiToUnicode(Dstringz ansi, size_t len)
|
Dwstring ansiToUnicode(Dstringz ansi, size_t len)
|
||||||
{
|
{
|
||||||
wchar[] ws;
|
|
||||||
|
|
||||||
len++;
|
len++;
|
||||||
ws = new wchar[len];
|
wchar[] ws = new wchar[len];
|
||||||
|
|
||||||
len = MultiByteToWideChar(0, 0, ansi, len.toI32, ws.ptr, len.toI32);
|
len = MultiByteToWideChar(0, 0, ansi, len.toI32, ws.ptr, len.toI32);
|
||||||
//assert(len == ws.length);
|
//assert(len == ws.length);
|
||||||
|
@ -260,12 +251,11 @@ private Dstring _toAnsiz(Dstring utf8, bool safe = true)
|
||||||
{
|
{
|
||||||
if(ch >= 0x80)
|
if(ch >= 0x80)
|
||||||
{
|
{
|
||||||
char[] result;
|
|
||||||
auto wsz = utf8stringToUtf16stringz(utf8);
|
auto wsz = utf8stringToUtf16stringz(utf8);
|
||||||
auto len = WideCharToMultiByte(0, 0, wsz, -1, null, 0, null, null);
|
auto len = WideCharToMultiByte(0, 0, wsz, -1, null, 0, null, null);
|
||||||
assert(len > 0);
|
assert(len > 0);
|
||||||
|
|
||||||
result = new char[len];
|
char[] result = new char[len];
|
||||||
len = WideCharToMultiByte(0, 0, wsz, -1, result.ptr, len, null, null);
|
len = WideCharToMultiByte(0, 0, wsz, -1, result.ptr, len, null, null);
|
||||||
assert(len == result.length);
|
assert(len == result.length);
|
||||||
//return result[0 .. len - 1];
|
//return result[0 .. len - 1];
|
||||||
|
@ -567,28 +557,22 @@ Dstring getWindowText(HWND hwnd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wchar* buf;
|
size_t len = proclen(hwnd);
|
||||||
size_t len;
|
|
||||||
|
|
||||||
len = proclen(hwnd);
|
|
||||||
if(!len)
|
if(!len)
|
||||||
return null;
|
return null;
|
||||||
len++;
|
len++;
|
||||||
buf = (new wchar[len]).ptr;
|
wchar* buf = (new wchar[len]).ptr;
|
||||||
|
|
||||||
len = proc(hwnd, buf, len.toI32);
|
len = proc(hwnd, buf, len.toI32);
|
||||||
return fromUnicode(buf, len);
|
return fromUnicode(buf, len);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char* buf;
|
size_t len = GetWindowTextLengthA(hwnd);
|
||||||
size_t len;
|
|
||||||
|
|
||||||
len = GetWindowTextLengthA(hwnd);
|
|
||||||
if(!len)
|
if(!len)
|
||||||
return null;
|
return null;
|
||||||
len++;
|
len++;
|
||||||
buf = (new char[len]).ptr;
|
char* buf = (new char[len]).ptr;
|
||||||
|
|
||||||
len = GetWindowTextA(hwnd, buf, len.toI32);
|
len = GetWindowTextA(hwnd, buf, len.toI32);
|
||||||
return fromAnsi(buf, len);
|
return fromAnsi(buf, len);
|
||||||
|
@ -647,18 +631,14 @@ Dstring getModuleFileName(HMODULE hmod)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wchar[] s;
|
wchar[] s = new wchar[MAX_PATH];
|
||||||
DWORD len;
|
DWORD len = proc(hmod, s.ptr, s.length.toI32);
|
||||||
s = new wchar[MAX_PATH];
|
|
||||||
len = proc(hmod, s.ptr, s.length.toI32);
|
|
||||||
return fromUnicode(s.ptr, len);
|
return fromUnicode(s.ptr, len);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char[] s;
|
char[] s = new char[MAX_PATH];
|
||||||
DWORD len;
|
DWORD len = GetModuleFileNameA(hmod, s.ptr, s.length.toI32);
|
||||||
s = new char[MAX_PATH];
|
|
||||||
len = GetModuleFileNameA(hmod, s.ptr, s.length.toI32);
|
|
||||||
return fromAnsi(s.ptr, len);
|
return fromAnsi(s.ptr, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -714,18 +694,14 @@ Dstring emGetSelText(HWND hwnd, size_t selTextLength)
|
||||||
proc = _loadSendMessageW();
|
proc = _loadSendMessageW();
|
||||||
}
|
}
|
||||||
|
|
||||||
wchar[] buf;
|
wchar[] buf = new wchar[selTextLength + 1];
|
||||||
size_t len;
|
size_t len = proc(hwnd, EM_GETSELTEXT, 0, cast(LPARAM)buf.ptr);
|
||||||
buf = new wchar[selTextLength + 1];
|
|
||||||
len = proc(hwnd, EM_GETSELTEXT, 0, cast(LPARAM)buf.ptr);
|
|
||||||
return fromUnicode(buf.ptr, len);
|
return fromUnicode(buf.ptr, len);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char[] buf;
|
char[] buf = new char[selTextLength + 1];
|
||||||
size_t len;
|
size_t len = SendMessageA(hwnd, EM_GETSELTEXT, 0, cast(LPARAM)buf.ptr);
|
||||||
buf = new char[selTextLength + 1];
|
|
||||||
len = SendMessageA(hwnd, EM_GETSELTEXT, 0, cast(LPARAM)buf.ptr);
|
|
||||||
return fromAnsi(buf.ptr, len);
|
return fromAnsi(buf.ptr, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -759,14 +735,12 @@ Dstring getSelectedText(HWND hwnd)
|
||||||
if(len)
|
if(len)
|
||||||
{
|
{
|
||||||
len++;
|
len++;
|
||||||
wchar* buf;
|
wchar* buf = (new wchar[len]).ptr;
|
||||||
buf = (new wchar[len]).ptr;
|
|
||||||
|
|
||||||
len = proc(hwnd, WM_GETTEXT, len, cast(LPARAM)buf).toI32;
|
len = proc(hwnd, WM_GETTEXT, len, cast(LPARAM)buf).toI32;
|
||||||
if(len)
|
if(len)
|
||||||
{
|
{
|
||||||
wchar[] s;
|
wchar[] s = buf[v1 .. v2].dup;
|
||||||
s = buf[v1 .. v2].dup;
|
|
||||||
return fromUnicode(s.ptr, s.length);
|
return fromUnicode(s.ptr, s.length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -782,14 +756,12 @@ Dstring getSelectedText(HWND hwnd)
|
||||||
if(len)
|
if(len)
|
||||||
{
|
{
|
||||||
len++;
|
len++;
|
||||||
char* buf;
|
char* buf = (new char[len]).ptr;
|
||||||
buf = (new char[len]).ptr;
|
|
||||||
|
|
||||||
len = SendMessageA(hwnd, WM_GETTEXT, len, cast(LPARAM)buf).toI32;
|
len = SendMessageA(hwnd, WM_GETTEXT, len, cast(LPARAM)buf).toI32;
|
||||||
if(len)
|
if(len)
|
||||||
{
|
{
|
||||||
char[] s;
|
char[] s = buf[v1 .. v2].dup;
|
||||||
s = buf[v1 .. v2].dup;
|
|
||||||
return fromAnsi(s.ptr, s.length);
|
return fromAnsi(s.ptr, s.length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -819,10 +791,8 @@ void emSetPasswordChar(HWND hwnd, dchar pwc)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Dstring chs;
|
Dstring chs = utf32stringtoUtf8string((&pwc)[0 .. 1]);
|
||||||
Dstring ansichs;
|
Dstring ansichs = unsafeAnsi(chs);
|
||||||
chs = utf32stringtoUtf8string((&pwc)[0 .. 1]);
|
|
||||||
ansichs = unsafeAnsi(chs);
|
|
||||||
|
|
||||||
if(ansichs)
|
if(ansichs)
|
||||||
SendMessageA(hwnd, EM_SETPASSWORDCHAR, ansichs[0], 0); // TODO: ?
|
SendMessageA(hwnd, EM_SETPASSWORDCHAR, ansichs[0], 0); // TODO: ?
|
||||||
|
@ -850,13 +820,10 @@ dchar emGetPasswordChar(HWND hwnd)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char ansich;
|
char ansich = cast(char)SendMessageA(hwnd, EM_GETPASSWORDCHAR, 0, 0);
|
||||||
Dstring chs;
|
//Dstring chs = fromAnsi((&ansich)[0 .. 1], 1);
|
||||||
Ddstring dchs;
|
Dstring chs = fromAnsi(&ansich, 1);
|
||||||
ansich = cast(char)SendMessageA(hwnd, EM_GETPASSWORDCHAR, 0, 0);
|
Ddstring dchs = utf8stringtoUtf32string(chs);
|
||||||
//chs = fromAnsi((&ansich)[0 .. 1], 1);
|
|
||||||
chs = fromAnsi(&ansich, 1);
|
|
||||||
dchs = utf8stringtoUtf32string(chs);
|
|
||||||
if(dchs.length == 1)
|
if(dchs.length == 1)
|
||||||
return dchs[0]; // TODO: ?
|
return dchs[0]; // TODO: ?
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1004,8 +971,7 @@ Dstring getClipboardFormatName(UINT format)
|
||||||
int len = proc(format, buf.ptr, buf.length.toI32);
|
int len = proc(format, buf.ptr, buf.length.toI32);
|
||||||
if(!len)
|
if(!len)
|
||||||
return null;
|
return null;
|
||||||
Dstring result = fromUnicode(buf.ptr, len);
|
return fromUnicode(buf.ptr, len);
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1013,8 +979,7 @@ Dstring getClipboardFormatName(UINT format)
|
||||||
int len = GetClipboardFormatNameA(format, buf.ptr, buf.length.toI32);
|
int len = GetClipboardFormatNameA(format, buf.ptr, buf.length.toI32);
|
||||||
if(!len)
|
if(!len)
|
||||||
return null;
|
return null;
|
||||||
Dstring result = fromAnsi(buf.ptr, len);
|
return fromAnsi(buf.ptr, len);
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1051,9 +1016,8 @@ int drawTextEx(HDC hdc, Dstring text, LPRECT lprc, UINT dwDTFormat, LPDRAWTEXTPA
|
||||||
strz = toUnicodez(text);
|
strz = toUnicodez(text);
|
||||||
return proc(hdc, strz, -1, lprc, dwDTFormat, lpDTParams);
|
return proc(hdc, strz, -1, lprc, dwDTFormat, lpDTParams);
|
||||||
+/
|
+/
|
||||||
Dwstring str;
|
|
||||||
wchar[2] tempStr;
|
wchar[2] tempStr;
|
||||||
str = toUnicode(text);
|
Dwstring str = toUnicode(text);
|
||||||
if(str.length == 1)
|
if(str.length == 1)
|
||||||
{
|
{
|
||||||
tempStr[0] = str[0];
|
tempStr[0] = str[0];
|
||||||
|
@ -1071,9 +1035,8 @@ int drawTextEx(HDC hdc, Dstring text, LPRECT lprc, UINT dwDTFormat, LPDRAWTEXTPA
|
||||||
strz = unsafeAnsiz(text);
|
strz = unsafeAnsiz(text);
|
||||||
return DrawTextExA(hdc, strz, -1, lprc, dwDTFormat, lpDTParams);
|
return DrawTextExA(hdc, strz, -1, lprc, dwDTFormat, lpDTParams);
|
||||||
+/
|
+/
|
||||||
Dstring str;
|
|
||||||
char[2] tempStr;
|
char[2] tempStr;
|
||||||
str = unsafeAnsi(text);
|
Dstring str = unsafeAnsi(text);
|
||||||
if(str.length == 1)
|
if(str.length == 1)
|
||||||
{
|
{
|
||||||
tempStr[0] = str[0];
|
tempStr[0] = str[0];
|
||||||
|
@ -1163,10 +1126,8 @@ Dstring getCurrentDirectory()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wchar* buf;
|
int len = proc(0, null);
|
||||||
int len;
|
wchar* buf = (new wchar[len]).ptr;
|
||||||
len = proc(0, null);
|
|
||||||
buf = (new wchar[len]).ptr;
|
|
||||||
len = proc(len, buf);
|
len = proc(len, buf);
|
||||||
if(!len)
|
if(!len)
|
||||||
return null;
|
return null;
|
||||||
|
@ -1174,10 +1135,8 @@ Dstring getCurrentDirectory()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char* buf;
|
int len = GetCurrentDirectoryA(0, null);
|
||||||
int len;
|
char* buf = (new char[len]).ptr;
|
||||||
len = GetCurrentDirectoryA(0, null);
|
|
||||||
buf = (new char[len]).ptr;
|
|
||||||
len = GetCurrentDirectoryA(len, buf);
|
len = GetCurrentDirectoryA(len, buf);
|
||||||
if(!len)
|
if(!len)
|
||||||
return null;
|
return null;
|
||||||
|
@ -1263,18 +1222,16 @@ Dstring getComputerName()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wchar[] buf;
|
|
||||||
DWORD len = MAX_COMPUTERNAME_LENGTH + 1;
|
DWORD len = MAX_COMPUTERNAME_LENGTH + 1;
|
||||||
buf = new wchar[len];
|
wchar[] buf = new wchar[len];
|
||||||
if(!proc(buf.ptr, &len))
|
if(!proc(buf.ptr, &len))
|
||||||
return null;
|
return null;
|
||||||
return fromUnicode(buf.ptr, len);
|
return fromUnicode(buf.ptr, len);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char[] buf;
|
|
||||||
DWORD len = MAX_COMPUTERNAME_LENGTH + 1;
|
DWORD len = MAX_COMPUTERNAME_LENGTH + 1;
|
||||||
buf = new char[len];
|
char[] buf = new char[len];
|
||||||
if(!GetComputerNameA(buf.ptr, &len))
|
if(!GetComputerNameA(buf.ptr, &len))
|
||||||
return null;
|
return null;
|
||||||
return fromAnsi(buf.ptr, len);
|
return fromAnsi(buf.ptr, len);
|
||||||
|
@ -1303,20 +1260,16 @@ Dstring getSystemDirectory()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wchar[] buf;
|
wchar[] buf = new wchar[MAX_PATH];
|
||||||
UINT len;
|
UINT len = proc(buf.ptr, buf.length.toI32);
|
||||||
buf = new wchar[MAX_PATH];
|
|
||||||
len = proc(buf.ptr, buf.length.toI32);
|
|
||||||
if(!len)
|
if(!len)
|
||||||
return null;
|
return null;
|
||||||
return fromUnicode(buf.ptr, len);
|
return fromUnicode(buf.ptr, len);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char[] buf;
|
char[] buf = new char[MAX_PATH];
|
||||||
UINT len;
|
UINT len = GetSystemDirectoryA(buf.ptr, buf.length.toI32);
|
||||||
buf = new char[MAX_PATH];
|
|
||||||
len = GetSystemDirectoryA(buf.ptr, buf.length.toI32);
|
|
||||||
if(!len)
|
if(!len)
|
||||||
return null;
|
return null;
|
||||||
return fromAnsi(buf.ptr, len);
|
return fromAnsi(buf.ptr, len);
|
||||||
|
@ -1384,14 +1337,11 @@ DWORD expandEnvironmentStrings(Dstring src, out Dstring result)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wchar* dest;
|
|
||||||
DWORD len;
|
|
||||||
|
|
||||||
auto strz = toUnicodez(src);
|
auto strz = toUnicodez(src);
|
||||||
len = proc(strz, null, 0);
|
DWORD len = proc(strz, null, 0);
|
||||||
if(!len)
|
if(!len)
|
||||||
return 0;
|
return 0;
|
||||||
dest = (new wchar[len]).ptr;
|
wchar* dest = (new wchar[len]).ptr;
|
||||||
len = proc(strz, dest, len);
|
len = proc(strz, dest, len);
|
||||||
if(!len)
|
if(!len)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1400,14 +1350,11 @@ DWORD expandEnvironmentStrings(Dstring src, out Dstring result)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char* dest;
|
|
||||||
DWORD len;
|
|
||||||
|
|
||||||
auto strz = unsafeAnsiz(src);
|
auto strz = unsafeAnsiz(src);
|
||||||
len = ExpandEnvironmentStringsA(strz, null, 0);
|
DWORD len = ExpandEnvironmentStringsA(strz, null, 0);
|
||||||
if(!len)
|
if(!len)
|
||||||
return 0;
|
return 0;
|
||||||
dest = (new char[len]).ptr;
|
char* dest = (new char[len]).ptr;
|
||||||
len = ExpandEnvironmentStringsA(strz, dest, len);
|
len = ExpandEnvironmentStringsA(strz, dest, len);
|
||||||
if(!len)
|
if(!len)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1438,25 +1385,21 @@ Dstring getEnvironmentVariable(Dstring name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wchar* buf;
|
|
||||||
DWORD len;
|
|
||||||
auto strz = toUnicodez(name);
|
auto strz = toUnicodez(name);
|
||||||
len = proc(strz, null, 0);
|
DWORD len = proc(strz, null, 0);
|
||||||
if(!len)
|
if(!len)
|
||||||
return null;
|
return null;
|
||||||
buf = (new wchar[len]).ptr;
|
wchar* buf = (new wchar[len]).ptr;
|
||||||
len = proc(strz, buf, len);
|
len = proc(strz, buf, len);
|
||||||
return fromUnicode(buf, len);
|
return fromUnicode(buf, len);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char* buf;
|
|
||||||
DWORD len;
|
|
||||||
auto strz = unsafeAnsiz(name);
|
auto strz = unsafeAnsiz(name);
|
||||||
len = GetEnvironmentVariableA(strz, null, 0);
|
DWORD len = GetEnvironmentVariableA(strz, null, 0);
|
||||||
if(!len)
|
if(!len)
|
||||||
return null;
|
return null;
|
||||||
buf = (new char[len]).ptr;
|
char* buf = (new char[len]).ptr;
|
||||||
len = GetEnvironmentVariableA(strz, buf, len);
|
len = GetEnvironmentVariableA(strz, buf, len);
|
||||||
return fromAnsi(buf, len);
|
return fromAnsi(buf, len);
|
||||||
}
|
}
|
||||||
|
@ -1569,16 +1512,14 @@ deprecated BOOL getTextExtentPoint32(HDC hdc, Dstring text, LPSIZE lpSize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Dwstring str;
|
Dwstring str = toUnicode(text);
|
||||||
str = toUnicode(text);
|
|
||||||
return proc(hdc, str.ptr, str.length.toI32, lpSize);
|
return proc(hdc, str.ptr, str.length.toI32, lpSize);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Using GetTextExtentPoint32A here even though W is supported in order
|
// Using GetTextExtentPoint32A here even though W is supported in order
|
||||||
// to keep the measurements accurate with DrawTextA.
|
// to keep the measurements accurate with DrawTextA.
|
||||||
Dstring str;
|
Dstring str = unsafeAnsi(text);
|
||||||
str = unsafeAnsi(text);
|
|
||||||
return GetTextExtentPoint32A(hdc, str.ptr, str.length.toI32, lpSize);
|
return GetTextExtentPoint32A(hdc, str.ptr, str.length.toI32, lpSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1608,23 +1549,19 @@ Dstring dragQueryFile(HDROP hDrop, UINT idxFile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wchar[] str;
|
UINT len = proc(hDrop, idxFile, null, 0);
|
||||||
UINT len;
|
|
||||||
len = proc(hDrop, idxFile, null, 0);
|
|
||||||
if(!len)
|
if(!len)
|
||||||
return null;
|
return null;
|
||||||
str = new wchar[len + 1];
|
wchar[] str = new wchar[len + 1];
|
||||||
proc(hDrop, idxFile, str.ptr, str.length.toI32);
|
proc(hDrop, idxFile, str.ptr, str.length.toI32);
|
||||||
return fromUnicode(str.ptr, len);
|
return fromUnicode(str.ptr, len);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char[] str;
|
UINT len = DragQueryFileA(hDrop, idxFile, null, 0);
|
||||||
UINT len;
|
|
||||||
len = DragQueryFileA(hDrop, idxFile, null, 0);
|
|
||||||
if(!len)
|
if(!len)
|
||||||
return null;
|
return null;
|
||||||
str = new char[len + 1];
|
char[] str = new char[len + 1];
|
||||||
DragQueryFileA(hDrop, idxFile, str.ptr, str.length.toI32);
|
DragQueryFileA(hDrop, idxFile, str.ptr, str.length.toI32);
|
||||||
return fromAnsi(str.ptr, len);
|
return fromAnsi(str.ptr, len);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,13 +4,14 @@
|
||||||
module dfl.internal.winapi;
|
module dfl.internal.winapi;
|
||||||
|
|
||||||
|
|
||||||
public import core.sys.windows.windef;
|
|
||||||
public import core.sys.windows.winuser;
|
|
||||||
public import core.sys.windows.winreg;
|
|
||||||
public import core.sys.windows.wingdi;
|
|
||||||
public import core.sys.windows.commdlg;
|
public import core.sys.windows.commdlg;
|
||||||
public import core.sys.windows.winbase;
|
public import core.sys.windows.winbase;
|
||||||
private import dfl.internal.wincom;
|
public import core.sys.windows.windef;
|
||||||
|
public import core.sys.windows.wingdi;
|
||||||
|
public import core.sys.windows.winreg;
|
||||||
|
public import core.sys.windows.winuser;
|
||||||
|
|
||||||
|
import dfl.internal.wincom;
|
||||||
|
|
||||||
|
|
||||||
version(D_Version2)
|
version(D_Version2)
|
||||||
|
|
|
@ -3,16 +3,16 @@
|
||||||
|
|
||||||
module dfl.internal.wincom;
|
module dfl.internal.wincom;
|
||||||
|
|
||||||
import core.sys.windows.windef;
|
|
||||||
import core.sys.windows.winbase;
|
|
||||||
import core.sys.windows.objidl;
|
import core.sys.windows.objidl;
|
||||||
|
import core.sys.windows.winbase;
|
||||||
|
import core.sys.windows.windef;
|
||||||
|
|
||||||
version(WINE)
|
version(WINE)
|
||||||
version = _dfl_needcom;
|
version = _dfl_needcom;
|
||||||
|
|
||||||
version(_dfl_needcom)
|
version(_dfl_needcom)
|
||||||
{
|
{
|
||||||
private import dfl.internal.dlib;
|
import dfl.internal.dlib;
|
||||||
|
|
||||||
// Grabbed from std.c.windows.com:
|
// Grabbed from std.c.windows.com:
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,14 @@
|
||||||
///
|
///
|
||||||
module dfl.label;
|
module dfl.label;
|
||||||
|
|
||||||
private import dfl.base, dfl.control, dfl.internal.winapi, dfl.application,
|
import dfl.application;
|
||||||
dfl.event, dfl.drawing, dfl.internal.dlib;
|
import dfl.base;
|
||||||
|
import dfl.control;
|
||||||
|
import dfl.drawing;
|
||||||
|
import dfl.event;
|
||||||
|
|
||||||
|
import dfl.internal.dlib;
|
||||||
|
import dfl.internal.winapi;
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
|
|
|
@ -5,14 +5,18 @@
|
||||||
///
|
///
|
||||||
module dfl.listbox;
|
module dfl.listbox;
|
||||||
|
|
||||||
private import dfl.internal.dlib;
|
import dfl.application;
|
||||||
|
import dfl.base;
|
||||||
private import dfl.internal.winapi, dfl.control, dfl.base, dfl.application;
|
import dfl.collections;
|
||||||
private import dfl.drawing, dfl.event, dfl.collections;
|
import dfl.control;
|
||||||
|
import dfl.drawing;
|
||||||
|
import dfl.event;
|
||||||
|
import dfl.internal.winapi;
|
||||||
|
|
||||||
|
import dfl.internal.dlib;
|
||||||
static import dfl.internal.utf;
|
static import dfl.internal.utf;
|
||||||
|
|
||||||
private import std.algorithm;
|
import std.algorithm;
|
||||||
|
|
||||||
private extern(C) void* memmove(void*, void*, size_t len);
|
private extern(C) void* memmove(void*, void*, size_t len);
|
||||||
|
|
||||||
|
@ -1323,7 +1327,7 @@ class ListBox: ListControl // docmain
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected override void onReflectedMessage(ref Message m)
|
override void onReflectedMessage(ref Message m)
|
||||||
{
|
{
|
||||||
super.onReflectedMessage(m);
|
super.onReflectedMessage(m);
|
||||||
|
|
||||||
|
|
|
@ -5,17 +5,24 @@
|
||||||
///
|
///
|
||||||
module dfl.listview;
|
module dfl.listview;
|
||||||
|
|
||||||
private import dfl.internal.dlib, dfl.internal.clib;
|
import dfl.application;
|
||||||
|
import dfl.base;
|
||||||
|
import dfl.collections;
|
||||||
|
import dfl.control;
|
||||||
|
import dfl.drawing;
|
||||||
|
import dfl.event;
|
||||||
|
|
||||||
private import dfl.base, dfl.control, dfl.internal.winapi, dfl.application;
|
import dfl.internal.clib;
|
||||||
private import dfl.event, dfl.drawing, dfl.collections, dfl.internal.utf;
|
import dfl.internal.dlib;
|
||||||
|
import dfl.internal.utf;
|
||||||
|
import dfl.internal.winapi;
|
||||||
|
|
||||||
version(DFL_NO_IMAGELIST)
|
version(DFL_NO_IMAGELIST)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
private import dfl.imagelist;
|
import dfl.imagelist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -121,35 +128,48 @@ class ListViewSubItem: DObject
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override Dstring toString()
|
override Dstring toString() const
|
||||||
{
|
{
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override Dequ opEquals(Object o)
|
override Dequ opEquals(Object o) const
|
||||||
{
|
{
|
||||||
return text == getObjectString(o);
|
return text == getObjectString(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dequ opEquals(Dstring val)
|
Dequ opEquals(Dstring val) const
|
||||||
{
|
{
|
||||||
return text == val;
|
return text == val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override int opCmp(Object o)
|
override int opCmp(Object o) const
|
||||||
{
|
{
|
||||||
return stringICmp(text, getObjectString(o));
|
return stringICmp(text, getObjectString(o));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int opCmp(Dstring val)
|
int opCmp(Dstring val) const
|
||||||
{
|
{
|
||||||
return stringICmp(text, val);
|
return stringICmp(text, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override size_t toHash() const nothrow @trusted
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return hashOf(text);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
assert(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
final @property void text(Dstring newText) // setter
|
final @property void text(Dstring newText) // setter
|
||||||
|
@ -168,7 +188,7 @@ class ListViewSubItem: DObject
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ditto
|
/// ditto
|
||||||
final @property Dstring text() // getter
|
final @property Dstring text() const // getter
|
||||||
{
|
{
|
||||||
return _txt;
|
return _txt;
|
||||||
}
|
}
|
||||||
|
@ -237,7 +257,7 @@ class ListViewItem: DObject
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private final void _setcheckstate(int thisindex, bool bchecked)
|
private void _setcheckstate(int thisindex, bool bchecked)
|
||||||
{
|
{
|
||||||
if(lview && lview.created)
|
if(lview && lview.created)
|
||||||
{
|
{
|
||||||
|
@ -249,7 +269,7 @@ class ListViewItem: DObject
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private final bool _getcheckstate(int thisindex)
|
private bool _getcheckstate(int thisindex)
|
||||||
{
|
{
|
||||||
if(lview && lview.created)
|
if(lview && lview.created)
|
||||||
{
|
{
|
||||||
|
@ -280,35 +300,48 @@ class ListViewItem: DObject
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override Dstring toString()
|
override Dstring toString() const
|
||||||
{
|
{
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override Dequ opEquals(Object o)
|
override Dequ opEquals(Object o) const
|
||||||
{
|
{
|
||||||
return text == getObjectString(o);
|
return text == getObjectString(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dequ opEquals(Dstring val)
|
Dequ opEquals(Dstring val) const
|
||||||
{
|
{
|
||||||
return text == val;
|
return text == val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override int opCmp(Object o)
|
override int opCmp(Object o) const
|
||||||
{
|
{
|
||||||
return stringICmp(text, getObjectString(o));
|
return stringICmp(text, getObjectString(o));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int opCmp(Dstring val)
|
int opCmp(Dstring val) const
|
||||||
{
|
{
|
||||||
return stringICmp(text, val);
|
return stringICmp(text, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override size_t toHash() const nothrow @trusted
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return hashOf(text);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
assert(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
final @property Rect bounds() // getter
|
final @property Rect bounds() // getter
|
||||||
|
@ -342,7 +375,7 @@ class ListViewItem: DObject
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ditto
|
/// ditto
|
||||||
final @property Dstring text() // getter
|
final @property Dstring text() const // getter
|
||||||
{
|
{
|
||||||
return _txt;
|
return _txt;
|
||||||
}
|
}
|
||||||
|
@ -491,42 +524,55 @@ class ColumnHeader: DObject
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ditto
|
/// ditto
|
||||||
final @property Dstring text() // getter
|
final @property Dstring text() const // getter
|
||||||
{
|
{
|
||||||
return _txt;
|
return _txt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override Dstring toString()
|
override Dstring toString() const
|
||||||
{
|
{
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override Dequ opEquals(Object o)
|
override Dequ opEquals(Object o) const
|
||||||
{
|
{
|
||||||
return text == getObjectString(o);
|
return text == getObjectString(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dequ opEquals(Dstring val)
|
Dequ opEquals(Dstring val) const
|
||||||
{
|
{
|
||||||
return text == val;
|
return text == val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override int opCmp(Object o)
|
override int opCmp(Object o) const
|
||||||
{
|
{
|
||||||
return stringICmp(text, getObjectString(o));
|
return stringICmp(text, getObjectString(o));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int opCmp(Dstring val)
|
int opCmp(Dstring val) const
|
||||||
{
|
{
|
||||||
return stringICmp(text, val);
|
return stringICmp(text, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override size_t toHash() const nothrow @trusted
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return hashOf(text);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
assert(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
final @property int index() // getter
|
final @property int index() // getter
|
||||||
{
|
{
|
||||||
|
@ -791,13 +837,13 @@ class ListView: ControlSuperClass // docmain
|
||||||
package ListViewItem[] _items;
|
package ListViewItem[] _items;
|
||||||
|
|
||||||
|
|
||||||
package final @property bool created() // getter
|
package @property bool created() // getter
|
||||||
{
|
{
|
||||||
return lv && lv.created();
|
return lv && lv.created();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
package final void doListItems() // DMD 0.125: this member is not accessible when private.
|
package void doListItems() // DMD 0.125: this member is not accessible when private.
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
assert(created);
|
assert(created);
|
||||||
|
@ -897,7 +943,7 @@ class ListView: ControlSuperClass // docmain
|
||||||
ColumnHeader[] _headers;
|
ColumnHeader[] _headers;
|
||||||
|
|
||||||
|
|
||||||
package final @property bool created() // getter
|
package @property bool created() // getter
|
||||||
{
|
{
|
||||||
return lv && lv.created();
|
return lv && lv.created();
|
||||||
}
|
}
|
||||||
|
@ -910,7 +956,7 @@ class ListView: ControlSuperClass // docmain
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
package final void doListHeaders() // DMD 0.125: this member is not accessible when private.
|
package void doListHeaders() // DMD 0.125: this member is not accessible when private.
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
assert(created);
|
assert(created);
|
||||||
|
@ -1746,7 +1792,7 @@ class ListView: ControlSuperClass // docmain
|
||||||
sitems = sitems.dup; // So exception won't damage anything.
|
sitems = sitems.dup; // So exception won't damage anything.
|
||||||
// Stupid bubble sort. At least it's a "stable sort".
|
// Stupid bubble sort. At least it's a "stable sort".
|
||||||
bool swp;
|
bool swp;
|
||||||
auto sortmax = sitems.length - 1;
|
auto sortmax = sitems.length + (-1);
|
||||||
size_t iw;
|
size_t iw;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -1803,7 +1849,7 @@ class ListView: ControlSuperClass // docmain
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ditto
|
/// ditto
|
||||||
final int delegate(ListViewItem, ListViewItem) sorter() @property // getter
|
final int delegate(ListViewItem, ListViewItem) sorter() const @property // getter
|
||||||
{
|
{
|
||||||
return _sortproc;
|
return _sortproc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,13 +5,20 @@
|
||||||
///
|
///
|
||||||
module dfl.menu;
|
module dfl.menu;
|
||||||
|
|
||||||
private import dfl.internal.dlib;
|
import dfl.application;
|
||||||
|
import dfl.base;
|
||||||
|
import dfl.collections;
|
||||||
|
import dfl.control;
|
||||||
|
import dfl.drawing;
|
||||||
|
import dfl.event;
|
||||||
|
|
||||||
|
import dfl.internal.dlib;
|
||||||
|
import dfl.internal.utf;
|
||||||
|
import dfl.internal.winapi;
|
||||||
|
|
||||||
private import dfl.internal.winapi, dfl.control, dfl.base, dfl.event;
|
|
||||||
private import dfl.internal.utf, dfl.drawing, dfl.application, dfl.collections;
|
|
||||||
debug(APP_PRINT)
|
debug(APP_PRINT)
|
||||||
{
|
{
|
||||||
private import dfl.internal.clib;
|
import dfl.internal.clib;
|
||||||
}
|
}
|
||||||
|
|
||||||
version(DFL_NO_MENUS)
|
version(DFL_NO_MENUS)
|
||||||
|
@ -118,7 +125,7 @@ else
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ditto
|
/// ditto
|
||||||
final @property Dstring text() // getter
|
final @property Dstring text() const // getter
|
||||||
{
|
{
|
||||||
// if(mparent) fetch text ?
|
// if(mparent) fetch text ?
|
||||||
return mtext;
|
return mtext;
|
||||||
|
@ -520,36 +527,49 @@ else
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override Dstring toString()
|
override Dstring toString() const
|
||||||
{
|
{
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override Dequ opEquals(Object o)
|
override Dequ opEquals(Object o) const
|
||||||
{
|
{
|
||||||
return text == getObjectString(o);
|
return text == getObjectString(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dequ opEquals(Dstring val)
|
Dequ opEquals(Dstring val) const
|
||||||
{
|
{
|
||||||
return text == val;
|
return text == val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override int opCmp(Object o)
|
override int opCmp(Object o) const
|
||||||
{
|
{
|
||||||
return stringICmp(text, getObjectString(o));
|
return stringICmp(text, getObjectString(o));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int opCmp(Dstring val)
|
int opCmp(Dstring val) const
|
||||||
{
|
{
|
||||||
return stringICmp(text, val);
|
return stringICmp(text, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override size_t toHash() const nothrow @trusted
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return hashOf(text);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
assert(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected override void onReflectedMessage(ref Message m)
|
protected override void onReflectedMessage(ref Message m)
|
||||||
{
|
{
|
||||||
super.onReflectedMessage(m);
|
super.onReflectedMessage(m);
|
||||||
|
@ -738,7 +758,7 @@ else
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
package final void _additem(MenuItem mi)
|
package void _additem(MenuItem mi)
|
||||||
{
|
{
|
||||||
// Fix indices after this point.
|
// Fix indices after this point.
|
||||||
int idx;
|
int idx;
|
||||||
|
@ -754,7 +774,7 @@ else
|
||||||
|
|
||||||
|
|
||||||
// Note: clear() doesn't call this. Update: does now.
|
// Note: clear() doesn't call this. Update: does now.
|
||||||
package final void _delitem(int idx)
|
package void _delitem(int idx)
|
||||||
{
|
{
|
||||||
// Fix indices after this point.
|
// Fix indices after this point.
|
||||||
if(idx < items.length)
|
if(idx < items.length)
|
||||||
|
@ -864,7 +884,7 @@ else
|
||||||
|
|
||||||
|
|
||||||
// Extra.
|
// Extra.
|
||||||
deprecated final void opOpAssign(string op)(MenuItem mi) if (op == "~")
|
deprecated void opOpAssign(string op)(MenuItem mi) if (op == "~")
|
||||||
{
|
{
|
||||||
menuItems.insert(menuItems.length.toI32, mi);
|
menuItems.insert(menuItems.length.toI32, mi);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,10 @@
|
||||||
///
|
///
|
||||||
module dfl.messagebox;
|
module dfl.messagebox;
|
||||||
|
|
||||||
private import dfl.internal.winapi, dfl.internal.dlib, dfl.base;
|
import dfl.base;
|
||||||
|
|
||||||
|
import dfl.internal.dlib;
|
||||||
|
import dfl.internal.winapi;
|
||||||
static import dfl.internal.utf;
|
static import dfl.internal.utf;
|
||||||
|
|
||||||
///
|
///
|
||||||
|
|
|
@ -5,16 +5,104 @@
|
||||||
///
|
///
|
||||||
module dfl.notifyicon;
|
module dfl.notifyicon;
|
||||||
|
|
||||||
private import dfl.internal.winapi, dfl.base, dfl.drawing;
|
import dfl.application;
|
||||||
private import dfl.control, dfl.form, dfl.application;
|
import dfl.base;
|
||||||
private import dfl.event, dfl.internal.utf, dfl.internal.dlib;
|
import dfl.control;
|
||||||
|
import dfl.drawing;
|
||||||
|
import dfl.event;
|
||||||
|
import dfl.form;
|
||||||
|
|
||||||
version(DFL_NO_MENUS)
|
version(DFL_NO_MENUS)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
private import dfl.menu;
|
import dfl.menu;
|
||||||
|
}
|
||||||
|
|
||||||
|
import dfl.internal.dlib;
|
||||||
|
import dfl.internal.utf;
|
||||||
|
|
||||||
|
import core.sys.windows.basetyps : GUID;
|
||||||
|
import core.sys.windows.shellapi;
|
||||||
|
import core.sys.windows.winbase;
|
||||||
|
import core.sys.windows.windef;
|
||||||
|
import core.sys.windows.winuser;
|
||||||
|
|
||||||
|
|
||||||
|
// NOTE: Workaround for shellapi.h
|
||||||
|
enum NOTIFYICON_VERSION_4 = 4;
|
||||||
|
enum NIF_SHOWTIP = 0x00000080;
|
||||||
|
enum NIIF_USER = 0x00000004;
|
||||||
|
|
||||||
|
struct DFL_NOTIFYICONDATAA {
|
||||||
|
DWORD cbSize = DFL_NOTIFYICONDATAA.sizeof;
|
||||||
|
HWND hWnd;
|
||||||
|
UINT uID;
|
||||||
|
UINT uFlags;
|
||||||
|
UINT uCallbackMessage;
|
||||||
|
HICON hIcon;
|
||||||
|
CHAR[128] szTip = 0;
|
||||||
|
DWORD dwState;
|
||||||
|
DWORD dwStateMask;
|
||||||
|
CHAR[256] szInfo = 0;
|
||||||
|
union {
|
||||||
|
UINT uTimeout;
|
||||||
|
UINT uVersion;
|
||||||
|
}
|
||||||
|
CHAR[64] szInfoTitle = 0;
|
||||||
|
DWORD dwInfoFlags;
|
||||||
|
GUID guidItem;
|
||||||
|
HICON hBalloonIcon;
|
||||||
|
}
|
||||||
|
alias DFL_PNOTIFYICONDATAA = DFL_NOTIFYICONDATAA*;
|
||||||
|
|
||||||
|
struct DFL_NOTIFYICONDATAW {
|
||||||
|
DWORD cbSize = DFL_NOTIFYICONDATAW.sizeof;
|
||||||
|
HWND hWnd;
|
||||||
|
UINT uID;
|
||||||
|
UINT uFlags;
|
||||||
|
UINT uCallbackMessage;
|
||||||
|
HICON hIcon;
|
||||||
|
WCHAR[128] szTip = 0;
|
||||||
|
DWORD dwState;
|
||||||
|
DWORD dwStateMask;
|
||||||
|
WCHAR[256] szInfo = 0;
|
||||||
|
union {
|
||||||
|
UINT uTimeout;
|
||||||
|
UINT uVersion;
|
||||||
|
}
|
||||||
|
WCHAR[64] szInfoTitle = 0;
|
||||||
|
DWORD dwInfoFlags;
|
||||||
|
GUID guidItem;
|
||||||
|
HICON hBalloonIcon;
|
||||||
|
}
|
||||||
|
alias DFL_PNOTIFYICONDATAW = DFL_NOTIFYICONDATAW*;
|
||||||
|
|
||||||
|
static if (useUnicode)
|
||||||
|
{
|
||||||
|
BOOL DFL_Shell_NotifyIcon(DWORD dw, DFL_PNOTIFYICONDATAW notif)
|
||||||
|
{
|
||||||
|
return Shell_NotifyIcon(dw, cast(PNOTIFYICONDATAW)notif);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BOOL DFL_Shell_NotifyIcon(DWORD dw, DFL_PNOTIFYICONDATAA notif)
|
||||||
|
{
|
||||||
|
return Shell_NotifyIcon(dw, cast(PNOTIFYICONDATAA)notif);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
enum BalloonTipIconStyle
|
||||||
|
{
|
||||||
|
NONE,
|
||||||
|
INFO,
|
||||||
|
WARNING,
|
||||||
|
ERROR,
|
||||||
|
USER
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,15 +129,15 @@ class NotifyIcon // docmain
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
final @property void icon(Icon ico) // setter
|
final @property void icon(Icon icon) // setter
|
||||||
{
|
{
|
||||||
_icon = ico;
|
_icon = icon;
|
||||||
nid.hIcon = ico ? ico.handle : null;
|
_nid.hIcon = icon ? icon.handle : null;
|
||||||
|
|
||||||
if(visible)
|
if(visible)
|
||||||
{
|
{
|
||||||
nid.uFlags = NIF_ICON;
|
_nid.uFlags |= NIF_ICON;
|
||||||
Shell_NotifyIconA(NIM_MODIFY, &nid);
|
DFL_Shell_NotifyIcon(NIM_MODIFY, &_nid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,34 +149,33 @@ class NotifyIcon // docmain
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
// Must be less than 64 chars.
|
|
||||||
// To-do: hold reference to setter's string, use that for getter.. ?
|
|
||||||
final @property void text(Dstring txt) // setter
|
final @property void text(Dstring txt) // setter
|
||||||
{
|
{
|
||||||
if(txt.length >= nid.szTip.length)
|
if(txt.length >= _nid.szTip.length)
|
||||||
throw new DflException("Notify icon text too long");
|
throw new DflException("Notify icon text too long");
|
||||||
|
|
||||||
// To-do: support Unicode.
|
static if (useUnicode)
|
||||||
|
Dwstring str = toUnicode(txt);
|
||||||
txt = unsafeAnsi(txt); // ...
|
else
|
||||||
nid.szTip[txt.length] = 0;
|
Dstring str = unsafeAnsi(txt);
|
||||||
nid.szTip[0 .. txt.length] = txt[];
|
_nid.szTip[str.length] = 0;
|
||||||
tipLen = txt.length.toI32;
|
_nid.szTip[0 .. str.length] = str[];
|
||||||
|
_tipLen = str.length.toI32;
|
||||||
|
|
||||||
if(visible)
|
if(visible)
|
||||||
{
|
{
|
||||||
nid.uFlags = NIF_TIP;
|
_nid.uFlags |= NIF_TIP;
|
||||||
Shell_NotifyIconA(NIM_MODIFY, &nid);
|
DFL_Shell_NotifyIcon(NIM_MODIFY, &_nid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ditto
|
/// ditto
|
||||||
final @property Dstring text() // getter
|
final @property Dstring text() // getter
|
||||||
{
|
{
|
||||||
//return nid.szTip[0 .. tipLen]; // Returning possibly mutated text!
|
static if (useUnicode)
|
||||||
//return nid.szTip[0 .. tipLen].dup;
|
return fromUnicodez(_nid.szTip[0 .. _tipLen].ptr);
|
||||||
//return nid.szTip[0 .. tipLen].idup; // Needed in D2. Doesn't work in D1.
|
else
|
||||||
return cast(Dstring)nid.szTip[0 .. tipLen].dup; // Needed in D2. Doesn't work in D1.
|
return cast(Dstring)_nid.szTip[0 .. _tipLen].dup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -97,29 +184,28 @@ class NotifyIcon // docmain
|
||||||
{
|
{
|
||||||
if(byes)
|
if(byes)
|
||||||
{
|
{
|
||||||
if(!nid.uID)
|
if(!_nid.uID)
|
||||||
{
|
{
|
||||||
nid.uID = allocNotifyIconID();
|
_nid.uID = allocNotifyIconID();
|
||||||
assert(nid.uID);
|
assert(_nid.uID);
|
||||||
allNotifyIcons[nid.uID] = this;
|
allNotifyIcons[_nid.uID] = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
_forceAdd();
|
_forceAdd();
|
||||||
}
|
}
|
||||||
else if(nid.uID)
|
else if(_nid.uID)
|
||||||
{
|
{
|
||||||
_forceDelete();
|
_forceDelete();
|
||||||
|
|
||||||
//delete allNotifyIcons[nid.uID];
|
allNotifyIcons.remove(_nid.uID);
|
||||||
allNotifyIcons.remove(nid.uID);
|
_nid.uID = 0;
|
||||||
nid.uID = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ditto
|
/// ditto
|
||||||
final @property bool visible() // getter
|
final @property bool visible() // getter
|
||||||
{
|
{
|
||||||
return nid.uID != 0;
|
return _nid.uID != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -134,8 +220,74 @@ class NotifyIcon // docmain
|
||||||
{
|
{
|
||||||
visible = false;
|
visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
final void showBalloonTip()
|
||||||
|
{
|
||||||
|
_nid.uFlags |= NIF_INFO;
|
||||||
|
DFL_Shell_NotifyIcon(NIM_MODIFY, &_nid);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
final @property void balloonTipTitle(Dstring title) // setter
|
||||||
|
{
|
||||||
|
Dwstring str = toUnicode(title ~ '\0');
|
||||||
|
_nid.szInfoTitle[0 .. str.length] = str[];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
final @property void balloonTipText(Dstring text) // setter
|
||||||
|
{
|
||||||
|
Dwstring str = toUnicode(text ~ '\0');
|
||||||
|
_nid.szInfo[0 .. str.length] = str[];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
final @property void balloonTipIconStyle(BalloonTipIconStyle style) // setter
|
||||||
|
{
|
||||||
|
_nid.dwInfoFlags &= ~NIIF_ICON_MASK;
|
||||||
|
final switch (style)
|
||||||
|
{
|
||||||
|
case BalloonTipIconStyle.NONE:
|
||||||
|
_nid.dwInfoFlags |= NIIF_NONE;
|
||||||
|
break;
|
||||||
|
case BalloonTipIconStyle.INFO:
|
||||||
|
_nid.dwInfoFlags |= NIIF_INFO;
|
||||||
|
break;
|
||||||
|
case BalloonTipIconStyle.WARNING:
|
||||||
|
_nid.dwInfoFlags |= NIIF_WARNING;
|
||||||
|
break;
|
||||||
|
case BalloonTipIconStyle.ERROR:
|
||||||
|
_nid.dwInfoFlags |= NIIF_ERROR;
|
||||||
|
break;
|
||||||
|
case BalloonTipIconStyle.USER:
|
||||||
|
_nid.dwInfoFlags |= NIIF_USER;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
final @property void balloonTipIcon(Icon icon) // setter
|
||||||
|
{
|
||||||
|
_balloonTipIcon = icon;
|
||||||
|
_nid.hBalloonIcon = icon ? icon.handle : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
final @property void balloonTipSound(bool byes) // setter
|
||||||
|
{
|
||||||
|
if (byes)
|
||||||
|
_nid.dwInfoFlags &= ~NIIF_NOSOUND;
|
||||||
|
else
|
||||||
|
_nid.dwInfoFlags |= NIIF_NOSOUND;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Event!(NotifyIcon, EventArgs) click; ///
|
Event!(NotifyIcon, EventArgs) click; ///
|
||||||
Event!(NotifyIcon, EventArgs) doubleClick; ///
|
Event!(NotifyIcon, EventArgs) doubleClick; ///
|
||||||
Event!(NotifyIcon, MouseEventArgs) mouseDown; ///
|
Event!(NotifyIcon, MouseEventArgs) mouseDown; ///
|
||||||
|
@ -148,34 +300,22 @@ class NotifyIcon // docmain
|
||||||
if(!ctrlNotifyIcon)
|
if(!ctrlNotifyIcon)
|
||||||
_init();
|
_init();
|
||||||
|
|
||||||
nid.cbSize = nid.sizeof;
|
_nid.cbSize = _nid.sizeof;
|
||||||
nid.hWnd = ctrlNotifyIcon.handle;
|
_nid.hWnd = ctrlNotifyIcon.handle;
|
||||||
nid.uID = 0;
|
_nid.uID = 0;
|
||||||
nid.uCallbackMessage = WM_NOTIFYICON;
|
_nid.uCallbackMessage = WM_NOTIFYICON;
|
||||||
nid.hIcon = null;
|
_nid.hIcon = null;
|
||||||
nid.szTip[0] = '\0';
|
_nid.szTip[0] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
~this()
|
~this()
|
||||||
{
|
{
|
||||||
if(nid.uID)
|
if(_nid.uID)
|
||||||
{
|
{
|
||||||
_forceDelete();
|
_forceDelete();
|
||||||
//delete allNotifyIcons[nid.uID];
|
allNotifyIcons.remove(_nid.uID);
|
||||||
allNotifyIcons.remove(nid.uID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//delete allNotifyIcons[nid.uID];
|
|
||||||
//allNotifyIcons.remove(nid.uID);
|
|
||||||
|
|
||||||
/+
|
|
||||||
if(!allNotifyIcons.length)
|
|
||||||
{
|
|
||||||
delete ctrlNotifyIcon;
|
|
||||||
ctrlNotifyIcon = null;
|
|
||||||
}
|
|
||||||
+/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -183,11 +323,8 @@ class NotifyIcon // docmain
|
||||||
// Extra.
|
// Extra.
|
||||||
void minimize(IWindow win)
|
void minimize(IWindow win)
|
||||||
{
|
{
|
||||||
LONG style;
|
HWND hwnd = win.handle;
|
||||||
HWND hwnd;
|
LONG style = GetWindowLongPtrA(hwnd, GWL_STYLE).toI32;
|
||||||
|
|
||||||
hwnd = win.handle;
|
|
||||||
style = GetWindowLongPtrA(hwnd, GWL_STYLE).toI32;
|
|
||||||
|
|
||||||
if(style & WS_VISIBLE)
|
if(style & WS_VISIBLE)
|
||||||
{
|
{
|
||||||
|
@ -211,11 +348,8 @@ class NotifyIcon // docmain
|
||||||
// Extra.
|
// Extra.
|
||||||
void restore(IWindow win)
|
void restore(IWindow win)
|
||||||
{
|
{
|
||||||
LONG style;
|
HWND hwnd = win.handle;
|
||||||
HWND hwnd;
|
LONG style = GetWindowLongPtrA(hwnd, GWL_STYLE).toI32;
|
||||||
|
|
||||||
hwnd = win.handle;
|
|
||||||
style = GetWindowLongPtrA(hwnd, GWL_STYLE).toI32;
|
|
||||||
|
|
||||||
if(!(style & WS_VISIBLE))
|
if(!(style & WS_VISIBLE))
|
||||||
{
|
{
|
||||||
|
@ -251,8 +385,11 @@ class NotifyIcon // docmain
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
NOTIFYICONDATA nid;
|
static if (useUnicode)
|
||||||
int tipLen = 0;
|
DFL_NOTIFYICONDATAW _nid;
|
||||||
|
else
|
||||||
|
DFL_NOTIFYICONDATAA _nid;
|
||||||
|
int _tipLen = 0;
|
||||||
version(DFL_NO_MENUS)
|
version(DFL_NO_MENUS)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -260,19 +397,24 @@ class NotifyIcon // docmain
|
||||||
{
|
{
|
||||||
ContextMenu cmenu;
|
ContextMenu cmenu;
|
||||||
}
|
}
|
||||||
Icon _icon;
|
Icon _icon; /// Task tray icon
|
||||||
|
Icon _balloonTipIcon; /// Balloon tip icon
|
||||||
|
|
||||||
|
|
||||||
package final void _forceAdd()
|
package final void _forceAdd()
|
||||||
{
|
{
|
||||||
nid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
|
_nid.uFlags |= NIF_MESSAGE | NIF_ICON | NIF_TIP | NIF_SHOWTIP;
|
||||||
Shell_NotifyIconA(NIM_ADD, &nid);
|
if (_nid.hIcon)
|
||||||
|
_nid.uFlags |= NIF_ICON;
|
||||||
|
else
|
||||||
|
_nid.uFlags &= ~NIF_ICON;
|
||||||
|
DFL_Shell_NotifyIcon(NIM_ADD, &_nid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
package final void _forceDelete()
|
package final void _forceDelete()
|
||||||
{
|
{
|
||||||
Shell_NotifyIconA(NIM_DELETE, &nid);
|
DFL_Shell_NotifyIcon(NIM_DELETE, &_nid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -291,12 +433,11 @@ class NotifyIcon // docmain
|
||||||
// Gets the tray area.
|
// Gets the tray area.
|
||||||
static void _area(out RECT rect)
|
static void _area(out RECT rect)
|
||||||
{
|
{
|
||||||
HWND hwTaskbar, hw;
|
HWND hwTaskbar = FindWindowExA(null, null, "Shell_TrayWnd", null);
|
||||||
|
|
||||||
hwTaskbar = FindWindowExA(null, null, "Shell_TrayWnd", null);
|
|
||||||
if(hwTaskbar)
|
if(hwTaskbar)
|
||||||
{
|
{
|
||||||
hw = FindWindowExA(hwTaskbar, null, "TrayNotifyWnd", null);
|
HWND hw = FindWindowExA(hwTaskbar, null, "TrayNotifyWnd", null);
|
||||||
if(hw)
|
if(hw)
|
||||||
{
|
{
|
||||||
GetWindowRect(hw, &rect);
|
GetWindowRect(hw, &rect);
|
||||||
|
@ -373,8 +514,7 @@ class NotifyIconControl: Control
|
||||||
}
|
}
|
||||||
|
|
||||||
Application.creatingControl(this);
|
Application.creatingControl(this);
|
||||||
hwnd = CreateWindowExA(wexstyle, CONTROL_CLASSNAME.ptr, "NotifyIcon", 0, 0, 0, 0, 0, null, null,
|
hwnd = CreateWindowExA(wexstyle, CONTROL_CLASSNAME.ptr, "NotifyIcon", 0, 0, 0, 0, 0, null, null, Application.getInstance(), null);
|
||||||
Application.getInstance(), null);
|
|
||||||
if(!hwnd)
|
if(!hwnd)
|
||||||
goto create_err;
|
goto create_err;
|
||||||
}
|
}
|
||||||
|
@ -386,11 +526,9 @@ class NotifyIconControl: Control
|
||||||
{
|
{
|
||||||
if(cast(UINT)msg.wParam in allNotifyIcons)
|
if(cast(UINT)msg.wParam in allNotifyIcons)
|
||||||
{
|
{
|
||||||
NotifyIcon ni;
|
NotifyIcon ni = allNotifyIcons[cast(UINT)msg.wParam];
|
||||||
Point pt;
|
Point pt;
|
||||||
|
|
||||||
ni = allNotifyIcons[cast(UINT)msg.wParam];
|
|
||||||
|
|
||||||
switch(cast(UINT)msg.lParam) // msg.
|
switch(cast(UINT)msg.lParam) // msg.
|
||||||
{
|
{
|
||||||
case WM_MOUSEMOVE:
|
case WM_MOUSEMOVE:
|
||||||
|
@ -468,8 +606,7 @@ static ~this()
|
||||||
|
|
||||||
UINT allocNotifyIconID()
|
UINT allocNotifyIconID()
|
||||||
{
|
{
|
||||||
UINT prev;
|
UINT prev = lastId;
|
||||||
prev = lastId;
|
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
lastId++;
|
lastId++;
|
||||||
|
|
|
@ -5,14 +5,46 @@
|
||||||
/// Imports all of DFL's public interface.
|
/// Imports all of DFL's public interface.
|
||||||
module dfl;
|
module dfl;
|
||||||
|
|
||||||
public import dfl.base, dfl.menu, dfl.control, dfl.usercontrol,
|
public import dfl.application;
|
||||||
dfl.form, dfl.drawing, dfl.panel, dfl.event, dfl.clippingform,
|
public import dfl.base;
|
||||||
dfl.application, dfl.button, dfl.socket,
|
public import dfl.button;
|
||||||
dfl.timer, dfl.environment, dfl.label, dfl.textboxbase, dfl.textbox,
|
public import dfl.chart;
|
||||||
dfl.listbox, dfl.splitter, dfl.groupbox, dfl.messagebox,
|
public import dfl.clipboard;
|
||||||
dfl.registry, dfl.notifyicon, dfl.collections, dfl.data,
|
public import dfl.clippingform;
|
||||||
dfl.clipboard, dfl.commondialog, dfl.richtextbox, dfl.tooltip,
|
public import dfl.collections;
|
||||||
dfl.combobox, dfl.treeview, dfl.picturebox, dfl.tabcontrol,
|
public import dfl.combobox;
|
||||||
dfl.listview, dfl.statusbar, dfl.progressbar, dfl.resources,
|
public import dfl.commondialog;
|
||||||
dfl.imagelist, dfl.toolbar, dfl.trackbar, dfl.sharedcontrol,
|
public import dfl.control;
|
||||||
dfl.printing, dfl.chart;
|
public import dfl.data;
|
||||||
|
public import dfl.drawing;
|
||||||
|
public import dfl.environment;
|
||||||
|
public import dfl.event;
|
||||||
|
public import dfl.form;
|
||||||
|
public import dfl.groupbox;
|
||||||
|
public import dfl.imagelist;
|
||||||
|
public import dfl.label;
|
||||||
|
public import dfl.listbox;
|
||||||
|
public import dfl.listview;
|
||||||
|
public import dfl.menu;
|
||||||
|
public import dfl.messagebox;
|
||||||
|
public import dfl.notifyicon;
|
||||||
|
public import dfl.panel;
|
||||||
|
public import dfl.picturebox;
|
||||||
|
public import dfl.printing;
|
||||||
|
public import dfl.progressbar;
|
||||||
|
public import dfl.registry;
|
||||||
|
public import dfl.resources;
|
||||||
|
public import dfl.richtextbox;
|
||||||
|
public import dfl.sharedcontrol;
|
||||||
|
public import dfl.socket;
|
||||||
|
public import dfl.splitter;
|
||||||
|
public import dfl.statusbar;
|
||||||
|
public import dfl.tabcontrol;
|
||||||
|
public import dfl.textbox;
|
||||||
|
public import dfl.textboxbase;
|
||||||
|
public import dfl.timer;
|
||||||
|
public import dfl.toolbar;
|
||||||
|
public import dfl.tooltip;
|
||||||
|
public import dfl.trackbar;
|
||||||
|
public import dfl.treeview;
|
||||||
|
public import dfl.usercontrol;
|
||||||
|
|
|
@ -5,7 +5,10 @@
|
||||||
///
|
///
|
||||||
module dfl.panel;
|
module dfl.panel;
|
||||||
|
|
||||||
private import dfl.control, dfl.base, dfl.internal.winapi;
|
import dfl.base;
|
||||||
|
import dfl.control;
|
||||||
|
|
||||||
|
import dfl.internal.winapi;
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
|
|
|
@ -5,12 +5,12 @@
|
||||||
///
|
///
|
||||||
module dfl.picturebox;
|
module dfl.picturebox;
|
||||||
|
|
||||||
private import dfl.control;
|
import dfl.base;
|
||||||
private import dfl.base;
|
import dfl.control;
|
||||||
private import dfl.drawing;
|
import dfl.drawing;
|
||||||
private import dfl.event;
|
import dfl.event;
|
||||||
|
|
||||||
private import core.sys.windows.windows;
|
import core.sys.windows.windows;
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
|
|
|
@ -5,30 +5,31 @@
|
||||||
///
|
///
|
||||||
module dfl.printing;
|
module dfl.printing;
|
||||||
|
|
||||||
|
import dfl.base;
|
||||||
|
import dfl.button;
|
||||||
|
import dfl.commondialog;
|
||||||
|
import dfl.control;
|
||||||
|
import dfl.drawing;
|
||||||
|
import dfl.event;
|
||||||
|
import dfl.form;
|
||||||
|
import dfl.imagelist;
|
||||||
|
import dfl.label;
|
||||||
|
import dfl.messagebox;
|
||||||
|
import dfl.panel;
|
||||||
|
import dfl.textbox;
|
||||||
|
import dfl.toolbar;
|
||||||
|
|
||||||
|
import dfl.internal.utf;
|
||||||
|
|
||||||
|
import std.algorithm;
|
||||||
|
import std.conv;
|
||||||
|
import std.range;
|
||||||
|
|
||||||
pragma(lib, "WinSpool");
|
pragma(lib, "WinSpool");
|
||||||
|
|
||||||
private import dfl.base;
|
import core.sys.windows.commdlg;
|
||||||
private import dfl.commondialog;
|
import core.sys.windows.windows;
|
||||||
private import dfl.drawing;
|
|
||||||
private import dfl.event;
|
|
||||||
private import dfl.messagebox;
|
|
||||||
private import dfl.control;
|
|
||||||
private import dfl.form;
|
|
||||||
private import dfl.toolbar;
|
|
||||||
private import dfl.imagelist;
|
|
||||||
private import dfl.panel;
|
|
||||||
private import dfl.label;
|
|
||||||
private import dfl.button;
|
|
||||||
private import dfl.textbox;
|
|
||||||
|
|
||||||
private import dfl.internal.utf;
|
|
||||||
|
|
||||||
private import core.sys.windows.commdlg;
|
|
||||||
private import core.sys.windows.windows;
|
|
||||||
|
|
||||||
private import std.conv;
|
|
||||||
private import std.range;
|
|
||||||
private import std.algorithm;
|
|
||||||
|
|
||||||
///
|
///
|
||||||
enum PrinterUnit
|
enum PrinterUnit
|
||||||
|
|
|
@ -5,16 +5,17 @@
|
||||||
///
|
///
|
||||||
module dfl.progressbar;
|
module dfl.progressbar;
|
||||||
|
|
||||||
private import dfl.application;
|
import dfl.application;
|
||||||
private import dfl.base;
|
import dfl.base;
|
||||||
private import dfl.control;
|
import dfl.control;
|
||||||
private import dfl.drawing;
|
import dfl.drawing;
|
||||||
private import dfl.event;
|
import dfl.event;
|
||||||
|
|
||||||
static private import dfl.internal.utf;
|
static import dfl.internal.utf;
|
||||||
|
|
||||||
|
import core.sys.windows.commctrl;
|
||||||
|
import core.sys.windows.windows;
|
||||||
|
|
||||||
private import core.sys.windows.windows;
|
|
||||||
private import core.sys.windows.commctrl;
|
|
||||||
|
|
||||||
private extern(Windows) void _initProgressbar();
|
private extern(Windows) void _initProgressbar();
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,11 @@
|
||||||
///
|
///
|
||||||
module dfl.registry;
|
module dfl.registry;
|
||||||
|
|
||||||
private import dfl.internal.dlib;
|
import dfl.base;
|
||||||
|
|
||||||
private import dfl.internal.winapi, dfl.base, dfl.internal.utf;
|
import dfl.internal.dlib;
|
||||||
|
import dfl.internal.utf;
|
||||||
|
import dfl.internal.winapi;
|
||||||
|
|
||||||
version (Win64) { /* not supported at this point */ } else:
|
version (Win64) { /* not supported at this point */ } else:
|
||||||
class DflRegistryException: DflException // package
|
class DflRegistryException: DflException // package
|
||||||
|
@ -127,7 +129,7 @@ private enum uint MAX_REG_BUFFER = 256;
|
||||||
abstract class RegistryValue
|
abstract class RegistryValue
|
||||||
{
|
{
|
||||||
@property DWORD valueType(); // getter
|
@property DWORD valueType(); // getter
|
||||||
override Dstring toString();
|
override Dstring toString() const;
|
||||||
/+ package +/ protected LONG save(HKEY hkey, Dstring name); // package
|
/+ package +/ protected LONG save(HKEY hkey, Dstring name); // package
|
||||||
package final @property RegistryValue _reg() { return this; }
|
package final @property RegistryValue _reg() { return this; }
|
||||||
}
|
}
|
||||||
|
@ -158,7 +160,7 @@ class RegistryValueSz: RegistryValue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override Dstring toString()
|
override Dstring toString() const
|
||||||
{
|
{
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -245,7 +247,7 @@ class RegistryValueMultiSz: RegistryValue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override Dstring toString()
|
override Dstring toString() const
|
||||||
{
|
{
|
||||||
Dstring result;
|
Dstring result;
|
||||||
foreach(Dstring str; value)
|
foreach(Dstring str; value)
|
||||||
|
@ -312,7 +314,7 @@ class RegistryValueExpandSz: RegistryValue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override Dstring toString()
|
override Dstring toString() const
|
||||||
{
|
{
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -391,7 +393,7 @@ class RegistryValueDword: RegistryValue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override Dstring toString()
|
override Dstring toString() const
|
||||||
{
|
{
|
||||||
return dwordToString(value);
|
return dwordToString(value);
|
||||||
}
|
}
|
||||||
|
@ -431,7 +433,7 @@ class RegistryValueDwordBigEndian: RegistryValue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override Dstring toString()
|
override Dstring toString() const
|
||||||
{
|
{
|
||||||
return dwordToString(value);
|
return dwordToString(value);
|
||||||
}
|
}
|
||||||
|
@ -469,7 +471,7 @@ class RegistryValueBinary: RegistryValue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override Dstring toString()
|
override Dstring toString() const
|
||||||
{
|
{
|
||||||
return "Binary";
|
return "Binary";
|
||||||
}
|
}
|
||||||
|
@ -507,7 +509,7 @@ class RegistryValueLink: RegistryValue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override Dstring toString()
|
override Dstring toString() const
|
||||||
{
|
{
|
||||||
return "Symbolic Link";
|
return "Symbolic Link";
|
||||||
}
|
}
|
||||||
|
@ -545,7 +547,7 @@ class RegistryValueResourceList: RegistryValue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override Dstring toString()
|
override Dstring toString() const
|
||||||
{
|
{
|
||||||
return "Resource List";
|
return "Resource List";
|
||||||
}
|
}
|
||||||
|
@ -583,7 +585,7 @@ class RegistryValueNone: RegistryValue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override Dstring toString()
|
override Dstring toString() const
|
||||||
{
|
{
|
||||||
return "None";
|
return "None";
|
||||||
}
|
}
|
||||||
|
@ -870,7 +872,7 @@ class RegistryKey // docmain
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override Dequ opEquals(Object o)
|
override Dequ opEquals(Object o) const
|
||||||
{
|
{
|
||||||
RegistryKey rk;
|
RegistryKey rk;
|
||||||
|
|
||||||
|
@ -881,10 +883,16 @@ class RegistryKey // docmain
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dequ opEquals(RegistryKey rk)
|
Dequ opEquals(RegistryKey rk) const
|
||||||
{
|
{
|
||||||
return hkey == rk.hkey;
|
return hkey == rk.hkey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override size_t toHash() const nothrow @safe
|
||||||
|
{
|
||||||
|
return hashOf(hKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
|
|
|
@ -5,10 +5,12 @@
|
||||||
///
|
///
|
||||||
module dfl.resources;
|
module dfl.resources;
|
||||||
|
|
||||||
private import dfl.internal.dlib;
|
import dfl.base;
|
||||||
|
import dfl.drawing;
|
||||||
private import dfl.internal.utf, dfl.internal.winapi, dfl.base, dfl.drawing;
|
|
||||||
|
|
||||||
|
import dfl.internal.dlib;
|
||||||
|
import dfl.internal.utf;
|
||||||
|
import dfl.internal.winapi;
|
||||||
|
|
||||||
version(DFL_NO_RESOURCES)
|
version(DFL_NO_RESOURCES)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,29 +5,29 @@
|
||||||
///
|
///
|
||||||
module dfl.richtextbox;
|
module dfl.richtextbox;
|
||||||
|
|
||||||
private import dfl.textboxbase;
|
import dfl.application;
|
||||||
private import dfl.base;
|
import dfl.base;
|
||||||
private import dfl.application;
|
import dfl.control;
|
||||||
private import dfl.event;
|
import dfl.data;
|
||||||
private import dfl.drawing;
|
import dfl.drawing;
|
||||||
private import dfl.data;
|
import dfl.event;
|
||||||
private import dfl.control;
|
import dfl.textboxbase;
|
||||||
|
|
||||||
private import dfl.internal.winapi;
|
|
||||||
private import core.sys.windows.richedit : SF_UNICODE, GETTEXTEX, GETTEXTLENGTHEX, GTL_CLOSE;
|
|
||||||
|
|
||||||
private import dfl.internal.utf;
|
|
||||||
private import dfl.internal.dlib;
|
|
||||||
|
|
||||||
version(DFL_NO_MENUS)
|
version(DFL_NO_MENUS)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
private import dfl.menu;
|
import dfl.menu;
|
||||||
import std.utf;
|
import std.utf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
import dfl.internal.winapi;
|
||||||
|
import dfl.internal.dlib;
|
||||||
|
import dfl.internal.utf;
|
||||||
|
|
||||||
|
import core.sys.windows.richedit : GETTEXTEX, GETTEXTLENGTHEX, GTL_CLOSE, SF_UNICODE;
|
||||||
|
|
||||||
|
|
||||||
private extern(C) char* strcpy(char*, char*);
|
private extern(C) char* strcpy(char*, char*);
|
||||||
|
|
||||||
|
@ -560,7 +560,7 @@ class RichTextBox: TextBoxBase // docmain
|
||||||
cf.dwEffects |= CFE_UNDERLINE;
|
cf.dwEffects |= CFE_UNDERLINE;
|
||||||
cf.yHeight = cast(typeof(cf.yHeight))Font.getEmSize(lf.lfHeight, GraphicsUnit.TWIP);
|
cf.yHeight = cast(typeof(cf.yHeight))Font.getEmSize(lf.lfHeight, GraphicsUnit.TWIP);
|
||||||
cf.bCharSet = lf.lfCharSet;
|
cf.bCharSet = lf.lfCharSet;
|
||||||
strcpy(cf.szFaceName.ptr, lf.lfFaceName.ptr);
|
cf.szFaceName = lf.lfFaceName;
|
||||||
cf.bUnderlineType = CFU_UNDERLINE;
|
cf.bUnderlineType = CFU_UNDERLINE;
|
||||||
cf.wWeight = cast(WORD)lf.lfWeight;
|
cf.wWeight = cast(WORD)lf.lfWeight;
|
||||||
|
|
||||||
|
@ -599,7 +599,7 @@ class RichTextBox: TextBoxBase // docmain
|
||||||
lfUnderline = (cf.dwEffects & CFE_UNDERLINE) != 0;
|
lfUnderline = (cf.dwEffects & CFE_UNDERLINE) != 0;
|
||||||
lfStrikeOut = (cf.dwEffects & CFE_STRIKEOUT) != 0;
|
lfStrikeOut = (cf.dwEffects & CFE_STRIKEOUT) != 0;
|
||||||
lfCharSet = cf.bCharSet;
|
lfCharSet = cf.bCharSet;
|
||||||
strcpy(lfFaceName.ptr, cf.szFaceName.ptr);
|
lfFaceName = cf.szFaceName;
|
||||||
lfOutPrecision = OUT_DEFAULT_PRECIS;
|
lfOutPrecision = OUT_DEFAULT_PRECIS;
|
||||||
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
|
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
|
||||||
lf.lfQuality = DEFAULT_QUALITY;
|
lf.lfQuality = DEFAULT_QUALITY;
|
||||||
|
|
|
@ -1,89 +1,69 @@
|
||||||
// Written by Christopher E. Miller
|
|
||||||
// See the included license.txt for copyright and license details.
|
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
module dfl.sharedcontrol;
|
module dfl.sharedcontrol;
|
||||||
|
|
||||||
private import dfl.control;
|
import dfl.application;
|
||||||
private import dfl.application;
|
import dfl.base;
|
||||||
|
import dfl.control;
|
||||||
|
|
||||||
|
import dfl.internal.clib : free, malloc;
|
||||||
|
import dfl.internal.dlib;
|
||||||
|
import dfl.internal.winapi;
|
||||||
|
|
||||||
|
import core.atomic;
|
||||||
|
|
||||||
private import dfl.internal.winapi;
|
|
||||||
private import dfl.internal.dlib;
|
|
||||||
private import dfl.internal.clib;
|
|
||||||
|
|
||||||
///
|
///
|
||||||
shared class SharedControl
|
synchronized shared class SharedControl
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
Control _ctrl;
|
Control _ctrl;
|
||||||
|
|
||||||
LPARAM makeParam(ARGS...)(void function(Control, ARGS) fn, Tuple!(ARGS)* args)
|
void makeParam(ARGS...)(ref void function(Control, ARGS) func, ref ARGS args, ref DflInvokeParam* dflInvokeParam)
|
||||||
if (ARGS.length)
|
if (ARGS.length)
|
||||||
{
|
{
|
||||||
static assert((DflInvokeParam*).sizeof <= LPARAM.sizeof);
|
static struct FunctionInvokeParam
|
||||||
static struct InvokeParam
|
|
||||||
{
|
{
|
||||||
void function(Control, ARGS) fn;
|
|
||||||
ARGS args;
|
ARGS args;
|
||||||
|
void function(Control, ARGS) func; // NOTE: This function pointer must be after "args", why?
|
||||||
}
|
}
|
||||||
alias malloc = dfl.internal.clib.malloc;
|
|
||||||
alias free = dfl.internal.clib.free;
|
auto invokeParam = cast(FunctionInvokeParam*)malloc(FunctionInvokeParam.sizeof);
|
||||||
|
if (!invokeParam)
|
||||||
auto param = cast(InvokeParam*)malloc(InvokeParam.sizeof);
|
|
||||||
param.fn = fn;
|
|
||||||
param.args = args.field;
|
|
||||||
|
|
||||||
if (!param)
|
|
||||||
throw new OomException();
|
throw new OomException();
|
||||||
|
invokeParam.func.atomicStore(func.atomicLoad());
|
||||||
auto p = cast(DflInvokeParam*)malloc(DflInvokeParam.sizeof);
|
static foreach (i, e; args)
|
||||||
|
|
||||||
if (!p)
|
|
||||||
throw new OomException();
|
|
||||||
|
|
||||||
|
|
||||||
static void fnentry(Control c, size_t[] p)
|
|
||||||
{
|
{
|
||||||
auto param = cast(InvokeParam*)p[0];
|
invokeParam.args[i].atomicStore(e.atomicLoad());
|
||||||
param.fn(c, param.args);
|
}
|
||||||
|
|
||||||
|
static void funcEntry(Control c, size_t[] p)
|
||||||
|
{
|
||||||
|
auto param = cast(FunctionInvokeParam*)p[0];
|
||||||
|
param.func(c, param.args);
|
||||||
free(param);
|
free(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
p.fp = &fnentry;
|
dflInvokeParam.fp.atomicStore(&funcEntry);
|
||||||
p.nparams = 1;
|
dflInvokeParam.exception.atomicStore(null);
|
||||||
p.params[0] = cast(size_t)param;
|
dflInvokeParam.nparams.atomicStore(1);
|
||||||
|
dflInvokeParam.params[0].atomicStore(cast(size_t)invokeParam);
|
||||||
return cast(LPARAM)p;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void makeParamNoneArgs(ref void function(Control) func, ref DflInvokeParam* dflInvokeParam)
|
||||||
LPARAM makeParamNoneArgs(void function(Control) fn)
|
|
||||||
{
|
{
|
||||||
static assert((DflInvokeParam*).sizeof <= LPARAM.sizeof);
|
static void funcEntry(Control c, size_t[] p)
|
||||||
alias malloc = dfl.internal.clib.malloc;
|
|
||||||
alias free = dfl.internal.clib.free;
|
|
||||||
|
|
||||||
auto p = cast(DflInvokeParam*)malloc(DflInvokeParam.sizeof);
|
|
||||||
|
|
||||||
if (!p)
|
|
||||||
throw new OomException();
|
|
||||||
|
|
||||||
static void fnentry(Control c, size_t[] p)
|
|
||||||
{
|
{
|
||||||
auto fn = cast(void function(Control))p[0];
|
auto func = cast(void function(Control))p[0];
|
||||||
fn(c);
|
func(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
p.fp = &fnentry;
|
dflInvokeParam.fp = &funcEntry;
|
||||||
p.nparams = 1;
|
dflInvokeParam.exception = null;
|
||||||
p.params[0] = cast(size_t)fn;
|
dflInvokeParam.nparams = 0;
|
||||||
|
dflInvokeParam.params[0] = cast(size_t)func;
|
||||||
return cast(LPARAM)p;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
this(Control ctrl)
|
this(Control ctrl)
|
||||||
|
@ -91,62 +71,112 @@ public:
|
||||||
assert(ctrl);
|
assert(ctrl);
|
||||||
_ctrl = cast(shared)ctrl;
|
_ctrl = cast(shared)ctrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
void invoke(ARGS...)(void function(Control, ARGS) fn, ARGS args)
|
void invoke(ARGS...)(void function(Control, ARGS) func, ARGS args)
|
||||||
if (ARGS.length && !hasLocalAliasing!(ARGS))
|
if (ARGS.length && !hasLocalAliasing!(ARGS))
|
||||||
{
|
{
|
||||||
auto ctrl = cast(Control)_ctrl;
|
auto ctrl = cast(Control)_ctrl;
|
||||||
auto hwnd = ctrl.handle;
|
auto hwnd = ctrl.handle;
|
||||||
|
|
||||||
if(!hwnd)
|
if(!hwnd)
|
||||||
Control.badInvokeHandle();
|
throw new DflException("Must invoke with created handle"); // Control.badInvokeHandle();
|
||||||
|
|
||||||
auto t = tuple(args);
|
static assert((DflInvokeParam*).sizeof <= LPARAM.sizeof);
|
||||||
auto p = makeParam(fn, &t);
|
|
||||||
SendMessageA(hwnd, wmDfl, WPARAM_DFL_DELAY_INVOKE_PARAMS, p);
|
auto dflInvokeParam = cast(DflInvokeParam*)malloc(DflInvokeParam.sizeof);
|
||||||
|
if (!dflInvokeParam)
|
||||||
|
throw new OomException();
|
||||||
|
|
||||||
|
makeParam(func, args, dflInvokeParam);
|
||||||
|
scope(exit)
|
||||||
|
{
|
||||||
|
free(dflInvokeParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (LRESULT_DFL_INVOKE != SendMessageA(hwnd.atomicLoad(), wmDfl.atomicLoad(), WPARAM_DFL_INVOKE_PARAMS.atomicLoad(), cast(LPARAM)dflInvokeParam))
|
||||||
|
throw new DflException("Invoke failure");
|
||||||
|
|
||||||
|
if (dflInvokeParam.exception)
|
||||||
|
throw dflInvokeParam.exception;
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
void invoke(ARGS...)(void function(Control, ARGS) fn, ARGS args)
|
void invoke(ARGS...)(void function(Control, ARGS) func, ARGS args)
|
||||||
if (!ARGS.length)
|
if (!ARGS.length)
|
||||||
{
|
{
|
||||||
auto ctrl = cast(Control)_ctrl;
|
auto ctrl = cast(Control)_ctrl;
|
||||||
auto hwnd = ctrl.handle;
|
auto hwnd = ctrl.handle;
|
||||||
|
|
||||||
if(!hwnd)
|
if(!hwnd)
|
||||||
Control.badInvokeHandle();
|
throw new DflException("Must invoke with created handle"); // Control.badInvokeHandle();
|
||||||
|
|
||||||
auto p = makeParamNoneArgs(fn);
|
static assert((DflInvokeParam*).sizeof <= LPARAM.sizeof);
|
||||||
SendMessageA(hwnd, wmDfl, WPARAM_DFL_DELAY_INVOKE_PARAMS, p);
|
|
||||||
|
auto dflInvokeParam = cast(DflInvokeParam*)malloc(DflInvokeParam.sizeof);
|
||||||
|
if (!dflInvokeParam)
|
||||||
|
throw new OomException();
|
||||||
|
|
||||||
|
makeParamNoneArgs(func, dflInvokeParam);
|
||||||
|
scope(exit)
|
||||||
|
{
|
||||||
|
free(dflInvokeParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (LRESULT_DFL_INVOKE != SendMessageA(hwnd.atomicLoad(), wmDfl.atomicLoad(), WPARAM_DFL_INVOKE_NOPARAMS.atomicLoad(), cast(LPARAM)dflInvokeParam))
|
||||||
|
throw new DflException("Invoke failure");
|
||||||
|
|
||||||
|
if (dflInvokeParam.exception)
|
||||||
|
throw dflInvokeParam.exception;
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
void delayInvoke(ARGS...)(void function(Control, ARGS) fn, ARGS args)
|
void delayInvoke(ARGS...)(void function(Control, ARGS) func, ARGS args)
|
||||||
if (ARGS.length && !hasLocalAliasing!(ARGS))
|
if (ARGS.length && !hasLocalAliasing!(ARGS))
|
||||||
{
|
{
|
||||||
auto ctrl = cast(Control)_ctrl;
|
auto ctrl = cast(Control)_ctrl;
|
||||||
auto hwnd = ctrl.handle;
|
auto hwnd = ctrl.handle;
|
||||||
|
|
||||||
if(!hwnd)
|
if(!hwnd)
|
||||||
Control.badInvokeHandle();
|
throw new DflException("Must invoke with created handle"); // Control.badInvokeHandle();
|
||||||
|
|
||||||
auto t = tuple(args);
|
static assert((DflInvokeParam*).sizeof <= LPARAM.sizeof);
|
||||||
auto p = makeParam(fn, &t);
|
|
||||||
PostMessageA(hwnd, wmDfl, WPARAM_DFL_DELAY_INVOKE_PARAMS, p);
|
auto dflInvokeParam = cast(DflInvokeParam*)malloc(DflInvokeParam.sizeof); // NOTE: You must free memory in window procedure.
|
||||||
|
if (!dflInvokeParam)
|
||||||
|
throw new OomException();
|
||||||
|
|
||||||
|
makeParam(func, args, dflInvokeParam);
|
||||||
|
PostMessageA(hwnd.atomicLoad(), wmDfl.atomicLoad(), WPARAM_DFL_DELAY_INVOKE_PARAMS.atomicLoad(), cast(LPARAM)dflInvokeParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
void delayInvoke(ARGS...)(void function(Control, ARGS) fn, ARGS args)
|
void delayInvoke(ARGS...)(void function(Control, ARGS) func, ARGS args)
|
||||||
if (!ARGS.length)
|
if (!ARGS.length)
|
||||||
{
|
{
|
||||||
auto ctrl = cast(Control)_ctrl;
|
auto ctrl = cast(Control)_ctrl;
|
||||||
auto hwnd = ctrl.handle;
|
auto hwnd = ctrl.handle;
|
||||||
|
|
||||||
if(!hwnd)
|
if(!hwnd)
|
||||||
Control.badInvokeHandle();
|
throw new DflException("Must invoke with created handle"); // Control.badInvokeHandle();
|
||||||
|
|
||||||
auto p = makeParamNoneArgs(fn);
|
static assert((DflInvokeParam*).sizeof <= LPARAM.sizeof);
|
||||||
PostMessageA(hwnd, wmDfl, WPARAM_DFL_DELAY_INVOKE_PARAMS, p);
|
|
||||||
|
auto dflInvokeParam = cast(DflInvokeParam*)malloc(DflInvokeParam.sizeof); // NOTE: You must free memory in window procedure.
|
||||||
|
if (!dflInvokeParam)
|
||||||
|
throw new OomException();
|
||||||
|
|
||||||
|
makeParamNoneArgs(func, dflInvokeParam);
|
||||||
|
PostMessageA(hwnd.atomicLoad(), wmDfl.atomicLoad(), WPARAM_DFL_DELAY_INVOKE_NOPARAMS.atomicLoad(), cast(LPARAM)dflInvokeParam);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private template hasLocalAliasing(T...)
|
||||||
|
{
|
||||||
|
import std.traits : hasUnsharedAliasing;
|
||||||
|
|
||||||
|
static if (!T.length)
|
||||||
|
enum hasLocalAliasing = false;
|
||||||
|
else
|
||||||
|
enum hasLocalAliasing = std.traits.hasUnsharedAliasing!(T[0]) || dfl.sharedcontrol.hasLocalAliasing!(T[1 .. $]);
|
||||||
|
}
|
||||||
|
|
|
@ -18,26 +18,30 @@ version(DFL_NoSocket)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
private import dfl.internal.dlib, dfl.internal.clib;
|
import dfl.application;
|
||||||
|
import dfl.base;
|
||||||
|
|
||||||
private
|
import dfl.internal.clib;
|
||||||
|
import dfl.internal.dlib;
|
||||||
|
import dfl.internal.utf;
|
||||||
|
import dfl.internal.winapi;
|
||||||
|
|
||||||
|
import core.bitop;
|
||||||
|
import core.sys.windows.winsock2;
|
||||||
|
|
||||||
|
import std.socket;
|
||||||
|
|
||||||
|
|
||||||
|
private alias DInternetHost = InternetHost;
|
||||||
|
private alias DInternetAddress = InternetAddress;
|
||||||
|
|
||||||
|
private socket_t getSocketHandle(Socket sock) nothrow @nogc
|
||||||
{
|
{
|
||||||
private import std.socket, core.bitop;
|
return sock.handle;
|
||||||
private import core.sys.windows.winsock2;
|
|
||||||
|
|
||||||
alias DInternetHost = InternetHost;
|
|
||||||
alias DInternetAddress = InternetAddress;
|
|
||||||
|
|
||||||
socket_t getSocketHandle(Socket sock) nothrow @nogc
|
|
||||||
{
|
|
||||||
return sock.handle;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
alias DflSocket = std.socket.Socket; ///
|
alias DflSocket = std.socket.Socket; ///
|
||||||
|
|
||||||
private import dfl.internal.winapi, dfl.application, dfl.base, dfl.internal.utf;
|
|
||||||
|
|
||||||
|
|
||||||
private
|
private
|
||||||
{
|
{
|
||||||
|
@ -85,7 +89,7 @@ alias RegisterEventCallback = void delegate(DflSocket sock, EventType type, int
|
||||||
// Calling this twice on the same socket cancels out previously
|
// Calling this twice on the same socket cancels out previously
|
||||||
// registered events for the socket.
|
// registered events for the socket.
|
||||||
// Requires Application.run() or Application.doEvents() loop.
|
// Requires Application.run() or Application.doEvents() loop.
|
||||||
void registerEvent(DflSocket sock, EventType events, RegisterEventCallback callback) // deprecated
|
deprecated void registerEvent(DflSocket sock, EventType events, RegisterEventCallback callback)
|
||||||
{
|
{
|
||||||
assert(sock !is null, "registerEvent: socket cannot be null");
|
assert(sock !is null, "registerEvent: socket cannot be null");
|
||||||
assert(callback !is null, "registerEvent: callback cannot be null");
|
assert(callback !is null, "registerEvent: callback cannot be null");
|
||||||
|
@ -95,8 +99,7 @@ void registerEvent(DflSocket sock, EventType events, RegisterEventCallback callb
|
||||||
|
|
||||||
sock.blocking = false; // So the getter will be correct.
|
sock.blocking = false; // So the getter will be correct.
|
||||||
|
|
||||||
// SOCKET_ERROR
|
if (WSAAsyncSelect(getSocketHandle(sock), hwNet, WM_DFL_NETEVENT, cast(int)events) == SOCKET_ERROR)
|
||||||
if(-1 == WSAAsyncSelect(getSocketHandle(sock), hwNet, WM_DFL_NETEVENT, cast(int)events))
|
|
||||||
throw new DflException("Unable to register socket events");
|
throw new DflException("Unable to register socket events");
|
||||||
|
|
||||||
EventInfo ei;
|
EventInfo ei;
|
||||||
|
@ -107,9 +110,10 @@ void registerEvent(DflSocket sock, EventType events, RegisterEventCallback callb
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void unregisterEvent(DflSocket sock) @trusted @nogc nothrow // deprecated
|
deprecated void unregisterEvent(DflSocket sock) @trusted @nogc nothrow
|
||||||
{
|
{
|
||||||
WSAAsyncSelect(getSocketHandle(sock), hwNet, 0, 0);
|
if (WSAAsyncSelect(getSocketHandle(sock), hwNet, 0, 0) == SOCKET_ERROR)
|
||||||
|
throw new DflException("Unable to register socket events");
|
||||||
|
|
||||||
//delete allEvents[getSocketHandle(sock)];
|
//delete allEvents[getSocketHandle(sock)];
|
||||||
allEvents.remove(getSocketHandle(sock));
|
allEvents.remove(getSocketHandle(sock));
|
||||||
|
|
|
@ -5,8 +5,12 @@
|
||||||
///
|
///
|
||||||
module dfl.splitter;
|
module dfl.splitter;
|
||||||
|
|
||||||
private import dfl.control, dfl.internal.winapi, dfl.base, dfl.drawing;
|
import dfl.base;
|
||||||
private import dfl.event;
|
import dfl.control;
|
||||||
|
import dfl.drawing;
|
||||||
|
import dfl.event;
|
||||||
|
|
||||||
|
import dfl.internal.winapi;
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
|
|
|
@ -6,10 +6,15 @@
|
||||||
module dfl.statusbar;
|
module dfl.statusbar;
|
||||||
|
|
||||||
|
|
||||||
private import dfl.control, dfl.base, dfl.internal.winapi, dfl.event,
|
import dfl.application;
|
||||||
dfl.collections, dfl.internal.utf, dfl.internal.dlib, dfl.application;
|
import dfl.base;
|
||||||
|
import dfl.collections;
|
||||||
|
import dfl.control;
|
||||||
|
import dfl.event;
|
||||||
|
|
||||||
private import dfl.internal.dlib;
|
import dfl.internal.dlib;
|
||||||
|
import dfl.internal.utf;
|
||||||
|
import dfl.internal.winapi;
|
||||||
|
|
||||||
|
|
||||||
private extern(Windows) void _initStatusbar();
|
private extern(Windows) void _initStatusbar();
|
||||||
|
@ -56,42 +61,48 @@ class StatusBarPanel: DObject
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override Dstring toString()
|
override Dstring toString() const
|
||||||
{
|
{
|
||||||
return _txt;
|
return _txt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override Dequ opEquals(Object o)
|
override Dequ opEquals(Object o) const
|
||||||
{
|
{
|
||||||
return _txt == getObjectString(o); // ?
|
return _txt == getObjectString(o); // ?
|
||||||
}
|
}
|
||||||
|
|
||||||
Dequ opEquals(StatusBarPanel pnl)
|
Dequ opEquals(StatusBarPanel pnl) const
|
||||||
{
|
{
|
||||||
return _txt == pnl._txt;
|
return _txt == pnl._txt;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dequ opEquals(Dstring val)
|
Dequ opEquals(Dstring val) const
|
||||||
{
|
{
|
||||||
return _txt == val;
|
return _txt == val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override int opCmp(Object o)
|
override int opCmp(Object o) const
|
||||||
{
|
{
|
||||||
return stringICmp(_txt, getObjectString(o)); // ?
|
return stringICmp(_txt, getObjectString(o)); // ?
|
||||||
}
|
}
|
||||||
|
|
||||||
int opCmp(StatusBarPanel pnl)
|
int opCmp(StatusBarPanel pnl) const
|
||||||
{
|
{
|
||||||
return stringICmp(_txt, pnl._txt);
|
return stringICmp(_txt, pnl._txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
int opCmp(Dstring val)
|
int opCmp(Dstring val) const
|
||||||
{
|
{
|
||||||
return stringICmp(_txt, val);
|
return stringICmp(_txt, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override size_t toHash() const nothrow @safe
|
||||||
|
{
|
||||||
|
return hashOf(_txt);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/+
|
/+
|
||||||
|
|
|
@ -5,11 +5,16 @@
|
||||||
///
|
///
|
||||||
module dfl.tabcontrol;
|
module dfl.tabcontrol;
|
||||||
|
|
||||||
private import dfl.internal.dlib;
|
import dfl.application;
|
||||||
|
import dfl.base;
|
||||||
private import dfl.control, dfl.panel, dfl.internal.winapi, dfl.drawing;
|
import dfl.collections;
|
||||||
private import dfl.application, dfl.event, dfl.base, dfl.collections;
|
import dfl.control;
|
||||||
|
import dfl.drawing;
|
||||||
|
import dfl.event;
|
||||||
|
import dfl.panel;
|
||||||
|
|
||||||
|
import dfl.internal.dlib;
|
||||||
|
import dfl.internal.winapi;
|
||||||
static import dfl.internal.utf;
|
static import dfl.internal.utf;
|
||||||
|
|
||||||
|
|
||||||
|
@ -81,6 +86,19 @@ class TabPage: Panel
|
||||||
{
|
{
|
||||||
return stringICmp(text, val);
|
return stringICmp(text, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override size_t toHash() const nothrow @trusted
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return hashOf(text);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
assert(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// imageIndex
|
// imageIndex
|
||||||
|
@ -95,8 +113,7 @@ class TabPage: Panel
|
||||||
|
|
||||||
if(created)
|
if(created)
|
||||||
{
|
{
|
||||||
TabControl tc;
|
TabControl tc = cast(TabControl)parent;
|
||||||
tc = cast(TabControl)parent;
|
|
||||||
if(tc)
|
if(tc)
|
||||||
tc.updateTabText(this, newText);
|
tc.updateTabText(this, newText);
|
||||||
}
|
}
|
||||||
|
@ -257,9 +274,8 @@ class TabPageCollection
|
||||||
{
|
{
|
||||||
if(val.parent)
|
if(val.parent)
|
||||||
{
|
{
|
||||||
TabControl tc;
|
TabControl parentTC = cast(TabControl)val.parent;
|
||||||
tc = cast(TabControl)val.parent;
|
if(parentTC && parentTC.tabPages.indexOf(val) != -1)
|
||||||
if(tc && tc.tabPages.indexOf(val) != -1)
|
|
||||||
throw new DflException("TabPage already has a parent");
|
throw new DflException("TabPage already has a parent");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,25 +5,28 @@
|
||||||
///
|
///
|
||||||
module dfl.textbox;
|
module dfl.textbox;
|
||||||
|
|
||||||
private import dfl.control, dfl.base, dfl.application;
|
import dfl.application;
|
||||||
private import dfl.drawing, dfl.event;
|
import dfl.base;
|
||||||
private import dfl.textboxbase;
|
import dfl.control;
|
||||||
|
import dfl.drawing;
|
||||||
private import dfl.internal.dlib;
|
import dfl.event;
|
||||||
private import dfl.internal.winapi;
|
import dfl.textboxbase;
|
||||||
private import dfl.internal.utf;
|
|
||||||
|
|
||||||
debug(APP_PRINT)
|
|
||||||
{
|
|
||||||
private import dfl.internal.clib;
|
|
||||||
}
|
|
||||||
|
|
||||||
version(DFL_NO_MENUS)
|
version(DFL_NO_MENUS)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
private import dfl.menu;
|
import dfl.menu;
|
||||||
|
}
|
||||||
|
|
||||||
|
import dfl.internal.dlib;
|
||||||
|
import dfl.internal.utf;
|
||||||
|
import dfl.internal.winapi;
|
||||||
|
|
||||||
|
debug(APP_PRINT)
|
||||||
|
{
|
||||||
|
import dfl.internal.clib;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,24 +5,27 @@
|
||||||
///
|
///
|
||||||
module dfl.textboxbase;
|
module dfl.textboxbase;
|
||||||
|
|
||||||
private import dfl.control, dfl.base, dfl.application;
|
import dfl.application;
|
||||||
private import dfl.drawing, dfl.event;
|
import dfl.base;
|
||||||
|
import dfl.control;
|
||||||
private import dfl.internal.dlib;
|
import dfl.drawing;
|
||||||
private import dfl.internal.winapi;
|
import dfl.event;
|
||||||
private import dfl.internal.utf;
|
|
||||||
|
|
||||||
debug(APP_PRINT)
|
|
||||||
{
|
|
||||||
private import dfl.internal.clib;
|
|
||||||
}
|
|
||||||
|
|
||||||
version(DFL_NO_MENUS)
|
version(DFL_NO_MENUS)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
private import dfl.menu;
|
import dfl.menu;
|
||||||
|
}
|
||||||
|
|
||||||
|
import dfl.internal.dlib;
|
||||||
|
import dfl.internal.utf;
|
||||||
|
import dfl.internal.winapi;
|
||||||
|
|
||||||
|
debug(APP_PRINT)
|
||||||
|
{
|
||||||
|
import dfl.internal.clib;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,17 +5,18 @@
|
||||||
///
|
///
|
||||||
module dfl.timer;
|
module dfl.timer;
|
||||||
|
|
||||||
private import dfl.application;
|
import dfl.application;
|
||||||
private import dfl.base;
|
import dfl.base;
|
||||||
private import dfl.event;
|
import dfl.event;
|
||||||
|
|
||||||
|
import dfl.internal.dlib;
|
||||||
|
|
||||||
private import dfl.internal.dlib;
|
|
||||||
debug(APP_PRINT)
|
debug(APP_PRINT)
|
||||||
{
|
{
|
||||||
private import dfl.internal.clib;
|
import dfl.internal.clib;
|
||||||
}
|
}
|
||||||
|
|
||||||
private import core.sys.windows.windows;
|
import core.sys.windows.windows;
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
|
|
|
@ -1,25 +1,19 @@
|
||||||
///
|
///
|
||||||
module dfl.toolbar;
|
module dfl.toolbar;
|
||||||
|
|
||||||
private import dfl.application;
|
import dfl.application;
|
||||||
private import dfl.base;
|
import dfl.base;
|
||||||
private import dfl.control;
|
import dfl.collections;
|
||||||
private import dfl.drawing;
|
import dfl.control;
|
||||||
private import dfl.event;
|
import dfl.drawing;
|
||||||
private import dfl.collections;
|
import dfl.event;
|
||||||
|
|
||||||
private import dfl.internal.dlib;
|
|
||||||
private static import dfl.internal.utf;
|
|
||||||
|
|
||||||
private import core.sys.windows.windows;
|
|
||||||
private import core.sys.windows.commctrl;
|
|
||||||
|
|
||||||
version (DFL_NO_IMAGELIST)
|
version (DFL_NO_IMAGELIST)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
private import dfl.imagelist;
|
import dfl.imagelist;
|
||||||
}
|
}
|
||||||
|
|
||||||
version (DFL_NO_MENUS)
|
version (DFL_NO_MENUS)
|
||||||
|
@ -30,9 +24,15 @@ version (DFL_TOOLBAR_NO_MENU)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
private import dfl.menu;
|
import dfl.menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
import dfl.internal.dlib;
|
||||||
|
static import dfl.internal.utf;
|
||||||
|
|
||||||
|
import core.sys.windows.commctrl;
|
||||||
|
import core.sys.windows.windows;
|
||||||
|
|
||||||
|
|
||||||
private int GET_X_LPARAM(LPARAM lparam) pure
|
private int GET_X_LPARAM(LPARAM lparam) pure
|
||||||
{
|
{
|
||||||
|
@ -145,31 +145,44 @@ class ToolBarButton
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override Dstring toString()
|
override Dstring toString() const
|
||||||
{
|
{
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override Dequ opEquals(Object o)
|
override Dequ opEquals(Object o) const
|
||||||
{
|
{
|
||||||
return text == getObjectString(o);
|
return text == getObjectString(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dequ opEquals(Dstring val)
|
Dequ opEquals(Dstring val) const
|
||||||
{
|
{
|
||||||
return text == val;
|
return text == val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override size_t toHash() const nothrow @trusted
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return hashOf(text);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
assert(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
override int opCmp(Object o)
|
override int opCmp(Object o) const
|
||||||
{
|
{
|
||||||
return stringICmp(text, getObjectString(o));
|
return stringICmp(text, getObjectString(o));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int opCmp(Dstring val)
|
int opCmp(Dstring val) const
|
||||||
{
|
{
|
||||||
return stringICmp(text, val);
|
return stringICmp(text, val);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,17 +5,16 @@
|
||||||
///
|
///
|
||||||
module dfl.tooltip;
|
module dfl.tooltip;
|
||||||
|
|
||||||
|
import dfl.application;
|
||||||
|
import dfl.base;
|
||||||
|
import dfl.control;
|
||||||
|
|
||||||
private import dfl.application;
|
import dfl.internal.clib;
|
||||||
private import dfl.base;
|
import dfl.internal.dlib;
|
||||||
private import dfl.control;
|
import dfl.internal.utf;
|
||||||
|
|
||||||
private import dfl.internal.dlib;
|
import core.sys.windows.commctrl;
|
||||||
private import dfl.internal.clib;
|
import core.sys.windows.windows;
|
||||||
private import dfl.internal.utf;
|
|
||||||
|
|
||||||
private import core.sys.windows.windows;
|
|
||||||
private import core.sys.windows.commctrl;
|
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
|
|
|
@ -10,18 +10,19 @@
|
||||||
///
|
///
|
||||||
module dfl.trackbar;
|
module dfl.trackbar;
|
||||||
|
|
||||||
private import dfl.base;
|
import dfl.application;
|
||||||
private import dfl.control;
|
import dfl.base;
|
||||||
private import dfl.application;
|
import dfl.control;
|
||||||
private import dfl.event;
|
import dfl.drawing;
|
||||||
private import dfl.drawing;
|
import dfl.event;
|
||||||
private static import dfl.internal.utf;
|
static import dfl.internal.utf;
|
||||||
|
|
||||||
private import core.sys.windows.commctrl;
|
import core.sys.windows.commctrl;
|
||||||
private import core.sys.windows.windef;
|
import core.sys.windows.windef;
|
||||||
private import core.sys.windows.winuser;
|
import core.sys.windows.winuser;
|
||||||
|
|
||||||
|
static import std.algorithm.comparison;
|
||||||
|
|
||||||
private static import std.algorithm.comparison;
|
|
||||||
|
|
||||||
extern(Windows) void _initTrackbar();
|
extern(Windows) void _initTrackbar();
|
||||||
|
|
||||||
|
|
|
@ -5,19 +5,26 @@
|
||||||
///
|
///
|
||||||
module dfl.treeview;
|
module dfl.treeview;
|
||||||
|
|
||||||
private import dfl.internal.dlib;
|
|
||||||
|
|
||||||
private import dfl.control, dfl.application, dfl.base, dfl.internal.winapi;
|
import dfl.application;
|
||||||
private import dfl.event, dfl.drawing, dfl.collections, dfl.internal.utf;
|
import dfl.base;
|
||||||
|
import dfl.collections;
|
||||||
|
import dfl.control;
|
||||||
|
import dfl.drawing;
|
||||||
|
import dfl.event;
|
||||||
|
|
||||||
version(DFL_NO_IMAGELIST)
|
version(DFL_NO_IMAGELIST)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
private import dfl.imagelist;
|
import dfl.imagelist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
import dfl.internal.utf;
|
||||||
|
import dfl.internal.winapi;
|
||||||
|
import dfl.internal.dlib;
|
||||||
|
|
||||||
|
|
||||||
private extern(Windows) void _initTreeview();
|
private extern(Windows) void _initTreeview();
|
||||||
|
|
||||||
|
@ -330,7 +337,9 @@ class TreeNode: DObject
|
||||||
final @property TreeNode lastNode() // getter
|
final @property TreeNode lastNode() // getter
|
||||||
{
|
{
|
||||||
if(tchildren.length)
|
if(tchildren.length)
|
||||||
return tchildren._nodes[tchildren.length - 1];
|
{
|
||||||
|
return tchildren._nodes[tchildren.length + (-1)];
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -618,7 +627,13 @@ class TreeNode: DObject
|
||||||
return 0 == stringICmp(ttext, val);
|
return 0 == stringICmp(ttext, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override size_t toHash() const nothrow @safe
|
||||||
|
{
|
||||||
|
return hashOf(ttext);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
override int opCmp(Object o) const
|
override int opCmp(Object o) const
|
||||||
{
|
{
|
||||||
return stringICmp(ttext, getObjectString(o)); // ?
|
return stringICmp(ttext, getObjectString(o)); // ?
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
///
|
///
|
||||||
module dfl.usercontrol;
|
module dfl.usercontrol;
|
||||||
|
|
||||||
private import dfl.control;
|
import dfl.control;
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue