|
||||||
Views:
11,105,301 |
Main | FAQ | IRC chat | Memberlist | Active users | Latest posts | Stats | Ranks | Online users | Search | 12-05-24 02:18 AM |
||||
Guest: Register | Login |
0 users currently in msg db 'Computer Address',0xa | 1 bot |
Main - msg db 'Computer Address',0xa - GUI systems design - a hypothetical scenario |
Kawa |
| ||
Retired Staff
Not okay Prophet of Celestia Level: 94 Posts: 478/2423 EXP: 8195131 Next: 161526 Since: 01-01-12 From: The Netherlands Last post: 2251 days Last view: 566 days |
Imagine you're in an operating system development team, and you're in charge of designing how a given application would handle its windows and controls. Not the actual drawing of elements, but how to set up a window and react to events.
In Windows, the answers are a tree of objects, where things like buttons and input boxes are the same as the windows they are in, distinguished only by their class and styles, and events are done by a message pump -- the application spins a loop, checking for new system messages and responding to them. For example, a button could be created by the CreateWindow system call, specifying that it needs to be a button by class, and returning the window handle for it. In the message pump, the message for being clicked is found, and the target handle matches the one CreateWindow returned, so we know that the button was clicked. This system works fine for procedural languages, and can be mapped into OOP -- just look at MFC and .Net. The question is, how would you do it? This is your OS, so anything goes. Surprise me. |
Lili~ ♥ |
| ||
Normal User
Queen Lesbian of Kafuka Level: 161 Posts: 321/8412 EXP: 52986179 Next: 1126938 Since: 01-06-12 Last post: 2977 days Last view: 1499 days |
I'd do it similar to HTML/JavaScript - a resource script would set the layout of the user interface like in HTML, and the buttons and fields would be interacted with by specifying onhover/onclick/onkeypress statements similar to how JavaScript does it, which would then call functions in the code. |
Kawa |
| ||
Retired Staff
Not okay Prophet of Celestia Level: 94 Posts: 483/2423 EXP: 8195131 Next: 161526 Since: 01-01-12 From: The Netherlands Last post: 2251 days Last view: 566 days |
So basically, the entire GUI is made of webpage?
Neat. Update: we discussed this on IRC just now and I feel this should be posted for posterity's sake. To get a language-agnostic nature, I've suggested to replace the Javascript-style onFoo attributes with a Win32-inspired message pump. The application would spin around waiting for events as in Win32, and each event would specify its own nature (clicked, closed, paint, drag-drop stuff...) and the target, which could be either a vague identifier ("this window") or an element's ID attribute.
|
Cynthia |
| ||
Normal User
Bot Without Panties Unofficial board mascot Level: 25 Posts: 29/115 EXP: 84677 Next: 4943 Since: 01-08-12 Last post: 3755 days Last view: 2528 days |
XML window definitions are okay, but not as braindead as on the Android, please. |
Kawa |
| ||
Retired Staff
Not okay Prophet of Celestia Level: 94 Posts: 551/2423 EXP: 8195131 Next: 161526 Since: 01-01-12 From: The Netherlands Last post: 2251 days Last view: 566 days |
Here's a practical demonstration I came up with. The screenshot is a mockup, and is missing one element but whatever.
http://helmet.kafuka.org/liliwin_sample1.rar |
NovaSquirrel |
| ||
Normal User
Goomba Level: 14 Posts: 7/29 EXP: 10727 Next: 2344 Since: 01-04-12 From: Toasterland Last post: 3798 days Last view: 1510 days |
I would most likely try to imitate Allegro's built-in GUI system, where the window is specified as a big array of functions to call in order (that get passed a signal number, like MSG_CLICK or MSG_DRAW and return a signal) with widget properties after it, like width, color, a generic pointer for labels and textboxes, colors and such. Widgets are extended by making a wrapper for another widget's function that traps messages or results. |
Kawa |
| ||
Retired Staff
Not okay Prophet of Celestia Level: 94 Posts: 634/2423 EXP: 8195131 Next: 161526 Since: 01-01-12 From: The Netherlands Last post: 2251 days Last view: 566 days |
Could you post a snippet of actual code? Also, how would you solve the problem of language-agnosticism? |
NovaSquirrel |
| ||
Normal User
Goomba Level: 14 Posts: 8/29 EXP: 10727 Next: 2344 Since: 01-04-12 From: Toasterland Last post: 3798 days Last view: 1510 days |
Posted by Kawa A popup that requests a line of text for a Conway's Life demo a long time ago:
and the classical (I guess) "calls a function defined for the button when the button is clicked" thingy I always implement in every single program:
that intercepts messages from a close button that tell the application to exit the menu and instead return the result of a function. |
Kawa |
| ||
Retired Staff
Not okay Prophet of Celestia Level: 94 Posts: 635/2423 EXP: 8195131 Next: 161526 Since: 01-01-12 From: The Netherlands Last post: 2251 days Last view: 566 days |
And the part where it doesn't have to be in C, which is what "languag-agnostic" means?
Minimalist theme mockup of the hypothetical LiliOS. I'm thinking, a given window ought to be able to change the theme it wants to use, but defaults to a system-wide setting. So in that shot, you might imagine opening the sample app's "Theme" menu and selecting a Motif theme, which would switch the whole window to an approximation of Motif, while bsnes and the rest of the system remain set to Minimal. |
Main - msg db 'Computer Address',0xa - GUI systems design - a hypothetical scenario |
Acmlmboard v2.5.6 (06/11/2024) © 2005-2024 Acmlm, Emuz, et al. |
MySQL - queries: 122, rows: 517/551, time: 0.054 seconds. |