Open main menu

CDOT Wiki β

Changes

Console UI Core Classes - OOP344 20111

6,616 bytes added, 23:42, 9 March 2011
CDialog
private:
int _fnum;
/* Suggestion: */
int _curidx;
CField* _fld[C_MAX_NO_FIELDS];
bool _dyn[C_MAX_NO_FIELDS];
/* you can do this part any way you like only if it covers the minimum requirements of the assignment*/
/* talk to your professor if you want to do it differently */
bool _editable;
public:
void draw(int fn = C_FULL_FRAME);
int edit(int fn = C_FULL_FRAME);
 
int add(CField* field, bool dynamic = true);
int add(CField& field, bool dynamic = false);
CDialog& operator<<(CField* field);
CDialog& operator<<(CField& field);
 
bool editable();
int fieldNum()const;
int curIndex()const;
 
CField& operator[](unsigned int index);
CField& curField();
};
</syntaxhighlight></big>
==CLineEdit==
<big><syntaxhighlight lang="cpp">
#pragma once
#include "cfield.h"
 
class CLineEdit: public CField{
bool _dyn;
int _maxdatalen;
int* _insertmode;
int _curpos;
int _offset;
public:
CLineEdit(char* Str, int Row, int Col, int Width,
int Maxdatalen, int* Insertmode,
bool Bordered = false,
const char* Border=C_BORDER_CHARS);
CLineEdit(int Row, int Col, int Width,
int Maxdatalen, int* Insertmode,
bool Bordered = false,
const char* Border=C_BORDER_CHARS);
~CLineEdit();
void draw(int Refresh = C_FULL_FRAME);
int edit();
bool editable()const;
void set(const void* Str);
};
</syntaxhighlight></big>
==CButton==
<big><syntaxhighlight lang="cpp">
#pragma once
#include "cfield.h"
class CButton: public CField{
int _length;
public:
CButton(const char *Str, int Row, int Col,
bool Bordered = true,
const char* Border=C_BORDER_CHARS);
virtual ~CButton();
void draw(int rn=C_FULL_FRAME);
int edit();
bool editable()const;
void set(const void* str);
};
 
</syntaxhighlight></big>
 
==CCheck==
<big><syntaxhighlight lang="cpp">
#include "cfield.h"
#include "clabel.h"
class CCheck : public CField{
int _flag;
int _radio;
char _format[4];
CLabel Label;
public:
CCheck(bool Checked,const char* Format, const char* Text, int Row, int Col, int Width, bool IsRadio = false);
CCheck(const CCheck& C);
void draw(int fn = C_NO_FRAME) ;
int edit();
bool editable()const;
void set(const void* flag);
void *data();
bool checked()const;
void checked(bool val);
};
</syntaxhighlight></big>
==CMenuItem==
<big><syntaxhighlight lang="cpp">
#include "cfield.h"
class CMenuItem:public CField{
int _selected;
char _format[3];
char* _text;
public:
CMenuItem(bool Selected,const char* Format, const char* Text, int Row, int Col, int Width);
CMenuItem(const CMenuItem &CM);
virtual ~CMenuItem(void);
void draw(int fn = C_NO_FRAME) ;
int edit();
bool editable()const;
void set(const void* Selected);
bool selected()const;
void selected(bool val);
const char* Text();
};
</syntaxhighlight></big>
 
==CValEdit==
<big><syntaxhighlight lang="cpp">
#include "clineedit.h"
 
class CValEdit: public CLineEdit{
void (*_help)(MessageStatus, CDialog&);
bool (*_validate)(const char*, CDialog&);
public:
CValEdit(char* Str, int Row, int Col, int Width,
int Maxdatalen, int* Insertmode,
bool (*Validate)(const char* , CDialog&) = NO_VALDFUNC,
void (*Help)(MessageStatus, CDialog&) = NO_HELPFUNC,
bool Bordered = false,
const char* Border=C_BORDER_CHARS);
CValEdit(int Row, int Col, int Width,
int Maxdatalen, int* Insertmode,
bool (*Validate)(const char* , CDialog&) = NO_VALDFUNC,
void (*Help)(MessageStatus, CDialog&) = NO_HELPFUNC,
bool Bordered = false,
const char* Border=C_BORDER_CHARS);
int edit();
};
 
</syntaxhighlight></big>
 
==CText==
<big><syntaxhighlight lang="cpp">
#include "strarr.h"
#include "cfield.h"
class BFrame;
 
class CText:public CField{
WHATEVER _lines; // a collection of lines in a text
bool _readOnly;
int _curpos;
int _fieldlen;
int _maxdatalen;
int* _insertmode;
int _offset;
int _lcurpos;
int _loffset;
// bool _dynamic;
public:
CText(int Row, int Col, int Width, int Height, bool Readonly,
int* Insertmode, const char* Border=C_BORDER_CHARS);
CText(const char* Str, int Row, int Col, int Width, int Height, bool Readonly,
int* Insertmode, const char* Border=C_BORDER_CHARS);
void draw(int fn = C_FULL_FRAME);
 
void set(const void *Str);
void *data();
 
int edit();
bool editable()const;
bool readOnly();
void readOnly(bool val);
~CText();
};
</syntaxhighlight></big>
 
 
==C==
<big><syntaxhighlight lang="cpp">
 
</syntaxhighlight></big>
 
 
==C==
<big><syntaxhighlight lang="cpp">
#include "cfield.h"
#include "ccheck.h"
class CCheckList;
class CCheckList : public CField{
??????
bool _radio;
char _format[4];
int _cnt;
unsigned int _flags;
public:
CCheckList(const char* Format, int Row, int Col, int Width,bool radio, bool Bordered = true,const char* Border=C_BORDER_CHARS);
CCheckList& add(const char* Text, bool selected = false);
void draw(int fn = C_FULL_FRAME);
int edit();
void* data();
void set(const void* data);
bool& operator[](unsigned int index);
bool editable()const;
bool radio();
void radio(bool val);
~CCheckList(void);
};
</syntaxhighlight></big>
#include "cfield.h"
#include "cmenuitem.h"
class Cmenu;
 
==class CMenu : public CField{
?????
public:
CMenu(const char* Format, int Row, int Col, int Width, bool Bordered = true,const char* Border=C_BORDER_CHARS);
CMenu& add(const char* Text, bool selected = false);
void draw(int fn = C_FULL_FRAME);
int edit();
void* data();
void set(const void* data);
int selectedIndex();
int selectedIndex(unsigned int index);
const char* selectedText();
void selectedText(char *text);
bool editable()const;
~CMenu(void);
};
==Make File==
<big><pre>
prj: iol.o fwborder.o fwfield.o fwlabel.o fwlineedit.o fwbutton.o fwcheck.o fwveditline.o fwdialog.o fwtext.o strarr.o testmains.o
c++ iol.o fwborder.o fwfield.o fwlabel.o fwlineedit.o fwbutton.o fwcheck.o fwveditline.o fwdialog.o fwtext.o strarr.o testmains.o \
-lncurses -oprj
 
iol.o: iol.c iol.h
cc -c iol.c
 
fwborder.o: fwborder.cpp fwborder.h confw.hiol.h
c++ -c fwborder.cpp
 
fwfield.o: fwfield.cpp fwfield.h fwborder.h confw.h iol.h
c++ -c fwfield.cpp
 
fwlabel.o: fwlabel.cpp fwlabel.h fwfield.h fwborder.h confw.h iol.h
c++ -c fwlabel.cpp
 
fwlineedit.o: fwlineedit.cpp fwlineedit.h fwfield.h fwborder.h confw.h iol.h
c++ -c fwlineedit.cpp
 
fwbutton.o: fwbutton.cpp fwbutton.h fwfield.h fwborder.h confw.h iol.h
c++ -c fwbutton.cpp
 
fwcheck.o: fwcheck.cpp fwcheck.h fwlabel.h fwfield.h fwborder.h confw.h iol.h
c++ -c fwcheck.cpp
 
fwveditline.o: fwveditline.cpp fwveditline.h fwlineedit.h fwfield.h fwborder.h confw.h iol.h
c++ -c fwveditline.cpp
fwtext.o: fwtext.cpp fwtext.h fwlineedit.h strarr.h fwfield.h fwborder.h confw.h iol.h
c++ -c fwtext.cpp
 
strarr.o: strarr.cpp strarr.h
c++ -c strarr.cpp
 
fwdialog.o: fwdialog.cpp fwdialog.h fwfield.h fwborder.h confw.h iol.h
c++ -c fwdialog.cpp
testmains.o: testmains.cpp fwdialog.h strarr.h fwtext.h fwveditline.h fwcheck.h fwbutton.h fwlineedit.h fwlabel.h fwfield.h fwborder.h iol.h
c++ -c testmains.cpp
 
</pre></big>