1. Exported functions

A theme engine must export these functions:

void metatheme_init(MT_ENGINE *engine);
void metatheme_exit(MT_ENGINE *engine);
void metatheme_realize(MT_ENGINE *engine);
void metatheme_draw_widget(MT_ENGINE *engine, MT_WINDOW *win, MT_RECTANGLE *area, int type, int state, int x, int y, int width, int height, MT_WIDGET_DATA *data);
void metatheme_draw_string(MT_ENGINE *engine, MT_WINDOW *win, int type, int state, MT_STRING *str);

1.1. metatheme_init

This function should initialize a theme. It might allocate a structure with it's private data and store the pointer to the data member of the MT_ENGINE structure.

This function should also set all metrics and gather colors from current palette. This function must not create any graphics contexts or pixmaps.

1.2. metatheme_exit

This function must free all resources obtained by the theme engine.

1.3. metatheme_realize

You should create any common graphics contexts and pixmaps in this function.

1.4. metatheme_draw_widget

This function is the core bussiness of a theme engine.

win

This is a window we draw on.

area

This is a (clip) rectangle which should be drawed. It might be NULL.

This rectangle is automatically used for clipping area, so you needn't to bother with it. It is provided for possibility of optimalization of drawing.

type

Type of the widget or it's part (see Widget types).

state

Current state of the widget or it's part (see Widget states).

x, y, width, height

This is a rectangle we draw within.

data

Additional informations about widget or it's part. For reference see the metatheme.h file and the chapter about Constants.

1.5. metatheme_draw_string

This function is used for customizing the appearance of texts in various widgets. However, it's use is very limited. The text is given as an opaque structure by which you can do ONLY the following things:

  1. do not display it at all

  2. display it as normal

  3. change the color of text and/or position

  4. repeat previous steps

The list of allowed widget types and states is listed here.