Hi Boyd,
Here something that might be interesting for you the gui is
rendered using the C++ version of AntiGrain Geometry (with C#
wrappers).
http://www.creativedocs.net/devs/gui
http://www.creativedocs.net/devs/agg
http://www.creativedocs.net/screenshots/
Zz
On Sunday, 15 December 2013 at 14:19:10 UTC, Boyd wrote:
On Sunday, 15 December 2013 at 12:59:27 UTC, MrSmith wrote:
Hi Boyd.
Have you uploaded your code somewhere so anyone can take a
look at it?
I Have not yet uploaded it, though I would like to. Where would
be a good place to put it?
Let me ask you some questions.
1. How have you done event propagation? Sinking and boobling
or something else? Can you cancel event propagation?
The event propagation method I use is event capturing. First
the event goes to the outer most widget which determines
whether to send it to child widgets.
2. How do you create platform dependent windows. Using WinAPI,
SFML, GLFW(+), SDL(+), GLUT?
Platform dependent widgets are not supported at this time. I
may add native widgets in the future, but right now it seems
more trouble than it's worth.
3. How are you rendering widgets? Using OpenGL(+), DirectX,
SDL, SFML, GDI? If it is OpenGL than what version of it?
I currently use GDI. It should not be that hard to change this,
though.
4. How your widgets are rendered? Do you have separate
GuiRenderer which knows how to render basic GUI elements(+) or
all widgets are directly calling OpenGL code?
I have created a Canvas class that does all the drawing. This
ensures platform independences.
You can also use graphic objects to do the drawing instead; the
TImageGraphic object draws an image, TTextGraphic draws text,
etc..
5. Do you have any styling of your widgets, external config,
CSS etc? If any how it is done? Can you set any image or
color, gradient to any widget?
I have plans for stylable widgets, but I don't have a concrete
design for this yet. I have some ideas though, and I intend for
it to be immensely flexible. Basically a stylable widget would
be a widget without a style at all. The widget would only
define a list of placeholder blocks that the theme would need
to fill.
For example: The TButtonWidget could define the placeholders
Normal, Hover, Down, DownHover. The theme would then determine
the exact content of these placeholders. Gradients, images,
text, borders, layout, you name it.
6. How is your resource management implemented? Do you have
any dedicated texture, font manager?
No I don't, although the theme system will do some resource
management. Would you consider this as an important feature
outside of themes?
7. Do you have animation support (plans to do it)?
No concrete plans, but eventually I do want to support it.
8. How is your widget events and properties implemented?
Signals, variants, reactive programming etc?
At first simply changing properties will have to do. I do
intend to support something similar to signals.
8. Do you have model and view separation? Controllers,
presenters?
I'm not sure what you mean. A GUI library by its very nature is
pure view.
9. How is your layouts implemented? Do you have layout
interface? What methods it has? When they are called?
There are to ways to do layout. You can inherit from a layout
component, in which case you would need to implement a few
functions. For example the gridlayout requires the
implementation of the following functions:
/// iterates through the rows of the grid
void ForeachRow(TCanvas canvas, void delegate(TGridLayoutRow)
exec);
/// iterates through the columns of the grid
void ForeachColumn(TCanvas canvas, void
delegate(TGridLayoutRow) exec);
/// returns the content of the specified grid cell
TGraphic GetCell(int x, int y);
The other method is to create a TGridWidget using the
constructor:
this(TGridLayoutRow[] columns, TGridLayoutRow[] rows,
TGraphic[][] cells)
10. Can you access property by its name like
widget.getProperty("width");
No. In what situation would you consider using this?
Also Widgets don't have any positional information in them, or
style information. This is one of main issues I have with the
existing GUI libraries.
11. Do you know that in D is common to use camelCase for
method names?
As I said earlier I built this library to cater to my every
whim, so I probably need to change my coding style slightly.
12. What other gui's are you looking at while making your own?
There are many gui libraries that have influenced my design,
but I don't plan to immitate any of them. Most influence come
from the old Borland delphi design, which is still used in many
of the current ones among which is QT, WxWidgets, other ideas
are from ExtJs and html/css. It is a fairly unique design
though, which is why I worry about whether it will be usable by
other programmers.
Thanks for the questions, I look forward to hear what you think
of my answers. Feel free to criticise.
Cheers,
Boyd