paragui-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [paragui-users] Paragui redesign


From: Alexander Pipelka
Subject: Re: [paragui-users] Paragui redesign
Date: 04 May 2002 00:47:35 +0200

Am Fre, 2002-05-03 um 22.22 schrieb Andrew Ford:
> I'm glad you like it.  I think the possibilities are
> really cool too.  I was thinking about it again, and I
> think that event if things like the backend,
> allocation, and reference types were templatized and
> instantiated at compile time that it would be easy to
> decouple it from the paragui internals by using
> interface functions that would be generated at
> compile-time, via virtual functions in a
> non-templatized base-class.  It seems like some people
> are doing commercial development with paragui, but
> they haven't given their opinions.  It's too bad there
> isn't more participation, because changes like these
> are are going to be a big-deal to people developing
> with the library, and more people putting their heads
> together right now while it's being designed will
> really help.

Right. But to be honest: I stopped complaining about that a long time
ago. It's useless. I really tried everything to get response (sometimes
i really freaked out).
Nowadays I don't even think about it. If people want to bring in their
thoughts,.. ok. If not,... bad luck. The world will keep spinning.

> Anyway Alex, what are the plans for
> the XML layout and how does it interact with a
> widget-factory?  I haven't even used the layout engine
> yet.

The problem with the current implementation is that it's static. There
are functions for parsing XML attributes for every widget of the lib.
It's impossible to extend the functionality for user defined widgets.

My idea was to provide a basic framework for XML layout loading and
passing parsing of widget attributes back to the widget.

To acomplish that there is need for dynamically created widgets
(depending on the XML layout).

One way to do this could be:

PG_FactoryBaseClass {
        virtual ~PG_FactoryBaseClass();
        virtual bool ParseXMLAttributes(..);
}

template <class T> PG_FactoryObject : virtual public {
        static T* CreateObject(PG_Widget* parent) {
                return new T(parent);
        }
}

template<class T> PG_Factory::RegisterClass(const char* classname) {
        register the static CreateObject function pointer
        map[classname]=createfuntion;
}

PG_Widget* PG_Factory::CreateObject(const char* classname) {
}

A widget would subclass PG_FactoryObject:

PG_Widget : public PG_MessageObject, public PG_FactoryObject<PG_Widget>
{
        ...
        bool ParseXMLAttributes(..);
}

The layout loader would do the following:

- Read XML file, get objecttype
- Create the object
- Pass parsing of XML attributes to the created object

Does this make sense ?

Alex






reply via email to

[Prev in Thread] Current Thread [Next in Thread]