next up previous contents
Next: Configuration Up: Menu engine Previous: The levels   Contents


The custum drawing function

For special application, the entries of the menu can be other object than strings. The engine can only draw item that are strings, so yo should provide a function to draw the item. A such function should have the folowing type:
\begin{lstlisting}
typedef void (*h_fctDrawMenu) (short i, short x, short y, h_Menu * hmenu,
h_ScreenMem screen);
\end{lstlisting}
The parameters of the function are:

!i!: is the number of the item
!x! and !y!: this is the position of the entry in the screen
!h_menu!: it is the !h_Menu! structure which is used for the menu (so you can have access to the !tab!)
!screen!: this is the screen where the item would be drawn

An exemple of this type of use is the "home" menu of HibView. This menu show the variables of the Ti as a tree. In fact, the !tab! used for this menu is a table of !HSym!. Then, to draw correctly the name of the variable, and further more some additionnal informations of the selected object, the folowing drawing function is passed to the menu engine.


\begin{lstlisting}
void h_drawVAT(short i, short x, short y, h_Menu * hmenu,
h_...
...Str(hmenu->font,LCD_WIDTH/2+15,25,ext,FALSE,FALSE,screen);
}
}
\end{lstlisting}


next up previous contents
Next: Configuration Up: Menu engine Previous: The levels   Contents
2006-02-19