-
Notifications
You must be signed in to change notification settings - Fork 32
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
UI: implement "query back" interface and "checked" menu items for Windows and GTK (for Mac it's another issue now!) #200
Comments
As far as I can see, I hope I can do it myself for GTK (it's interesting that I implemented this for Windows, but not for GTK ...), but I'm sure I have no idea how to do this for Mac UI. |
I will take this for macOS. |
Thanks! I've updated the first comment here a bit to better explain how it works. |
I'll take care about the GTK part. |
One important point! Just browsing the sources, it seems windows is not so much consistent with the GTK implementation. That is, the callback SHOULD set either of XEMUGUI_MENUFLAG_CHECKED or XEMUGUI_MENUFLAG_UNCHECKED or query request, it's maybe not enough in every case to set only checked. And be careful not to set both, since it's possible just the result is hmmm unknown :) Honestly my GUI layer is not the best. The problem here that on Windows you can mark a menu item checked later. On GTK you need to create as checkable ... Thus if we don't have CHECKED or UNCHECKED the GTK version won't know that it's a checkable item if it's not checked, so no way to check it by the user ... I should create a better abstraction in the future, but I wouldn't rewrite everything in the GUI as well ... :-/ |
Done for Windows and GTK. |
Though MacOS still lacks of these ... TODO
I hacked the MacOS UI implementation to have query-back, but it does not do too much, as the UI code should be aware to render the "checkbox" status to be really useful, what I have no idea about how to do. I tested it with my hackintosh-VM on my Linux box, it still seems to work, so maybe I haven't messed up at least ;) |
This problem is moved into issue #227 |
DO NOT USE INFORMATION FROM THIS ISSUE BUT ONLY FROM ISSUE #227 BECAUSE THIS ONE HERE CAN BE OUTDATED ALREADY
For Windows, I've already written this. The task is to create similar functionality for Mac and GTK UIs too. See mega65's ui.c as an example:
So the key is to use XEMUGUI_MENUFLAG_QUERYBACK to specify such a functionality for a given defined menu point. The callback then should looks like something like this:
According the callback, the UI core should render the "checked sign" or not. For example xemu/gui/windows.c:
So basically a callback is called when it's activated, BUT if it's a menu point marked with XEMUGUI_MENUFLAG_QUERYBACK, then it must be also called on building the menusystem itself to query if it should be checked or not. The query callback happens on the time building of the menu itself. Note, that in theory the callback even can sets other flags to alter menu, but currently that's not implemented (eg: there is radio buttons in the windows GUI version by me, but never used by emulation target UIs ...). See the example above in general with the sysconsole example, how a callback knows if it's a query call to itself, or an activation call. Basically checking query pointer, if it's not NULL, it's a query call only, *query must be altered and callback should return. Otherwise if it's NULL, it's a call because of the user clicked on the menu itself.
A minor part, not too much related:
XEMUGUI_MENUFLAG_SEPARATOR or'ed to the type in the menu definition should cause to have a separator line AFTER THAT menu item.
For examples see this commit
Commit 5f0f6d8 for issues #200 and #201 for GTK and Windows UI.
Please see the vic branch for now: https://github.com/lgblgblgb/xemu/tree/vic
Other similar issue
Issue #201
The text was updated successfully, but these errors were encountered: