mirror of
https://github.com/vczh-libraries/Release.git
synced 2026-05-30 13:05:20 +08:00
Update release
This commit is contained in:
+39
-10
@@ -6411,7 +6411,7 @@ GuiControlHost
|
|||||||
control=control->GetParent();
|
control=control->GetParent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiControlHost::MoveIntoTooltipControl(GuiControl* tooltipControl, Point location)
|
void GuiControlHost::MoveIntoTooltipControl(GuiControl* tooltipControl, Point location)
|
||||||
@@ -6547,7 +6547,15 @@ GuiControlHost
|
|||||||
void GuiControlHost::Destroying()
|
void GuiControlHost::Destroying()
|
||||||
{
|
{
|
||||||
WindowDestroying.Execute(GetNotifyEventArguments());
|
WindowDestroying.Execute(GetNotifyEventArguments());
|
||||||
SetNativeWindow(0);
|
calledDestroyed = true;
|
||||||
|
if (deleteWhenDestroyed)
|
||||||
|
{
|
||||||
|
GetApplication()->InvokeInMainThread(this, [=]()
|
||||||
|
{
|
||||||
|
delete this;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
SetNativeWindow(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiControlHost::UpdateClientSizeAfterRendering(Size clientSize)
|
void GuiControlHost::UpdateClientSizeAfterRendering(Size clientSize)
|
||||||
@@ -6580,6 +6588,20 @@ GuiControlHost
|
|||||||
delete host;
|
delete host;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GuiControlHost::DeleteAfterProcessingAllEvents()
|
||||||
|
{
|
||||||
|
auto window = host->GetNativeWindow();
|
||||||
|
if (calledDestroyed || !window)
|
||||||
|
{
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
deleteWhenDestroyed = true;
|
||||||
|
GetCurrentController()->WindowService()->DestroyNativeWindow(window);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
compositions::GuiGraphicsHost* GuiControlHost::GetGraphicsHost()
|
compositions::GuiGraphicsHost* GuiControlHost::GetGraphicsHost()
|
||||||
{
|
{
|
||||||
return host;
|
return host;
|
||||||
@@ -6902,17 +6924,17 @@ GuiControlHost
|
|||||||
|
|
||||||
void GuiControlHost::Close()
|
void GuiControlHost::Close()
|
||||||
{
|
{
|
||||||
INativeWindow* window=host->GetNativeWindow();
|
if (auto window = host->GetNativeWindow())
|
||||||
if(window)
|
|
||||||
{
|
{
|
||||||
if(GetCurrentController()->WindowService()->GetMainWindow()!=window)
|
auto mainWindow = GetCurrentController()->WindowService()->GetMainWindow();
|
||||||
|
if (mainWindow == window)
|
||||||
{
|
{
|
||||||
window->Hide(false);
|
SetNativeWindow(nullptr);
|
||||||
|
GetCurrentController()->WindowService()->DestroyNativeWindow(window);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetNativeWindow(0);
|
window->Hide(false);
|
||||||
GetCurrentController()->WindowService()->DestroyNativeWindow(window);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7054,7 +7076,7 @@ GuiWindow
|
|||||||
INativeWindow* window=host->GetNativeWindow();
|
INativeWindow* window=host->GetNativeWindow();
|
||||||
if(window)
|
if(window)
|
||||||
{
|
{
|
||||||
SetNativeWindow(0);
|
SetNativeWindow(nullptr);
|
||||||
GetCurrentController()->WindowService()->DestroyNativeWindow(window);
|
GetCurrentController()->WindowService()->DestroyNativeWindow(window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7153,7 +7175,7 @@ GuiWindow
|
|||||||
ShowModal(owner, [=]()
|
ShowModal(owner, [=]()
|
||||||
{
|
{
|
||||||
callback();
|
callback();
|
||||||
delete this;
|
DeleteAfterProcessingAllEvents();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8598,10 +8620,17 @@ Helper Functions
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SafeDeleteControl(controls::GuiControl* value)
|
void SafeDeleteControl(controls::GuiControl* value)
|
||||||
|
{
|
||||||
|
if (auto controlHost = dynamic_cast<controls::GuiControlHost*>(value))
|
||||||
|
{
|
||||||
|
controlHost->DeleteAfterProcessingAllEvents();
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
NotifyFinalizeInstance(value);
|
NotifyFinalizeInstance(value);
|
||||||
SafeDeleteControlInternal(value);
|
SafeDeleteControlInternal(value);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SafeDeleteComposition(GuiGraphicsComposition* value)
|
void SafeDeleteComposition(GuiGraphicsComposition* value)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11010,6 +11010,9 @@ Control Host
|
|||||||
Ptr<INativeDelay> tooltipCloseDelay;
|
Ptr<INativeDelay> tooltipCloseDelay;
|
||||||
Point tooltipLocation;
|
Point tooltipLocation;
|
||||||
|
|
||||||
|
bool calledDestroyed = false;
|
||||||
|
bool deleteWhenDestroyed = false;
|
||||||
|
|
||||||
controls::GuiControlHost* GetControlHostForInstance()override;
|
controls::GuiControlHost* GetControlHostForInstance()override;
|
||||||
GuiControl* GetTooltipOwner(Point location);
|
GuiControl* GetTooltipOwner(Point location);
|
||||||
void MoveIntoTooltipControl(GuiControl* tooltipControl, Point location);
|
void MoveIntoTooltipControl(GuiControl* tooltipControl, Point location);
|
||||||
@@ -11051,6 +11054,9 @@ Control Host
|
|||||||
/// <summary>Window destroying event.</summary>
|
/// <summary>Window destroying event.</summary>
|
||||||
compositions::GuiNotifyEvent WindowDestroying;
|
compositions::GuiNotifyEvent WindowDestroying;
|
||||||
|
|
||||||
|
/// <summary>Delete this control host after processing all events.</summary>
|
||||||
|
void DeleteAfterProcessingAllEvents();
|
||||||
|
|
||||||
/// <summary>Get the internal <see cref="compositions::GuiGraphicsHost"/> object to host the window content.</summary>
|
/// <summary>Get the internal <see cref="compositions::GuiGraphicsHost"/> object to host the window content.</summary>
|
||||||
/// <returns>The internal <see cref="compositions::GuiGraphicsHost"/> object to host the window content.</returns>
|
/// <returns>The internal <see cref="compositions::GuiGraphicsHost"/> object to host the window content.</returns>
|
||||||
compositions::GuiGraphicsHost* GetGraphicsHost();
|
compositions::GuiGraphicsHost* GetGraphicsHost();
|
||||||
|
|||||||
@@ -2166,6 +2166,7 @@ Type Declaration (Class)
|
|||||||
CLASS_MEMBER_PROPERTY_FAST(ShortcutKeyManager)
|
CLASS_MEMBER_PROPERTY_FAST(ShortcutKeyManager)
|
||||||
CLASS_MEMBER_PROPERTY_READONLY_FAST(RelatedScreen)
|
CLASS_MEMBER_PROPERTY_READONLY_FAST(RelatedScreen)
|
||||||
|
|
||||||
|
CLASS_MEMBER_METHOD(DeleteAfterProcessingAllEvents, NO_PARAMETER)
|
||||||
CLASS_MEMBER_METHOD(ForceCalculateSizeImmediately, NO_PARAMETER)
|
CLASS_MEMBER_METHOD(ForceCalculateSizeImmediately, NO_PARAMETER)
|
||||||
CLASS_MEMBER_METHOD(GetFocused, NO_PARAMETER)
|
CLASS_MEMBER_METHOD(GetFocused, NO_PARAMETER)
|
||||||
CLASS_MEMBER_METHOD(SetFocused, NO_PARAMETER)
|
CLASS_MEMBER_METHOD(SetFocused, NO_PARAMETER)
|
||||||
|
|||||||
+32
-24
@@ -13301,30 +13301,22 @@ WindowsForm
|
|||||||
protected:
|
protected:
|
||||||
HWND handle;
|
HWND handle;
|
||||||
WString title;
|
WString title;
|
||||||
WindowsCursor* cursor;
|
WindowsCursor* cursor = nullptr;
|
||||||
Point caretPoint;
|
Point caretPoint;
|
||||||
WindowsForm* parentWindow;
|
WindowsForm* parentWindow = nullptr;
|
||||||
bool alwaysPassFocusToParent;
|
bool alwaysPassFocusToParent = false;
|
||||||
List<INativeWindowListener*> listeners;
|
List<INativeWindowListener*> listeners;
|
||||||
vint mouseLastX;
|
vint mouseLastX = -1;
|
||||||
vint mouseLastY;
|
vint mouseLastY = -1;
|
||||||
vint mouseHoving;
|
bool mouseHoving = false;
|
||||||
Interface* graphicsHandler;
|
Interface* graphicsHandler = nullptr;
|
||||||
bool customFrameMode;
|
bool customFrameMode = false;
|
||||||
List<Ptr<INativeMessageHandler>> messageHandlers;
|
List<Ptr<INativeMessageHandler>> messageHandlers;
|
||||||
bool supressingAlt;
|
bool supressingAlt = false;
|
||||||
|
Ptr<bool> flagDisposed = new bool(false);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
WindowsForm(HWND parent, WString className, HINSTANCE hInstance)
|
WindowsForm(HWND parent, WString className, HINSTANCE hInstance)
|
||||||
:cursor(0)
|
|
||||||
,parentWindow(0)
|
|
||||||
,alwaysPassFocusToParent(false)
|
|
||||||
,mouseLastX(-1)
|
|
||||||
,mouseLastY(-1)
|
|
||||||
,mouseHoving(false)
|
|
||||||
,graphicsHandler(0)
|
|
||||||
,customFrameMode(false)
|
|
||||||
,supressingAlt(false)
|
|
||||||
{
|
{
|
||||||
DWORD exStyle = WS_EX_APPWINDOW | WS_EX_CONTROLPARENT;
|
DWORD exStyle = WS_EX_APPWINDOW | WS_EX_CONTROLPARENT;
|
||||||
DWORD style = WS_BORDER | WS_CAPTION | WS_SIZEBOX | WS_SYSMENU | WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_MAXIMIZEBOX | WS_MINIMIZEBOX;
|
DWORD style = WS_BORDER | WS_CAPTION | WS_SIZEBOX | WS_SYSMENU | WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_MAXIMIZEBOX | WS_MINIMIZEBOX;
|
||||||
@@ -13333,6 +13325,7 @@ WindowsForm
|
|||||||
|
|
||||||
~WindowsForm()
|
~WindowsForm()
|
||||||
{
|
{
|
||||||
|
*flagDisposed.Obj() = true;
|
||||||
List<INativeWindowListener*> copiedListeners;
|
List<INativeWindowListener*> copiedListeners;
|
||||||
CopyFrom(copiedListeners, listeners);
|
CopyFrom(copiedListeners, listeners);
|
||||||
for (vint i = 0; i < copiedListeners.Count(); i++)
|
for (vint i = 0; i < copiedListeners.Count(); i++)
|
||||||
@@ -13356,11 +13349,14 @@ WindowsForm
|
|||||||
|
|
||||||
bool HandleMessage(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& result)
|
bool HandleMessage(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& result)
|
||||||
{
|
{
|
||||||
|
#define CHECK_DISPOSED if (*flag.Obj()) return skip
|
||||||
|
auto flag = flagDisposed;
|
||||||
bool skip = false;
|
bool skip = false;
|
||||||
{
|
{
|
||||||
FOREACH(Ptr<INativeMessageHandler>, handler, messageHandlers)
|
FOREACH(Ptr<INativeMessageHandler>, handler, messageHandlers)
|
||||||
{
|
{
|
||||||
handler->BeforeHandle(hwnd, uMsg, wParam, lParam, skip);
|
handler->BeforeHandle(hwnd, uMsg, wParam, lParam, skip);
|
||||||
|
CHECK_DISPOSED;
|
||||||
}
|
}
|
||||||
if (skip)
|
if (skip)
|
||||||
{
|
{
|
||||||
@@ -13368,14 +13364,17 @@ WindowsForm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
skip = HandleMessageInternal(hwnd, uMsg, wParam, lParam, result);
|
skip = HandleMessageInternal(hwnd, uMsg, wParam, lParam, result);
|
||||||
|
CHECK_DISPOSED;
|
||||||
if (GetWindowsFormFromHandle(hwnd))
|
if (GetWindowsFormFromHandle(hwnd))
|
||||||
{
|
{
|
||||||
FOREACH(Ptr<INativeMessageHandler>, handler, messageHandlers)
|
FOREACH(Ptr<INativeMessageHandler>, handler, messageHandlers)
|
||||||
{
|
{
|
||||||
handler->AfterHandle(hwnd, uMsg, wParam, lParam, skip, result);
|
handler->AfterHandle(hwnd, uMsg, wParam, lParam, skip, result);
|
||||||
|
CHECK_DISPOSED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return skip;
|
return skip;
|
||||||
|
#undef CHECK_DISPOSED
|
||||||
}
|
}
|
||||||
|
|
||||||
HWND GetWindowHandle()override
|
HWND GetWindowHandle()override
|
||||||
@@ -13824,6 +13823,7 @@ WindowsController
|
|||||||
Dictionary<HWND, WindowsForm*> windows;
|
Dictionary<HWND, WindowsForm*> windows;
|
||||||
INativeWindow* mainWindow;
|
INativeWindow* mainWindow;
|
||||||
HWND mainWindowHandle;
|
HWND mainWindowHandle;
|
||||||
|
vint handleMessageLevelCounter = 0;
|
||||||
|
|
||||||
WindowsCallbackService callbackService;
|
WindowsCallbackService callbackService;
|
||||||
WindowsResourceService resourceService;
|
WindowsResourceService resourceService;
|
||||||
@@ -13868,6 +13868,8 @@ WindowsController
|
|||||||
bool HandleMessage(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& result)
|
bool HandleMessage(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& result)
|
||||||
{
|
{
|
||||||
bool skipDefaultProcedure=false;
|
bool skipDefaultProcedure=false;
|
||||||
|
handleMessageLevelCounter++;
|
||||||
|
{
|
||||||
vint index = windows.Keys().IndexOf(hwnd);
|
vint index = windows.Keys().IndexOf(hwnd);
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
@@ -13890,7 +13892,8 @@ WindowsController
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
if (hwnd == mainWindowHandle && uMsg == WM_DESTROY)
|
if (hwnd == mainWindowHandle && uMsg == WM_DESTROY)
|
||||||
{
|
{
|
||||||
for (vint i = 0; i < windows.Count(); i++)
|
for (vint i = 0; i < windows.Count(); i++)
|
||||||
@@ -13906,13 +13909,18 @@ WindowsController
|
|||||||
}
|
}
|
||||||
PostQuitMessage(0);
|
PostQuitMessage(0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
handleMessageLevelCounter--;
|
||||||
|
if (handleMessageLevelCounter == 0)
|
||||||
|
{
|
||||||
asyncService.ExecuteAsyncTasks();
|
asyncService.ExecuteAsyncTasks();
|
||||||
|
}
|
||||||
return skipDefaultProcedure;
|
return skipDefaultProcedure;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
INativeWindow* CreateNativeWindow()
|
INativeWindow* CreateNativeWindow()override
|
||||||
{
|
{
|
||||||
WindowsForm* window=new WindowsForm(godWindow, windowClass.GetName(), hInstance);
|
WindowsForm* window=new WindowsForm(godWindow, windowClass.GetName(), hInstance);
|
||||||
windows.Add(window->GetWindowHandle(), window);
|
windows.Add(window->GetWindowHandle(), window);
|
||||||
@@ -13921,7 +13929,7 @@ WindowsController
|
|||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DestroyNativeWindow(INativeWindow* window)
|
void DestroyNativeWindow(INativeWindow* window)override
|
||||||
{
|
{
|
||||||
WindowsForm* windowsForm=dynamic_cast<WindowsForm*>(window);
|
WindowsForm* windowsForm=dynamic_cast<WindowsForm*>(window);
|
||||||
windowsForm->InvokeDestroying();
|
windowsForm->InvokeDestroying();
|
||||||
@@ -13933,12 +13941,12 @@ WindowsController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
INativeWindow* GetMainWindow()
|
INativeWindow* GetMainWindow()override
|
||||||
{
|
{
|
||||||
return mainWindow;
|
return mainWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Run(INativeWindow* window)
|
void Run(INativeWindow* window)override
|
||||||
{
|
{
|
||||||
mainWindow=window;
|
mainWindow=window;
|
||||||
mainWindowHandle=GetWindowsForm(window)->GetWindowHandle();
|
mainWindowHandle=GetWindowsForm(window)->GetWindowHandle();
|
||||||
@@ -13952,7 +13960,7 @@ WindowsController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
INativeWindow* GetWindow(Point location)
|
INativeWindow* GetWindow(Point location)override
|
||||||
{
|
{
|
||||||
POINT p;
|
POINT p;
|
||||||
p.x=(int)location.x;
|
p.x=(int)location.x;
|
||||||
|
|||||||
@@ -305,7 +305,7 @@
|
|||||||
<![CDATA[
|
<![CDATA[
|
||||||
prop FolderName : string = "" {}
|
prop FolderName : string = "" {}
|
||||||
|
|
||||||
var Ready : bool = true;
|
var Ready : bool = false;
|
||||||
]]>
|
]]>
|
||||||
</ref.Members>
|
</ref.Members>
|
||||||
<Window ref.Name="self" Text="New Folder" ClientSize="x:240 y:120" MaximizedBox="false" MinimizedBox="false" SizeBox="false">
|
<Window ref.Name="self" Text="New Folder" ClientSize="x:240 y:120" MaximizedBox="false" MinimizedBox="false" SizeBox="false">
|
||||||
|
|||||||
Reference in New Issue
Block a user