GUI abstraction

Abhishek
Posts: 266
Joined: Wed May 23, 2012 3:15 pm

Re: GUI abstraction

Post by Abhishek »

Cool! However the GUI layer needs a lot of polishing.

Abhishek
User avatar
Tectu
Posts: 1225
Joined: Thu May 10, 2012 9:50 am

Re: GUI abstraction

Post by Tectu »

Of course it does!

With polishing, do you mean fancy animations or the code cleanup itself?
Abhishek
Posts: 266
Joined: Wed May 23, 2012 3:15 pm

Re: GUI abstraction

Post by Abhishek »

By polishing, I mean a better presentation of the controls. Currently we're just using rectangles and lines. I'm looking forward to the use of gradients and better looks. Currently the slider just looks like a progress bar!
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: GUI abstraction

Post by Giovanni »

I wonder if it would be possible to mimic some existing framework in order to have some API compatibility, for example QT or GTK ( I am not an expert, just naming some I heard about), is is a good idea to reinvent an API?

Giovanni
User avatar
Badger
Posts: 346
Joined: Mon Apr 18, 2011 6:07 pm

Re: GUI abstraction

Post by Badger »

might be best to use something more low-level, e.g libSDL. It could probably be implemented as a display / touch pad driver.
User avatar
Tectu
Posts: 1225
Joined: Thu May 10, 2012 9:50 am

Re: GUI abstraction

Post by Tectu »

if someone has deeper knowlege in knowing how to use gtk / qt / sdl as a graphic front end, I'd be happy to hear something. This would be very nice.


~ Tectu
Abhishek
Posts: 266
Joined: Wed May 23, 2012 3:15 pm

Re: GUI abstraction

Post by Abhishek »

@Badger, I had asked this earlier on the forum, but asking again: would it be practical to use libfreetype for text rendering with the lib?

Also. IMHO we need a familiar event handling type architecture for the GUI we are currently using. I don't have much idea about Qt or GTK but I am familiar with Swing (Java) and Windows Forms. My idea of a GUI is something like:

Code: Select all

Button b=createButton(x,y,text,name);
SetEventHandler(b, CLICK, buttonClickedFunc);


Each control should have its own paint function and should save its state in its instance.
E.g. For a button, state could be:
Idle: Normal state.
Just Pressed: If the touch is made inside the control area. As soon as a touch is detected, every control (or widget, as you like it) should be iterated and should check for a 'hit'
Hot: If the button has been touched and is Waiting to be released. Probably indicated by a colour shift.
It could have two sub-states: (i) active and hold, (ii) auto-repeat via some auto-repeat interval (only if required)
Released: when touch is removed. Either state Hot or this could be used to fire the click event.

IMO GUI requires an event based approach. Probably the event passing mechanism or message passing mechanism available in ChibiOS would prove handy.

Request comments on this approach.

Abhishek
User avatar
Tectu
Posts: 1225
Joined: Thu May 10, 2012 9:50 am

Re: GUI abstraction

Post by Tectu »

I worked with Qt about a year ago do create a GUI application for x86.
The thing you wrote is likley to how Qt does it.

Implementing such a thing from scratch up is a bit of work, and I guess I woud need some time and many many changes to bring up something useable.
The reason why I didn't start directly that way is because I need something working like the buttons in a current project of mine with a deadline. That is how the entire library came up.

I am sorry that I cannot provide a fancy GUI abstraction layer yet. I just thought I share what I already have, in case it could be useful for somebody to play arround.


~ Tectu
User avatar
Badger
Posts: 346
Joined: Mon Apr 18, 2011 6:07 pm

Re: GUI abstraction

Post by Badger »

I'm sure libfreetype can be implemented, but it should be done in such a way that it is completely optional.

As for the libraries, we can probably learn a thing or two by studying the microchip and ST graphics libraries, and borrowing some good ideas.
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: GUI abstraction

Post by Giovanni »

I need to deploy another idea in this thread. The library is probably going to be stack-intensive. You should consider to implement it as a GUI-thread serving messages from the clients much like the FatFs wrapper thread created by Mabl: viewtopic.php?f=8&t=466

Giovanni
Locked