| Top |
The Tepl framework uses the TeplAbstractFactory singleton to create some
objects and widgets. By creating a subclass of TeplAbstractFactory (to
override the desired virtual functions) and setting the instance with
tepl_abstract_factory_set_singleton(), an application can tell Tepl to create
custom objects and widgets.
Note that GtkTextViewClass has the ::create_buffer factory method, that TeplView overrides to create a TeplBuffer. How the TeplView and TeplBuffer are created can be customized with the ::create_tab vfunc of TeplAbstractFactory.
void
tepl_abstract_factory_set_singleton (TeplAbstractFactory *factory);
Sets the TeplAbstractFactory singleton. This should be called early in
main(), for example just after calling tepl_init().
This function must be called only once, before the first call to
tepl_abstract_factory_get_singleton().
Tepl takes ownership of the factory
reference.
Since: 3.0
TeplAbstractFactory *
tepl_abstract_factory_get_singleton (void);
Gets the TeplAbstractFactory singleton instance.
If tepl_abstract_factory_set_singleton() has not been called, the singleton
is created with a TeplAbstractFactory instance.
Since: 3.0
TeplTab *
tepl_abstract_factory_create_tab (TeplAbstractFactory *factory);
Since: 3.0
GtkWidget * tepl_abstract_factory_create_tab_label (TeplAbstractFactory *factory,TeplTab *tab);
Creates a new tab label for tab
, suitable for gtk_notebook_set_tab_label().
a new GtkWidget, or NULL for the
default tab label (“page N” with GtkNotebook).
[transfer floating][nullable]
Since: 3.0
struct TeplAbstractFactoryClass {
GObjectClass parent_class;
TeplTab * (* create_tab) (TeplAbstractFactory *factory);
GtkWidget * (* create_tab_label) (TeplAbstractFactory *factory,
TeplTab *tab);
};
Virtual function pointer for |
||
Virtual function pointer for
|