next up previous contents
Next: The custum drawing function Up: Menu engine Previous: The "move" mode   Contents


The levels

The menu engine can works with levels. The level of each item is decribed by this folowing structure:
\begin{lstlisting}
typedef struct {
char level:6,
hide:1,
draw:1;
} h_MenuLevel;
\end{lstlisting}
As the definition of the structure shows, !level! starts from 0 (the root level) to 26-1=63 (the most little leaf). Another field !hide! describes if the item should be hide or not and the last field !draw! is internally used to know if an entry should be drawn or not.

If we want to do:

+ l_1
  + l_11
  + l_12
    + l_121
  + l_13
+ l_2
+ l_3
  + l_31
  + l_32

So the structure should be:
\begin{lstlisting}
h_MenuLevel level_tab[ = {{.level=0, //l_1
.hide=0,
.draw=1...
... .hide=0,
.draw=1},
{.level=1, //l_32
.hide=0,
.draw=1}
};
\end{lstlisting}

Then if you want to hide every subnode of !l_1!:


\begin{lstlisting}
h_MenuLevel level_tab[] = {{.level=0, //l_1
.hide=0,
.draw=...
... .hide=0,
.draw=0},
{.level=1, //l_32
.hide=0,
.draw=0}
};
\end{lstlisting}
The engine will only draw:

+ l_1
+ l_2
+ l_3
  + l_31
  + l_32



2006-02-19