Open main menu

CDOT Wiki β

Changes

Console UI Core Classes - OOP344 20113

2,962 bytes added, 09:47, 8 November 2011
Methods
bool editable()const;
</syntaxhighlight></big>
 
 
 
==CCheck==
<big><syntaxhighlight lang="cpp">
#include "cfield.h"
#include "clabel.h"
namespace cio{
class CCheckMark : public CField{
bool _flag;
bool _radio;
char _format[4];
CLabel Label;
public:
CCheckMark(bool Checked,const char* Format, const char* Text, int Row, int Col, int Width, bool IsRadio = false);
CCheckMark(const CCheckMark& C);
void draw(int fn = C_NO_FRAME) ;
int edit();
bool editable()const;
void set(const void* flag);
bool checked()const;
void checked(bool val);
};
}
 
</syntaxhighlight></big>
===Attributes===
<big><syntaxhighlight lang="cpp">
int _flag;
int _radio;
char _format[4];
CLabel _Label;
</syntaxhighlight></big>
*'''_flag''' holds the status of the Checkbox (0: unchecked or 1: checked ) and is pointed by _data pointer .
*'''_radio''' dictates the behavior of the Checkbox as a radio-button, or a check-mark.
*'''_format''' holds the characters, the Checkbox is drawn with (i.e. "[X]", "(O)", "<*>", etc...).
*'''_Label''' holds the Label attached to the this Checkbox
===Constructor / Destructor===
<big><syntaxhighlight lang="cpp">
CCheck(bool Checked,const char* Format, const char* Text, int Row, int Col, int Width, bool IsRadio = false);
</syntaxhighlight></big>
*Passes the Row, Col, Width and "1" to row, col, width and height arguments of CField and directly initializes* _Label with Text, 0, 4, and (Width-4) for Str, Row, Col and Len, arguments of CLabel's Constructor.<br />
*: *see page 64 of Practical Programming Techniques Using C++
*Sets the frame of _Label to itself
*Sets _flag to Checked
*Sets _radio to IsRadio
*Copies Format to _format
*Sets _data to the address of _flag
<big><syntaxhighlight lang="cpp">
CCheck(const CCheck& C);
</syntaxhighlight></big>
*Passes incoming CCheck reference ("C") to CField's copy constructor, and directly initializes the _Label with the _Label of C
*Sets all the attributes of this object to the attributes of incoming CCheck reference ("C")
*Sets _data to the address of _flag
 
===Methods===
<big><syntaxhighlight lang="cpp">
void draw(int fn = C_NO_FRAME) ;
</syntaxhighlight></big>
*Uses iol_displayflag() to display _flag using _format at absRow() and absCol()
*Then draw()s the _Label
<big><syntaxhighlight lang="cpp">
int edit();
</syntaxhighlight></big>
*returns iol_flag()'s returned value.
*:iol_flag is to edit the value of _flag using the same arguments used in draw() as radiobutton or checkbox depending to the value of _radio
<big><syntaxhighlight lang="cpp">
bool editable()const;
</syntaxhighlight></big>
*Always return true;
<big><syntaxhighlight lang="cpp">
void set(const void* flag);
</syntaxhighlight></big>
*Casts the incoming flag pointer to an (int*) and sets the content of '''_flag''' to where '''flag''' is pointing to.
<big><syntaxhighlight lang="cpp">
bool checked()const;
void checked(bool val);
</syntaxhighlight></big>
*These methods set and get _flag.
 
 
Always returns true;
<big><syntaxhighlight lang="cpp">