GTK+ Custom Widgets: General Definitions

Writing a GTK+ custom widget with Vala is easy. First all create an XML definition with a top level container widget and a set of child ones. You can use Glade to do so. This is not a tutorial for Glade, so let start at with an already designed template UI file.

For this Glade UI file to be useful in this tutorial pay attention on:

  1. The top level widget’s type must be the same of the one your Vala class is derived from.
  2. The top level widget in your UI file must be declared as a template and should have the same ID as your class, this is the C name, a class called Cust.DateChooser, should be called CustDateChooser in order to allow Vala’s compiler to find its UI definition.
  3. The child widgets, to be controlled by your class should have an ID.

Take in account all these for following delivers.

Continue reading “GTK+ Custom Widgets: General Definitions”