Index > Lgi > Skinning a GEdit?
Author/Date Skinning a GEdit?
26/12/2004 5:13pm
Is it possible to skin a GEdit-widget? It seems to be using the windows "EDIT" class directly, so it's not really owner-drawn... the Gel-skin looks very promising (a bit like iTunes/OS X?) but it clearly isn't finished yet.. I'd really love to have the Gel skin completed and have a consistent style throughout my whole application.

I just compiled Lgi with VC 2003 Express Beta by the way, and it compiles with just two errors (due to ambiguity between a strfunc(const char*, const char*) and strfunc(char*, char*), changed it but don't know exactly where that was) and a lot of warnings due to deprecated string functions (it works though, and MS should have told me what to use instead of those deprecated functions...) Gel compiles just fine too, works 'out of the box'.

And, I'm still thinking that the layout system of Lgi is just too simple. Maybe you should introduce the concept of a 'layout-manager', just as Java does in AWT and Swing (don't know if you know those?). basically, you can set a layout-manager for a panel, window or any other 'container' and it lays out its children using some parameters. For example:

container.setLayout(new BorderLayout([parameters go here]));
container.add([some component, a button for example], BorderLayout.LEFT);

And there's not just BorderLayout... There's GridLayout (for tabular layout) and many other (complex) layouts (see -> docs -> java.awt layout classes). Shouldn't be really difficult to implement, and works like a charm! You can even subclass and make your own layout manager, you can nest layouts using containers ;-)

Last thing: I thing you should change or make another GPanel class that acts as a 'sidebar' (and thus pushes away other components right to it, using the layout managers ;-)) because that's just very cool and handy.

Happy new year!

26/12/2004 8:36pm
Your right that the GEdit control is drawn by the OS, not me. The windows edit control has a lot of unusual functionality that would take a life time for me to replicate so I've just used that instead of my own code. In Linux I use the GTextView3 control, which is all my own code.

The skinning provided by the Gel skin is not complete simply because I've not had time to finish it.

As for layout code, I've been thinking about using the table layout code in the HTML control, which is now quite advanced to make a layout widget for some months now. In preparation for the next major version of Scribe. I'd also like to take some of the HTML styles and apply them to the controls. Making every widget styleable, in terms of CSS box model and fonts etc. Which would mean that lr8 files would then by CSS enabled allowing for some interesting "skinning" possibilities.

But it's a lot of work. Something I'll slowly work at in the new year.
28/12/2004 8:52am
Well, CSS styling for forms etc. would be great, if implemented right. How exactly were you thinking to 'merge' HTML-code and widgets? Or do you mean something like this:

GButton* btn = ...;
btn->Style->BackgroundColor = 0xCCCC00;
btn->Style->BorderTop = "solid 1px #FFCC00";

In that case, how would you then make CSS available for layout? Or just use tables for layout and CSS for the rest?