mirror of
https://github.com/vczh-libraries/Release.git
synced 2026-05-31 13:55:26 +08:00
Update release
This commit is contained in:
+96
-42
@@ -31504,20 +31504,9 @@ GuiGraphicsHost
|
|||||||
|
|
||||||
void GuiGraphicsHost::KeyDown(const NativeWindowKeyInfo& info)
|
void GuiGraphicsHost::KeyDown(const NativeWindowKeyInfo& info)
|
||||||
{
|
{
|
||||||
if (altActionManager->KeyDown(info))
|
if (altActionManager->KeyDown(info)) { return; }
|
||||||
{
|
if (tabActionManager->KeyDown(info, focusedComposition)) { return; }
|
||||||
return;
|
if(shortcutKeyManager && shortcutKeyManager->Execute(info)) { return; }
|
||||||
}
|
|
||||||
|
|
||||||
if (tabActionManager->Execute(info, focusedComposition))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(shortcutKeyManager && shortcutKeyManager->Execute(info))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (focusedComposition && focusedComposition->HasEventReceiver())
|
if (focusedComposition && focusedComposition->HasEventReceiver())
|
||||||
{
|
{
|
||||||
@@ -31527,10 +31516,7 @@ GuiGraphicsHost
|
|||||||
|
|
||||||
void GuiGraphicsHost::KeyUp(const NativeWindowKeyInfo& info)
|
void GuiGraphicsHost::KeyUp(const NativeWindowKeyInfo& info)
|
||||||
{
|
{
|
||||||
if (altActionManager->KeyUp(info))
|
if (altActionManager->KeyUp(info)) { return; }
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(focusedComposition && focusedComposition->HasEventReceiver())
|
if(focusedComposition && focusedComposition->HasEventReceiver())
|
||||||
{
|
{
|
||||||
@@ -31540,10 +31526,7 @@ GuiGraphicsHost
|
|||||||
|
|
||||||
void GuiGraphicsHost::SysKeyDown(const NativeWindowKeyInfo& info)
|
void GuiGraphicsHost::SysKeyDown(const NativeWindowKeyInfo& info)
|
||||||
{
|
{
|
||||||
if (altActionManager->SysKeyDown(info))
|
if (altActionManager->SysKeyDown(info)) { return; }
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(focusedComposition && focusedComposition->HasEventReceiver())
|
if(focusedComposition && focusedComposition->HasEventReceiver())
|
||||||
{
|
{
|
||||||
@@ -31553,10 +31536,7 @@ GuiGraphicsHost
|
|||||||
|
|
||||||
void GuiGraphicsHost::SysKeyUp(const NativeWindowKeyInfo& info)
|
void GuiGraphicsHost::SysKeyUp(const NativeWindowKeyInfo& info)
|
||||||
{
|
{
|
||||||
if (altActionManager->SysKeyUp(info))
|
if (altActionManager->SysKeyUp(info)) { return; }
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!info.ctrl && !info.shift && info.code == VKEY::_MENU && hostRecord.nativeWindow)
|
if (!info.ctrl && !info.shift && info.code == VKEY::_MENU && hostRecord.nativeWindow)
|
||||||
{
|
{
|
||||||
@@ -31574,10 +31554,8 @@ GuiGraphicsHost
|
|||||||
|
|
||||||
void GuiGraphicsHost::Char(const NativeWindowCharInfo& info)
|
void GuiGraphicsHost::Char(const NativeWindowCharInfo& info)
|
||||||
{
|
{
|
||||||
if (altActionManager->Char(info))
|
if (altActionManager->Char(info)) { return; }
|
||||||
{
|
if (tabActionManager->Char(info)) { return; }
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(focusedComposition && focusedComposition->HasEventReceiver())
|
if(focusedComposition && focusedComposition->HasEventReceiver())
|
||||||
{
|
{
|
||||||
@@ -31606,6 +31584,7 @@ GuiGraphicsHost
|
|||||||
:controlHost(_controlHost)
|
:controlHost(_controlHost)
|
||||||
{
|
{
|
||||||
altActionManager = new GuiAltActionManager(controlHost);
|
altActionManager = new GuiAltActionManager(controlHost);
|
||||||
|
tabActionManager = new GuiTabActionManager(controlHost);
|
||||||
hostRecord.host = this;
|
hostRecord.host = this;
|
||||||
windowComposition=new GuiWindowComposition;
|
windowComposition=new GuiWindowComposition;
|
||||||
windowComposition->SetMinSizeLimitation(GuiGraphicsComposition::LimitToElementAndChildren);
|
windowComposition->SetMinSizeLimitation(GuiGraphicsComposition::LimitToElementAndChildren);
|
||||||
@@ -31619,6 +31598,7 @@ GuiGraphicsHost
|
|||||||
NotifyFinalizeInstance(windowComposition);
|
NotifyFinalizeInstance(windowComposition);
|
||||||
|
|
||||||
delete altActionManager;
|
delete altActionManager;
|
||||||
|
delete tabActionManager;
|
||||||
if (shortcutKeyManager)
|
if (shortcutKeyManager)
|
||||||
{
|
{
|
||||||
delete shortcutKeyManager;
|
delete shortcutKeyManager;
|
||||||
@@ -32370,28 +32350,94 @@ namespace vl
|
|||||||
GuiTabActionManager
|
GuiTabActionManager
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
|
|
||||||
|
namespace tab_focus
|
||||||
|
{
|
||||||
|
void CollectControls(GuiControl* current, bool includeCurrent, Group<vuint64_t, GuiControl*>& prioritized)
|
||||||
|
{
|
||||||
|
if (includeCurrent)
|
||||||
|
{
|
||||||
|
auto tabAction = current->QueryTypedService<IGuiTabAction>();
|
||||||
|
if (tabAction && (tabAction->IsTabAvailable() || tabAction->GetTabPriority() != -1))
|
||||||
|
{
|
||||||
|
vint priority = tabAction->GetTabPriority();
|
||||||
|
vuint64_t normalized = priority < 0 ? ~(vuint64_t)0 : (vuint64_t)priority;
|
||||||
|
prioritized.Add(normalized, current);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vint count = current->GetChildrenCount();
|
||||||
|
for (vint i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
CollectControls(current->GetChild(i), true, prioritized);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void InsertPrioritized(List<GuiControl*>& controls, vint index, Group<vuint64_t, GuiControl*>& prioritized)
|
||||||
|
{
|
||||||
|
vint count = prioritized.Count();
|
||||||
|
for (vint i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
auto& values = prioritized.GetByIndex(i);
|
||||||
|
for (vint j = 0; j < values.Count(); j++)
|
||||||
|
{
|
||||||
|
controls.Insert(index++, values[j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
using namespace tab_focus;
|
||||||
|
|
||||||
void GuiTabActionManager::BuildControlList()
|
void GuiTabActionManager::BuildControlList()
|
||||||
{
|
{
|
||||||
|
controlsInOrder.Clear();
|
||||||
|
{
|
||||||
|
Group<vuint64_t, GuiControl*> prioritized;
|
||||||
|
CollectControls(controlHost, false, prioritized);
|
||||||
|
InsertPrioritized(controlsInOrder, 0, prioritized);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (vint i = 0; i < controlsInOrder.Count(); i++)
|
||||||
|
{
|
||||||
|
Group<vuint64_t, GuiControl*> prioritized;
|
||||||
|
CollectControls(controlsInOrder[i], false, prioritized);
|
||||||
|
InsertPrioritized(controlsInOrder, i + 1, prioritized);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
controls::GuiControl* GuiTabActionManager::GetNextFocusControl(controls::GuiControl* focusedControl)
|
controls::GuiControl* GuiTabActionManager::GetNextFocusControl(controls::GuiControl* focusedControl, vint offset)
|
||||||
{
|
{
|
||||||
if (!available)
|
if (!available)
|
||||||
{
|
{
|
||||||
BuildControlList();
|
BuildControlList();
|
||||||
available = true;
|
available = true;
|
||||||
}
|
}
|
||||||
|
#define STEP_AND_NORMALIZE(INDEX) (((INDEX) + offset + controlsInOrder.Count()) % controlsInOrder.Count())
|
||||||
|
|
||||||
vint index = controlsInOrder.IndexOf(focusedControl);
|
if (controlsInOrder.Count() == 0) return nullptr;
|
||||||
if (index == -1)
|
vint startIndex = controlsInOrder.IndexOf(focusedControl);
|
||||||
|
startIndex =
|
||||||
|
startIndex == -1 ? 0 :
|
||||||
|
STEP_AND_NORMALIZE(startIndex);
|
||||||
|
|
||||||
|
vint index = startIndex;
|
||||||
|
do
|
||||||
{
|
{
|
||||||
return controlsInOrder.Count() == 0 ? nullptr : controlsInOrder[0];
|
auto control = controlsInOrder[index];
|
||||||
}
|
if (auto tabAction = control->QueryTypedService<IGuiTabAction>())
|
||||||
else
|
{
|
||||||
{
|
if (tabAction->IsTabAvailable() && tabAction->IsTabEnabled())
|
||||||
return controlsInOrder[(index + 1) % controlsInOrder.Count()];
|
{
|
||||||
}
|
return control;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
index = STEP_AND_NORMALIZE(index);
|
||||||
|
} while (index != startIndex);
|
||||||
|
|
||||||
|
#undef STEP_AND_NORMALIZE
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
GuiTabActionManager::GuiTabActionManager(controls::GuiControlHost* _controlHost)
|
GuiTabActionManager::GuiTabActionManager(controls::GuiControlHost* _controlHost)
|
||||||
@@ -32409,9 +32455,9 @@ GuiTabActionManager
|
|||||||
controlsInOrder.Clear();
|
controlsInOrder.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GuiTabActionManager::Execute(const NativeWindowKeyInfo& info, GuiGraphicsComposition* focusedComposition)
|
bool GuiTabActionManager::KeyDown(const NativeWindowKeyInfo& info, GuiGraphicsComposition* focusedComposition)
|
||||||
{
|
{
|
||||||
if (info.code == VKEY::_TAB)
|
if (!info.ctrl && !info.alt && info.code == VKEY::_TAB)
|
||||||
{
|
{
|
||||||
GuiControl* focusedControl = nullptr;
|
GuiControl* focusedControl = nullptr;
|
||||||
if (focusedComposition)
|
if (focusedComposition)
|
||||||
@@ -32423,14 +32469,22 @@ GuiTabActionManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto next = GetNextFocusControl(focusedControl))
|
if (auto next = GetNextFocusControl(focusedControl, (info.shift ? -1 : 1)))
|
||||||
{
|
{
|
||||||
next->SetFocus();
|
next->SetFocus();
|
||||||
|
supressTabOnce = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GuiTabActionManager::Char(const NativeWindowCharInfo& info)
|
||||||
|
{
|
||||||
|
bool supress = supressTabOnce;
|
||||||
|
supressTabOnce = false;
|
||||||
|
return supress && info.code == L'\t';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-4
@@ -4023,15 +4023,17 @@ Tab-Combined Shortcut Key Interfaces Helpers
|
|||||||
controls::GuiControlHost* controlHost = nullptr;
|
controls::GuiControlHost* controlHost = nullptr;
|
||||||
ControlList controlsInOrder;
|
ControlList controlsInOrder;
|
||||||
bool available = true;
|
bool available = true;
|
||||||
|
bool supressTabOnce = false;
|
||||||
|
|
||||||
void BuildControlList();
|
void BuildControlList();
|
||||||
controls::GuiControl* GetNextFocusControl(controls::GuiControl* focusedControl);
|
controls::GuiControl* GetNextFocusControl(controls::GuiControl* focusedControl, vint offset);
|
||||||
public:
|
public:
|
||||||
GuiTabActionManager(controls::GuiControlHost* _controlHost);
|
GuiTabActionManager(controls::GuiControlHost* _controlHost);
|
||||||
~GuiTabActionManager();
|
~GuiTabActionManager();
|
||||||
|
|
||||||
void InvalidateTabOrderCache();
|
void InvalidateTabOrderCache();
|
||||||
bool Execute(const NativeWindowKeyInfo& info, GuiGraphicsComposition* focusedComposition);
|
bool KeyDown(const NativeWindowKeyInfo& info, GuiGraphicsComposition* focusedComposition);
|
||||||
|
bool Char(const NativeWindowCharInfo& info);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8414,7 +8416,7 @@ Basic Construction
|
|||||||
|
|
||||||
/// <summary>Add a service to this control dynamically. The added service cannot override existing services.</summary>
|
/// <summary>Add a service to this control dynamically. The added service cannot override existing services.</summary>
|
||||||
/// <returns>Returns true if this operation succeeded.</returns>
|
/// <returns>Returns true if this operation succeeded.</returns>
|
||||||
/// <param name="identifier">The identifier. You are suggested to fill this parameter using the value from the interface's GetIdentifier function, or <see cref="QueryTypedService"/> will not work on this service.</param>
|
/// <param name="identifier">The identifier. You are suggested to fill this parameter using the value from the interface's GetIdentifier function, or <see cref="QueryTypedService`1"/> will not work on this service.</param>
|
||||||
/// <param name="value">The service.</param>
|
/// <param name="value">The service.</param>
|
||||||
bool AddService(const WString& identifier, Ptr<IDescriptable> value);
|
bool AddService(const WString& identifier, Ptr<IDescriptable> value);
|
||||||
|
|
||||||
@@ -13783,7 +13785,6 @@ DateComboBox
|
|||||||
public:
|
public:
|
||||||
/// <summary>Create a control with a specified style provider.</summary>
|
/// <summary>Create a control with a specified style provider.</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>
|
||||||
/// <param name="_datePicker">The date picker control to show in the popup.</param>
|
|
||||||
GuiDateComboBox(theme::ThemeName themeName);
|
GuiDateComboBox(theme::ThemeName themeName);
|
||||||
~GuiDateComboBox();
|
~GuiDateComboBox();
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user