===CMenu===
CMenu is a linked list of MNodes and also contains a CButton for a Title (only used on if in '''_dropdown''' mode). <br />Assuming that a CMenu is created with a title as "FILE" and menu-items as "Save, Load, Print, Quit":
*When in '''_dropdown''' mode:
*:When drawing, Only the _Title(CButton ) is drawn (and not the menu itself) and when <big><pre> FILE</pre></big>When edited (in '''_dropdown''' mode) the CButton gets activated and if it is hit, then the Menu will be displayed dropped down (drawn) under the CButton and used user can browse through the options and select one of them. selecting the option in this case will close the menu and CButton gets activated again:<br />when active, CMenu looks like this:<big><pre>[FILE]</pre></big>User hits enter: (since nothing is selected all menu items are unselected)<big><pre> FILE/-------\| Save || Load || Print || Quit |\-------/</pre></big>Now the cursor is standing under '''S'''ave.User hits down arrow twice to select '''P'''rint and then hits Space:<big><pre>[FILE]</pre></big>The Print is selected and The menu is closed and FILE is active again.If the user hits Enter again:<big><pre> FILE/-------\| Save || Load ||[Print]|| Quit |\-------/</pre></big>We will see the Print is selected and the cursor in under P.If user hits Enter instead of space, the selection wont change and whatever was selected before will remain the same:<big><pre>[FILE]</pre></big>User hits navigation keys and moves out of the CMenu Field.''Note that if '''left''' or '''right''' navigation keys are hit when the title is active, then they are translated to '''up''' or '''down''' respectively.
*When NOT in '''_dropdown''' mode:
*:The CButton will not be displayed at all, and when user starts to edit, he enters the menu browsing the items and if he gets to the end of the menu, the control go goes to the next field in the dialog. If user goes up and passes the first them, then the control will go to the previous field in the dalog.<big><pre>/-------\| Save || Load ||[Print]|| Quit |\-------/</pre></big>
====Attributes====
int edit();
</syntaxhighlight></big>
Editing of Edits the menu has two different parts that work together:*Editing the _Title (CButton)*Editing the CMenuItems#Editing the _Title#*If the CMenu is a '''_dropdown''' but way it is not '''_dropped''', then '''_Title should be edited#*:If the returned key is C_BUTTON_HIT; then '''_dropped''' should be set to true, explains in CMenu should be drawn and '''Editing the CMenuItems''' should commencedescription.<br />#*:however If it is key returned is not C_BUTTUN_HITtoo confusing, then CMenu::edit() is terminated returning the key. ''''''Note that in this case, if any of the two keys (LEFT or RIGHT) is hit, then instead (UP or DOWN) should be returned respectively'''''#*If the [[CMenu is a '''_dropdown''' and it is also '''_dropped''', then _Title is only drawn and '''Editing the CMenuItems''' will commence.#Editing the CMenuItems#* to be continued..pseudo code - OOP344 20113|pseudo code]] may help.
<big><syntaxhighlight lang = "cpp">
void set(const void* data);
</syntaxhighlight></big>
Sets the selected index to the integer pointed by data;
<big><syntaxhighlight lang = "cpp">
int selectedIndex();
</syntaxhighlight></big>
returns the selected index or -1 if nothing is selected
<big><syntaxhighlight lang = "cpp">
int selectedIndex(int index);
</syntaxhighlight></big>
sets the selected index.
<big><syntaxhighlight lang = "cpp">
const char* selectedText();
</syntaxhighlight></big>
returns the text of the selected menu, if nothing is selected, and empty string is returned.
<big><syntaxhighlight lang = "cpp">
bool editable()const;
</syntaxhighlight></big>
returns true if '''_cnt''' is greater than zero