Update release

This commit is contained in:
Zihan Chen
2021-06-01 16:28:35 -07:00
parent 78cdc5c446
commit 4d52771e73
13 changed files with 367 additions and 468 deletions
+76 -152
View File
@@ -199,24 +199,6 @@ GuiApplication
} }
} }
void GuiApplication::LeftButtonDown(NativePoint position)
{
OnMouseDown(position);
}
void GuiApplication::LeftButtonUp(NativePoint position)
{
}
void GuiApplication::RightButtonDown(NativePoint position)
{
OnMouseDown(position);
}
void GuiApplication::RightButtonUp(NativePoint position)
{
}
void GuiApplication::ClipboardUpdated() void GuiApplication::ClipboardUpdated()
{ {
for(vint i=0;i<windows.Count();i++) for(vint i=0;i<windows.Count();i++)
@@ -264,10 +246,6 @@ GuiApplication
if(index==-1) if(index==-1)
{ {
openingPopups.Add(popup); openingPopups.Add(popup);
if(openingPopups.Count()==1)
{
GetCurrentController()->InputService()->StartHookMouse();
}
} }
} }
@@ -275,22 +253,6 @@ GuiApplication
{ {
if(openingPopups.Remove(popup)) if(openingPopups.Remove(popup))
{ {
if(openingPopups.Count()==0)
{
GetCurrentController()->InputService()->StopHookMouse();
}
}
}
void GuiApplication::OnMouseDown(NativePoint location)
{
GuiWindow* window=GetWindow(location);
for(vint i=0;i<windows.Count();i++)
{
if(windows[i]!=window)
{
windows[i]->MouseClickedOnOtherWindow(window);
}
} }
} }
@@ -4291,6 +4253,10 @@ GuiWindow
void GuiWindow::OnNativeWindowChanged() void GuiWindow::OnNativeWindowChanged()
{ {
SyncNativeWindowProperties(); SyncNativeWindowProperties();
if (auto window = GetNativeWindow())
{
window->SetWindowMode(windowMode);
}
GuiControlHost::OnNativeWindowChanged(); GuiControlHost::OnNativeWindowChanged();
} }
@@ -4299,10 +4265,6 @@ GuiWindow
GuiControlHost::OnVisualStatusChanged(); GuiControlHost::OnVisualStatusChanged();
} }
void GuiWindow::MouseClickedOnOtherWindow(GuiWindow* window)
{
}
void GuiWindow::OnWindowActivated(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments) void GuiWindow::OnWindowActivated(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments)
{ {
if (auto ct = GetControlTemplateObject(false)) if (auto ct = GetControlTemplateObject(false))
@@ -4319,8 +4281,9 @@ GuiWindow
} }
} }
GuiWindow::GuiWindow(theme::ThemeName themeName) GuiWindow::GuiWindow(theme::ThemeName themeName, INativeWindow::WindowMode mode)
:GuiControlHost(themeName) :GuiControlHost(themeName)
, windowMode(mode)
{ {
SetAltComposition(boundsComposition); SetAltComposition(boundsComposition);
SetAltControl(this, true); SetAltControl(this, true);
@@ -4334,6 +4297,11 @@ GuiWindow
WindowDeactivated.AttachMethod(this, &GuiWindow::OnWindowDeactivated); WindowDeactivated.AttachMethod(this, &GuiWindow::OnWindowDeactivated);
} }
GuiWindow::GuiWindow(theme::ThemeName themeName)
:GuiWindow(themeName, INativeWindow::Normal)
{
}
GuiWindow::~GuiWindow() GuiWindow::~GuiWindow()
{ {
FinalizeAggregation(); FinalizeAggregation();
@@ -4503,11 +4471,6 @@ GuiPopup
} }
} }
void GuiPopup::MouseClickedOnOtherWindow(GuiWindow* window)
{
Hide();
}
void GuiPopup::PopupOpened(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments) void GuiPopup::PopupOpened(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments)
{ {
GetApplication()->RegisterPopupOpened(this); GetApplication()->RegisterPopupOpened(this);
@@ -4649,17 +4612,18 @@ GuiPopup
if (controlWindow) if (controlWindow)
{ {
window->SetParent(controlWindow); window->SetParent(controlWindow);
window->SetTopMost(controlWindow->GetTopMost()); SetTopMost(controlWindow->GetTopMost());
} }
else else
{ {
window->SetTopMost(true); SetTopMost(true);
} }
SetEnabledActivate(false);
ShowDeactivated(); ShowDeactivated();
} }
GuiPopup::GuiPopup(theme::ThemeName themeName) GuiPopup::GuiPopup(theme::ThemeName themeName, INativeWindow::WindowMode mode)
:GuiWindow(themeName) :GuiWindow(themeName, mode)
{ {
SetMinimizedBox(false); SetMinimizedBox(false);
SetMaximizedBox(false); SetMaximizedBox(false);
@@ -4672,6 +4636,11 @@ GuiPopup
boundsComposition->GetEventReceiver()->keyDown.AttachMethod(this, &GuiPopup::OnKeyDown); boundsComposition->GetEventReceiver()->keyDown.AttachMethod(this, &GuiPopup::OnKeyDown);
} }
GuiPopup::GuiPopup(theme::ThemeName themeName)
:GuiPopup(themeName, INativeWindow::Popup)
{
}
GuiPopup::~GuiPopup() GuiPopup::~GuiPopup()
{ {
GetApplication()->RegisterPopupClosed(this); GetApplication()->RegisterPopupClosed(this);
@@ -4768,8 +4737,7 @@ GuiPopup
} }
GuiTooltip::GuiTooltip(theme::ThemeName themeName) GuiTooltip::GuiTooltip(theme::ThemeName themeName)
:GuiPopup(themeName) : GuiPopup(themeName, INativeWindow::Tooltip)
,temporaryContentControl(0)
{ {
containerComposition->SetMinSizeLimitation(GuiGraphicsComposition::LimitToElementAndChildren); containerComposition->SetMinSizeLimitation(GuiGraphicsComposition::LimitToElementAndChildren);
containerComposition->SetPreferredMinSize(Size(20, 10)); containerComposition->SetPreferredMinSize(Size(20, 10));
@@ -6812,7 +6780,10 @@ GuiComboBoxListControl
void GuiComboBoxListControl::AfterControlTemplateInstalled(bool initialize) void GuiComboBoxListControl::AfterControlTemplateInstalled(bool initialize)
{ {
GuiComboBoxBase::AfterControlTemplateInstalled(initialize); GuiComboBoxBase::AfterControlTemplateInstalled(initialize);
GetControlTemplateObject(true)->SetTextVisible(!itemStyleProperty); if (auto ct = GetControlTemplateObject(true))
{
ct->SetTextVisible(!itemStyleProperty);
}
} }
void GuiComboBoxListControl::RemoveStyleController() void GuiComboBoxListControl::RemoveStyleController()
@@ -6871,16 +6842,19 @@ GuiComboBoxListControl
void GuiComboBoxListControl::AdoptSubMenuSize() void GuiComboBoxListControl::AdoptSubMenuSize()
{ {
Size expectedSize(0, GetDisplayFont().size * 20); if (auto subMenu = GetSubMenu())
Size adoptedSize = containedListControl->GetAdoptedSize(expectedSize);
Size clientSize = GetPreferredMenuClientSize();
clientSize.y = adoptedSize.y + GetSubMenu()->GetClientSize().y - containedListControl->GetBoundsComposition()->GetBounds().Height();
SetPreferredMenuClientSize(clientSize);
if (GetSubMenuOpening())
{ {
GetSubMenu()->SetClientSize(clientSize); Size expectedSize(0, GetDisplayFont().size * 20);
Size adoptedSize = containedListControl->GetAdoptedSize(expectedSize);
Size clientSize = GetPreferredMenuClientSize();
clientSize.y = adoptedSize.y + subMenu->GetClientSize().y - containedListControl->GetBoundsComposition()->GetBounds().Height();
SetPreferredMenuClientSize(clientSize);
if (GetSubMenuOpening())
{
subMenu->SetClientSize(clientSize);
}
} }
} }
@@ -6912,8 +6886,6 @@ GuiComboBoxListControl
void GuiComboBoxListControl::OnAfterSubMenuOpening(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments) void GuiComboBoxListControl::OnAfterSubMenuOpening(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments)
{ {
containedListControl->SelectItemsByClick(selectedIndex, false, false, true); containedListControl->SelectItemsByClick(selectedIndex, false, false, true);
GetSubMenu()->GetNativeWindow()->SetFocus();
containedListControl->SetFocus();
} }
void GuiComboBoxListControl::OnListControlAdoptedSizeInvalidated(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments) void GuiComboBoxListControl::OnListControlAdoptedSizeInvalidated(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments)
@@ -6939,7 +6911,7 @@ GuiComboBoxListControl
GetSubMenu()->Hide(); GetSubMenu()->Hide();
} }
void GuiComboBoxListControl::OnListControlKeyDown(compositions::GuiGraphicsComposition* sender, compositions::GuiKeyEventArgs& arguments) void GuiComboBoxListControl::OnKeyDown(compositions::GuiGraphicsComposition* sender, compositions::GuiKeyEventArgs& arguments)
{ {
if (!arguments.autoRepeatKeyDown) if (!arguments.autoRepeatKeyDown)
{ {
@@ -6952,7 +6924,8 @@ GuiComboBoxListControl
GetSubMenu()->Hide(); GetSubMenu()->Hide();
arguments.handled = true; arguments.handled = true;
break; break;
default:; default:
containedListControl->SelectItemsByKey(arguments.code, arguments.ctrl, arguments.shift);
} }
} }
} }
@@ -6990,8 +6963,8 @@ GuiComboBoxListControl
containedListControl->AdoptedSizeInvalidated.AttachMethod(this, &GuiComboBoxListControl::OnListControlAdoptedSizeInvalidated); containedListControl->AdoptedSizeInvalidated.AttachMethod(this, &GuiComboBoxListControl::OnListControlAdoptedSizeInvalidated);
containedListControl->ItemLeftButtonDown.AttachMethod(this, &GuiComboBoxListControl::OnListControlItemMouseDown); containedListControl->ItemLeftButtonDown.AttachMethod(this, &GuiComboBoxListControl::OnListControlItemMouseDown);
containedListControl->ItemRightButtonDown.AttachMethod(this, &GuiComboBoxListControl::OnListControlItemMouseDown); containedListControl->ItemRightButtonDown.AttachMethod(this, &GuiComboBoxListControl::OnListControlItemMouseDown);
containedListControl->GetFocusableComposition()->GetEventReceiver()->keyDown.AttachMethod(this, &GuiComboBoxListControl::OnListControlKeyDown);
boundsChangedHandler = containedListControl->GetBoundsComposition()->BoundsChanged.AttachMethod(this, &GuiComboBoxListControl::OnListControlBoundsChanged); boundsChangedHandler = containedListControl->GetBoundsComposition()->BoundsChanged.AttachMethod(this, &GuiComboBoxListControl::OnListControlBoundsChanged);
boundsComposition->GetEventReceiver()->keyDown.AttachMethod(this, &GuiComboBoxListControl::OnKeyDown);
auto itemProvider = containedListControl->GetItemProvider(); auto itemProvider = containedListControl->GetItemProvider();
@@ -17472,19 +17445,26 @@ GuiSinglelineTextBox::DefaultTextElementOperatorCallback
bool GuiSinglelineTextBox::TextElementOperatorCallback::BeforeModify(TextPos start, TextPos end, const WString& originalText, WString& inputText) bool GuiSinglelineTextBox::TextElementOperatorCallback::BeforeModify(TextPos start, TextPos end, const WString& originalText, WString& inputText)
{ {
vint length=inputText.Length(); vint length = inputText.Length();
const wchar_t* input=inputText.Buffer(); const wchar_t* input = inputText.Buffer();
for(vint i=0;i<length;i++) for (vint i = 0; i < length; i++)
{ {
if(*input==0 || *input==L'\r' || *input==L'\n') if (*input == 0 || *input == L'\r' || *input == L'\n')
{ {
length=i; length = i;
break; break;
} }
} }
if(length!=inputText.Length()) if (length != inputText.Length())
{ {
inputText=inputText.Left(length); if (length == 0)
{
// if the first line is empty after adjustment
// the input should just be canceled
// to prevent from making noise in undo
return false;
}
inputText = inputText.Left(length);
} }
return true; return true;
} }
@@ -20540,15 +20520,6 @@ GuiMenu
GuiPopup::OnDeactivatedAltHost(); GuiPopup::OnDeactivatedAltHost();
} }
void GuiMenu::MouseClickedOnOtherWindow(GuiWindow* window)
{
GuiMenu* targetMenu=dynamic_cast<GuiMenu*>(window);
if(!targetMenu)
{
Hide();
}
}
void GuiMenu::OnWindowClosed(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments) void GuiMenu::OnWindowClosed(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments)
{ {
if(parentMenuService) if(parentMenuService)
@@ -20563,11 +20534,9 @@ GuiMenu
} }
GuiMenu::GuiMenu(theme::ThemeName themeName, GuiControl* _owner) GuiMenu::GuiMenu(theme::ThemeName themeName, GuiControl* _owner)
:GuiPopup(themeName) :GuiPopup(themeName, INativeWindow::Menu)
, owner(_owner) , owner(_owner)
, parentMenuService(0)
{ {
GetNativeWindow()->SetAlwaysPassFocusToParent(true);
UpdateMenuService(); UpdateMenuService();
WindowOpened.AttachMethod(this, &GuiMenu::OnWindowOpened); WindowOpened.AttachMethod(this, &GuiMenu::OnWindowOpened);
WindowClosed.AttachMethod(this, &GuiMenu::OnWindowClosed); WindowClosed.AttachMethod(this, &GuiMenu::OnWindowClosed);
@@ -20784,6 +20753,9 @@ GuiMenuButton
{ {
subMenu->WindowOpened.Detach(subMenuWindowOpenedHandler); subMenu->WindowOpened.Detach(subMenuWindowOpenedHandler);
subMenu->WindowClosed.Detach(subMenuWindowClosedHandler); subMenu->WindowClosed.Detach(subMenuWindowClosedHandler);
subMenuWindowOpenedHandler = nullptr;
subMenuWindowClosedHandler = nullptr;
if (ownedSubMenu) if (ownedSubMenu)
{ {
delete subMenu; delete subMenu;
@@ -30564,42 +30536,29 @@ GuiGraphicsResourceManager
{ {
} }
bool GuiGraphicsResourceManager::RegisterElementFactory(IGuiGraphicsElementFactory* factory) vint GuiGraphicsResourceManager::RegisterElementType(const WString& elementTypeName)
{ {
if(elementFactories.Keys().Contains(factory->GetElementTypeName())) CHECK_ERROR(!elementTypes.Contains(elementTypeName), L"GuiGraphicsResourceManager::RegisterElementType(const WString&)#This element type has already been registered.");
return elementTypes.Add(elementTypeName);
}
void GuiGraphicsResourceManager::RegisterRendererFactory(vint elementType, Ptr<IGuiGraphicsRendererFactory> factory)
{
if (rendererFactories.Count() <= elementType)
{ {
return false; rendererFactories.Resize(elementType + 1);
rendererFactories[elementType] = factory;
} }
else else
{ {
elementFactories.Add(factory->GetElementTypeName(), factory); CHECK_ERROR(!rendererFactories[elementType], L"GuiGraphicsResourceManager::RegisterRendererFactory(vint, Ptr<IGuiGraphicsRendererFactory>)#This element type has already been binded a renderer factory.");
return true; rendererFactories[elementType] = factory;
} }
} }
bool GuiGraphicsResourceManager::RegisterRendererFactory(const WString& elementTypeName, IGuiGraphicsRendererFactory* factory) IGuiGraphicsRendererFactory* GuiGraphicsResourceManager::GetRendererFactory(vint elementType)
{ {
if(rendererFactories.Keys().Contains(elementTypeName)) return rendererFactories.Count() > elementType ? rendererFactories[elementType].Obj() : nullptr;
{
return false;
}
else
{
rendererFactories.Add(elementTypeName, factory);
return true;
}
}
IGuiGraphicsElementFactory* GuiGraphicsResourceManager::GetElementFactory(const WString& elementTypeName)
{
vint index=elementFactories.Keys().IndexOf(elementTypeName);
return index==-1?0:elementFactories.Values().Get(index).Obj();
}
IGuiGraphicsRendererFactory* GuiGraphicsResourceManager::GetRendererFactory(const WString& elementTypeName)
{
vint index=rendererFactories.Keys().IndexOf(elementTypeName);
return index==-1?nullptr:rendererFactories.Values().Get(index).Obj();
} }
GuiGraphicsResourceManager* guiGraphicsResourceManager=0; GuiGraphicsResourceManager* guiGraphicsResourceManager=0;
@@ -30613,21 +30572,6 @@ GuiGraphicsResourceManager
{ {
guiGraphicsResourceManager=resourceManager; guiGraphicsResourceManager=resourceManager;
} }
bool RegisterFactories(IGuiGraphicsElementFactory* elementFactory, IGuiGraphicsRendererFactory* rendererFactory)
{
if(guiGraphicsResourceManager && elementFactory && rendererFactory)
{
if(guiGraphicsResourceManager->RegisterElementFactory(elementFactory))
{
if(guiGraphicsResourceManager->RegisterRendererFactory(elementFactory->GetElementTypeName(), rendererFactory))
{
return true;
}
}
}
return false;
}
} }
} }
} }
@@ -32312,8 +32256,8 @@ namespace vl
using namespace theme; using namespace theme;
const wchar_t* const IGuiAltAction::Identifier = L"vl::presentation::compositions::IGuiAltAction"; const wchar_t* const IGuiAltAction::Identifier = L"vl::presentation::compositions::IGuiAltAction";
const wchar_t* const IGuiAltActionContainer::Identifier = L"vl::presentation::compositions::IGuiAltAction"; const wchar_t* const IGuiAltActionContainer::Identifier = L"vl::presentation::compositions::IGuiAltActionContainer";
const wchar_t* const IGuiAltActionHost::Identifier = L"vl::presentation::compositions::IGuiAltAction"; const wchar_t* const IGuiAltActionHost::Identifier = L"vl::presentation::compositions::IGuiAltActionHost";
/*********************************************************************** /***********************************************************************
IGuiAltAction IGuiAltAction
@@ -33171,26 +33115,6 @@ INativeWindowListener
INativeControllerListener INativeControllerListener
***********************************************************************/ ***********************************************************************/
void INativeControllerListener::LeftButtonDown(NativePoint position)
{
}
void INativeControllerListener::LeftButtonUp(NativePoint position)
{
}
void INativeControllerListener::RightButtonDown(NativePoint position)
{
}
void INativeControllerListener::RightButtonUp(NativePoint position)
{
}
void INativeControllerListener::MouseMoving(NativePoint position)
{
}
void INativeControllerListener::GlobalTimer() void INativeControllerListener::GlobalTimer()
{ {
} }
+116 -160
View File
File diff suppressed because it is too large Load Diff
-7
View File
@@ -8259,13 +8259,6 @@ GuiControlInstanceLoader
GuiPredefinedInstanceLoadersPlugin GuiPredefinedInstanceLoadersPlugin
***********************************************************************/ ***********************************************************************/
Ptr<WfExpression> CreateTrue(IGuiInstanceLoader::ArgumentMap&)
{
auto expr = MakePtr<WfLiteralExpression>();
expr->value = WfLiteralValue::True;
return expr;
}
void InitializeTrackerProgressBar(const WString& variableName, Ptr<WfBlockStatement> block) void InitializeTrackerProgressBar(const WString& variableName, Ptr<WfBlockStatement> block)
{ {
auto refVariable = MakePtr<WfReferenceExpression>(); auto refVariable = MakePtr<WfReferenceExpression>();
+13 -3
View File
@@ -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(AlwaysPassFocusToParent) CLASS_MEMBER_PROPERTY_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)
@@ -421,6 +421,14 @@ Type Declaration
ENUM_NAMESPACE_ITEM(Maximized) ENUM_NAMESPACE_ITEM(Maximized)
END_ENUM_ITEM(INativeWindow::WindowSizeState) END_ENUM_ITEM(INativeWindow::WindowSizeState)
BEGIN_ENUM_ITEM(INativeWindow::WindowMode)
ENUM_ITEM_NAMESPACE(INativeWindow)
ENUM_NAMESPACE_ITEM(Normal)
ENUM_NAMESPACE_ITEM(Tooltip)
ENUM_NAMESPACE_ITEM(Popup)
ENUM_NAMESPACE_ITEM(Menu)
END_ENUM_ITEM(INativeWindow::WindowMode)
BEGIN_INTERFACE_MEMBER_NOPROXY(INativeDelay) BEGIN_INTERFACE_MEMBER_NOPROXY(INativeDelay)
CLASS_MEMBER_PROPERTY_READONLY_FAST(Status) CLASS_MEMBER_PROPERTY_READONLY_FAST(Status)
@@ -1242,6 +1250,8 @@ Type Declaration (Class)
CLASS_MEMBER_PROPERTY_FAST(ColumnPadding) CLASS_MEMBER_PROPERTY_FAST(ColumnPadding)
CLASS_MEMBER_PROPERTY_FAST(Axis) CLASS_MEMBER_PROPERTY_FAST(Axis)
CLASS_MEMBER_PROPERTY_FAST(Alignment) CLASS_MEMBER_PROPERTY_FAST(Alignment)
CLASS_MEMBER_METHOD(InsertFlowItem, { L"index" _ L"item" })
END_CLASS_MEMBER(GuiFlowComposition) END_CLASS_MEMBER(GuiFlowComposition)
BEGIN_CLASS_MEMBER(GuiFlowItemComposition) BEGIN_CLASS_MEMBER(GuiFlowItemComposition)
@@ -1279,12 +1289,12 @@ Type Declaration (Class)
CLASS_MEMBER_PROPERTY_FAST(Group) CLASS_MEMBER_PROPERTY_FAST(Group)
CLASS_MEMBER_PROPERTY_FAST(SharedWidth) CLASS_MEMBER_PROPERTY_FAST(SharedWidth)
CLASS_MEMBER_PROPERTY_FAST(SharedHeight) CLASS_MEMBER_PROPERTY_FAST(SharedHeight)
END_CLASS_MEMBER(GuiSubComponentMeasurer) END_CLASS_MEMBER(GuiSharedSizeItemComposition)
BEGIN_CLASS_MEMBER(GuiSharedSizeRootComposition) BEGIN_CLASS_MEMBER(GuiSharedSizeRootComposition)
CLASS_MEMBER_BASE(GuiBoundsComposition) CLASS_MEMBER_BASE(GuiBoundsComposition)
CLASS_MEMBER_CONSTRUCTOR(GuiSharedSizeRootComposition*(), NO_PARAMETER) CLASS_MEMBER_CONSTRUCTOR(GuiSharedSizeRootComposition*(), NO_PARAMETER)
END_CLASS_MEMBER(GuiSubComponentMeasurerSource) END_CLASS_MEMBER(GuiSharedSizeRootComposition)
BEGIN_CLASS_MEMBER(GuiRepeatCompositionBase) BEGIN_CLASS_MEMBER(GuiRepeatCompositionBase)
CLASS_MEMBER_GUIEVENT(ItemInserted) CLASS_MEMBER_GUIEVENT(ItemInserted)
+1
View File
@@ -125,6 +125,7 @@ Type List (Basic)
F(presentation::INativeCursor::SystemCursorType)\ F(presentation::INativeCursor::SystemCursorType)\
F(presentation::INativeWindow)\ F(presentation::INativeWindow)\
F(presentation::INativeWindow::WindowSizeState)\ F(presentation::INativeWindow::WindowSizeState)\
F(presentation::INativeWindow::WindowMode)\
F(presentation::INativeDelay)\ F(presentation::INativeDelay)\
F(presentation::INativeDelay::ExecuteStatus)\ F(presentation::INativeDelay::ExecuteStatus)\
F(presentation::INativeScreen)\ F(presentation::INativeScreen)\
+160 -139
View File
@@ -8136,45 +8136,59 @@ WindowsForm
SetWindowPos(handle, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED); SetWindowPos(handle, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
} }
LONG_PTR InternalGetStyle()
{
return GetWindowLongPtr(handle, GWL_STYLE);
}
void InternalSetStyle(LONG_PTR style)
{
SetWindowLongPtr(handle, GWL_STYLE, style);
SetWindowPos(handle, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
}
LONG_PTR TurnOnStyle(LONG_PTR combination, LONG_PTR style)
{
return combination | style;
}
LONG_PTR TurnOffStyle(LONG_PTR combination, LONG_PTR style)
{
return combination & (~style);
}
bool GetExStyle(LONG_PTR exStyle) bool GetExStyle(LONG_PTR exStyle)
{ {
LONG_PTR Long=InternalGetExStyle(); return (InternalGetExStyle() & exStyle) != 0;
return (Long & exStyle) != 0;
} }
void SetExStyle(LONG_PTR exStyle, bool available) void SetExStyle(LONG_PTR exStyle, bool available)
{ {
LONG_PTR Long = InternalGetExStyle(); if (available)
if(available)
{ {
Long |= exStyle; InternalSetExStyle(TurnOnStyle(InternalGetExStyle(), exStyle));
} }
else else
{ {
Long &= ~exStyle; InternalSetExStyle(TurnOffStyle(InternalGetExStyle(), exStyle));
} }
InternalSetExStyle(Long);
} }
bool GetStyle(LONG_PTR style) bool GetStyle(LONG_PTR style)
{ {
LONG_PTR Long = GetWindowLongPtr(handle, GWL_STYLE); return (InternalGetStyle() & style) != 0;
return (Long & style) != 0;
} }
void SetStyle(LONG_PTR style, bool available) void SetStyle(LONG_PTR style, bool available)
{ {
LONG_PTR Long = GetWindowLongPtr(handle, GWL_STYLE); if (available)
if(available)
{ {
Long |= style; InternalSetStyle(TurnOnStyle(InternalGetStyle(), style));
} }
else else
{ {
Long &= ~style; InternalSetStyle(TurnOffStyle(InternalGetStyle(), style));
} }
SetWindowLongPtr(handle, GWL_STYLE, Long);
SetWindowPos(handle, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
} }
#pragma push_macro("_CONTROL") #pragma push_macro("_CONTROL")
#if defined _CONTROL #if defined _CONTROL
@@ -8297,6 +8311,48 @@ WindowsForm
bool transferFocusEvent = false; bool transferFocusEvent = false;
bool nonClient = false; bool nonClient = false;
// handling popup windows
{
bool closeChildPopups = false;
switch (uMsg)
{
case WM_ACTIVATE:
if (wParam == WA_INACTIVE && windowMode == Normal)
{
closeChildPopups = true;
}
break;
case WM_LBUTTONDOWN:
case WM_MBUTTONDOWN:
case WM_RBUTTONDOWN:
closeChildPopups = true;
break;
}
if (closeChildPopups)
{
List<WindowsForm*> childPopups;
childPopups.Add(this);
for (vint i = 0; i < childPopups.Count(); i++)
{
auto popup = childPopups[i];
for (vint j = 0; j < popup->childWindows.Count(); j++)
{
auto childPopup = popup->childWindows[j];
if (childPopup->windowMode != Normal)
{
childPopups.Add(childPopup);
}
}
if (popup != this && popup->IsVisible())
{
popup->Hide(false);
}
}
}
}
switch(uMsg) switch(uMsg)
{ {
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
@@ -8387,11 +8443,18 @@ WindowsForm
} }
} }
break; break;
case WM_MOUSEACTIVATE:
if (!IsEnabledActivate())
{
result = MA_NOACTIVATE;
return true;
}
break;
case WM_ACTIVATE: case WM_ACTIVATE:
{ {
for(vint i=0;i<listeners.Count();i++) for (vint i = 0; i < listeners.Count(); i++)
{ {
if(wParam==WA_ACTIVE || wParam==WA_CLICKACTIVE) if (wParam == WA_ACTIVE || wParam == WA_CLICKACTIVE)
{ {
listeners[i]->Activated(); listeners[i]->Activated();
} }
@@ -8792,22 +8855,7 @@ WindowsForm
break; break;
} }
if(IsWindow(hwnd)!=0) // handling custom frame
{
if(transferFocusEvent && IsFocused())
{
WindowsForm* window=this;
while(window->parentWindow && window->alwaysPassFocusToParent)
{
window=window->parentWindow;
}
if(window!=this)
{
window->SetFocus();
}
}
}
if (customFrameMode) if (customFrameMode)
{ {
switch (uMsg) switch (uMsg)
@@ -8859,7 +8907,8 @@ WindowsForm
WindowsCursor* cursor = nullptr; WindowsCursor* cursor = nullptr;
NativePoint caretPoint; NativePoint caretPoint;
WindowsForm* parentWindow = nullptr; WindowsForm* parentWindow = nullptr;
bool alwaysPassFocusToParent = false; List<WindowsForm*> childWindows;
WindowMode windowMode = Normal;
List<INativeWindowListener*> listeners; List<INativeWindowListener*> listeners;
vint mouseLastX = -1; vint mouseLastX = -1;
vint mouseLastY = -1; vint mouseLastY = -1;
@@ -8889,7 +8938,7 @@ WindowsForm
WindowsForm(HWND parent, WString className, HINSTANCE hInstance) WindowsForm(HWND parent, WString className, HINSTANCE hInstance)
{ {
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_OVERLAPPED | 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);
UpdateDpiAwaredFields(true); UpdateDpiAwaredFields(true);
@@ -8897,6 +8946,15 @@ WindowsForm
~WindowsForm() ~WindowsForm()
{ {
if (parentWindow)
{
parentWindow->childWindows.Remove(this);
}
for (vint i = childWindows.Count() - 1; i >= 0; i--)
{
childWindows[i]->SetParent(parentWindow);
}
*flagDisposed.Obj() = true; *flagDisposed.Obj() = true;
List<INativeWindowListener*> copiedListeners; List<INativeWindowListener*> copiedListeners;
CopyFrom(copiedListeners, listeners); CopyFrom(copiedListeners, listeners);
@@ -9125,25 +9183,44 @@ WindowsForm
void SetParent(INativeWindow* parent)override void SetParent(INativeWindow* parent)override
{ {
parentWindow=dynamic_cast<WindowsForm*>(parent); if (parentWindow)
if(parentWindow)
{ {
parentWindow->childWindows.Remove(this);
}
if ((parentWindow = dynamic_cast<WindowsForm*>(parent)))
{
parentWindow->childWindows.Add(this);
// ::SetParent(handle, parentWindow->handle);
SetWindowLongPtr(handle, GWLP_HWNDPARENT, (LONG_PTR)parentWindow->handle); SetWindowLongPtr(handle, GWLP_HWNDPARENT, (LONG_PTR)parentWindow->handle);
} }
else else
{ {
// ::SetParent(handle, NULL);
SetWindowLongPtr(handle, GWLP_HWNDPARENT, NULL); SetWindowLongPtr(handle, GWLP_HWNDPARENT, NULL);
} }
} }
bool GetAlwaysPassFocusToParent()override WindowMode GetWindowMode()override
{ {
return alwaysPassFocusToParent; return windowMode;
} }
void SetAlwaysPassFocusToParent(bool value)override void SetWindowMode(WindowMode mode)override
{ {
alwaysPassFocusToParent=value; 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
@@ -9563,7 +9640,7 @@ WindowsForm
void SetTopMost(bool topmost)override void SetTopMost(bool topmost)override
{ {
SetWindowPos(handle, (topmost ? HWND_TOPMOST : HWND_NOTOPMOST), 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_FRAMECHANGED); SetWindowPos(handle, (topmost ? HWND_TOPMOST : HWND_NOTOPMOST), 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_FRAMECHANGED);
} }
void SupressAlt()override void SupressAlt()override
@@ -9617,7 +9694,6 @@ WindowsController
LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK GodProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK GodProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK MouseProc(int nCode , WPARAM wParam , LPARAM lParam);
class WindowsController : public Object, public virtual INativeController, public virtual INativeWindowService class WindowsController : public Object, public virtual INativeController, public virtual INativeWindowService
{ {
@@ -9647,7 +9723,6 @@ WindowsController
,mainWindow(0) ,mainWindow(0)
,mainWindowHandle(0) ,mainWindowHandle(0)
,screenService(&GetHWNDFromNativeWindowHandle) ,screenService(&GetHWNDFromNativeWindowHandle)
,inputService(&MouseProc)
,dialogService(&GetHWNDFromNativeWindowHandle) ,dialogService(&GetHWNDFromNativeWindowHandle)
{ {
godWindow=CreateWindowEx(WS_EX_CONTROLPARENT, godClass.GetName().Buffer(), L"GodWindow", WS_OVERLAPPEDWINDOW, 0, 0, 0, 0, NULL, NULL, hInstance, NULL); godWindow=CreateWindowEx(WS_EX_CONTROLPARENT, godClass.GetName().Buffer(), L"GodWindow", WS_OVERLAPPEDWINDOW, 0, 0, 0, 0, NULL, NULL, hInstance, NULL);
@@ -9658,7 +9733,6 @@ WindowsController
~WindowsController() ~WindowsController()
{ {
inputService.StopTimer(); inputService.StopTimer();
inputService.StopHookMouse();
clipboardService.SetOwnerHandle(NULL); clipboardService.SetOwnerHandle(NULL);
DestroyWindow(godWindow); DestroyWindow(godWindow);
} }
@@ -9700,17 +9774,32 @@ WindowsController
{ {
if (hwnd == mainWindowHandle && uMsg == WM_DESTROY) if (hwnd == mainWindowHandle && uMsg == WM_DESTROY)
{ {
for (vint i = 0; i < windows.Count(); i++) FOREACH(WindowsForm*, window, windows.Values())
{ {
if (windows.Values().Get(i)->IsVisible()) if (window->IsVisible())
{ {
windows.Values().Get(i)->Hide(true); window->Hide(true);
} }
} }
while (windows.Count()) List<WindowsForm*> normalWindows;
CopyFrom(
normalWindows,
From(windows.Values())
.Where([](WindowsForm* window)
{
return window->GetWindowMode() == INativeWindow::Normal;
})
);
FOREACH(WindowsForm*, window, normalWindows)
{ {
DestroyNativeWindow(windows.Values().Get(0)); DestroyNativeWindow(window);
} }
for (vint i = windows.Count() - 1; i >= 0; i--)
{
auto window = windows.Values()[i];
DestroyNativeWindow(window);
}
PostQuitMessage(0); PostQuitMessage(0);
} }
} }
@@ -9832,11 +9921,6 @@ WindowsController
//======================================================================= //=======================================================================
void InvokeMouseHook(WPARAM message, NativePoint location)
{
callbackService.InvokeMouseHook(message, location);
}
void InvokeGlobalTimer() void InvokeGlobalTimer()
{ {
callbackService.InvokeGlobalTimer(); callbackService.InvokeGlobalTimer();
@@ -9884,18 +9968,6 @@ Windows Procedure
return DefWindowProc(hwnd, uMsg, wParam, lParam); return DefWindowProc(hwnd, uMsg, wParam, lParam);
} }
LRESULT CALLBACK MouseProc(int nCode , WPARAM wParam , LPARAM lParam)
{
WindowsController* controller=dynamic_cast<WindowsController*>(GetCurrentController());
if(controller)
{
MSLLHOOKSTRUCT* mouseHookStruct=(MSLLHOOKSTRUCT*)lParam;
NativePoint location(mouseHookStruct->pt.x, mouseHookStruct->pt.y);
controller->InvokeMouseHook(wParam, location);
}
return CallNextHookEx(NULL,nCode,wParam,lParam);
}
/*********************************************************************** /***********************************************************************
Windows Platform Native Controller Windows Platform Native Controller
***********************************************************************/ ***********************************************************************/
@@ -10322,6 +10394,16 @@ ControllerListener
} }
} }
~Direct2DWindowsNativeControllerListener()
{
for (vint i = 0; i < nativeWindowListeners.Count(); i++)
{
auto window = nativeWindowListeners.Keys()[i];
auto listener = nativeWindowListeners.Values()[i];
window->UninstallListener(listener.Obj());
}
}
ComPtr<ID3D11Device> CreateD3D11Device(D3D_DRIVER_TYPE driverType) ComPtr<ID3D11Device> CreateD3D11Device(D3D_DRIVER_TYPE driverType)
{ {
UINT flags = D3D11_CREATE_DEVICE_BGRA_SUPPORT; UINT flags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;
@@ -12633,6 +12715,16 @@ namespace vl
public: public:
Dictionary<INativeWindow*, Ptr<GdiWindowsNativeWindowListener>> nativeWindowListeners; Dictionary<INativeWindow*, Ptr<GdiWindowsNativeWindowListener>> nativeWindowListeners;
~GdiWindowsNativeControllerListener()
{
for (vint i = 0; i < nativeWindowListeners.Count(); i++)
{
auto window = nativeWindowListeners.Keys()[i];
auto listener = nativeWindowListeners.Values()[i];
window->UninstallListener(listener.Obj());
}
}
void NativeWindowCreated(INativeWindow* window) void NativeWindowCreated(INativeWindow* window)
{ {
Ptr<GdiWindowsNativeWindowListener> listener=new GdiWindowsNativeWindowListener(window); Ptr<GdiWindowsNativeWindowListener> listener=new GdiWindowsNativeWindowListener(window);
@@ -13010,53 +13102,6 @@ WindowsCallbackService
} }
} }
void WindowsCallbackService::InvokeMouseHook(WPARAM message, NativePoint location)
{
switch(message)
{
case WM_LBUTTONDOWN:
{
for(vint i=0;i<listeners.Count();i++)
{
listeners[i]->LeftButtonDown(location);
}
}
break;
case WM_LBUTTONUP:
{
for(vint i=0;i<listeners.Count();i++)
{
listeners[i]->LeftButtonUp(location);
}
}
break;
case WM_RBUTTONDOWN:
{
for(vint i=0;i<listeners.Count();i++)
{
listeners[i]->RightButtonDown(location);
}
}
break;
case WM_RBUTTONUP:
{
for(vint i=0;i<listeners.Count();i++)
{
listeners[i]->RightButtonUp(location);
}
}
break;
case WM_MOUSEMOVE:
{
for(vint i=0;i<listeners.Count();i++)
{
listeners[i]->MouseMoving(location);
}
}
break;
}
}
void WindowsCallbackService::InvokeGlobalTimer() void WindowsCallbackService::InvokeGlobalTimer()
{ {
for(vint i=0;i<listeners.Count();i++) for(vint i=0;i<listeners.Count();i++)
@@ -14399,11 +14444,9 @@ WindowsInputService
} }
} }
WindowsInputService::WindowsInputService(HOOKPROC _mouseProc) WindowsInputService::WindowsInputService()
:ownerHandle(NULL) :ownerHandle(NULL)
,mouseHook(NULL)
,isTimerEnabled(false) ,isTimerEnabled(false)
,mouseProc(_mouseProc)
,keyNames(146) ,keyNames(146)
{ {
InitializeKeyNames(); InitializeKeyNames();
@@ -14414,28 +14457,6 @@ WindowsInputService
ownerHandle=handle; ownerHandle=handle;
} }
void WindowsInputService::StartHookMouse()
{
if(!IsHookingMouse())
{
mouseHook=SetWindowsHookEx(WH_MOUSE_LL, mouseProc, NULL, NULL);
}
}
void WindowsInputService::StopHookMouse()
{
if(IsHookingMouse())
{
UnhookWindowsHookEx(mouseHook);
mouseHook=NULL;
}
}
bool WindowsInputService::IsHookingMouse()
{
return mouseHook!=NULL;
}
void WindowsInputService::StartTimer() void WindowsInputService::StartTimer()
{ {
if(!IsTimerEnabled()) if(!IsTimerEnabled())
+1 -7
View File
@@ -1852,7 +1852,6 @@ namespace vl
bool InstallListener(INativeControllerListener* listener)override; bool InstallListener(INativeControllerListener* listener)override;
bool UninstallListener(INativeControllerListener* listener)override; bool UninstallListener(INativeControllerListener* listener)override;
void InvokeMouseHook(WPARAM message, NativePoint location);
void InvokeGlobalTimer(); void InvokeGlobalTimer();
void InvokeClipboardUpdated(); void InvokeClipboardUpdated();
void InvokeNativeWindowCreated(INativeWindow* window); void InvokeNativeWindowCreated(INativeWindow* window);
@@ -2241,9 +2240,7 @@ namespace vl
{ {
protected: protected:
HWND ownerHandle; HWND ownerHandle;
HHOOK mouseHook;
bool isTimerEnabled; bool isTimerEnabled;
HOOKPROC mouseProc;
collections::Array<WString> keyNames; collections::Array<WString> keyNames;
collections::Dictionary<WString, VKEY> keys; collections::Dictionary<WString, VKEY> keys;
@@ -2251,12 +2248,9 @@ namespace vl
WString GetKeyNameInternal(VKEY code); WString GetKeyNameInternal(VKEY code);
void InitializeKeyNames(); void InitializeKeyNames();
public: public:
WindowsInputService(HOOKPROC _mouseProc); WindowsInputService();
void SetOwnerHandle(HWND handle); void SetOwnerHandle(HWND handle);
void StartHookMouse()override;
void StopHookMouse()override;
bool IsHookingMouse()override;
void StartTimer()override; void StartTimer()override;
void StopTimer()override; void StopTimer()override;
bool IsTimerEnabled()override; bool IsTimerEnabled()override;
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.