glob2-devel
[Top][All Lists]
Advanced

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

Re: [glob2-devel] The widget system


From: Stéphane Magnenat
Subject: Re: [glob2-devel] The widget system
Date: Mon, 13 Mar 2006 22:12:36 +0100
User-agent: KMail/1.9.1

Hi,

> I have a variety of questions about the widget system. It has a very
> c-ish interface, with all the const char*s and what not. But, past
> that, here are my questions:

Ideally everything would be C++ strings. C-ish things are just an history side 
effect.

> 1) How is memory managed? In all your classes, you 'new' objects, like
> buttons, but you don't delete them in the destructor. And I see no
> sign of "passing respondibility", where the button is assigned a
> parent and its the parents job to destroy the button, so its all done
> automatically.

The code is in libgag/src/GUIBase.cpp, in GUIScreen::~GUIScreen
The screen collects all widgets added throug addWidget(...) when destroyed.
The screen is thus the parents of the widgets.

> 2) How are events handled? The current system seems very ad-hoc
> (theres that word again), it seems to have something to do with
> onAction but I can't tell.

Widgets got events through Widget::onSDLEvent, and they produce actions that 
can be collected in onAction in subclasses of Screen

> 3) What are unicode shortcuts? How are fonts referenced?

Fonts are refered by name and lookup through the Toolkit which holds 
collection of fonts (see libgag/include/Toolkit.h and libgag/src/Toolkit.cpp)

Unicode shortcut are the unicode character that trigger a key shortcut on a 
given button.

> 4) All of the menus seem to use exact indices, except for the yog
> menu, which stretches out to the edges of the screen. Why is this so?

Because we though then when you have IRC, the more space you have to read the 
better. libgag's widget support a primitive form of layouting, which can been 
seen in libgag/src/GUIBase.cpp in RectangularWidget::getScreenPos

> 5) Are we planning a rewrite of all of these systems? Perhaps use an
> existing SDL widgets library? (They do exist)

Well, there is a Qt port but it would take some time until completion. libgag, 
although a bit strange, has more feature, specially in widget interaction, 
than most of SDL widgets libs.

Libgag has preliminary theming support so the graphics ID passed to the button 
should be ignored for now. They are not used in glob2's code anyway.

I hope it helps,

Steph




reply via email to

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