Forum Post
Index > Lgi > Skinning code?

Author/Date Skinning code?
Maggot
10/02/2004 8:56am
Dear fRet,

I read the news about the new skinning support(http://memecode.com/forums/view.php?id=2134).

Is it available in the latest download of Lgi?

Other questions:
1. Are there any plans for a signal/slot or delegates mechanism?
2. How about using namespaces for LGI classes? (e.g: namespace lgi {...})

Thanks for a good GUI library.

Regards,
-magg
fReT
10/02/2004 5:17pm
Yes, the skinning is in v1.98 which I released yesterday. It consists of a extra DLL/SO that Lgi looks for when it initializes. It calls a C function in the lib to create an instance of a virtual class that has a whole lot of fucntions to paint this control or that control. Then the controls check for the presence of a skinning engine in their OnPaint event and pass control to the skinning engine if it's present. That way if the skin lib didn't load, or isn't present then it falls back to the standard code.

So there isn't a file format or anything, but there is no reason why you couldn't write one. At this stage you have to write C++ to do the drawing for the different controls.

As for slots and delegates. Lgi's model is a little simpler, in that the GView class has a OnNotify virtual function to catch events that happen to children views. OnNotify events bubble up the parent list until they hit a view that knows what to do with the event. The parameters to the function are a pointer to the view (control) and a 32bit int. So for instance the list control defines a bunch of events that it passes in OnNotify's int parameter. The receiver can then switch on this and act appropriately. The window that receives events can be overiden by setting the Notify member of the view.

I've had a lot of trouble with namespaces in VC++ which Lgi needs to compile under. It's support for namespaces is pretty dodgy, like when you include several files that define the same namespace in a nested form you actual get errors for no good reason. So I'm a little wary of them. I've prefixed most of the symbols used with either "G..." for classes or "Lgi..." for functions. Although it's not universal. If it's a major hassle then I'll start working on cleaning up the class and function names and/or adding an explicit namespace to the headers.
Maggot
11/02/2004 2:25am
Dear fRet,

Thanks a mill for the response. What are your personal opinions on signal/slot mechanisms (especially http://libsigc.sourceforge.net/)? I like it and have been using it in QT for some projects.

I suggested namespaces to prevent name collisions and confusion (eg: MemSet, memset). Well it ain't critical though (but sure does help with intellisense ;-)). I suppose you meant VC6 has dodgy namespace support, what SP are you using? Is there a link to MSDN discussing it? I am using Intel C++ 7.1 and VC 7.1.

Thanks mate.

mucho gracias,
-magg
fReT
11/02/2004 5:56pm
Signals/Slots: I havn't had any experience with them, other than Qt's moc system. Which to be honest I found rather clumsy and difficult to use. I'm sure there are better ways to do it.

I'm using Visual C++ 6, sp5 for the most part. And I had trouble with non trivial namespaces. I could revisit it later and see if I could put a namespace wrapper around Lgi. But at the moment I'm only working on Lgi to support the applications I'm writting, not so much to extend Lgi for it's own sake. I'm hoping that others will take an interest in doing that. Although I've been working towards binary compaitibility for a few months now, using the same rules that Qt uses.
Maggot
12/02/2004 8:28am
Dear fRet,

Have you had a look at libsigc? It is way better than moc. It is also LGPLed and is used in GTKMM.

If not full namespace support how about trivial namespace support then?

Thanks mate.

Greets,
-magg
fReT
12/02/2004 6:00pm
libsigc: not yet, I'm busy with Scribe stuff at the moment.
Maggot
13/02/2004 7:07am
Dear fRet,

I would like to implement libsigc into LGI itself if you do not have the time but there may be binary compatibility issues, design changes, etc. I would do do it if it officially becomes part of Lgi, not an independent third party hack.

I would like to add namespaces as well but the above applies here as well. You would have to do the VC6 testing though.

Cheers,
-magg
fReT
13/02/2004 5:09pm
Lgi is pretty size sensitive, in that the current download is about 300kb of compressed libraries on windows. Adding libsigc might blow that out considerably, so we'll have to see.

I don't want to significantly impact the size of all my programs.
fReT
15/02/2004 1:53am
libsigc: I downloaded it and compiled up the release .lib, and it's 70kb. Which is a good sign, I wouldn't have bought into something several hundred kb or more.

If I could trim Lgi a little as well to make some room for it then I'd be even more happy about intergrating it.

So tell me, whats so great about it?

PS: I don't think having to download cygwin to build some dependent lib is a great idea though. I think a buildable version should be included in the base Lgi distro.
Maggot
16/02/2004 7:35am
What's so great about it?
http://www.ddj.com/documents/s=1642/ddj0303d/

Using VC6 with libsigc++?
http://www.codeproject.com/cpp/sigcart.asp

Lightweight alternatives to libsigc++:
http://www.codeproject.com/cpp/cppdelegates.asp
http://www.myelin.co.nz/notes/callbacks/cpp-delegates.html (a little ugly)

There ya go mate!

Cheers,
-magg
Maggot
16/02/2004 7:38am
Upcoming libsigc++ docs (2.0):
http://libsigc.sourceforge.net/libsigc2/docs/

Cheers mate,
-magg
Maggot
18/02/2004 6:57am
Dear fRet,

So what do ya say fRet? To sig/slot or not?
(Don't mean to rush ya or anything like that.)

Cheers mate,
-magg
fReT
18/02/2004 6:22pm
It looks interesting and I think it's problem the way to go eventually. I'm pretty busy with other things at the moment so I won't personally be working on add signals for a little while.

My focus is really the applications like Scribe and so on, not Lgi. Lgi is just an enabler for me.

I don't thing the code size hit is too bad... I havn't linked against it yet but it looks like it's about 70k. Which I can accept.

Removing all the existing notification structure would leave a little room for signals and slots. Although gcc is pretty bad at keep executable size down in C++.
MisterData
03/05/2004 6:34am
For people still wanting to know how skinning works:

- Compile the 'Gel'-skin project, move lgiskin.dll to your application's Release/Debug dir
- Add the following code in LgiMain:


int LgiMain(OsAppArguments &Args) {
GApp *App = new GApp("application/x-MyProgram", Args);
GLibrary lib("lgiskin.dll");
Proc_CreateSkinEngine b = (Proc_CreateSkinEngine)lib.GetAddress(LgiSkinEntryPoint);
App->SkinEngine = b(App);
MisterData
03/05/2004 6:35am
And you might want to add some error checking too, such as if(b) in the example above...
fReT
06/05/2004 11:34pm
The skinning is part of the GApp construction now so you don't have to do it your self.

The new version of Lgi was released today.
Reply