-
Notifications
You must be signed in to change notification settings - Fork 409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the ability to switch between tabs using keyboard controls #1363
Conversation
How is this used/tested? |
I can make the osu! PR for it if you like, but it won't compile until the framework is updated. Essentially it lets you use platform actions to switch between chat tabs. |
As in there has to be added tests to the framework to explore this functionality. Also why are the actions not bound anywhere in the framework? |
The osu! change adds an action listener to the chat panel to switch channels, but I guess it be done by default (or optionally) on the framework side. Then all tab containers would get the functionality if they have a focused child. I will make a test case for it too. |
I'd probably make it available for next/previous tab, at very least (toggleable works too). |
@swoolcock the referenced PR has been merged, feel free to apply any changes you previously wanted. |
@swoolcock any chance of having the updated and testable in a testcase (preferrably automated)? |
I've been a combination of sick and busy the past couple of weeks, I will finish this up this weekend. I have a working visual test for it, too. |
Once this PR is merged I’ll force push the osu! PR as it will no longer have visual tests. |
@@ -50,6 +50,8 @@ internal MacOSGameHost(string gameName, bool bindIPC = false) | |||
new KeyBinding(new KeyCombination(new[] { InputKey.Super, InputKey.Delete }), new PlatformAction(PlatformActionType.LineEnd, PlatformActionMethod.Delete)), | |||
new KeyBinding(new KeyCombination(new[] { InputKey.Super, InputKey.Shift, InputKey.Left }), new PlatformAction(PlatformActionType.LineStart, PlatformActionMethod.Select)), | |||
new KeyBinding(new KeyCombination(new[] { InputKey.Super, InputKey.Shift, InputKey.Right }), new PlatformAction(PlatformActionType.LineEnd, PlatformActionMethod.Select)), | |||
new KeyBinding(new KeyCombination(new[] { InputKey.Alt, InputKey.Super, InputKey.Left }), new PlatformAction(PlatformActionType.DocumentPrevious)), |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@@ -237,6 +246,35 @@ protected virtual void SelectTab(TabItem<T> tab) | |||
Current.Value = SelectedTab.Value; | |||
} | |||
|
|||
public virtual void SwitchTab(int offset, bool wrap = true) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
public virtual void SwitchTab(int direction, bool wrap = true) | ||
{ | ||
if (Math.Abs(direction) != 1) | ||
throw new ArgumentException("Switch direction must be 1 or -1."); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Adds a function to switch tabs in a TabControl based on an offset and optionally wrapping.
Also adds next/previous document platform-level actions to be used for switching tabs.