Changes

Jump to: navigation, search

OOP344 20102 TextEdit

22 bytes added, 14:25, 26 June 2010
no edit summary
Include your already existing C code into your C++ code as follows:
<big><syntaxhighlight lang="cpp">
extern "C"{
#include "iof.h"
};
</syntaxhighlight></big>
This tells to C++ compiler, the included header file contains C functions and should be complied and called as such. Remember, you do not need and should not rename your iof.c to iof.cpp, since the compiler is already aware of the C functions in iof.c.
Also as mentioned above, A Form object is responsible to hold the input/output objects and display and edit them in an orderly fashion. A Form, so to speak, could be an array or list of input/output objects.
These objects by design, could be framed, which means they can have a border drawn around them. Because of this, a class needs to be designed to represent a Frame (we call it '''IOFrame''') to represent a Frame and this class should be inherited by all Framed objects.
Also, the input/output objects all have the same purpose (that is displaying or editing something). This "same purpose" will be encapsulated in a class called '''IOField''' that presents the idea of an input/output object in a form.
Also, the input/output objects all have the same purpose (that is displaying or editing something). This "same purpose" will be encapsulated in an abstract class called '''[[#IOField | IOField]]''' that presents the idea of an input/output object in a form.
== IOFrame ==
<br />
[[OOP344 20102 IOFrame test main|A main() function to test IOFrame::draw Offsets]]<br />
 
 
 
== IOField ==
class IOForm: public IOFrame{
private: int _fnum; int _curidx; IOField* _fld[MAX_NO_FIELDS]; bool _dyn[MAX_NO_FIELDS]; bool _editable; IOForm* _owner; public: IOForm(int row = -1, int col = -1, int width = -1, int height = -1, bool framed = false); virtual ~IOForm(); void display(int fn = OT_CLR_AND_DSPLY_ALL)const; int edit(int fn = 0, IOForm* owner = (IOForm*)0); IOForm& add(IOField* field, bool dynamic = true); IOForm& add(IOField& field, bool dynamic = false); bool editable(); int fieldNum()const; int curField()const; IOForm& set(IOForm* owner);
IOField& operator[](unsigned int index);
};
= Executable Samples on Matrix=
* Bframe test: ~fardad.soleimanloo/bframetest
* optext Release 0.3: ~fardad.soleimanloo/optext0.3
== compiling under Linux ==
To compile in matrix, use:
g++ yada.cpp yadoo.cpp -x c biofiof.c -lncurses
If you have many cpp's, you may also do
g++ *.cpp -x c biofiof.c -lncurses
== Sample makefile for TextEdit ==
<big><pre>
textedit: iof.o ioframe.o iofield.o iolabel.o ioedit.o ioform.o optexttextedit.o c++ iof.o ioframe.o iofield.o iolabel.o ioedit.o ioform.o optexttextedit.o \
-lncurses -otextedit
c++ -c ioedit.cpp
ioform.o: ioform.cpp ioform.h iotext.h IOFieldiofield.h
c++ -c ioform.cpp
optexttextedit.o: optexttextedit.cpp iotext.h iolabel.h ioedit.h ioform.h IOFieldiofield.h
c++ -c optext.cpp
</pre></big>

Navigation menu