mirror of
https://github.com/vczh-libraries/Release.git
synced 2026-05-22 07:01:23 +08:00
Update release
This commit is contained in:
+96
-42
@@ -31504,20 +31504,9 @@ GuiGraphicsHost
|
||||
|
||||
void GuiGraphicsHost::KeyDown(const NativeWindowKeyInfo& info)
|
||||
{
|
||||
if (altActionManager->KeyDown(info))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (tabActionManager->Execute(info, focusedComposition))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(shortcutKeyManager && shortcutKeyManager->Execute(info))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (altActionManager->KeyDown(info)) { return; }
|
||||
if (tabActionManager->KeyDown(info, focusedComposition)) { return; }
|
||||
if(shortcutKeyManager && shortcutKeyManager->Execute(info)) { return; }
|
||||
|
||||
if (focusedComposition && focusedComposition->HasEventReceiver())
|
||||
{
|
||||
@@ -31527,10 +31516,7 @@ GuiGraphicsHost
|
||||
|
||||
void GuiGraphicsHost::KeyUp(const NativeWindowKeyInfo& info)
|
||||
{
|
||||
if (altActionManager->KeyUp(info))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (altActionManager->KeyUp(info)) { return; }
|
||||
|
||||
if(focusedComposition && focusedComposition->HasEventReceiver())
|
||||
{
|
||||
@@ -31540,10 +31526,7 @@ GuiGraphicsHost
|
||||
|
||||
void GuiGraphicsHost::SysKeyDown(const NativeWindowKeyInfo& info)
|
||||
{
|
||||
if (altActionManager->SysKeyDown(info))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (altActionManager->SysKeyDown(info)) { return; }
|
||||
|
||||
if(focusedComposition && focusedComposition->HasEventReceiver())
|
||||
{
|
||||
@@ -31553,10 +31536,7 @@ GuiGraphicsHost
|
||||
|
||||
void GuiGraphicsHost::SysKeyUp(const NativeWindowKeyInfo& info)
|
||||
{
|
||||
if (altActionManager->SysKeyUp(info))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (altActionManager->SysKeyUp(info)) { return; }
|
||||
|
||||
if (!info.ctrl && !info.shift && info.code == VKEY::_MENU && hostRecord.nativeWindow)
|
||||
{
|
||||
@@ -31574,10 +31554,8 @@ GuiGraphicsHost
|
||||
|
||||
void GuiGraphicsHost::Char(const NativeWindowCharInfo& info)
|
||||
{
|
||||
if (altActionManager->Char(info))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (altActionManager->Char(info)) { return; }
|
||||
if (tabActionManager->Char(info)) { return; }
|
||||
|
||||
if(focusedComposition && focusedComposition->HasEventReceiver())
|
||||
{
|
||||
@@ -31606,6 +31584,7 @@ GuiGraphicsHost
|
||||
:controlHost(_controlHost)
|
||||
{
|
||||
altActionManager = new GuiAltActionManager(controlHost);
|
||||
tabActionManager = new GuiTabActionManager(controlHost);
|
||||
hostRecord.host = this;
|
||||
windowComposition=new GuiWindowComposition;
|
||||
windowComposition->SetMinSizeLimitation(GuiGraphicsComposition::LimitToElementAndChildren);
|
||||
@@ -31619,6 +31598,7 @@ GuiGraphicsHost
|
||||
NotifyFinalizeInstance(windowComposition);
|
||||
|
||||
delete altActionManager;
|
||||
delete tabActionManager;
|
||||
if (shortcutKeyManager)
|
||||
{
|
||||
delete shortcutKeyManager;
|
||||
@@ -32370,28 +32350,94 @@ namespace vl
|
||||
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()
|
||||
{
|
||||
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)
|
||||
{
|
||||
BuildControlList();
|
||||
available = true;
|
||||
}
|
||||
#define STEP_AND_NORMALIZE(INDEX) (((INDEX) + offset + controlsInOrder.Count()) % controlsInOrder.Count())
|
||||
|
||||
vint index = controlsInOrder.IndexOf(focusedControl);
|
||||
if (index == -1)
|
||||
if (controlsInOrder.Count() == 0) return nullptr;
|
||||
vint startIndex = controlsInOrder.IndexOf(focusedControl);
|
||||
startIndex =
|
||||
startIndex == -1 ? 0 :
|
||||
STEP_AND_NORMALIZE(startIndex);
|
||||
|
||||
vint index = startIndex;
|
||||
do
|
||||
{
|
||||
return controlsInOrder.Count() == 0 ? nullptr : controlsInOrder[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
return controlsInOrder[(index + 1) % controlsInOrder.Count()];
|
||||
}
|
||||
auto control = controlsInOrder[index];
|
||||
if (auto tabAction = control->QueryTypedService<IGuiTabAction>())
|
||||
{
|
||||
if (tabAction->IsTabAvailable() && tabAction->IsTabEnabled())
|
||||
{
|
||||
return control;
|
||||
}
|
||||
}
|
||||
|
||||
index = STEP_AND_NORMALIZE(index);
|
||||
} while (index != startIndex);
|
||||
|
||||
#undef STEP_AND_NORMALIZE
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GuiTabActionManager::GuiTabActionManager(controls::GuiControlHost* _controlHost)
|
||||
@@ -32409,9 +32455,9 @@ GuiTabActionManager
|
||||
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;
|
||||
if (focusedComposition)
|
||||
@@ -32423,14 +32469,22 @@ GuiTabActionManager
|
||||
}
|
||||
}
|
||||
|
||||
if (auto next = GetNextFocusControl(focusedControl))
|
||||
if (auto next = GetNextFocusControl(focusedControl, (info.shift ? -1 : 1)))
|
||||
{
|
||||
next->SetFocus();
|
||||
supressTabOnce = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
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;
|
||||
ControlList controlsInOrder;
|
||||
bool available = true;
|
||||
bool supressTabOnce = false;
|
||||
|
||||
void BuildControlList();
|
||||
controls::GuiControl* GetNextFocusControl(controls::GuiControl* focusedControl);
|
||||
controls::GuiControl* GetNextFocusControl(controls::GuiControl* focusedControl, vint offset);
|
||||
public:
|
||||
GuiTabActionManager(controls::GuiControlHost* _controlHost);
|
||||
~GuiTabActionManager();
|
||||
|
||||
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>
|
||||
/// <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>
|
||||
bool AddService(const WString& identifier, Ptr<IDescriptable> value);
|
||||
|
||||
@@ -13783,7 +13785,6 @@ DateComboBox
|
||||
public:
|
||||
/// <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="_datePicker">The date picker control to show in the popup.</param>
|
||||
GuiDateComboBox(theme::ThemeName themeName);
|
||||
~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