Aggiunta gestione di get e set_picture ai form items

git-svn-id: svn://10.65.10.50/trunk@2272 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1995-12-11 17:36:57 +00:00
parent 837b4c0c46
commit 780df3a079
2 changed files with 44 additions and 30 deletions

View File

@ -663,6 +663,18 @@ bool TForm_item::edit(TMask& m)
return dirty; return dirty;
} }
const TString& TForm_item::picture() const
{
CHECK(0, "Can't get the picture of a generic form item!");
return _prompt;
}
void TForm_item::set_picture(const char*)
{
CHECK(0, "Can't set the picture of a generic form item!");
}
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// TForm_subsection // TForm_subsection
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
@ -866,14 +878,13 @@ protected:
virtual const char* get() const; virtual const char* get() const;
bool set(const char*); bool set(const char*);
const TString& picture() const { return _picture; }
TFieldref& field(int i) const { return (TFieldref&)_field[i]; } TFieldref& field(int i) const { return (TFieldref&)_field[i]; }
void put_paragraph(const char* s); void put_paragraph(const char* s);
public: public:
virtual const TString& picture() const { return _picture; }
virtual void set_picture(const char* p) { _picture = p; }
void set_picture(const char* p) { _picture = p; }
virtual bool edit(TMask& m); virtual bool edit(TMask& m);
TForm_string(TPrint_section* section) : TForm_item(section) {} TForm_string(TPrint_section* section) : TForm_item(section) {}
virtual ~TForm_string() {} virtual ~TForm_string() {}
@ -1030,7 +1041,7 @@ void TForm_string::put_paragraph(const char* s)
_effective_height= i - (_prompt.not_empty() ? 1 : 0); _effective_height= i - (_prompt.not_empty() ? 1 : 0);
} }
else else
string_at(-1, _y, s); string_at(-1, _y, s);
} }
@ -2782,30 +2793,30 @@ bool TForm::write_profile()
void TForm::init() void TForm::init()
{ {
_relation= NULL; _relation= NULL;
_cursor= NULL; _cursor= NULL;
_rel_desc= NULL; _rel_desc= NULL;
_isnew= FALSE; _isnew= FALSE;
_fontname= "Roman 17cpi"; _fontname= "Roman 17cpi";
_fontsize= 12; _fontsize= 12;
_x= 0; _x= 0;
_y= 0; _y= 0;
_char_to_pos= '\0'; _char_to_pos= '\0';
_ipx= 0; _ipx= 0;
_ipy= 0; _ipy= 0;
_fpx= 0; _fpx= 0;
_arrange= TRUE; _arrange= TRUE;
_fink= "+,+,+,+,+,+,+,+,+,-,|"; _fink= "+,+,+,+,+,+,+,+,+,-,|";
_fink.separator(','); _fink.separator(',');
_dirty= FALSE; _dirty= FALSE;
} }
void TForm::read(const char* name, const char* code, int lev, const char* desc) void TForm::read(const char* name, const char* code, int lev, const char* desc)
{ {
_name= name; _name= name;
_code= code; _code= code;
_editlevel= lev; _editlevel= lev;
_desc= desc; _desc= desc;
main_app().begin_wait(); main_app().begin_wait();
@ -2872,13 +2883,13 @@ void TForm::read(const char* name, const char* code, int lev, const char* desc)
TForm::TForm() TForm::TForm()
{ {
init(); init();
} }
TForm::TForm(const char* name, const char* code, int lev, const char* desc) TForm::TForm(const char* name, const char* code, int lev, const char* desc)
{ {
init(); init();
read(name, code, lev, desc); read(name, code, lev, desc);
} }
TForm::~TForm() TForm::~TForm()

View File

@ -134,8 +134,8 @@ class TForm : public TObject
bool ps_change_number_format(TPrint_section& s, int w, int dec, const char* p); bool ps_change_number_format(TPrint_section& s, int w, int dec, const char* p);
protected: protected:
void init(); // inizializza il form void init(); // inizializza il form
void read(const char* form, const char * code = "", int editlevel = 0, const char* desc = ""); // carica il form dal file specificato void read(const char* form, const char * code = "", int editlevel = 0, const char* desc = ""); // carica il form dal file specificato
// H = Header, B = Body, F = Footer, R = Relation // H = Header, B = Body, F = Footer, R = Relation
TPrint_section& section(char s = 'B', word page = 1); TPrint_section& section(char s = 'B', word page = 1);
@ -295,7 +295,10 @@ public:
virtual const char* get() const { return _prompt; } virtual const char* get() const { return _prompt; }
virtual bool set(const char* s) { _prompt = s; return TRUE; } virtual bool set(const char* s) { _prompt = s; return TRUE; }
const char* prompt() const { return _prompt; } const TString& prompt() const { return _prompt; }
virtual const TString& picture() const; // Da' CHECK
virtual void set_picture(const char*); // Da' CHECK
TPrint_section& section() const { return *_section; } TPrint_section& section() const { return *_section; }
TForm& form() const { return _section->form(); } TForm& form() const { return _section->form(); }