ewmailing / iupcocoa Goto Github PK
View Code? Open in Web Editor NEWCocoa/Mac backend for IUP (Portable native-GUI Interface) [switch to Cocoa branch]
License: Other
Cocoa/Mac backend for IUP (Portable native-GUI Interface) [switch to Cocoa branch]
License: Other
README for IUP IUP is a portable toolkit for building graphical user interfaces. It offers a configuration API in three basic languages: C, Lua and LED. IUP's purpose is to allow a program to be executed in different systems without any modification, therefore it is highly portable. Its main advantages are: * high performance, due to the fact that it uses native interface elements. * fast learning by the user, due to the simplicity of its API. Build instructions and usage are available in the IUP documentation. For complete information, visit IUP's web site at http://www.tecgraf.puc-rio.br/iup or access its documentation in the HTML folder. (end of README)
I forked your branch, and in Terminal did:
cd IupCocoa
make
The compile failed with many #include <gtk/...> file not found errors. So I coulduse some help getting started:
How do I configure for an OS X build? for an iOS build?
What do you need?
Iup has a key callback for most widgets called K_ANY and KEYPRESS_CB
https://webserver2.tecgraf.puc-rio.br/iup/en/call/iup_k_any.html
We have to detect a native key press on each specific widget
Map the native keys that were pressed to the corresponding Iup keycodes.
https://webserver2.tecgraf.puc-rio.br/iup/en/attrib/key.html
Also may need to set MODKEYSTATE to record whether modifier keys are being pressed (control, alt, shift, option)
Invoke the user's callback
Check the user's return value from the callback and do the proper thing
This code should eventually be factored in a common place, but right now, the easiest place to start is directly code in iupcocoa_tree.m. There is a method called
From there (2) you will need to find which keys are being pressed from the_event object. You will then map these to the Iup keycodes.
You invoke the user callback (3), following the usual Iup invoke callback conventions. This too should eventually be factored in a way we can call this for all widgets.
Then check the return value (4).
I think (but not completely sure):
In - (void) keyDown:(NSEvent*)the_event
If IUP_IGNORE:
return immediately to end the method and don't do anything.
if IUP_CONTINUE:
call
[super keyDown:the_event];
and return.
If IUP_DEFAULT:
return immediately to end the method and don't do anything.
(this is the same as IUP_IGNORE, which is why I'm not completely sure)
if IUP_CLOSE:
call
IupExitLoop();
and return immediately.
Some info on Cocoa key events
https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/EventOverview/HandlingKeyEvents/HandlingKeyEvents.html
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.