Changes

Jump to: navigation, search

Console UI Core Classes - OOP344 20121

4 bytes added, 13:52, 1 April 2012
CLineEdit
===Due Date===
* ThuMon, Mar 29thApr 2nd, 201211:59:59 
===Tester===
* The testers are in [svn://zenit.senecac.on.ca/oop344/trunk/cioTesters Lecture Repository]
==CLabel==
A readonly Field that encapsulates console.display() function. (i.e it is responsible to display a short character string on the display) CLable CLabel although, by inheritance is Frame, but it is never '''bordered'''.
<big><syntaxhighlight lang="cpp">
#include "cfield.h"
<big><syntaxhighlight lang="cpp">
int _offset;
</syntaxhighlight></big>
current offset
</syntaxhighlight></big>
===Constructors / Destructor===
LineEdit, sets the Field's _data to the value of str. If LineEdit is instantiated with this constructor then it will edit an external string provided by the caller function of LineEdit. LineEdit in this case is not creating any dynamic memory, therefore _dyn is set to false (therefore the destructor will not attempt to deallocate the memory pointed by _data).<br />
The location (row and col) and Bordered are directly passed to the parent (FWFieldCField) and str is passed as data to the parent constructor. Unlike Label, LineEdit could have border or not so depending on this (Bordered being true or false) the Height is set to 3 or 1 respectfully. <br />(hint: use '''? :''' operator to pass the proper Height value to FWFieldCField's constructor)
<big><syntaxhighlight lang="cpp">
#Initializes the Label with (Text, 0, 1 and Width-2) for (Str, Row, Col, and Len)
#Sets the attributes to corresponding arguments
#Sets CFeildsCFields::_data to the address of _formated_format
#Sets the Label's frame to this object.
<big><syntaxhighlight lang="cpp">
CMenuItem(const CMenuItem &CM);
</syntaxhighlight></big>
#Passes CM to CFiled CField and Initializes the Label with CM
#Sets the _selected to _selected of CM
#Sets CFeildsCFields::_data to the address of _format
#Sets the Label's frame to this object.
void draw(int fn = C_NO_FRAME) ;
</syntaxhighlight></big>
#Draws the Label with fn
#If _selected is true, it surrounds the Label Text the _format[0] and _format[1]
#If _selected if false, it surrounds the Label with SPACEs (overwrites _format[0] and _format[1])
</syntaxhighlight></big>
Returns the text of Label
 
==CText==
CText is a CField to edit a multiline text.<br />
CCheckMark* _checkmarks[32];
</syntaxhighlight></big>
An array of 32 CCheckmark pointers that will piont point to _cnt dynamically allocated CCheckMarks.
<big><syntaxhighlight lang="cpp">
bool _radio;
int edit();
</syntaxhighlight></big>
*Draws the '''CCheckList''' then starts the editing the '''_checkmarks''' form '''_cur''' and according to the return key of CCheckMark::edit():
**If Down or Right key is hit it goes to the next '''_checkmark''', if '''_cur''' is the last one, then it exits the edit, returning the last key entered.
**UP and Left key works in opposite direction of Down and Right, if '''_cur''' is already zero, then it exits the edit, returning the last key entered.
1
edit

Navigation menu