mirror of
https://github.com/vczh-libraries/Release.git
synced 2026-05-28 02:35:32 +08:00
Remove INativeWindow::SetWindowMode, put it in INativeController::CreateNativeWindow
This commit is contained in:
+11
-8
@@ -3785,8 +3785,9 @@ GuiControlHost
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GuiControlHost::GuiControlHost(theme::ThemeName themeName)
|
GuiControlHost::GuiControlHost(theme::ThemeName themeName, INativeWindow::WindowMode mode)
|
||||||
:GuiControl(themeName)
|
:GuiControl(themeName)
|
||||||
|
, windowMode(mode)
|
||||||
{
|
{
|
||||||
boundsComposition->SetAlignmentToParent(Margin(0, 0, 0, 0));
|
boundsComposition->SetAlignmentToParent(Margin(0, 0, 0, 0));
|
||||||
|
|
||||||
@@ -3845,6 +3846,13 @@ GuiControlHost
|
|||||||
{
|
{
|
||||||
host->GetNativeWindow()->UninstallListener(this);
|
host->GetNativeWindow()->UninstallListener(this);
|
||||||
}
|
}
|
||||||
|
if (window)
|
||||||
|
{
|
||||||
|
if (windowMode != window->GetWindowMode())
|
||||||
|
{
|
||||||
|
CHECK_FAIL(L"GuiControlHost::SetNativeWindow(INativeWindow*)#Window mode does not match.");
|
||||||
|
}
|
||||||
|
}
|
||||||
host->SetNativeWindow(window);
|
host->SetNativeWindow(window);
|
||||||
if(host->GetNativeWindow())
|
if(host->GetNativeWindow())
|
||||||
{
|
{
|
||||||
@@ -4283,10 +4291,6 @@ GuiWindow
|
|||||||
void GuiWindow::OnNativeWindowChanged()
|
void GuiWindow::OnNativeWindowChanged()
|
||||||
{
|
{
|
||||||
SyncNativeWindowProperties();
|
SyncNativeWindowProperties();
|
||||||
if (auto window = GetNativeWindow())
|
|
||||||
{
|
|
||||||
window->SetWindowMode(windowMode);
|
|
||||||
}
|
|
||||||
GuiControlHost::OnNativeWindowChanged();
|
GuiControlHost::OnNativeWindowChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4312,13 +4316,12 @@ GuiWindow
|
|||||||
}
|
}
|
||||||
|
|
||||||
GuiWindow::GuiWindow(theme::ThemeName themeName, INativeWindow::WindowMode mode)
|
GuiWindow::GuiWindow(theme::ThemeName themeName, INativeWindow::WindowMode mode)
|
||||||
:GuiControlHost(themeName)
|
:GuiControlHost(themeName, mode)
|
||||||
, windowMode(mode)
|
|
||||||
{
|
{
|
||||||
SetAltComposition(boundsComposition);
|
SetAltComposition(boundsComposition);
|
||||||
SetAltControl(this, true);
|
SetAltControl(this, true);
|
||||||
|
|
||||||
INativeWindow* window = GetCurrentController()->WindowService()->CreateNativeWindow();
|
INativeWindow* window = GetCurrentController()->WindowService()->CreateNativeWindow(windowMode);
|
||||||
SetNativeWindow(window);
|
SetNativeWindow(window);
|
||||||
GetApplication()->RegisterWindow(this);
|
GetApplication()->RegisterWindow(this);
|
||||||
ClipboardUpdated.SetAssociatedComposition(boundsComposition);
|
ClipboardUpdated.SetAssociatedComposition(boundsComposition);
|
||||||
|
|||||||
+5
-8
@@ -2035,11 +2035,6 @@ Native Window
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>The window mode.</summary>
|
/// <returns>The window mode.</summary>
|
||||||
virtual WindowMode GetWindowMode() = 0;
|
virtual WindowMode GetWindowMode() = 0;
|
||||||
/// <summary>
|
|
||||||
/// Set the window mode
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="mode">The window mode.</param>
|
|
||||||
virtual void SetWindowMode(WindowMode mode) = 0;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enable the window customized frame mode.
|
/// Enable the window customized frame mode.
|
||||||
@@ -2791,7 +2786,8 @@ Native Window Services
|
|||||||
/// Create a window.
|
/// Create a window.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>The created window.</returns>
|
/// <returns>The created window.</returns>
|
||||||
virtual INativeWindow* CreateNativeWindow() = 0;
|
/// <param name="windowMode">The window mode.</param>
|
||||||
|
virtual INativeWindow* CreateNativeWindow(INativeWindow::WindowMode windowMode) = 0;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Destroy a window.
|
/// Destroy a window.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -11207,6 +11203,7 @@ Control Host
|
|||||||
friend class compositions::GuiGraphicsHost;
|
friend class compositions::GuiGraphicsHost;
|
||||||
protected:
|
protected:
|
||||||
compositions::GuiGraphicsHost* host;
|
compositions::GuiGraphicsHost* host;
|
||||||
|
INativeWindow::WindowMode windowMode = INativeWindow::Normal;
|
||||||
|
|
||||||
virtual void OnNativeWindowChanged();
|
virtual void OnNativeWindowChanged();
|
||||||
virtual void OnVisualStatusChanged();
|
virtual void OnVisualStatusChanged();
|
||||||
@@ -11243,7 +11240,8 @@ Control Host
|
|||||||
public:
|
public:
|
||||||
/// <summary>Create a control with a specified default theme.</summary>
|
/// <summary>Create a control with a specified default theme.</summary>
|
||||||
/// <param name="themeName">The theme name for retriving a default control template.</param>
|
/// <param name="themeName">The theme name for retriving a default control template.</param>
|
||||||
GuiControlHost(theme::ThemeName themeName);
|
/// <param name="mode">The window mode.</param>
|
||||||
|
GuiControlHost(theme::ThemeName themeName, INativeWindow::WindowMode mode);
|
||||||
~GuiControlHost();
|
~GuiControlHost();
|
||||||
|
|
||||||
/// <summary>Window got focus event.</summary>
|
/// <summary>Window got focus event.</summary>
|
||||||
@@ -11404,7 +11402,6 @@ Window
|
|||||||
GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(WindowTemplate, GuiControlHost)
|
GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(WindowTemplate, GuiControlHost)
|
||||||
friend class GuiApplication;
|
friend class GuiApplication;
|
||||||
protected:
|
protected:
|
||||||
INativeWindow::WindowMode windowMode = INativeWindow::Normal;
|
|
||||||
compositions::IGuiAltActionHost* previousAltHost = nullptr;
|
compositions::IGuiAltActionHost* previousAltHost = nullptr;
|
||||||
bool hasMaximizedBox = true;
|
bool hasMaximizedBox = true;
|
||||||
bool hasMinimizedBox = true;
|
bool hasMinimizedBox = true;
|
||||||
|
|||||||
@@ -373,7 +373,7 @@ Type Declaration
|
|||||||
CLASS_MEMBER_PROPERTY_FAST(WindowCursor)
|
CLASS_MEMBER_PROPERTY_FAST(WindowCursor)
|
||||||
CLASS_MEMBER_PROPERTY_FAST(CaretPoint)
|
CLASS_MEMBER_PROPERTY_FAST(CaretPoint)
|
||||||
CLASS_MEMBER_PROPERTY_FAST(Parent)
|
CLASS_MEMBER_PROPERTY_FAST(Parent)
|
||||||
CLASS_MEMBER_PROPERTY_FAST(WindowMode)
|
CLASS_MEMBER_PROPERTY_READONLY_FAST(WindowMode)
|
||||||
CLASS_MEMBER_PROPERTY_READONLY_FAST(CustomFramePadding)
|
CLASS_MEMBER_PROPERTY_READONLY_FAST(CustomFramePadding)
|
||||||
CLASS_MEMBER_PROPERTY_FAST(Icon)
|
CLASS_MEMBER_PROPERTY_FAST(Icon)
|
||||||
CLASS_MEMBER_PROPERTY_READONLY_FAST(SizeState)
|
CLASS_MEMBER_PROPERTY_READONLY_FAST(SizeState)
|
||||||
@@ -2252,7 +2252,7 @@ Type Declaration (Class)
|
|||||||
BEGIN_CLASS_MEMBER(GuiControlHost)
|
BEGIN_CLASS_MEMBER(GuiControlHost)
|
||||||
CLASS_MEMBER_BASE(GuiControl)
|
CLASS_MEMBER_BASE(GuiControl)
|
||||||
CLASS_MEMBER_BASE(GuiInstanceRootObject)
|
CLASS_MEMBER_BASE(GuiInstanceRootObject)
|
||||||
CONTROL_CONSTRUCTOR_CONTROLT_TEMPLATE_INHERITANCE(GuiControlHost)
|
CONTROL_CONSTRUCTOR_CONTROLT_TEMPLATE_INHERITANCE_2(GuiControlHost, INativeWindow::WindowMode, mode)
|
||||||
|
|
||||||
CLASS_MEMBER_GUIEVENT(WindowGotFocus)
|
CLASS_MEMBER_GUIEVENT(WindowGotFocus)
|
||||||
CLASS_MEMBER_GUIEVENT(WindowLostFocus)
|
CLASS_MEMBER_GUIEVENT(WindowLostFocus)
|
||||||
|
|||||||
+19
-25
@@ -8897,7 +8897,7 @@ WindowsForm
|
|||||||
NativePoint caretPoint;
|
NativePoint caretPoint;
|
||||||
WindowsForm* parentWindow = nullptr;
|
WindowsForm* parentWindow = nullptr;
|
||||||
List<WindowsForm*> childWindows;
|
List<WindowsForm*> childWindows;
|
||||||
WindowMode windowMode = Normal;
|
WindowMode windowMode;
|
||||||
List<INativeWindowListener*> listeners;
|
List<INativeWindowListener*> listeners;
|
||||||
vint mouseLastX = -1;
|
vint mouseLastX = -1;
|
||||||
vint mouseLastY = -1;
|
vint mouseLastY = -1;
|
||||||
@@ -8925,12 +8925,23 @@ WindowsForm
|
|||||||
customFramePadding = NativeMargin(padding, padding, padding, padding);
|
customFramePadding = NativeMargin(padding, padding, padding, padding);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
WindowsForm(HWND parent, WString className, HINSTANCE hInstance)
|
WindowsForm(HWND parent, WString className, HINSTANCE hInstance, INativeWindow::WindowMode _windowMode)
|
||||||
|
:windowMode(_windowMode)
|
||||||
{
|
{
|
||||||
// use WS_POPUP in CreateWindowEx, because CW_USERDEFAULT is interpreted as 0, unlike WS_OVERLAPPED
|
{
|
||||||
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;
|
||||||
handle = CreateWindowEx(exStyle, className.Buffer(), L"", style, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, parent, NULL, hInstance, NULL);
|
handle = CreateWindowEx(exStyle, className.Buffer(), L"", style, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, parent, NULL, hInstance, NULL);
|
||||||
|
}
|
||||||
|
if (windowMode == INativeWindow::Normal)
|
||||||
|
{
|
||||||
|
// use WS_POPUP in CreateWindowEx, because CW_USERDEFAULT is interpreted as 0, unlike WS_OVERLAPPED
|
||||||
|
// if this is not a popup window, replace WS_POPUP with WS_OVERLAPPED
|
||||||
|
auto style = InternalGetStyle();
|
||||||
|
style = TurnOnStyle(style, WS_OVERLAPPED);
|
||||||
|
style = TurnOffStyle(style, WS_POPUP);
|
||||||
|
InternalSetStyle(style);
|
||||||
|
}
|
||||||
UpdateDpiAwaredFields(true);
|
UpdateDpiAwaredFields(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9196,23 +9207,6 @@ WindowsForm
|
|||||||
return windowMode;
|
return windowMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetWindowMode(WindowMode mode)override
|
|
||||||
{
|
|
||||||
windowMode = mode;
|
|
||||||
auto style = InternalGetStyle();
|
|
||||||
if (mode == Normal)
|
|
||||||
{
|
|
||||||
style = TurnOnStyle(style, WS_OVERLAPPED);
|
|
||||||
style = TurnOffStyle(style, WS_POPUP);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
style = TurnOffStyle(style, WS_OVERLAPPED);
|
|
||||||
style = TurnOnStyle(style, WS_POPUP);
|
|
||||||
}
|
|
||||||
InternalSetStyle(style);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EnableCustomFrameMode()override
|
void EnableCustomFrameMode()override
|
||||||
{
|
{
|
||||||
customFrameMode=true;
|
customFrameMode=true;
|
||||||
@@ -9800,9 +9794,9 @@ WindowsController
|
|||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
INativeWindow* CreateNativeWindow()override
|
INativeWindow* CreateNativeWindow(INativeWindow::WindowMode windowMode)override
|
||||||
{
|
{
|
||||||
WindowsForm* window=new WindowsForm(godWindow, windowClass.GetName(), hInstance);
|
WindowsForm* window=new WindowsForm(godWindow, windowClass.GetName(), hInstance, windowMode);
|
||||||
windows.Add(window->GetWindowHandle(), window);
|
windows.Add(window->GetWindowHandle(), window);
|
||||||
callbackService.InvokeNativeWindowCreated(window);
|
callbackService.InvokeNativeWindowCreated(window);
|
||||||
window->SetWindowCursor(resourceService.GetDefaultSystemCursor());
|
window->SetWindowCursor(resourceService.GetDefaultSystemCursor());
|
||||||
|
|||||||
Reference in New Issue
Block a user