Hello,
This seems to be a very interesting project, although very early.
I've a few simple questions that aren't answered in the documentation.
Is it possible to have custom widgets specified in the gtkaml code? If
so, how?
What's the best practice for keeping gtkaml XML in sync with the UI
code? Can it update the currently existing UI code, or do I have to
use "Do not touch" tactics, like a separate module for most of the
handlers?
I'm retracting this statement. The project is very advanced, though new. :)
>>
>> Is it possible to have custom widgets specified in the gtkaml code? If
>> so, how?
>
> The making of custom *composite* widgets is 99% of gtkaml's work.
> Every gtkaml file that starts with let's say <VBox> is a widget that derives
> from Gtk's VBox and has a composite user interface.
>
> Of course, if that widget has public properties it can be re-used in another
> gtkaml file and you can specify their value as XML attributes.
>
> For example, here we have a widget named MyVBox which can be used in another
> file just by entering <prefix:MyVBox>, if:
> - the definition of MyVBox contains a namespace name (e.g. add
> class:namespace="myns")
> - the file using MyVBox imports that namespace (e.g. add
> xmlns:prefix="myns") under the name prefix
>
This is so good, GtkBuilder has to be replaced or improved to be on-par.
> Pure custom widgets (as opposed to composite ones) can be written directly
> in Vala (using Gdk, or Cairo etc.) and can of course be used in a gtkaml
> file.
What's the syntax to reference one from gtkaml? Just <MyCustomWidget
class:namespace="MyWidgets.MyCustomWidget"...>?
Or is it class:namespace="MyWidgets"? Let's say it's in another module
that has to be included.
>
>>
>> What's the best practice for keeping gtkaml XML in sync with the UI
>> code? Can it update the currently existing UI code, or do I have to
>> use "Do not touch" tactics, like a separate module for most of the
>> handlers?
>>
>
> The recommended way would be not to modify the output. In fact, the next
> major gtkaml version will further integrate into Vala's AST so that it will
> not even output a vala file (you would still be able to check the generated
> code by using vala's --dump-tree).
Hmm. Interesting, but I still like the code, because then you don't
have to port to vala-0.10
for me to be able to use it (maybe with minor modifications to the
generated code, if any).
Although a port would be nice too, but not critical. I've both.
>
> That means you have to:
> - either write code in the <![[CDATA[ section of the root element (the
> quickest way)
And ugly unless I write some advanced XML+Vala syntax highlighting rules.
Could be useful for trivial stuff though. Or the following...
> - or use another vala class as a 'controller' to respond to events or any
> other way of calling other code that suits you. You would still have to use
> the code section but only to instantiate a such private member (or you can
> declare a non-visual instance with <yourprefix:MyVBoxController
> g:private='controller' g:standalone='true'>)
Everyone loves MVC. :)
> I have put a test example for this non-visual instance in test3 (nevermind
> the main is still in a gtkaml file).
I'm going to look at it right now.
Best regards,
Radoslaw
I'm retracting this statement. The project is very advanced, though new. :)
> Pure custom widgets (as opposed to composite ones) can be written directlyWhat's the syntax to reference one from gtkaml? Just <MyCustomWidget
> in Vala (using Gdk, or Cairo etc.) and can of course be used in a gtkaml
> file.
class:namespace="MyWidgets.MyCustomWidget"...>?
Or is it class:namespace="MyWidgets"? Let's say it's in another module
that has to be included.
Hmm. Interesting, but I still like the code, because then you don't
have to port to vala-0.10
for me to be able to use it (maybe with minor modifications to the
generated code, if any).
Although a port would be nice too, but not critical. I've both.