mirror of
https://github.com/Rayerd/dfl.git
synced 2025-04-26 21:30:25 +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(menuItem2);
|
||||
_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;
|
||||
|
||||
private import dfl.internal.dlib, dfl.internal.clib;
|
||||
|
||||
private import dfl.base, dfl.form, dfl.internal.winapi, dfl.event;
|
||||
private import dfl.control, dfl.drawing, dfl.label;
|
||||
private import dfl.button, dfl.textbox, dfl.internal.wincom, dfl.environment;
|
||||
private import dfl.internal.utf;
|
||||
import dfl.base;
|
||||
import dfl.button;
|
||||
import dfl.control;
|
||||
import dfl.drawing;
|
||||
import dfl.environment;
|
||||
import dfl.event;
|
||||
import dfl.form;
|
||||
import dfl.label;
|
||||
import dfl.textbox;
|
||||
|
||||
version(DFL_NO_RESOURCES)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
private import dfl.resources;
|
||||
import dfl.resources;
|
||||
}
|
||||
|
||||
version(DFL_NO_MENUS)
|
||||
|
@ -25,9 +28,15 @@ version(DFL_NO_MENUS)
|
|||
}
|
||||
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;
|
||||
|
||||
|
@ -362,7 +371,7 @@ final class Application // docmain
|
|||
{
|
||||
if(!i)
|
||||
filters = filters[1 .. $];
|
||||
else if(i == filters.length - 1)
|
||||
else if(i + 1 == filters.length)
|
||||
filters = filters[0 .. i];
|
||||
else
|
||||
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.
|
||||
debug(SHOW_MESSAGE_INFO)
|
||||
{
|
||||
private import std.stdio, std.string;
|
||||
import std.stdio, std.string;
|
||||
|
||||
|
||||
void showMessageInfo(ref Message m)
|
||||
|
@ -1866,20 +1875,18 @@ extern(Windows) LRESULT dflWndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp
|
|||
{
|
||||
switch(wparam)
|
||||
{
|
||||
case WPARAM_DFL_INVOKE:
|
||||
case WPARAM_DFL_INVOKE_PARAMS:
|
||||
{
|
||||
InvokeData* pinv;
|
||||
pinv = cast(InvokeData*)lparam;
|
||||
DflInvokeParam* p = cast(DflInvokeParam*)lparam;
|
||||
try
|
||||
{
|
||||
pinv.result = pinv.dg(pinv.args);
|
||||
p.fp(Application.lookupHwnd(hwnd), p.params.ptr[0 .. p.nparams]);
|
||||
}
|
||||
catch(DThrowable e)
|
||||
{
|
||||
//Application.onThreadException(e);
|
||||
try
|
||||
{
|
||||
pinv.exception = e;
|
||||
p.exception = e;
|
||||
}
|
||||
catch(DThrowable e2)
|
||||
{
|
||||
|
@ -1889,20 +1896,18 @@ extern(Windows) LRESULT dflWndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp
|
|||
}
|
||||
return LRESULT_DFL_INVOKE;
|
||||
|
||||
case WPARAM_DFL_INVOKE_SIMPLE:
|
||||
case WPARAM_DFL_INVOKE_NOPARAMS:
|
||||
{
|
||||
InvokeSimpleData* pinv;
|
||||
pinv = cast(InvokeSimpleData*)lparam;
|
||||
DflInvokeParam* p = cast(DflInvokeParam*)lparam;
|
||||
try
|
||||
{
|
||||
pinv.dg();
|
||||
p.fp(Application.lookupHwnd(hwnd), p.params);
|
||||
}
|
||||
catch(DThrowable e)
|
||||
{
|
||||
//Application.onThreadException(e);
|
||||
try
|
||||
{
|
||||
pinv.exception = e;
|
||||
p.exception = e;
|
||||
}
|
||||
catch(DThrowable e2)
|
||||
{
|
||||
|
@ -1912,21 +1917,24 @@ extern(Windows) LRESULT dflWndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp
|
|||
}
|
||||
return LRESULT_DFL_INVOKE;
|
||||
|
||||
case WPARAM_DFL_DELAY_INVOKE:
|
||||
try
|
||||
case WPARAM_DFL_DELAY_INVOKE_NOPARAMS:
|
||||
{
|
||||
(cast(void function())lparam)();
|
||||
}
|
||||
catch(DThrowable e)
|
||||
{
|
||||
Application.onThreadException(e);
|
||||
DflInvokeParam* p = cast(DflInvokeParam*)lparam;
|
||||
try
|
||||
{
|
||||
p.fp(Application.lookupHwnd(hwnd), p.params);
|
||||
}
|
||||
catch(DThrowable e)
|
||||
{
|
||||
Application.onThreadException(e);
|
||||
}
|
||||
dfl.internal.clib.free(p);
|
||||
}
|
||||
break;
|
||||
|
||||
case WPARAM_DFL_DELAY_INVOKE_PARAMS:
|
||||
{
|
||||
DflInvokeParam* p;
|
||||
p = cast(DflInvokeParam*)lparam;
|
||||
DflInvokeParam* p = cast(DflInvokeParam*)lparam;
|
||||
try
|
||||
{
|
||||
p.fp(Application.lookupHwnd(hwnd), p.params.ptr[0 .. p.nparams]);
|
||||
|
@ -2044,36 +2052,20 @@ else
|
|||
|
||||
enum LRESULT LRESULT_DFL_INVOKE = 0x95FADF; // Magic number.
|
||||
|
||||
|
||||
struct InvokeData
|
||||
{
|
||||
Object delegate(Object[]) dg;
|
||||
Object[] args;
|
||||
Object result;
|
||||
DThrowable exception = null;
|
||||
}
|
||||
|
||||
|
||||
struct InvokeSimpleData
|
||||
{
|
||||
void delegate() dg;
|
||||
DThrowable exception = null;
|
||||
}
|
||||
|
||||
|
||||
UINT wmDfl;
|
||||
UINT wmDfl; // TODO: shared?
|
||||
|
||||
enum: WPARAM
|
||||
{
|
||||
WPARAM_DFL_INVOKE = 78,
|
||||
WPARAM_DFL_DELAY_INVOKE = 79,
|
||||
WPARAM_DFL_INVOKE_PARAMS = 78,
|
||||
WPARAM_DFL_DELAY_INVOKE_NOPARAMS = 79,
|
||||
WPARAM_DFL_DELAY_INVOKE_PARAMS = 80,
|
||||
WPARAM_DFL_INVOKE_SIMPLE = 81,
|
||||
WPARAM_DFL_INVOKE_NOPARAMS = 81,
|
||||
}
|
||||
|
||||
struct DflInvokeParam
|
||||
{
|
||||
void function(Control, size_t[]) fp;
|
||||
DThrowable exception;
|
||||
size_t nparams;
|
||||
size_t[1] params;
|
||||
}
|
||||
|
|
|
@ -5,9 +5,15 @@
|
|||
///
|
||||
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;
|
||||
|
@ -68,6 +74,12 @@ class StringObject: DObject
|
|||
}
|
||||
|
||||
|
||||
override size_t toHash() const nothrow @safe
|
||||
{
|
||||
return hashOf(value);
|
||||
}
|
||||
|
||||
|
||||
override int opCmp(Object o) const
|
||||
{
|
||||
return stringICmp(value, getObjectString(o)); // ?
|
||||
|
@ -395,26 +407,28 @@ abstract class WaitHandle
|
|||
|
||||
private static DWORD _wait(WaitHandle[] handles, BOOL waitall, DWORD msTimeout)
|
||||
{
|
||||
DWORD result;
|
||||
HANDLE* hs;
|
||||
void fail()
|
||||
{
|
||||
throw new DflException("Wait failure");
|
||||
}
|
||||
|
||||
// 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.
|
||||
if(handles.length >= 128)
|
||||
goto fail;
|
||||
fail();
|
||||
|
||||
//hs = new HANDLE[handles.length];
|
||||
hs = cast(HANDLE*)alloca(HANDLE.sizeof * handles.length);
|
||||
//HANDLE* hs = new HANDLE[handles.length];
|
||||
HANDLE* hs = cast(HANDLE*)alloca(HANDLE.sizeof * handles.length);
|
||||
|
||||
foreach(size_t i, WaitHandle wh; handles)
|
||||
{
|
||||
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)
|
||||
{
|
||||
fail:
|
||||
throw new DflException("Wait failure");
|
||||
fail();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -440,8 +454,7 @@ abstract class WaitHandle
|
|||
|
||||
static int waitAny(WaitHandle[] handles, DWORD msTimeout)
|
||||
{
|
||||
DWORD result;
|
||||
result = _wait(handles, false, msTimeout);
|
||||
DWORD result = _wait(handles, false, msTimeout);
|
||||
return cast(int)result; // Same return info.
|
||||
}
|
||||
|
||||
|
@ -454,8 +467,7 @@ abstract class WaitHandle
|
|||
|
||||
void waitOne(DWORD msTimeout)
|
||||
{
|
||||
DWORD result;
|
||||
result = WaitForSingleObject(handle, msTimeout);
|
||||
DWORD result = WaitForSingleObject(handle, msTimeout);
|
||||
if(WAIT_FAILED == result)
|
||||
throw new DflException("Wait failure");
|
||||
}
|
||||
|
@ -1461,6 +1473,12 @@ class Cursor // docmain
|
|||
{
|
||||
return hcur == cur.hcur;
|
||||
}
|
||||
|
||||
|
||||
override size_t toHash() const nothrow @safe
|
||||
{
|
||||
return hashOf(hcur);
|
||||
}
|
||||
|
||||
|
||||
/// Show/hide the current mouse cursor; reference counted.
|
||||
|
@ -1540,35 +1558,36 @@ class Cursors // docmain
|
|||
hcurHand = LoadCursorA(HINSTANCE.init, IDC_HAND);
|
||||
if(!hcurHand) // Must be Windows 95, so load the cursor from winhlp32.exe.
|
||||
{
|
||||
UINT len;
|
||||
char[MAX_PATH] winhlppath = void;
|
||||
|
||||
len = GetWindowsDirectoryA(winhlppath.ptr, winhlppath.length - 16);
|
||||
if(!len || len > winhlppath.length - 16)
|
||||
char[MAX_PATH] winhlpPath = void;
|
||||
|
||||
string filePath = "\\winhlp32.exe";
|
||||
UINT len = GetWindowsDirectoryA(winhlpPath.ptr, winhlpPath.length);
|
||||
if (len == 0 || len + filePath.length > winhlpPath.length)
|
||||
{
|
||||
load_failed:
|
||||
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;
|
||||
hinstWinhlp = LoadLibraryExA(winhlppath.ptr, HANDLE.init, LOAD_LIBRARY_AS_DATAFILE);
|
||||
HINSTANCE hinstWinhlp = LoadLibraryExA(winhlpPath.ptr, HANDLE.init, LOAD_LIBRARY_AS_DATAFILE);
|
||||
if(!hinstWinhlp)
|
||||
goto load_failed;
|
||||
{
|
||||
return arrow; // Just fall back to a normal arrow.
|
||||
}
|
||||
|
||||
HCURSOR hcur;
|
||||
hcur = LoadCursorA(hinstWinhlp, cast(char*)106);
|
||||
HCURSOR hcur = LoadCursorA(hinstWinhlp, cast(char*)106);
|
||||
if(!hcur) // No such cursor resource.
|
||||
{
|
||||
FreeLibrary(hinstWinhlp);
|
||||
goto load_failed;
|
||||
return arrow; // Just fall back to a normal arrow.
|
||||
}
|
||||
|
||||
hcurHand = CopyCursor(hcur);
|
||||
if(!hcurHand)
|
||||
{
|
||||
FreeLibrary(hinstWinhlp);
|
||||
//throw new DflException("Unable to copy cursor resource");
|
||||
goto load_failed;
|
||||
return arrow; // Just fall back to a normal arrow.
|
||||
}
|
||||
|
||||
FreeLibrary(hinstWinhlp);
|
||||
|
@ -1584,8 +1603,7 @@ class Cursors // docmain
|
|||
///
|
||||
@property Cursor help() // getter
|
||||
{
|
||||
HCURSOR hcur;
|
||||
hcur = LoadCursorA(HINSTANCE.init, IDC_HELP);
|
||||
HCURSOR hcur = LoadCursorA(HINSTANCE.init, IDC_HELP);
|
||||
if(!hcur) // IDC_HELP might not be supported on Windows 95, so fall back to a normal arrow.
|
||||
return arrow;
|
||||
return new Cursor(hcur);
|
||||
|
@ -1608,32 +1626,45 @@ class Cursors // docmain
|
|||
|
||||
///
|
||||
@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
|
||||
{ return new Cursor(LoadCursorA(HINSTANCE.init, IDC_NO), false); }
|
||||
|
||||
{
|
||||
return new Cursor(LoadCursorA(HINSTANCE.init, IDC_NO), false);
|
||||
}
|
||||
|
||||
///
|
||||
@property Cursor sizeAll() // getter
|
||||
{ return new Cursor(LoadCursorA(HINSTANCE.init, IDC_SIZEALL), false); }
|
||||
{
|
||||
return new Cursor(LoadCursorA(HINSTANCE.init, IDC_SIZEALL), false);
|
||||
}
|
||||
|
||||
/// ditto
|
||||
@property Cursor sizeNESW() // getter
|
||||
{ return new Cursor(LoadCursorA(HINSTANCE.init, IDC_SIZENESW), false); }
|
||||
{
|
||||
return new Cursor(LoadCursorA(HINSTANCE.init, IDC_SIZENESW), false);
|
||||
}
|
||||
|
||||
/// ditto
|
||||
@property Cursor sizeNS() // getter
|
||||
{ return new Cursor(LoadCursorA(HINSTANCE.init, IDC_SIZENS), false); }
|
||||
{
|
||||
return new Cursor(LoadCursorA(HINSTANCE.init, IDC_SIZENS), false);
|
||||
}
|
||||
|
||||
/// ditto
|
||||
@property Cursor sizeNWSE() // getter
|
||||
{ return new Cursor(LoadCursorA(HINSTANCE.init, IDC_SIZENWSE), false); }
|
||||
{
|
||||
return new Cursor(LoadCursorA(HINSTANCE.init, IDC_SIZENWSE), false);
|
||||
}
|
||||
|
||||
/// ditto
|
||||
@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
|
||||
{ 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;
|
||||
|
||||
private import dfl.base, dfl.control, dfl.application, dfl.internal.winapi;
|
||||
private import dfl.event, dfl.drawing, dfl.internal.dlib;
|
||||
import dfl.application;
|
||||
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;
|
||||
|
||||
|
||||
|
@ -452,7 +457,7 @@ class Button: ButtonBase, IButtonControl // docmain
|
|||
|
||||
default:
|
||||
throw new DflException("Unsupported image format");
|
||||
not_unsupported: ;
|
||||
// not_unsupported: ;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
///
|
||||
module dfl.chart;
|
||||
|
||||
private import dfl.base;
|
||||
private import dfl.drawing;
|
||||
import dfl.base;
|
||||
import dfl.drawing;
|
||||
|
||||
private import std.csv;
|
||||
private import std.typecons;
|
||||
private import std.conv;
|
||||
private import std.algorithm;
|
||||
private import std.range;
|
||||
import std.csv;
|
||||
import std.typecons;
|
||||
import std.conv;
|
||||
import std.algorithm;
|
||||
import std.range;
|
||||
|
||||
///
|
||||
class TableRenderer(T...)
|
||||
|
@ -37,7 +37,7 @@ class TableRenderer(T...)
|
|||
_lastRecord = last;
|
||||
}
|
||||
/// ditto
|
||||
this(string csv) // deprecated
|
||||
private this(string csv)
|
||||
{
|
||||
_csv = csv;
|
||||
_columns = T.length;
|
||||
|
@ -383,7 +383,7 @@ private:
|
|||
|
||||
///
|
||||
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)
|
||||
|
@ -400,7 +400,7 @@ class LineGraphRenderer(T...)
|
|||
_lastRecord = last;
|
||||
}
|
||||
/// ditto
|
||||
this(string csv) // deprecated
|
||||
private this(string csv)
|
||||
{
|
||||
_csv = csv;
|
||||
_vZeroPos = VerticalZeroPosition.BOTTOM;
|
||||
|
@ -980,7 +980,7 @@ class TimeChartRenderer(T...)
|
|||
_lastRecord = last;
|
||||
}
|
||||
/// ditto
|
||||
this(string csv) // deprecated
|
||||
private this(string csv)
|
||||
{
|
||||
_csv = csv;
|
||||
_chartMargins = ChartMargins(50, 50, 50, 50);
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
/// Interfacing with the system clipboard for copy and paste operations.
|
||||
module dfl.clipboard;
|
||||
|
||||
private import dfl.base;
|
||||
private import dfl.data;
|
||||
private import dfl.drawing;
|
||||
import dfl.base;
|
||||
import dfl.data;
|
||||
import dfl.drawing;
|
||||
|
||||
private import dfl.internal.dlib;
|
||||
private import dfl.internal.wincom;
|
||||
import dfl.internal.dlib;
|
||||
import dfl.internal.wincom;
|
||||
|
||||
|
||||
///
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
module dfl.clippingform;
|
||||
|
||||
private import dfl.all;
|
||||
private import dfl.internal.dlib : toI32;
|
||||
private import core.memory;
|
||||
private import core.sys.windows.windows;
|
||||
import dfl.base;
|
||||
import dfl.form;
|
||||
import dfl.control;
|
||||
import dfl.event;
|
||||
import dfl.drawing;
|
||||
|
||||
import dfl.internal.dlib : toI32;
|
||||
|
||||
import core.memory;
|
||||
import core.sys.windows.windows;
|
||||
|
||||
///
|
||||
struct RegionRects
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
///
|
||||
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
|
||||
|
@ -404,7 +404,7 @@ template ListWrapArray(TValue, alias Array,
|
|||
ItemRemovingCallback(index, oldval); // Removing.
|
||||
if(!index)
|
||||
Array = Array[1 .. $];
|
||||
else if(index == Array.length - 1)
|
||||
else if(index + 1 == Array.length)
|
||||
Array = Array[0 .. index];
|
||||
else if(index > 0 && index < cast(int)Array.length)
|
||||
Array = Array[0 .. index] ~ Array[index + 1 .. $];
|
||||
|
@ -534,7 +534,7 @@ template removeIndex(T) // package
|
|||
{
|
||||
if(!index)
|
||||
array = array[1 .. array.length];
|
||||
else if(index == array.length - 1)
|
||||
else if(index + 1 == array.length)
|
||||
array = array[0 .. index];
|
||||
else
|
||||
array = array[0 .. index] ~ array[index + 1 .. $];
|
||||
|
|
|
@ -5,15 +5,15 @@
|
|||
///
|
||||
module dfl.colordialog;
|
||||
|
||||
private import dfl.application;
|
||||
private import dfl.base;
|
||||
private import dfl.drawing;
|
||||
private import dfl.commondialog;
|
||||
import dfl.application;
|
||||
import dfl.base;
|
||||
import dfl.drawing;
|
||||
import dfl.commondialog;
|
||||
|
||||
private import dfl.internal.dlib;
|
||||
private import dfl.internal.utf;
|
||||
private import dfl.internal.winapi;
|
||||
private import dfl.internal.wincom;
|
||||
import dfl.internal.dlib;
|
||||
import dfl.internal.utf;
|
||||
import dfl.internal.winapi;
|
||||
import dfl.internal.wincom;
|
||||
|
||||
|
||||
///
|
||||
|
|
|
@ -5,17 +5,17 @@
|
|||
///
|
||||
module dfl.combobox;
|
||||
|
||||
private import dfl.internal.dlib;
|
||||
private import dfl.internal.winapi;
|
||||
private import dfl.internal.utf;
|
||||
import dfl.application;
|
||||
import dfl.base;
|
||||
import dfl.control;
|
||||
import dfl.event;
|
||||
import dfl.drawing;
|
||||
import dfl.collections;
|
||||
import dfl.listbox;
|
||||
|
||||
private import dfl.application;
|
||||
private import dfl.base;
|
||||
private import dfl.control;
|
||||
private import dfl.event;
|
||||
private import dfl.drawing;
|
||||
private import dfl.collections;
|
||||
private import dfl.listbox;
|
||||
import dfl.internal.dlib;
|
||||
import dfl.internal.winapi;
|
||||
import dfl.internal.utf;
|
||||
|
||||
|
||||
private extern(Windows) void _initCombobox();
|
||||
|
@ -513,7 +513,7 @@ class ComboBox: ListControl // docmain
|
|||
|
||||
|
||||
///
|
||||
static class ObjectCollection
|
||||
static final class ObjectCollection
|
||||
{
|
||||
protected this(ComboBox lbox)
|
||||
{
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
///
|
||||
module dfl.commondialog;
|
||||
|
||||
private import dfl.application;
|
||||
private import dfl.base;
|
||||
private import dfl.control;
|
||||
private import dfl.drawing;
|
||||
private import dfl.event;
|
||||
import dfl.application;
|
||||
import dfl.base;
|
||||
import dfl.control;
|
||||
import dfl.drawing;
|
||||
import dfl.event;
|
||||
|
||||
private import dfl.internal.winapi;
|
||||
private import dfl.internal.utf;
|
||||
import dfl.internal.winapi;
|
||||
import dfl.internal.utf;
|
||||
|
||||
public import dfl.filedialog;
|
||||
public import dfl.folderdialog;
|
||||
|
|
|
@ -5,15 +5,13 @@
|
|||
///
|
||||
module dfl.control;
|
||||
|
||||
private import dfl.base, dfl.form, dfl.drawing;
|
||||
private import dfl.application, dfl.event, dfl.label;
|
||||
private import dfl.collections;
|
||||
private import core.memory;
|
||||
|
||||
private import dfl.internal.dlib, dfl.internal.clib;
|
||||
private import dfl.internal.winapi, dfl.internal.wincom;
|
||||
private import dfl.internal.utf;
|
||||
private import dfl.internal.com;
|
||||
import dfl.application;
|
||||
import dfl.base;
|
||||
import dfl.collections;
|
||||
import dfl.drawing;
|
||||
import dfl.event;
|
||||
import dfl.form;
|
||||
import dfl.label;
|
||||
|
||||
version(NO_DRAG_DROP)
|
||||
version = DFL_NO_DRAG_DROP;
|
||||
|
@ -23,7 +21,7 @@ version(DFL_NO_DRAG_DROP)
|
|||
}
|
||||
else
|
||||
{
|
||||
private import dfl.data;
|
||||
import dfl.data;
|
||||
}
|
||||
|
||||
version(DFL_NO_MENUS)
|
||||
|
@ -31,9 +29,20 @@ version(DFL_NO_MENUS)
|
|||
}
|
||||
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 = DFL_NO_ZOMBIE_FORM;
|
||||
|
||||
|
@ -839,7 +848,7 @@ class Control: DObject, IWindow // docmain
|
|||
{
|
||||
if(!i)
|
||||
children = children[1 .. $];
|
||||
else if(i == children.length - 1)
|
||||
else if(i + 1 == children.length)
|
||||
children = children[0 .. i];
|
||||
else
|
||||
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;
|
||||
}
|
||||
|
@ -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)
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
final void _simple_back_one(int i)
|
||||
void _simple_back_one(int i)
|
||||
{
|
||||
if(i <= 0 || i >= length)
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
final void _simple_back(int i)
|
||||
void _simple_back(int i)
|
||||
{
|
||||
if(i <= 0 || i >= length)
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
final void _simple_front(int i)
|
||||
void _simple_front(int i)
|
||||
{
|
||||
if(i < 0 || i >= length - 1)
|
||||
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));
|
||||
}
|
||||
|
@ -1792,7 +1801,7 @@ class Control: DObject, IWindow // docmain
|
|||
alias onDockChanged = onHasLayoutChanged;
|
||||
|
||||
|
||||
private final void _alreadyLayout()
|
||||
private void _alreadyLayout()
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
@ -2356,7 +2365,7 @@ class Control: DObject, IWindow // docmain
|
|||
}
|
||||
|
||||
|
||||
private final Control _fetchParent()
|
||||
private Control _fetchParent()
|
||||
{
|
||||
HWND hwParent = GetParent(hwnd);
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
@ -3418,6 +3427,12 @@ class Control: DObject, IWindow // docmain
|
|||
}
|
||||
|
||||
|
||||
override size_t toHash() const nothrow @trusted
|
||||
{
|
||||
return hashOf(hwnd);
|
||||
}
|
||||
|
||||
|
||||
override int opCmp(Object o)
|
||||
{
|
||||
Control ctrl = cast(Control)o;
|
||||
|
@ -3614,16 +3629,37 @@ class Control: DObject, IWindow // docmain
|
|||
if(!hwnd)
|
||||
badInvokeHandle();
|
||||
|
||||
InvokeData inv;
|
||||
inv.dg = dg;
|
||||
inv.args = args;
|
||||
static assert((DflInvokeParam*).sizeof <= LPARAM.sizeof);
|
||||
|
||||
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");
|
||||
if(inv.exception)
|
||||
throw inv.exception;
|
||||
if(dflInvokeParam.exception)
|
||||
throw dflInvokeParam.exception;
|
||||
|
||||
return inv.result;
|
||||
return dip.result;
|
||||
}
|
||||
|
||||
/// ditto
|
||||
|
@ -3632,13 +3668,32 @@ class Control: DObject, IWindow // docmain
|
|||
if(!hwnd)
|
||||
badInvokeHandle();
|
||||
|
||||
InvokeSimpleData inv;
|
||||
inv.dg = dg;
|
||||
static assert((DflInvokeParam*).sizeof <= LPARAM.sizeof);
|
||||
|
||||
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");
|
||||
if(inv.exception)
|
||||
throw inv.exception;
|
||||
if(dflInvokeParam.exception)
|
||||
throw dflInvokeParam.exception;
|
||||
}
|
||||
|
||||
|
||||
|
@ -3654,10 +3709,24 @@ class Control: DObject, IWindow // docmain
|
|||
if(!hwnd)
|
||||
badInvokeHandle();
|
||||
|
||||
assert(!invokeRequired);
|
||||
|
||||
static assert(fn.sizeof <= LPARAM.sizeof);
|
||||
PostMessageA(hwnd, wmDfl, WPARAM_DFL_DELAY_INVOKE, cast(LPARAM)fn);
|
||||
static assert((DflInvokeParam*).sizeof <= LPARAM.sizeof);
|
||||
|
||||
static void funcEntry(Control c, size_t[] p)
|
||||
{
|
||||
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
|
||||
|
@ -3671,22 +3740,19 @@ class Control: DObject, IWindow // docmain
|
|||
if(!hwnd)
|
||||
badInvokeHandle();
|
||||
|
||||
assert(!invokeRequired);
|
||||
|
||||
static assert((DflInvokeParam*).sizeof <= LPARAM.sizeof);
|
||||
|
||||
DflInvokeParam* p;
|
||||
p = cast(DflInvokeParam*)dfl.internal.clib.malloc(
|
||||
(DflInvokeParam.sizeof - size_t.sizeof)
|
||||
+ params.length * size_t.sizeof);
|
||||
if(!p)
|
||||
DflInvokeParam* dflInvokeParams = cast(DflInvokeParam*)malloc(
|
||||
DflInvokeParam.sizeof - size_t.sizeof + params.length * size_t.sizeof);
|
||||
if(!dflInvokeParams)
|
||||
throw new OomException();
|
||||
|
||||
p.fp = fn;
|
||||
p.nparams = params.length;
|
||||
p.params.ptr[0 .. params.length] = params[];
|
||||
dflInvokeParams.fp = fn;
|
||||
dflInvokeParams.exception = null;
|
||||
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;
|
||||
|
@ -6415,7 +6481,7 @@ class Control: DObject, IWindow // docmain
|
|||
///
|
||||
// Override to change the creation parameters.
|
||||
// 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)
|
||||
{
|
||||
|
@ -6441,7 +6507,7 @@ class Control: DObject, IWindow // docmain
|
|||
|
||||
|
||||
///
|
||||
protected void createHandle()
|
||||
void createHandle()
|
||||
{
|
||||
// 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
|
||||
{
|
||||
assert(!recreatingHandle);
|
||||
|
@ -6625,7 +6691,7 @@ class Control: DObject, IWindow // docmain
|
|||
}
|
||||
|
||||
|
||||
private final void fillRecreationData()
|
||||
private void fillRecreationData()
|
||||
{
|
||||
//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);
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
protected final bool getStyle(ControlStyles flag)
|
||||
final bool getStyle(ControlStyles flag)
|
||||
{
|
||||
return (ctrlStyle & flag) != 0;
|
||||
}
|
||||
|
||||
/// ditto
|
||||
protected final void setStyle(ControlStyles flag, bool value)
|
||||
final void setStyle(ControlStyles flag, bool value)
|
||||
{
|
||||
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.
|
||||
protected final void updateStyles()
|
||||
final void updateStyles()
|
||||
{
|
||||
LONG newClassStyles = _classStyle();
|
||||
LONG newWndStyles = _style();
|
||||
|
@ -6784,7 +6850,7 @@ class Control: DObject, IWindow // docmain
|
|||
|
||||
///
|
||||
// Called after adding the control to a container.
|
||||
protected void initLayout()
|
||||
void initLayout()
|
||||
{
|
||||
assert(wparent !is null);
|
||||
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.
|
||||
//suspendLayout();
|
||||
|
@ -6896,7 +6962,7 @@ class Control: DObject, IWindow // docmain
|
|||
return false;
|
||||
}
|
||||
+/
|
||||
protected bool isInputChar(char charCode)
|
||||
bool isInputChar(char charCode)
|
||||
{
|
||||
int mask = 0;
|
||||
if (charCode == Keys.TAB)
|
||||
|
@ -6915,7 +6981,7 @@ class Control: DObject, IWindow // docmain
|
|||
/// isInputKey returns true when keyData is a regular input key.
|
||||
// If keyData is input key, then window message is sended to wndProc()
|
||||
// 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)
|
||||
{
|
||||
|
@ -6993,7 +7059,7 @@ class Control: DObject, IWindow // docmain
|
|||
|
||||
///
|
||||
// Return true if processed.
|
||||
protected bool processKeyEventArgs(ref Message msg)
|
||||
bool processKeyEventArgs(ref Message msg)
|
||||
{
|
||||
// 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;
|
||||
}
|
||||
|
@ -7329,7 +7395,7 @@ class Control: DObject, IWindow // docmain
|
|||
}
|
||||
|
||||
|
||||
package void _classStyle(LONG cl)
|
||||
void _classStyle(LONG cl)
|
||||
{
|
||||
if(isHandleCreated)
|
||||
{
|
||||
|
@ -8323,15 +8389,3 @@ class ContainerControl: ScrollableControl, IContainerControl // docmain
|
|||
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;
|
||||
|
||||
private import dfl.base;
|
||||
private import dfl.application;
|
||||
private import dfl.drawing;
|
||||
import dfl.base;
|
||||
import dfl.application;
|
||||
import dfl.drawing;
|
||||
|
||||
private import dfl.internal.dlib;
|
||||
private import dfl.internal.utf;
|
||||
private import dfl.internal.com;
|
||||
private import dfl.internal.winapi;
|
||||
private import dfl.internal.wincom;
|
||||
|
||||
private import core.sys.windows.ole2; // DATA_E_FORMATETC
|
||||
import dfl.internal.dlib;
|
||||
import dfl.internal.utf;
|
||||
import dfl.internal.com;
|
||||
import dfl.internal.winapi;
|
||||
import dfl.internal.wincom;
|
||||
|
||||
import core.sys.windows.ole2 : DATA_E_FORMATETC;
|
||||
public import core.sys.windows.wingdi : BITMAPINFO;
|
||||
|
||||
|
||||
|
|
|
@ -5,14 +5,15 @@
|
|||
///
|
||||
module dfl.drawing;
|
||||
|
||||
private import dfl.base;
|
||||
private import std.stdio;
|
||||
import dfl.base;
|
||||
|
||||
private import dfl.internal.dlib;
|
||||
private import dfl.internal.winapi;
|
||||
private import dfl.internal.wincom;
|
||||
private import dfl.internal.utf;
|
||||
private import dfl.internal.com;
|
||||
import dfl.internal.dlib;
|
||||
import dfl.internal.winapi;
|
||||
import dfl.internal.wincom;
|
||||
import dfl.internal.utf;
|
||||
import dfl.internal.com;
|
||||
|
||||
import std.stdio;
|
||||
|
||||
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.
|
||||
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.
|
||||
//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;
|
||||
|
||||
private import dfl.base;
|
||||
private import dfl.event;
|
||||
import dfl.base;
|
||||
import dfl.event;
|
||||
|
||||
private import dfl.internal.dlib;
|
||||
private import dfl.internal.clib;
|
||||
private import dfl.internal.utf;
|
||||
private import dfl.internal.winapi;
|
||||
import dfl.internal.dlib;
|
||||
import dfl.internal.clib;
|
||||
import dfl.internal.utf;
|
||||
import dfl.internal.winapi;
|
||||
|
||||
|
||||
private extern(Windows) nothrow
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
module dfl.event;
|
||||
|
||||
import dfl.internal.dlib;
|
||||
|
||||
import std.functional;
|
||||
|
||||
|
||||
|
@ -88,7 +89,7 @@ template Event(T1, T2) // docmain
|
|||
break;
|
||||
}
|
||||
|
||||
if(iw == _array.length - 1)
|
||||
if(iw + 1 == _array.length)
|
||||
{
|
||||
_array[iw] = null;
|
||||
_array = _array[0 .. iw];
|
||||
|
@ -233,7 +234,7 @@ class EventArgs // docmain
|
|||
{
|
||||
/+
|
||||
private static byte[] buf;
|
||||
private import std.gc; // <-- ...
|
||||
import std.gc; // <-- ...
|
||||
|
||||
|
||||
new(uint sz)
|
||||
|
|
|
@ -5,16 +5,16 @@
|
|||
///
|
||||
module dfl.filedialog;
|
||||
|
||||
private import dfl.application;
|
||||
private import dfl.base;
|
||||
private import dfl.control;
|
||||
private import dfl.drawing;
|
||||
private import dfl.event;
|
||||
private import dfl.commondialog;
|
||||
import dfl.application;
|
||||
import dfl.base;
|
||||
import dfl.commondialog;
|
||||
import dfl.control;
|
||||
import dfl.drawing;
|
||||
import dfl.event;
|
||||
|
||||
private import dfl.internal.winapi;
|
||||
private import dfl.internal.dlib;
|
||||
private import dfl.internal.utf;
|
||||
import dfl.internal.dlib;
|
||||
import dfl.internal.utf;
|
||||
import dfl.internal.winapi;
|
||||
|
||||
|
||||
///
|
||||
|
@ -856,8 +856,8 @@ class OpenFileDialog: FileDialog // docmain
|
|||
}
|
||||
|
||||
|
||||
private static import undead.stream;
|
||||
private import std.stdio : File;
|
||||
static import undead.stream;
|
||||
import std.stdio : File;
|
||||
|
||||
///
|
||||
// Old openFile() is renamed openFileStream().
|
||||
|
@ -978,8 +978,8 @@ class SaveFileDialog: FileDialog // docmain
|
|||
}
|
||||
|
||||
|
||||
private static import undead.stream;
|
||||
private import std.stdio : File;
|
||||
static import undead.stream;
|
||||
import std.stdio : File;
|
||||
|
||||
///
|
||||
// Opens and creates with read and write access.
|
||||
|
|
|
@ -5,16 +5,16 @@
|
|||
///
|
||||
module dfl.folderdialog;
|
||||
|
||||
private import dfl.application;
|
||||
private import dfl.base;
|
||||
private import dfl.commondialog;
|
||||
private import dfl.environment;
|
||||
import dfl.application;
|
||||
import dfl.base;
|
||||
import dfl.commondialog;
|
||||
import dfl.environment;
|
||||
|
||||
private import dfl.internal.dlib;
|
||||
private import dfl.internal.clib;
|
||||
private import dfl.internal.utf;
|
||||
private import dfl.internal.winapi;
|
||||
private import dfl.internal.wincom;
|
||||
import dfl.internal.clib;
|
||||
import dfl.internal.dlib;
|
||||
import dfl.internal.utf;
|
||||
import dfl.internal.winapi;
|
||||
import dfl.internal.wincom;
|
||||
|
||||
|
||||
private extern(Windows) nothrow
|
||||
|
|
|
@ -5,16 +5,16 @@
|
|||
///
|
||||
module dfl.fontdialog;
|
||||
|
||||
private import dfl.application;
|
||||
private import dfl.base;
|
||||
private import dfl.control;
|
||||
private import dfl.drawing;
|
||||
private import dfl.event;
|
||||
private import dfl.commondialog;
|
||||
import dfl.application;
|
||||
import dfl.base;
|
||||
import dfl.control;
|
||||
import dfl.drawing;
|
||||
import dfl.event;
|
||||
import dfl.commondialog;
|
||||
|
||||
private import dfl.internal.dlib;
|
||||
private import dfl.internal.utf;
|
||||
private import dfl.internal.winapi;
|
||||
import dfl.internal.dlib;
|
||||
import dfl.internal.utf;
|
||||
import dfl.internal.winapi;
|
||||
|
||||
|
||||
private extern(Windows) nothrow
|
||||
|
|
|
@ -5,28 +5,33 @@
|
|||
///
|
||||
module dfl.form;
|
||||
|
||||
private import dfl.control, dfl.event, dfl.drawing;
|
||||
private import dfl.application, dfl.base;
|
||||
private import dfl.collections;
|
||||
|
||||
private import dfl.internal.dlib;
|
||||
private import dfl.internal.utf;
|
||||
private import core.sys.windows.windows;
|
||||
private import core.sys.windows.commctrl;
|
||||
|
||||
debug(APP_PRINT)
|
||||
{
|
||||
private import dfl.internal.clib;
|
||||
}
|
||||
import dfl.application;
|
||||
import dfl.base;
|
||||
import dfl.collections;
|
||||
import dfl.control;
|
||||
import dfl.drawing;
|
||||
import dfl.event;
|
||||
|
||||
version(DFL_NO_MENUS)
|
||||
{
|
||||
}
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
@ -121,7 +126,7 @@ class FormShortcutEventArgs: EventArgs
|
|||
|
||||
|
||||
// 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.
|
||||
|
@ -3481,7 +3486,7 @@ class Form: ContainerControl, IDialogResult // docmain
|
|||
+/
|
||||
|
||||
|
||||
final void _recalcClientSize()
|
||||
void _recalcClientSize()
|
||||
{
|
||||
RECT r;
|
||||
r.left = 0;
|
||||
|
|
|
@ -5,11 +5,17 @@
|
|||
///
|
||||
module dfl.groupbox;
|
||||
|
||||
private import dfl.control, dfl.base, dfl.button, dfl.drawing;
|
||||
private import dfl.internal.winapi, dfl.application, dfl.event;
|
||||
import dfl.application;
|
||||
import dfl.base;
|
||||
import dfl.button;
|
||||
import dfl.control;
|
||||
import dfl.drawing;
|
||||
import dfl.event;
|
||||
|
||||
import dfl.internal.winapi;
|
||||
static import dfl.internal.utf;
|
||||
|
||||
|
||||
private extern(Windows) void _initButton();
|
||||
|
||||
|
||||
|
|
|
@ -5,8 +5,12 @@
|
|||
///
|
||||
module dfl.imagelist;
|
||||
|
||||
import dfl.base, dfl.drawing, dfl.internal.winapi, dfl.internal.dlib;
|
||||
import dfl.base;
|
||||
import dfl.collections;
|
||||
import dfl.drawing;
|
||||
|
||||
import dfl.internal.dlib;
|
||||
import dfl.internal.winapi;
|
||||
|
||||
|
||||
version(DFL_NO_IMAGELIST)
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
module dfl.internal.clib;
|
||||
|
||||
|
||||
public import core.stdc.stdlib,
|
||||
core.stdc.string,
|
||||
core.stdc.stdint, // Mostly the same as the C interface.
|
||||
core.stdc.stdio;
|
||||
public import core.stdc.stdlib;
|
||||
public import core.stdc.string;
|
||||
public import core.stdc.stdint; // Mostly the same as the C interface.
|
||||
public import core.stdc.stdio;
|
||||
|
||||
alias cprintf = core.stdc.stdio.printf;
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
|
||||
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)
|
||||
|
|
|
@ -145,7 +145,7 @@ Dstring getObjectString(Object o)
|
|||
|
||||
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 gcUnpin(void* p) { }
|
||||
|
@ -156,7 +156,7 @@ version(DFL_NO_USE_CORE_MEMORY)
|
|||
}
|
||||
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 gcUnpin(void* p) { }
|
||||
|
@ -168,18 +168,12 @@ else
|
|||
|
||||
void gcFullCollect() nothrow
|
||||
{
|
||||
try
|
||||
{
|
||||
core.memory.GC.collect();
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
}
|
||||
core.memory.GC.collect();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private import std.string;
|
||||
import std.string;
|
||||
|
||||
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;
|
||||
|
||||
|
@ -241,7 +235,7 @@ Dstring uintToHexString(uint num)
|
|||
alias stringSplitLines = std.string.splitLines;
|
||||
|
||||
|
||||
private import std.path;
|
||||
import std.path;
|
||||
|
||||
alias pathGetDirName = std.path.dirName;
|
||||
|
||||
|
@ -257,13 +251,13 @@ alias nativePathSeparatorString = std.path.pathSeparator;
|
|||
|
||||
version(_DFL_NO_USE_CORE_EXCEPTION_OUTOFMEMORY_EXCEPTION)
|
||||
{
|
||||
private import std.outofmemory;
|
||||
import std.outofmemory;
|
||||
|
||||
alias OomException = std.outofmemory.OutOfMemoryException;
|
||||
}
|
||||
else
|
||||
{
|
||||
private import core.exception;
|
||||
import core.exception;
|
||||
|
||||
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;
|
||||
|
||||
|
@ -303,12 +297,12 @@ alias utf32stringtoUtf8string = std.utf.toUTF8;
|
|||
alias utf8stringtoUtf32string = std.utf.toUTF32;
|
||||
|
||||
|
||||
private import std.uni;
|
||||
import std.uni;
|
||||
|
||||
alias utf32charToLower = std.uni.toLower;
|
||||
|
||||
|
||||
private import std.conv;
|
||||
import std.conv;
|
||||
|
||||
version(DFL_NO_CONV_TO_TEMPLATE)
|
||||
{
|
||||
|
@ -330,12 +324,12 @@ else
|
|||
}
|
||||
|
||||
|
||||
private import std.ascii;
|
||||
import std.ascii;
|
||||
|
||||
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.
|
||||
|
||||
|
|
|
@ -21,22 +21,20 @@
|
|||
|
||||
module dfl.internal.utf;
|
||||
|
||||
private import dfl.internal.dlib;
|
||||
private import dfl.internal.clib;
|
||||
private import dfl.internal.winapi :
|
||||
LPCITEMIDLIST,
|
||||
SHGetPathFromIDListA, SHGetPathFromIDListW;
|
||||
import dfl.internal.clib;
|
||||
import dfl.internal.dlib;
|
||||
import dfl.internal.winapi : LPCITEMIDLIST, SHGetPathFromIDListA, SHGetPathFromIDListW;
|
||||
|
||||
private import core.sys.windows.windef;
|
||||
private import core.sys.windows.winuser;
|
||||
private import core.sys.windows.winreg;
|
||||
private import core.sys.windows.wingdi;
|
||||
private import core.sys.windows.winbase;
|
||||
private import core.sys.windows.shellapi;
|
||||
private import core.sys.windows.winnls;
|
||||
private import core.sys.windows.richedit;
|
||||
import core.sys.windows.richedit;
|
||||
import core.sys.windows.shellapi;
|
||||
import core.sys.windows.winbase;
|
||||
import core.sys.windows.windef;
|
||||
import core.sys.windows.wingdi;
|
||||
import core.sys.windows.winnls;
|
||||
import core.sys.windows.winreg;
|
||||
import core.sys.windows.winuser;
|
||||
|
||||
private import std.windows.charset;
|
||||
import std.windows.charset;
|
||||
|
||||
|
||||
version(DFL_NO_D2_AND_ABOVE)
|
||||
|
@ -176,8 +174,7 @@ Dstringz unsafeStringz(Dstring s) nothrow pure
|
|||
return s.ptr;
|
||||
|
||||
// Need to duplicate with null terminator.
|
||||
char[] result;
|
||||
result = new char[s.length + 1];
|
||||
char[] result = new char[s.length + 1];
|
||||
result[0 .. s.length] = s[];
|
||||
result[s.length] = 0;
|
||||
//return result.ptr;
|
||||
|
@ -190,14 +187,10 @@ Dstring unicodeToAnsi(Dwstringz unicode, size_t ulen)
|
|||
if(!ulen)
|
||||
return null;
|
||||
|
||||
wchar* wsz;
|
||||
char[] result;
|
||||
int len;
|
||||
|
||||
len = WideCharToMultiByte(0, 0, unicode, ulen.toI32, null, 0, null, null);
|
||||
int len = WideCharToMultiByte(0, 0, unicode, ulen.toI32, null, 0, null, null);
|
||||
assert(len > 0);
|
||||
|
||||
result = new char[len];
|
||||
char[] result = new char[len];
|
||||
len = WideCharToMultiByte(0, 0, unicode, ulen.toI32, result.ptr, len, null, null);
|
||||
assert(len == result.length);
|
||||
//return result[0 .. len - 1];
|
||||
|
@ -207,10 +200,8 @@ Dstring unicodeToAnsi(Dwstringz unicode, size_t ulen)
|
|||
|
||||
Dwstring ansiToUnicode(Dstringz ansi, size_t len)
|
||||
{
|
||||
wchar[] ws;
|
||||
|
||||
len++;
|
||||
ws = new wchar[len];
|
||||
wchar[] ws = new wchar[len];
|
||||
|
||||
len = MultiByteToWideChar(0, 0, ansi, len.toI32, ws.ptr, len.toI32);
|
||||
//assert(len == ws.length);
|
||||
|
@ -260,12 +251,11 @@ private Dstring _toAnsiz(Dstring utf8, bool safe = true)
|
|||
{
|
||||
if(ch >= 0x80)
|
||||
{
|
||||
char[] result;
|
||||
auto wsz = utf8stringToUtf16stringz(utf8);
|
||||
auto len = WideCharToMultiByte(0, 0, wsz, -1, null, 0, null, null);
|
||||
assert(len > 0);
|
||||
|
||||
result = new char[len];
|
||||
char[] result = new char[len];
|
||||
len = WideCharToMultiByte(0, 0, wsz, -1, result.ptr, len, null, null);
|
||||
assert(len == result.length);
|
||||
//return result[0 .. len - 1];
|
||||
|
@ -567,28 +557,22 @@ Dstring getWindowText(HWND hwnd)
|
|||
}
|
||||
}
|
||||
|
||||
wchar* buf;
|
||||
size_t len;
|
||||
|
||||
len = proclen(hwnd);
|
||||
size_t len = proclen(hwnd);
|
||||
if(!len)
|
||||
return null;
|
||||
len++;
|
||||
buf = (new wchar[len]).ptr;
|
||||
wchar* buf = (new wchar[len]).ptr;
|
||||
|
||||
len = proc(hwnd, buf, len.toI32);
|
||||
return fromUnicode(buf, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
char* buf;
|
||||
size_t len;
|
||||
|
||||
len = GetWindowTextLengthA(hwnd);
|
||||
size_t len = GetWindowTextLengthA(hwnd);
|
||||
if(!len)
|
||||
return null;
|
||||
len++;
|
||||
buf = (new char[len]).ptr;
|
||||
char* buf = (new char[len]).ptr;
|
||||
|
||||
len = GetWindowTextA(hwnd, buf, len.toI32);
|
||||
return fromAnsi(buf, len);
|
||||
|
@ -647,18 +631,14 @@ Dstring getModuleFileName(HMODULE hmod)
|
|||
}
|
||||
}
|
||||
|
||||
wchar[] s;
|
||||
DWORD len;
|
||||
s = new wchar[MAX_PATH];
|
||||
len = proc(hmod, s.ptr, s.length.toI32);
|
||||
wchar[] s = new wchar[MAX_PATH];
|
||||
DWORD len = proc(hmod, s.ptr, s.length.toI32);
|
||||
return fromUnicode(s.ptr, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
char[] s;
|
||||
DWORD len;
|
||||
s = new char[MAX_PATH];
|
||||
len = GetModuleFileNameA(hmod, s.ptr, s.length.toI32);
|
||||
char[] s = new char[MAX_PATH];
|
||||
DWORD len = GetModuleFileNameA(hmod, s.ptr, s.length.toI32);
|
||||
return fromAnsi(s.ptr, len);
|
||||
}
|
||||
}
|
||||
|
@ -714,18 +694,14 @@ Dstring emGetSelText(HWND hwnd, size_t selTextLength)
|
|||
proc = _loadSendMessageW();
|
||||
}
|
||||
|
||||
wchar[] buf;
|
||||
size_t len;
|
||||
buf = new wchar[selTextLength + 1];
|
||||
len = proc(hwnd, EM_GETSELTEXT, 0, cast(LPARAM)buf.ptr);
|
||||
wchar[] buf = new wchar[selTextLength + 1];
|
||||
size_t len = proc(hwnd, EM_GETSELTEXT, 0, cast(LPARAM)buf.ptr);
|
||||
return fromUnicode(buf.ptr, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
char[] buf;
|
||||
size_t len;
|
||||
buf = new char[selTextLength + 1];
|
||||
len = SendMessageA(hwnd, EM_GETSELTEXT, 0, cast(LPARAM)buf.ptr);
|
||||
char[] buf = new char[selTextLength + 1];
|
||||
size_t len = SendMessageA(hwnd, EM_GETSELTEXT, 0, cast(LPARAM)buf.ptr);
|
||||
return fromAnsi(buf.ptr, len);
|
||||
}
|
||||
}
|
||||
|
@ -759,14 +735,12 @@ Dstring getSelectedText(HWND hwnd)
|
|||
if(len)
|
||||
{
|
||||
len++;
|
||||
wchar* buf;
|
||||
buf = (new wchar[len]).ptr;
|
||||
wchar* buf = (new wchar[len]).ptr;
|
||||
|
||||
len = proc(hwnd, WM_GETTEXT, len, cast(LPARAM)buf).toI32;
|
||||
if(len)
|
||||
{
|
||||
wchar[] s;
|
||||
s = buf[v1 .. v2].dup;
|
||||
wchar[] s = buf[v1 .. v2].dup;
|
||||
return fromUnicode(s.ptr, s.length);
|
||||
}
|
||||
}
|
||||
|
@ -782,14 +756,12 @@ Dstring getSelectedText(HWND hwnd)
|
|||
if(len)
|
||||
{
|
||||
len++;
|
||||
char* buf;
|
||||
buf = (new char[len]).ptr;
|
||||
char* buf = (new char[len]).ptr;
|
||||
|
||||
len = SendMessageA(hwnd, WM_GETTEXT, len, cast(LPARAM)buf).toI32;
|
||||
if(len)
|
||||
{
|
||||
char[] s;
|
||||
s = buf[v1 .. v2].dup;
|
||||
char[] s = buf[v1 .. v2].dup;
|
||||
return fromAnsi(s.ptr, s.length);
|
||||
}
|
||||
}
|
||||
|
@ -819,10 +791,8 @@ void emSetPasswordChar(HWND hwnd, dchar pwc)
|
|||
}
|
||||
else
|
||||
{
|
||||
Dstring chs;
|
||||
Dstring ansichs;
|
||||
chs = utf32stringtoUtf8string((&pwc)[0 .. 1]);
|
||||
ansichs = unsafeAnsi(chs);
|
||||
Dstring chs = utf32stringtoUtf8string((&pwc)[0 .. 1]);
|
||||
Dstring ansichs = unsafeAnsi(chs);
|
||||
|
||||
if(ansichs)
|
||||
SendMessageA(hwnd, EM_SETPASSWORDCHAR, ansichs[0], 0); // TODO: ?
|
||||
|
@ -850,13 +820,10 @@ dchar emGetPasswordChar(HWND hwnd)
|
|||
}
|
||||
else
|
||||
{
|
||||
char ansich;
|
||||
Dstring chs;
|
||||
Ddstring dchs;
|
||||
ansich = cast(char)SendMessageA(hwnd, EM_GETPASSWORDCHAR, 0, 0);
|
||||
//chs = fromAnsi((&ansich)[0 .. 1], 1);
|
||||
chs = fromAnsi(&ansich, 1);
|
||||
dchs = utf8stringtoUtf32string(chs);
|
||||
char ansich = cast(char)SendMessageA(hwnd, EM_GETPASSWORDCHAR, 0, 0);
|
||||
//Dstring chs = fromAnsi((&ansich)[0 .. 1], 1);
|
||||
Dstring chs = fromAnsi(&ansich, 1);
|
||||
Ddstring dchs = utf8stringtoUtf32string(chs);
|
||||
if(dchs.length == 1)
|
||||
return dchs[0]; // TODO: ?
|
||||
return 0;
|
||||
|
@ -1004,8 +971,7 @@ Dstring getClipboardFormatName(UINT format)
|
|||
int len = proc(format, buf.ptr, buf.length.toI32);
|
||||
if(!len)
|
||||
return null;
|
||||
Dstring result = fromUnicode(buf.ptr, len);
|
||||
return result;
|
||||
return fromUnicode(buf.ptr, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1013,8 +979,7 @@ Dstring getClipboardFormatName(UINT format)
|
|||
int len = GetClipboardFormatNameA(format, buf.ptr, buf.length.toI32);
|
||||
if(!len)
|
||||
return null;
|
||||
Dstring result = fromAnsi(buf.ptr, len);
|
||||
return result;
|
||||
return fromAnsi(buf.ptr, len);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1051,9 +1016,8 @@ int drawTextEx(HDC hdc, Dstring text, LPRECT lprc, UINT dwDTFormat, LPDRAWTEXTPA
|
|||
strz = toUnicodez(text);
|
||||
return proc(hdc, strz, -1, lprc, dwDTFormat, lpDTParams);
|
||||
+/
|
||||
Dwstring str;
|
||||
wchar[2] tempStr;
|
||||
str = toUnicode(text);
|
||||
Dwstring str = toUnicode(text);
|
||||
if(str.length == 1)
|
||||
{
|
||||
tempStr[0] = str[0];
|
||||
|
@ -1071,9 +1035,8 @@ int drawTextEx(HDC hdc, Dstring text, LPRECT lprc, UINT dwDTFormat, LPDRAWTEXTPA
|
|||
strz = unsafeAnsiz(text);
|
||||
return DrawTextExA(hdc, strz, -1, lprc, dwDTFormat, lpDTParams);
|
||||
+/
|
||||
Dstring str;
|
||||
char[2] tempStr;
|
||||
str = unsafeAnsi(text);
|
||||
Dstring str = unsafeAnsi(text);
|
||||
if(str.length == 1)
|
||||
{
|
||||
tempStr[0] = str[0];
|
||||
|
@ -1163,10 +1126,8 @@ Dstring getCurrentDirectory()
|
|||
}
|
||||
}
|
||||
|
||||
wchar* buf;
|
||||
int len;
|
||||
len = proc(0, null);
|
||||
buf = (new wchar[len]).ptr;
|
||||
int len = proc(0, null);
|
||||
wchar* buf = (new wchar[len]).ptr;
|
||||
len = proc(len, buf);
|
||||
if(!len)
|
||||
return null;
|
||||
|
@ -1174,10 +1135,8 @@ Dstring getCurrentDirectory()
|
|||
}
|
||||
else
|
||||
{
|
||||
char* buf;
|
||||
int len;
|
||||
len = GetCurrentDirectoryA(0, null);
|
||||
buf = (new char[len]).ptr;
|
||||
int len = GetCurrentDirectoryA(0, null);
|
||||
char* buf = (new char[len]).ptr;
|
||||
len = GetCurrentDirectoryA(len, buf);
|
||||
if(!len)
|
||||
return null;
|
||||
|
@ -1263,18 +1222,16 @@ Dstring getComputerName()
|
|||
}
|
||||
}
|
||||
|
||||
wchar[] buf;
|
||||
DWORD len = MAX_COMPUTERNAME_LENGTH + 1;
|
||||
buf = new wchar[len];
|
||||
wchar[] buf = new wchar[len];
|
||||
if(!proc(buf.ptr, &len))
|
||||
return null;
|
||||
return fromUnicode(buf.ptr, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
char[] buf;
|
||||
DWORD len = MAX_COMPUTERNAME_LENGTH + 1;
|
||||
buf = new char[len];
|
||||
char[] buf = new char[len];
|
||||
if(!GetComputerNameA(buf.ptr, &len))
|
||||
return null;
|
||||
return fromAnsi(buf.ptr, len);
|
||||
|
@ -1303,20 +1260,16 @@ Dstring getSystemDirectory()
|
|||
}
|
||||
}
|
||||
|
||||
wchar[] buf;
|
||||
UINT len;
|
||||
buf = new wchar[MAX_PATH];
|
||||
len = proc(buf.ptr, buf.length.toI32);
|
||||
wchar[] buf = new wchar[MAX_PATH];
|
||||
UINT len = proc(buf.ptr, buf.length.toI32);
|
||||
if(!len)
|
||||
return null;
|
||||
return fromUnicode(buf.ptr, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
char[] buf;
|
||||
UINT len;
|
||||
buf = new char[MAX_PATH];
|
||||
len = GetSystemDirectoryA(buf.ptr, buf.length.toI32);
|
||||
char[] buf = new char[MAX_PATH];
|
||||
UINT len = GetSystemDirectoryA(buf.ptr, buf.length.toI32);
|
||||
if(!len)
|
||||
return null;
|
||||
return fromAnsi(buf.ptr, len);
|
||||
|
@ -1384,14 +1337,11 @@ DWORD expandEnvironmentStrings(Dstring src, out Dstring result)
|
|||
}
|
||||
}
|
||||
|
||||
wchar* dest;
|
||||
DWORD len;
|
||||
|
||||
auto strz = toUnicodez(src);
|
||||
len = proc(strz, null, 0);
|
||||
DWORD len = proc(strz, null, 0);
|
||||
if(!len)
|
||||
return 0;
|
||||
dest = (new wchar[len]).ptr;
|
||||
wchar* dest = (new wchar[len]).ptr;
|
||||
len = proc(strz, dest, len);
|
||||
if(!len)
|
||||
return 0;
|
||||
|
@ -1400,14 +1350,11 @@ DWORD expandEnvironmentStrings(Dstring src, out Dstring result)
|
|||
}
|
||||
else
|
||||
{
|
||||
char* dest;
|
||||
DWORD len;
|
||||
|
||||
auto strz = unsafeAnsiz(src);
|
||||
len = ExpandEnvironmentStringsA(strz, null, 0);
|
||||
DWORD len = ExpandEnvironmentStringsA(strz, null, 0);
|
||||
if(!len)
|
||||
return 0;
|
||||
dest = (new char[len]).ptr;
|
||||
char* dest = (new char[len]).ptr;
|
||||
len = ExpandEnvironmentStringsA(strz, dest, len);
|
||||
if(!len)
|
||||
return 0;
|
||||
|
@ -1438,25 +1385,21 @@ Dstring getEnvironmentVariable(Dstring name)
|
|||
}
|
||||
}
|
||||
|
||||
wchar* buf;
|
||||
DWORD len;
|
||||
auto strz = toUnicodez(name);
|
||||
len = proc(strz, null, 0);
|
||||
DWORD len = proc(strz, null, 0);
|
||||
if(!len)
|
||||
return null;
|
||||
buf = (new wchar[len]).ptr;
|
||||
wchar* buf = (new wchar[len]).ptr;
|
||||
len = proc(strz, buf, len);
|
||||
return fromUnicode(buf, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
char* buf;
|
||||
DWORD len;
|
||||
auto strz = unsafeAnsiz(name);
|
||||
len = GetEnvironmentVariableA(strz, null, 0);
|
||||
DWORD len = GetEnvironmentVariableA(strz, null, 0);
|
||||
if(!len)
|
||||
return null;
|
||||
buf = (new char[len]).ptr;
|
||||
char* buf = (new char[len]).ptr;
|
||||
len = GetEnvironmentVariableA(strz, buf, len);
|
||||
return fromAnsi(buf, len);
|
||||
}
|
||||
|
@ -1569,16 +1512,14 @@ deprecated BOOL getTextExtentPoint32(HDC hdc, Dstring text, LPSIZE lpSize)
|
|||
}
|
||||
}
|
||||
|
||||
Dwstring str;
|
||||
str = toUnicode(text);
|
||||
Dwstring str = toUnicode(text);
|
||||
return proc(hdc, str.ptr, str.length.toI32, lpSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Using GetTextExtentPoint32A here even though W is supported in order
|
||||
// to keep the measurements accurate with DrawTextA.
|
||||
Dstring str;
|
||||
str = unsafeAnsi(text);
|
||||
Dstring str = unsafeAnsi(text);
|
||||
return GetTextExtentPoint32A(hdc, str.ptr, str.length.toI32, lpSize);
|
||||
}
|
||||
}
|
||||
|
@ -1608,23 +1549,19 @@ Dstring dragQueryFile(HDROP hDrop, UINT idxFile)
|
|||
}
|
||||
}
|
||||
|
||||
wchar[] str;
|
||||
UINT len;
|
||||
len = proc(hDrop, idxFile, null, 0);
|
||||
UINT len = proc(hDrop, idxFile, null, 0);
|
||||
if(!len)
|
||||
return null;
|
||||
str = new wchar[len + 1];
|
||||
wchar[] str = new wchar[len + 1];
|
||||
proc(hDrop, idxFile, str.ptr, str.length.toI32);
|
||||
return fromUnicode(str.ptr, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
char[] str;
|
||||
UINT len;
|
||||
len = DragQueryFileA(hDrop, idxFile, null, 0);
|
||||
UINT len = DragQueryFileA(hDrop, idxFile, null, 0);
|
||||
if(!len)
|
||||
return null;
|
||||
str = new char[len + 1];
|
||||
char[] str = new char[len + 1];
|
||||
DragQueryFileA(hDrop, idxFile, str.ptr, str.length.toI32);
|
||||
return fromAnsi(str.ptr, len);
|
||||
}
|
||||
|
|
|
@ -4,13 +4,14 @@
|
|||
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.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)
|
||||
|
|
|
@ -3,16 +3,16 @@
|
|||
|
||||
module dfl.internal.wincom;
|
||||
|
||||
import core.sys.windows.windef;
|
||||
import core.sys.windows.winbase;
|
||||
import core.sys.windows.objidl;
|
||||
import core.sys.windows.winbase;
|
||||
import core.sys.windows.windef;
|
||||
|
||||
version(WINE)
|
||||
version = _dfl_needcom;
|
||||
|
||||
version(_dfl_needcom)
|
||||
{
|
||||
private import dfl.internal.dlib;
|
||||
import dfl.internal.dlib;
|
||||
|
||||
// Grabbed from std.c.windows.com:
|
||||
|
||||
|
|
|
@ -5,8 +5,14 @@
|
|||
///
|
||||
module dfl.label;
|
||||
|
||||
private import dfl.base, dfl.control, dfl.internal.winapi, dfl.application,
|
||||
dfl.event, dfl.drawing, dfl.internal.dlib;
|
||||
import dfl.application;
|
||||
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;
|
||||
|
||||
private import dfl.internal.dlib;
|
||||
|
||||
private import dfl.internal.winapi, dfl.control, dfl.base, dfl.application;
|
||||
private import dfl.drawing, dfl.event, dfl.collections;
|
||||
import dfl.application;
|
||||
import dfl.base;
|
||||
import dfl.collections;
|
||||
import dfl.control;
|
||||
import dfl.drawing;
|
||||
import dfl.event;
|
||||
import dfl.internal.winapi;
|
||||
|
||||
import dfl.internal.dlib;
|
||||
static import dfl.internal.utf;
|
||||
|
||||
private import std.algorithm;
|
||||
import std.algorithm;
|
||||
|
||||
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);
|
||||
|
||||
|
|
|
@ -5,17 +5,24 @@
|
|||
///
|
||||
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;
|
||||
private import dfl.event, dfl.drawing, dfl.collections, dfl.internal.utf;
|
||||
import dfl.internal.clib;
|
||||
import dfl.internal.dlib;
|
||||
import dfl.internal.utf;
|
||||
import dfl.internal.winapi;
|
||||
|
||||
version(DFL_NO_IMAGELIST)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
private import dfl.imagelist;
|
||||
import dfl.imagelist;
|
||||
}
|
||||
|
||||
|
||||
|
@ -121,35 +128,48 @@ class ListViewSubItem: DObject
|
|||
}
|
||||
|
||||
|
||||
override Dstring toString()
|
||||
override Dstring toString() const
|
||||
{
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
override Dequ opEquals(Object o)
|
||||
override Dequ opEquals(Object o) const
|
||||
{
|
||||
return text == getObjectString(o);
|
||||
}
|
||||
|
||||
|
||||
Dequ opEquals(Dstring val)
|
||||
Dequ opEquals(Dstring val) const
|
||||
{
|
||||
return text == val;
|
||||
}
|
||||
|
||||
|
||||
override int opCmp(Object o)
|
||||
override int opCmp(Object o) const
|
||||
{
|
||||
return stringICmp(text, getObjectString(o));
|
||||
}
|
||||
|
||||
|
||||
int opCmp(Dstring val)
|
||||
int opCmp(Dstring val) const
|
||||
{
|
||||
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
|
||||
|
@ -168,7 +188,7 @@ class ListViewSubItem: DObject
|
|||
}
|
||||
|
||||
/// ditto
|
||||
final @property Dstring text() // getter
|
||||
final @property Dstring text() const // getter
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
@ -249,7 +269,7 @@ class ListViewItem: DObject
|
|||
}
|
||||
|
||||
|
||||
private final bool _getcheckstate(int thisindex)
|
||||
private bool _getcheckstate(int thisindex)
|
||||
{
|
||||
if(lview && lview.created)
|
||||
{
|
||||
|
@ -280,35 +300,48 @@ class ListViewItem: DObject
|
|||
}
|
||||
|
||||
|
||||
override Dstring toString()
|
||||
override Dstring toString() const
|
||||
{
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
override Dequ opEquals(Object o)
|
||||
override Dequ opEquals(Object o) const
|
||||
{
|
||||
return text == getObjectString(o);
|
||||
}
|
||||
|
||||
|
||||
Dequ opEquals(Dstring val)
|
||||
Dequ opEquals(Dstring val) const
|
||||
{
|
||||
return text == val;
|
||||
}
|
||||
|
||||
|
||||
override int opCmp(Object o)
|
||||
override int opCmp(Object o) const
|
||||
{
|
||||
return stringICmp(text, getObjectString(o));
|
||||
}
|
||||
|
||||
|
||||
int opCmp(Dstring val)
|
||||
int opCmp(Dstring val) const
|
||||
{
|
||||
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
|
||||
|
@ -342,7 +375,7 @@ class ListViewItem: DObject
|
|||
}
|
||||
|
||||
/// ditto
|
||||
final @property Dstring text() // getter
|
||||
final @property Dstring text() const // getter
|
||||
{
|
||||
return _txt;
|
||||
}
|
||||
|
@ -491,42 +524,55 @@ class ColumnHeader: DObject
|
|||
}
|
||||
|
||||
/// ditto
|
||||
final @property Dstring text() // getter
|
||||
final @property Dstring text() const // getter
|
||||
{
|
||||
return _txt;
|
||||
}
|
||||
|
||||
|
||||
override Dstring toString()
|
||||
override Dstring toString() const
|
||||
{
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
override Dequ opEquals(Object o)
|
||||
override Dequ opEquals(Object o) const
|
||||
{
|
||||
return text == getObjectString(o);
|
||||
}
|
||||
|
||||
|
||||
Dequ opEquals(Dstring val)
|
||||
Dequ opEquals(Dstring val) const
|
||||
{
|
||||
return text == val;
|
||||
}
|
||||
|
||||
|
||||
override int opCmp(Object o)
|
||||
override int opCmp(Object o) const
|
||||
{
|
||||
return stringICmp(text, getObjectString(o));
|
||||
}
|
||||
|
||||
|
||||
int opCmp(Dstring val)
|
||||
int opCmp(Dstring val) const
|
||||
{
|
||||
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
|
||||
{
|
||||
|
@ -791,13 +837,13 @@ class ListView: ControlSuperClass // docmain
|
|||
package ListViewItem[] _items;
|
||||
|
||||
|
||||
package final @property bool created() // getter
|
||||
package @property bool created() // getter
|
||||
{
|
||||
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
|
||||
{
|
||||
assert(created);
|
||||
|
@ -897,7 +943,7 @@ class ListView: ControlSuperClass // docmain
|
|||
ColumnHeader[] _headers;
|
||||
|
||||
|
||||
package final @property bool created() // getter
|
||||
package @property bool created() // getter
|
||||
{
|
||||
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
|
||||
{
|
||||
assert(created);
|
||||
|
@ -1746,7 +1792,7 @@ class ListView: ControlSuperClass // docmain
|
|||
sitems = sitems.dup; // So exception won't damage anything.
|
||||
// Stupid bubble sort. At least it's a "stable sort".
|
||||
bool swp;
|
||||
auto sortmax = sitems.length - 1;
|
||||
auto sortmax = sitems.length + (-1);
|
||||
size_t iw;
|
||||
do
|
||||
{
|
||||
|
@ -1803,7 +1849,7 @@ class ListView: ControlSuperClass // docmain
|
|||
}
|
||||
|
||||
/// ditto
|
||||
final int delegate(ListViewItem, ListViewItem) sorter() @property // getter
|
||||
final int delegate(ListViewItem, ListViewItem) sorter() const @property // getter
|
||||
{
|
||||
return _sortproc;
|
||||
}
|
||||
|
|
|
@ -5,13 +5,20 @@
|
|||
///
|
||||
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)
|
||||
{
|
||||
private import dfl.internal.clib;
|
||||
import dfl.internal.clib;
|
||||
}
|
||||
|
||||
version(DFL_NO_MENUS)
|
||||
|
@ -118,7 +125,7 @@ else
|
|||
}
|
||||
|
||||
/// ditto
|
||||
final @property Dstring text() // getter
|
||||
final @property Dstring text() const // getter
|
||||
{
|
||||
// if(mparent) fetch text ?
|
||||
return mtext;
|
||||
|
@ -520,36 +527,49 @@ else
|
|||
}
|
||||
|
||||
|
||||
override Dstring toString()
|
||||
override Dstring toString() const
|
||||
{
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
override Dequ opEquals(Object o)
|
||||
override Dequ opEquals(Object o) const
|
||||
{
|
||||
return text == getObjectString(o);
|
||||
}
|
||||
|
||||
|
||||
Dequ opEquals(Dstring val)
|
||||
Dequ opEquals(Dstring val) const
|
||||
{
|
||||
return text == val;
|
||||
}
|
||||
|
||||
|
||||
override int opCmp(Object o)
|
||||
override int opCmp(Object o) const
|
||||
{
|
||||
return stringICmp(text, getObjectString(o));
|
||||
}
|
||||
|
||||
|
||||
int opCmp(Dstring val)
|
||||
int opCmp(Dstring val) const
|
||||
{
|
||||
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)
|
||||
{
|
||||
super.onReflectedMessage(m);
|
||||
|
@ -738,7 +758,7 @@ else
|
|||
}
|
||||
|
||||
|
||||
package final void _additem(MenuItem mi)
|
||||
package void _additem(MenuItem mi)
|
||||
{
|
||||
// Fix indices after this point.
|
||||
int idx;
|
||||
|
@ -754,7 +774,7 @@ else
|
|||
|
||||
|
||||
// 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.
|
||||
if(idx < items.length)
|
||||
|
@ -864,7 +884,7 @@ else
|
|||
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
|
|
@ -5,8 +5,10 @@
|
|||
///
|
||||
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;
|
||||
|
||||
///
|
||||
|
|
|
@ -5,16 +5,104 @@
|
|||
///
|
||||
module dfl.notifyicon;
|
||||
|
||||
private import dfl.internal.winapi, dfl.base, dfl.drawing;
|
||||
private import dfl.control, dfl.form, dfl.application;
|
||||
private import dfl.event, dfl.internal.utf, dfl.internal.dlib;
|
||||
import dfl.application;
|
||||
import dfl.base;
|
||||
import dfl.control;
|
||||
import dfl.drawing;
|
||||
import dfl.event;
|
||||
import dfl.form;
|
||||
|
||||
version(DFL_NO_MENUS)
|
||||
{
|
||||
}
|
||||
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;
|
||||
nid.hIcon = ico ? ico.handle : null;
|
||||
_icon = icon;
|
||||
_nid.hIcon = icon ? icon.handle : null;
|
||||
|
||||
if(visible)
|
||||
{
|
||||
nid.uFlags = NIF_ICON;
|
||||
Shell_NotifyIconA(NIM_MODIFY, &nid);
|
||||
_nid.uFlags |= NIF_ICON;
|
||||
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
|
||||
{
|
||||
if(txt.length >= nid.szTip.length)
|
||||
if(txt.length >= _nid.szTip.length)
|
||||
throw new DflException("Notify icon text too long");
|
||||
|
||||
// To-do: support Unicode.
|
||||
|
||||
txt = unsafeAnsi(txt); // ...
|
||||
nid.szTip[txt.length] = 0;
|
||||
nid.szTip[0 .. txt.length] = txt[];
|
||||
tipLen = txt.length.toI32;
|
||||
static if (useUnicode)
|
||||
Dwstring str = toUnicode(txt);
|
||||
else
|
||||
Dstring str = unsafeAnsi(txt);
|
||||
_nid.szTip[str.length] = 0;
|
||||
_nid.szTip[0 .. str.length] = str[];
|
||||
_tipLen = str.length.toI32;
|
||||
|
||||
if(visible)
|
||||
{
|
||||
nid.uFlags = NIF_TIP;
|
||||
Shell_NotifyIconA(NIM_MODIFY, &nid);
|
||||
_nid.uFlags |= NIF_TIP;
|
||||
DFL_Shell_NotifyIcon(NIM_MODIFY, &_nid);
|
||||
}
|
||||
}
|
||||
|
||||
/// ditto
|
||||
final @property Dstring text() // getter
|
||||
{
|
||||
//return nid.szTip[0 .. tipLen]; // Returning possibly mutated text!
|
||||
//return nid.szTip[0 .. tipLen].dup;
|
||||
//return nid.szTip[0 .. tipLen].idup; // Needed in D2. Doesn't work in D1.
|
||||
return cast(Dstring)nid.szTip[0 .. tipLen].dup; // Needed in D2. Doesn't work in D1.
|
||||
static if (useUnicode)
|
||||
return fromUnicodez(_nid.szTip[0 .. _tipLen].ptr);
|
||||
else
|
||||
return cast(Dstring)_nid.szTip[0 .. _tipLen].dup;
|
||||
}
|
||||
|
||||
|
||||
|
@ -97,29 +184,28 @@ class NotifyIcon // docmain
|
|||
{
|
||||
if(byes)
|
||||
{
|
||||
if(!nid.uID)
|
||||
if(!_nid.uID)
|
||||
{
|
||||
nid.uID = allocNotifyIconID();
|
||||
assert(nid.uID);
|
||||
allNotifyIcons[nid.uID] = this;
|
||||
_nid.uID = allocNotifyIconID();
|
||||
assert(_nid.uID);
|
||||
allNotifyIcons[_nid.uID] = this;
|
||||
}
|
||||
|
||||
_forceAdd();
|
||||
}
|
||||
else if(nid.uID)
|
||||
else if(_nid.uID)
|
||||
{
|
||||
_forceDelete();
|
||||
|
||||
//delete allNotifyIcons[nid.uID];
|
||||
allNotifyIcons.remove(nid.uID);
|
||||
nid.uID = 0;
|
||||
allNotifyIcons.remove(_nid.uID);
|
||||
_nid.uID = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// ditto
|
||||
final @property bool visible() // getter
|
||||
{
|
||||
return nid.uID != 0;
|
||||
return _nid.uID != 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -134,8 +220,74 @@ class NotifyIcon // docmain
|
|||
{
|
||||
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) doubleClick; ///
|
||||
Event!(NotifyIcon, MouseEventArgs) mouseDown; ///
|
||||
|
@ -148,34 +300,22 @@ class NotifyIcon // docmain
|
|||
if(!ctrlNotifyIcon)
|
||||
_init();
|
||||
|
||||
nid.cbSize = nid.sizeof;
|
||||
nid.hWnd = ctrlNotifyIcon.handle;
|
||||
nid.uID = 0;
|
||||
nid.uCallbackMessage = WM_NOTIFYICON;
|
||||
nid.hIcon = null;
|
||||
nid.szTip[0] = '\0';
|
||||
_nid.cbSize = _nid.sizeof;
|
||||
_nid.hWnd = ctrlNotifyIcon.handle;
|
||||
_nid.uID = 0;
|
||||
_nid.uCallbackMessage = WM_NOTIFYICON;
|
||||
_nid.hIcon = null;
|
||||
_nid.szTip[0] = '\0';
|
||||
}
|
||||
|
||||
|
||||
~this()
|
||||
{
|
||||
if(nid.uID)
|
||||
if(_nid.uID)
|
||||
{
|
||||
_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.
|
||||
void minimize(IWindow win)
|
||||
{
|
||||
LONG style;
|
||||
HWND hwnd;
|
||||
|
||||
hwnd = win.handle;
|
||||
style = GetWindowLongPtrA(hwnd, GWL_STYLE).toI32;
|
||||
HWND hwnd = win.handle;
|
||||
LONG style = GetWindowLongPtrA(hwnd, GWL_STYLE).toI32;
|
||||
|
||||
if(style & WS_VISIBLE)
|
||||
{
|
||||
|
@ -211,11 +348,8 @@ class NotifyIcon // docmain
|
|||
// Extra.
|
||||
void restore(IWindow win)
|
||||
{
|
||||
LONG style;
|
||||
HWND hwnd;
|
||||
|
||||
hwnd = win.handle;
|
||||
style = GetWindowLongPtrA(hwnd, GWL_STYLE).toI32;
|
||||
HWND hwnd = win.handle;
|
||||
LONG style = GetWindowLongPtrA(hwnd, GWL_STYLE).toI32;
|
||||
|
||||
if(!(style & WS_VISIBLE))
|
||||
{
|
||||
|
@ -251,8 +385,11 @@ class NotifyIcon // docmain
|
|||
|
||||
private:
|
||||
|
||||
NOTIFYICONDATA nid;
|
||||
int tipLen = 0;
|
||||
static if (useUnicode)
|
||||
DFL_NOTIFYICONDATAW _nid;
|
||||
else
|
||||
DFL_NOTIFYICONDATAA _nid;
|
||||
int _tipLen = 0;
|
||||
version(DFL_NO_MENUS)
|
||||
{
|
||||
}
|
||||
|
@ -260,19 +397,24 @@ class NotifyIcon // docmain
|
|||
{
|
||||
ContextMenu cmenu;
|
||||
}
|
||||
Icon _icon;
|
||||
Icon _icon; /// Task tray icon
|
||||
Icon _balloonTipIcon; /// Balloon tip icon
|
||||
|
||||
|
||||
package final void _forceAdd()
|
||||
{
|
||||
nid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
|
||||
Shell_NotifyIconA(NIM_ADD, &nid);
|
||||
_nid.uFlags |= NIF_MESSAGE | NIF_ICON | NIF_TIP | NIF_SHOWTIP;
|
||||
if (_nid.hIcon)
|
||||
_nid.uFlags |= NIF_ICON;
|
||||
else
|
||||
_nid.uFlags &= ~NIF_ICON;
|
||||
DFL_Shell_NotifyIcon(NIM_ADD, &_nid);
|
||||
}
|
||||
|
||||
|
||||
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.
|
||||
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)
|
||||
{
|
||||
hw = FindWindowExA(hwTaskbar, null, "TrayNotifyWnd", null);
|
||||
HWND hw = FindWindowExA(hwTaskbar, null, "TrayNotifyWnd", null);
|
||||
if(hw)
|
||||
{
|
||||
GetWindowRect(hw, &rect);
|
||||
|
@ -373,8 +514,7 @@ class NotifyIconControl: Control
|
|||
}
|
||||
|
||||
Application.creatingControl(this);
|
||||
hwnd = CreateWindowExA(wexstyle, CONTROL_CLASSNAME.ptr, "NotifyIcon", 0, 0, 0, 0, 0, null, null,
|
||||
Application.getInstance(), null);
|
||||
hwnd = CreateWindowExA(wexstyle, CONTROL_CLASSNAME.ptr, "NotifyIcon", 0, 0, 0, 0, 0, null, null, Application.getInstance(), null);
|
||||
if(!hwnd)
|
||||
goto create_err;
|
||||
}
|
||||
|
@ -386,11 +526,9 @@ class NotifyIconControl: Control
|
|||
{
|
||||
if(cast(UINT)msg.wParam in allNotifyIcons)
|
||||
{
|
||||
NotifyIcon ni;
|
||||
NotifyIcon ni = allNotifyIcons[cast(UINT)msg.wParam];
|
||||
Point pt;
|
||||
|
||||
ni = allNotifyIcons[cast(UINT)msg.wParam];
|
||||
|
||||
switch(cast(UINT)msg.lParam) // msg.
|
||||
{
|
||||
case WM_MOUSEMOVE:
|
||||
|
@ -468,8 +606,7 @@ static ~this()
|
|||
|
||||
UINT allocNotifyIconID()
|
||||
{
|
||||
UINT prev;
|
||||
prev = lastId;
|
||||
UINT prev = lastId;
|
||||
for(;;)
|
||||
{
|
||||
lastId++;
|
||||
|
|
|
@ -5,14 +5,46 @@
|
|||
/// Imports all of DFL's public interface.
|
||||
module dfl;
|
||||
|
||||
public import dfl.base, dfl.menu, dfl.control, dfl.usercontrol,
|
||||
dfl.form, dfl.drawing, dfl.panel, dfl.event, dfl.clippingform,
|
||||
dfl.application, dfl.button, dfl.socket,
|
||||
dfl.timer, dfl.environment, dfl.label, dfl.textboxbase, dfl.textbox,
|
||||
dfl.listbox, dfl.splitter, dfl.groupbox, dfl.messagebox,
|
||||
dfl.registry, dfl.notifyicon, dfl.collections, dfl.data,
|
||||
dfl.clipboard, dfl.commondialog, dfl.richtextbox, dfl.tooltip,
|
||||
dfl.combobox, dfl.treeview, dfl.picturebox, dfl.tabcontrol,
|
||||
dfl.listview, dfl.statusbar, dfl.progressbar, dfl.resources,
|
||||
dfl.imagelist, dfl.toolbar, dfl.trackbar, dfl.sharedcontrol,
|
||||
dfl.printing, dfl.chart;
|
||||
public import dfl.application;
|
||||
public import dfl.base;
|
||||
public import dfl.button;
|
||||
public import dfl.chart;
|
||||
public import dfl.clipboard;
|
||||
public import dfl.clippingform;
|
||||
public import dfl.collections;
|
||||
public import dfl.combobox;
|
||||
public import dfl.commondialog;
|
||||
public import dfl.control;
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
private import dfl.control;
|
||||
private import dfl.base;
|
||||
private import dfl.drawing;
|
||||
private import dfl.event;
|
||||
import dfl.base;
|
||||
import dfl.control;
|
||||
import dfl.drawing;
|
||||
import dfl.event;
|
||||
|
||||
private import core.sys.windows.windows;
|
||||
import core.sys.windows.windows;
|
||||
|
||||
|
||||
///
|
||||
|
|
|
@ -5,30 +5,31 @@
|
|||
///
|
||||
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");
|
||||
|
||||
private import dfl.base;
|
||||
private import dfl.commondialog;
|
||||
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;
|
||||
import core.sys.windows.commdlg;
|
||||
import core.sys.windows.windows;
|
||||
|
||||
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
|
||||
|
|
|
@ -5,16 +5,17 @@
|
|||
///
|
||||
module dfl.progressbar;
|
||||
|
||||
private import dfl.application;
|
||||
private import dfl.base;
|
||||
private import dfl.control;
|
||||
private import dfl.drawing;
|
||||
private import dfl.event;
|
||||
import dfl.application;
|
||||
import dfl.base;
|
||||
import dfl.control;
|
||||
import dfl.drawing;
|
||||
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();
|
||||
|
||||
|
|
|
@ -7,9 +7,11 @@
|
|||
///
|
||||
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:
|
||||
class DflRegistryException: DflException // package
|
||||
|
@ -127,7 +129,7 @@ private enum uint MAX_REG_BUFFER = 256;
|
|||
abstract class RegistryValue
|
||||
{
|
||||
@property DWORD valueType(); // getter
|
||||
override Dstring toString();
|
||||
override Dstring toString() const;
|
||||
/+ package +/ protected LONG save(HKEY hkey, Dstring name); // package
|
||||
package final @property RegistryValue _reg() { return this; }
|
||||
}
|
||||
|
@ -158,7 +160,7 @@ class RegistryValueSz: RegistryValue
|
|||
}
|
||||
|
||||
|
||||
override Dstring toString()
|
||||
override Dstring toString() const
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
@ -245,7 +247,7 @@ class RegistryValueMultiSz: RegistryValue
|
|||
}
|
||||
|
||||
|
||||
override Dstring toString()
|
||||
override Dstring toString() const
|
||||
{
|
||||
Dstring result;
|
||||
foreach(Dstring str; value)
|
||||
|
@ -312,7 +314,7 @@ class RegistryValueExpandSz: RegistryValue
|
|||
}
|
||||
|
||||
|
||||
override Dstring toString()
|
||||
override Dstring toString() const
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
@ -391,7 +393,7 @@ class RegistryValueDword: RegistryValue
|
|||
}
|
||||
|
||||
|
||||
override Dstring toString()
|
||||
override Dstring toString() const
|
||||
{
|
||||
return dwordToString(value);
|
||||
}
|
||||
|
@ -431,7 +433,7 @@ class RegistryValueDwordBigEndian: RegistryValue
|
|||
}
|
||||
|
||||
|
||||
override Dstring toString()
|
||||
override Dstring toString() const
|
||||
{
|
||||
return dwordToString(value);
|
||||
}
|
||||
|
@ -469,7 +471,7 @@ class RegistryValueBinary: RegistryValue
|
|||
}
|
||||
|
||||
|
||||
override Dstring toString()
|
||||
override Dstring toString() const
|
||||
{
|
||||
return "Binary";
|
||||
}
|
||||
|
@ -507,7 +509,7 @@ class RegistryValueLink: RegistryValue
|
|||
}
|
||||
|
||||
|
||||
override Dstring toString()
|
||||
override Dstring toString() const
|
||||
{
|
||||
return "Symbolic Link";
|
||||
}
|
||||
|
@ -545,7 +547,7 @@ class RegistryValueResourceList: RegistryValue
|
|||
}
|
||||
|
||||
|
||||
override Dstring toString()
|
||||
override Dstring toString() const
|
||||
{
|
||||
return "Resource List";
|
||||
}
|
||||
|
@ -583,7 +585,7 @@ class RegistryValueNone: RegistryValue
|
|||
}
|
||||
|
||||
|
||||
override Dstring toString()
|
||||
override Dstring toString() const
|
||||
{
|
||||
return "None";
|
||||
}
|
||||
|
@ -870,7 +872,7 @@ class RegistryKey // docmain
|
|||
}
|
||||
|
||||
|
||||
override Dequ opEquals(Object o)
|
||||
override Dequ opEquals(Object o) const
|
||||
{
|
||||
RegistryKey rk;
|
||||
|
||||
|
@ -881,10 +883,16 @@ class RegistryKey // docmain
|
|||
}
|
||||
|
||||
|
||||
Dequ opEquals(RegistryKey rk)
|
||||
Dequ opEquals(RegistryKey rk) const
|
||||
{
|
||||
return hkey == rk.hkey;
|
||||
}
|
||||
|
||||
|
||||
override size_t toHash() const nothrow @safe
|
||||
{
|
||||
return hashOf(hKey);
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
|
|
|
@ -5,10 +5,12 @@
|
|||
///
|
||||
module dfl.resources;
|
||||
|
||||
private import dfl.internal.dlib;
|
||||
|
||||
private import dfl.internal.utf, dfl.internal.winapi, dfl.base, dfl.drawing;
|
||||
import dfl.base;
|
||||
import dfl.drawing;
|
||||
|
||||
import dfl.internal.dlib;
|
||||
import dfl.internal.utf;
|
||||
import dfl.internal.winapi;
|
||||
|
||||
version(DFL_NO_RESOURCES)
|
||||
{
|
||||
|
|
|
@ -5,29 +5,29 @@
|
|||
///
|
||||
module dfl.richtextbox;
|
||||
|
||||
private import dfl.textboxbase;
|
||||
private import dfl.base;
|
||||
private import dfl.application;
|
||||
private import dfl.event;
|
||||
private import dfl.drawing;
|
||||
private import dfl.data;
|
||||
private import dfl.control;
|
||||
|
||||
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;
|
||||
import dfl.application;
|
||||
import dfl.base;
|
||||
import dfl.control;
|
||||
import dfl.data;
|
||||
import dfl.drawing;
|
||||
import dfl.event;
|
||||
import dfl.textboxbase;
|
||||
|
||||
version(DFL_NO_MENUS)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
private import dfl.menu;
|
||||
import dfl.menu;
|
||||
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*);
|
||||
|
||||
|
@ -560,7 +560,7 @@ class RichTextBox: TextBoxBase // docmain
|
|||
cf.dwEffects |= CFE_UNDERLINE;
|
||||
cf.yHeight = cast(typeof(cf.yHeight))Font.getEmSize(lf.lfHeight, GraphicsUnit.TWIP);
|
||||
cf.bCharSet = lf.lfCharSet;
|
||||
strcpy(cf.szFaceName.ptr, lf.lfFaceName.ptr);
|
||||
cf.szFaceName = lf.lfFaceName;
|
||||
cf.bUnderlineType = CFU_UNDERLINE;
|
||||
cf.wWeight = cast(WORD)lf.lfWeight;
|
||||
|
||||
|
@ -599,7 +599,7 @@ class RichTextBox: TextBoxBase // docmain
|
|||
lfUnderline = (cf.dwEffects & CFE_UNDERLINE) != 0;
|
||||
lfStrikeOut = (cf.dwEffects & CFE_STRIKEOUT) != 0;
|
||||
lfCharSet = cf.bCharSet;
|
||||
strcpy(lfFaceName.ptr, cf.szFaceName.ptr);
|
||||
lfFaceName = cf.szFaceName;
|
||||
lfOutPrecision = OUT_DEFAULT_PRECIS;
|
||||
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
|
||||
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;
|
||||
|
||||
private import dfl.control;
|
||||
private import dfl.application;
|
||||
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:
|
||||
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)
|
||||
{
|
||||
static assert((DflInvokeParam*).sizeof <= LPARAM.sizeof);
|
||||
static struct InvokeParam
|
||||
static struct FunctionInvokeParam
|
||||
{
|
||||
void function(Control, ARGS) fn;
|
||||
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 param = cast(InvokeParam*)malloc(InvokeParam.sizeof);
|
||||
param.fn = fn;
|
||||
param.args = args.field;
|
||||
|
||||
if (!param)
|
||||
|
||||
auto invokeParam = cast(FunctionInvokeParam*)malloc(FunctionInvokeParam.sizeof);
|
||||
if (!invokeParam)
|
||||
throw new OomException();
|
||||
|
||||
auto p = cast(DflInvokeParam*)malloc(DflInvokeParam.sizeof);
|
||||
|
||||
if (!p)
|
||||
throw new OomException();
|
||||
|
||||
|
||||
static void fnentry(Control c, size_t[] p)
|
||||
invokeParam.func.atomicStore(func.atomicLoad());
|
||||
static foreach (i, e; args)
|
||||
{
|
||||
auto param = cast(InvokeParam*)p[0];
|
||||
param.fn(c, param.args);
|
||||
invokeParam.args[i].atomicStore(e.atomicLoad());
|
||||
}
|
||||
|
||||
static void funcEntry(Control c, size_t[] p)
|
||||
{
|
||||
auto param = cast(FunctionInvokeParam*)p[0];
|
||||
param.func(c, param.args);
|
||||
free(param);
|
||||
}
|
||||
|
||||
p.fp = &fnentry;
|
||||
p.nparams = 1;
|
||||
p.params[0] = cast(size_t)param;
|
||||
|
||||
return cast(LPARAM)p;
|
||||
dflInvokeParam.fp.atomicStore(&funcEntry);
|
||||
dflInvokeParam.exception.atomicStore(null);
|
||||
dflInvokeParam.nparams.atomicStore(1);
|
||||
dflInvokeParam.params[0].atomicStore(cast(size_t)invokeParam);
|
||||
}
|
||||
|
||||
|
||||
LPARAM makeParamNoneArgs(void function(Control) fn)
|
||||
void makeParamNoneArgs(ref void function(Control) func, ref DflInvokeParam* dflInvokeParam)
|
||||
{
|
||||
static assert((DflInvokeParam*).sizeof <= LPARAM.sizeof);
|
||||
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)
|
||||
static void funcEntry(Control c, size_t[] p)
|
||||
{
|
||||
auto fn = cast(void function(Control))p[0];
|
||||
fn(c);
|
||||
auto func = cast(void function(Control))p[0];
|
||||
func(c);
|
||||
}
|
||||
|
||||
p.fp = &fnentry;
|
||||
p.nparams = 1;
|
||||
p.params[0] = cast(size_t)fn;
|
||||
|
||||
return cast(LPARAM)p;
|
||||
dflInvokeParam.fp = &funcEntry;
|
||||
dflInvokeParam.exception = null;
|
||||
dflInvokeParam.nparams = 0;
|
||||
dflInvokeParam.params[0] = cast(size_t)func;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public:
|
||||
///
|
||||
this(Control ctrl)
|
||||
|
@ -91,62 +71,112 @@ public:
|
|||
assert(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))
|
||||
{
|
||||
auto ctrl = cast(Control)_ctrl;
|
||||
auto hwnd = ctrl.handle;
|
||||
|
||||
if(!hwnd)
|
||||
Control.badInvokeHandle();
|
||||
throw new DflException("Must invoke with created handle"); // Control.badInvokeHandle();
|
||||
|
||||
auto t = tuple(args);
|
||||
auto p = makeParam(fn, &t);
|
||||
SendMessageA(hwnd, wmDfl, WPARAM_DFL_DELAY_INVOKE_PARAMS, p);
|
||||
static assert((DflInvokeParam*).sizeof <= LPARAM.sizeof);
|
||||
|
||||
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)
|
||||
{
|
||||
auto ctrl = cast(Control)_ctrl;
|
||||
auto hwnd = ctrl.handle;
|
||||
|
||||
if(!hwnd)
|
||||
Control.badInvokeHandle();
|
||||
throw new DflException("Must invoke with created handle"); // Control.badInvokeHandle();
|
||||
|
||||
auto p = makeParamNoneArgs(fn);
|
||||
SendMessageA(hwnd, wmDfl, WPARAM_DFL_DELAY_INVOKE_PARAMS, p);
|
||||
static assert((DflInvokeParam*).sizeof <= LPARAM.sizeof);
|
||||
|
||||
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))
|
||||
{
|
||||
auto ctrl = cast(Control)_ctrl;
|
||||
auto hwnd = ctrl.handle;
|
||||
|
||||
if(!hwnd)
|
||||
Control.badInvokeHandle();
|
||||
throw new DflException("Must invoke with created handle"); // Control.badInvokeHandle();
|
||||
|
||||
auto t = tuple(args);
|
||||
auto p = makeParam(fn, &t);
|
||||
PostMessageA(hwnd, wmDfl, WPARAM_DFL_DELAY_INVOKE_PARAMS, p);
|
||||
static assert((DflInvokeParam*).sizeof <= LPARAM.sizeof);
|
||||
|
||||
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)
|
||||
{
|
||||
auto ctrl = cast(Control)_ctrl;
|
||||
auto hwnd = ctrl.handle;
|
||||
|
||||
if(!hwnd)
|
||||
Control.badInvokeHandle();
|
||||
throw new DflException("Must invoke with created handle"); // Control.badInvokeHandle();
|
||||
|
||||
auto p = makeParamNoneArgs(fn);
|
||||
PostMessageA(hwnd, wmDfl, WPARAM_DFL_DELAY_INVOKE_PARAMS, p);
|
||||
static assert((DflInvokeParam*).sizeof <= LPARAM.sizeof);
|
||||
|
||||
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
|
||||
{
|
||||
|
||||
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;
|
||||
private import core.sys.windows.winsock2;
|
||||
|
||||
alias DInternetHost = InternetHost;
|
||||
alias DInternetAddress = InternetAddress;
|
||||
|
||||
socket_t getSocketHandle(Socket sock) nothrow @nogc
|
||||
{
|
||||
return sock.handle;
|
||||
}
|
||||
return sock.handle;
|
||||
}
|
||||
|
||||
alias DflSocket = std.socket.Socket; ///
|
||||
|
||||
private import dfl.internal.winapi, dfl.application, dfl.base, dfl.internal.utf;
|
||||
|
||||
|
||||
private
|
||||
{
|
||||
|
@ -85,7 +89,7 @@ alias RegisterEventCallback = void delegate(DflSocket sock, EventType type, int
|
|||
// Calling this twice on the same socket cancels out previously
|
||||
// registered events for the socket.
|
||||
// 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(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.
|
||||
|
||||
// SOCKET_ERROR
|
||||
if(-1 == WSAAsyncSelect(getSocketHandle(sock), hwNet, WM_DFL_NETEVENT, cast(int)events))
|
||||
if (WSAAsyncSelect(getSocketHandle(sock), hwNet, WM_DFL_NETEVENT, cast(int)events) == SOCKET_ERROR)
|
||||
throw new DflException("Unable to register socket events");
|
||||
|
||||
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)];
|
||||
allEvents.remove(getSocketHandle(sock));
|
||||
|
|
|
@ -5,8 +5,12 @@
|
|||
///
|
||||
module dfl.splitter;
|
||||
|
||||
private import dfl.control, dfl.internal.winapi, dfl.base, dfl.drawing;
|
||||
private import dfl.event;
|
||||
import dfl.base;
|
||||
import dfl.control;
|
||||
import dfl.drawing;
|
||||
import dfl.event;
|
||||
|
||||
import dfl.internal.winapi;
|
||||
|
||||
|
||||
///
|
||||
|
|
|
@ -6,10 +6,15 @@
|
|||
module dfl.statusbar;
|
||||
|
||||
|
||||
private import dfl.control, dfl.base, dfl.internal.winapi, dfl.event,
|
||||
dfl.collections, dfl.internal.utf, dfl.internal.dlib, dfl.application;
|
||||
import 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();
|
||||
|
@ -56,42 +61,48 @@ class StatusBarPanel: DObject
|
|||
}
|
||||
|
||||
|
||||
override Dstring toString()
|
||||
override Dstring toString() const
|
||||
{
|
||||
return _txt;
|
||||
}
|
||||
|
||||
|
||||
override Dequ opEquals(Object o)
|
||||
override Dequ opEquals(Object o) const
|
||||
{
|
||||
return _txt == getObjectString(o); // ?
|
||||
}
|
||||
|
||||
Dequ opEquals(StatusBarPanel pnl)
|
||||
Dequ opEquals(StatusBarPanel pnl) const
|
||||
{
|
||||
return _txt == pnl._txt;
|
||||
}
|
||||
|
||||
Dequ opEquals(Dstring val)
|
||||
Dequ opEquals(Dstring val) const
|
||||
{
|
||||
return _txt == val;
|
||||
}
|
||||
|
||||
|
||||
override int opCmp(Object o)
|
||||
override int opCmp(Object o) const
|
||||
{
|
||||
return stringICmp(_txt, getObjectString(o)); // ?
|
||||
}
|
||||
|
||||
int opCmp(StatusBarPanel pnl)
|
||||
int opCmp(StatusBarPanel pnl) const
|
||||
{
|
||||
return stringICmp(_txt, pnl._txt);
|
||||
}
|
||||
|
||||
int opCmp(Dstring val)
|
||||
int opCmp(Dstring val) const
|
||||
{
|
||||
return stringICmp(_txt, val);
|
||||
}
|
||||
|
||||
|
||||
override size_t toHash() const nothrow @safe
|
||||
{
|
||||
return hashOf(_txt);
|
||||
}
|
||||
|
||||
|
||||
/+
|
||||
|
|
|
@ -5,11 +5,16 @@
|
|||
///
|
||||
module dfl.tabcontrol;
|
||||
|
||||
private import dfl.internal.dlib;
|
||||
|
||||
private import dfl.control, dfl.panel, dfl.internal.winapi, dfl.drawing;
|
||||
private import dfl.application, dfl.event, dfl.base, dfl.collections;
|
||||
import dfl.application;
|
||||
import dfl.base;
|
||||
import 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;
|
||||
|
||||
|
||||
|
@ -81,6 +86,19 @@ class TabPage: Panel
|
|||
{
|
||||
return stringICmp(text, val);
|
||||
}
|
||||
|
||||
|
||||
override size_t toHash() const nothrow @trusted
|
||||
{
|
||||
try
|
||||
{
|
||||
return hashOf(text);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// imageIndex
|
||||
|
@ -95,8 +113,7 @@ class TabPage: Panel
|
|||
|
||||
if(created)
|
||||
{
|
||||
TabControl tc;
|
||||
tc = cast(TabControl)parent;
|
||||
TabControl tc = cast(TabControl)parent;
|
||||
if(tc)
|
||||
tc.updateTabText(this, newText);
|
||||
}
|
||||
|
@ -257,9 +274,8 @@ class TabPageCollection
|
|||
{
|
||||
if(val.parent)
|
||||
{
|
||||
TabControl tc;
|
||||
tc = cast(TabControl)val.parent;
|
||||
if(tc && tc.tabPages.indexOf(val) != -1)
|
||||
TabControl parentTC = cast(TabControl)val.parent;
|
||||
if(parentTC && parentTC.tabPages.indexOf(val) != -1)
|
||||
throw new DflException("TabPage already has a parent");
|
||||
}
|
||||
|
||||
|
|
|
@ -5,25 +5,28 @@
|
|||
///
|
||||
module dfl.textbox;
|
||||
|
||||
private import dfl.control, dfl.base, dfl.application;
|
||||
private import dfl.drawing, dfl.event;
|
||||
private import dfl.textboxbase;
|
||||
|
||||
private import dfl.internal.dlib;
|
||||
private import dfl.internal.winapi;
|
||||
private import dfl.internal.utf;
|
||||
|
||||
debug(APP_PRINT)
|
||||
{
|
||||
private import dfl.internal.clib;
|
||||
}
|
||||
import dfl.application;
|
||||
import dfl.base;
|
||||
import dfl.control;
|
||||
import dfl.drawing;
|
||||
import dfl.event;
|
||||
import dfl.textboxbase;
|
||||
|
||||
version(DFL_NO_MENUS)
|
||||
{
|
||||
}
|
||||
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;
|
||||
|
||||
private import dfl.control, dfl.base, dfl.application;
|
||||
private import dfl.drawing, dfl.event;
|
||||
|
||||
private import dfl.internal.dlib;
|
||||
private import dfl.internal.winapi;
|
||||
private import dfl.internal.utf;
|
||||
|
||||
debug(APP_PRINT)
|
||||
{
|
||||
private import dfl.internal.clib;
|
||||
}
|
||||
import dfl.application;
|
||||
import dfl.base;
|
||||
import dfl.control;
|
||||
import dfl.drawing;
|
||||
import dfl.event;
|
||||
|
||||
version(DFL_NO_MENUS)
|
||||
{
|
||||
}
|
||||
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;
|
||||
|
||||
private import dfl.application;
|
||||
private import dfl.base;
|
||||
private import dfl.event;
|
||||
import dfl.application;
|
||||
import dfl.base;
|
||||
import dfl.event;
|
||||
|
||||
import dfl.internal.dlib;
|
||||
|
||||
private import dfl.internal.dlib;
|
||||
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;
|
||||
|
||||
private import dfl.application;
|
||||
private import dfl.base;
|
||||
private import dfl.control;
|
||||
private import dfl.drawing;
|
||||
private import dfl.event;
|
||||
private import dfl.collections;
|
||||
|
||||
private import dfl.internal.dlib;
|
||||
private static import dfl.internal.utf;
|
||||
|
||||
private import core.sys.windows.windows;
|
||||
private import core.sys.windows.commctrl;
|
||||
import dfl.application;
|
||||
import dfl.base;
|
||||
import dfl.collections;
|
||||
import dfl.control;
|
||||
import dfl.drawing;
|
||||
import dfl.event;
|
||||
|
||||
version (DFL_NO_IMAGELIST)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
private import dfl.imagelist;
|
||||
import dfl.imagelist;
|
||||
}
|
||||
|
||||
version (DFL_NO_MENUS)
|
||||
|
@ -30,9 +24,15 @@ version (DFL_TOOLBAR_NO_MENU)
|
|||
}
|
||||
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
|
||||
{
|
||||
|
@ -145,31 +145,44 @@ class ToolBarButton
|
|||
}
|
||||
|
||||
|
||||
override Dstring toString()
|
||||
override Dstring toString() const
|
||||
{
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
override Dequ opEquals(Object o)
|
||||
override Dequ opEquals(Object o) const
|
||||
{
|
||||
return text == getObjectString(o);
|
||||
}
|
||||
|
||||
|
||||
Dequ opEquals(Dstring val)
|
||||
Dequ opEquals(Dstring val) const
|
||||
{
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
int opCmp(Dstring val)
|
||||
int opCmp(Dstring val) const
|
||||
{
|
||||
return stringICmp(text, val);
|
||||
}
|
||||
|
|
|
@ -5,17 +5,16 @@
|
|||
///
|
||||
module dfl.tooltip;
|
||||
|
||||
import dfl.application;
|
||||
import dfl.base;
|
||||
import dfl.control;
|
||||
|
||||
private import dfl.application;
|
||||
private import dfl.base;
|
||||
private import dfl.control;
|
||||
import dfl.internal.clib;
|
||||
import dfl.internal.dlib;
|
||||
import dfl.internal.utf;
|
||||
|
||||
private import dfl.internal.dlib;
|
||||
private import dfl.internal.clib;
|
||||
private import dfl.internal.utf;
|
||||
|
||||
private import core.sys.windows.windows;
|
||||
private import core.sys.windows.commctrl;
|
||||
import core.sys.windows.commctrl;
|
||||
import core.sys.windows.windows;
|
||||
|
||||
|
||||
///
|
||||
|
|
|
@ -10,18 +10,19 @@
|
|||
///
|
||||
module dfl.trackbar;
|
||||
|
||||
private import dfl.base;
|
||||
private import dfl.control;
|
||||
private import dfl.application;
|
||||
private import dfl.event;
|
||||
private import dfl.drawing;
|
||||
private static import dfl.internal.utf;
|
||||
import dfl.application;
|
||||
import dfl.base;
|
||||
import dfl.control;
|
||||
import dfl.drawing;
|
||||
import dfl.event;
|
||||
static import dfl.internal.utf;
|
||||
|
||||
private import core.sys.windows.commctrl;
|
||||
private import core.sys.windows.windef;
|
||||
private import core.sys.windows.winuser;
|
||||
import core.sys.windows.commctrl;
|
||||
import core.sys.windows.windef;
|
||||
import core.sys.windows.winuser;
|
||||
|
||||
static import std.algorithm.comparison;
|
||||
|
||||
private static import std.algorithm.comparison;
|
||||
|
||||
extern(Windows) void _initTrackbar();
|
||||
|
||||
|
|
|
@ -5,19 +5,26 @@
|
|||
///
|
||||
module dfl.treeview;
|
||||
|
||||
private import dfl.internal.dlib;
|
||||
|
||||
private import dfl.control, dfl.application, dfl.base, dfl.internal.winapi;
|
||||
private import dfl.event, dfl.drawing, dfl.collections, dfl.internal.utf;
|
||||
import dfl.application;
|
||||
import dfl.base;
|
||||
import dfl.collections;
|
||||
import dfl.control;
|
||||
import dfl.drawing;
|
||||
import dfl.event;
|
||||
|
||||
version(DFL_NO_IMAGELIST)
|
||||
{
|
||||
}
|
||||
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();
|
||||
|
||||
|
@ -330,7 +337,9 @@ class TreeNode: DObject
|
|||
final @property TreeNode lastNode() // getter
|
||||
{
|
||||
if(tchildren.length)
|
||||
return tchildren._nodes[tchildren.length - 1];
|
||||
{
|
||||
return tchildren._nodes[tchildren.length + (-1)];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -618,7 +627,13 @@ class TreeNode: DObject
|
|||
return 0 == stringICmp(ttext, val);
|
||||
}
|
||||
|
||||
|
||||
|
||||
override size_t toHash() const nothrow @safe
|
||||
{
|
||||
return hashOf(ttext);
|
||||
}
|
||||
|
||||
|
||||
override int opCmp(Object o) const
|
||||
{
|
||||
return stringICmp(ttext, getObjectString(o)); // ?
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
///
|
||||
module dfl.usercontrol;
|
||||
|
||||
private import dfl.control;
|
||||
import dfl.control;
|
||||
|
||||
|
||||
///
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue