home *** CD-ROM | disk | FTP | other *** search
- /***
- * CGestisciTE_v02.h
- *
- * Handle a textEdit field.
- * © 1994-96 Francesco Cadili.
- *
- ****/
- #ifndef __CGestisciTE__
- #define __CGestisciTE__
- #ifndef __Cstring_P__
- #include "Cstring_P_v32.h"
- #endif
- #include <Fonts.h>
- #include <Events.h>
- #include <Dialogs.h>
- #include <Controls.h>
- #include <QuickDraw.h>
-
- class CGestisci_TE
- {
- private:
- /*** "InitData(textFont, textHeight)"
- *
- * Inizializza i dati relativi al DLOG.
- * (Presuppone che i primi dati della struttura globale
- * siano presenti).
- *
- * Par INPUT: 'textFont' la fonte del campo text edit,
- * 'textHeight' l'altezza del campo text edit.
- * Val OUTPUT: false se tutto ok, true altrimenti.
- *
- ***/
- Boolean InitData(short textFont, short textHeight, Rect &editRect,
- Boolean hasScroll, Boolean hasOrizScroll,
- Boolean noWarpAround, Boolean canModify,
- Boolean useChicagoRef, Boolean maximizeField);
-
- /*** clickInEdit(&theEvent);
- *
- * gestisce il click nel campo Text Edit.
- *
- ****/
- Boolean clickInEdit(EventRecord *theEvent);
-
- /*** "clickInVerScroll(&theEvent)"
- *
- * Gestisce i click nella scroll Bar verticale.
- *
- * Non tratta il doppio click e lo scroll mentre il bottone é abbassato.
- *
- * Par INPUT: 'TEHdl' il puntatore alla struttura dati attuale,
- * 'theEvent' il puntatore al record dell'evento attuale;
- * Val OUTPUT: false se tutto ok, true altrimenti.
- ***/
- Boolean clickInVerScroll(EventRecord *theEvent);
-
- /*** "clickInHorScroll(&theEvent)"
- *
- * Gestisce i click nella scroll Bar orizzontale.
- *
- * Non tratta il doppio click e lo scroll mentre il bottone é abbassato.
- *
- * Par INPUT: 'TEHdl' il puntatore alla struttura dati attuale,
- * 'theEvent' il puntatore al record dell'evento attuale;
- * Val OUTPUT: false se tutto ok, true altrimenti.
- ***/
- Boolean clickInHorScroll(EventRecord *theEvent);
-
- protected:
- DialogPtr theDialog; // il puntatore al dialog che contiene i campi;
- RGBColor backGround; // il colore di BackGround;
- short linee; // il numero di linee del campo textEdit;
- Boolean attivo; // se il text edit è attivo.
- short top; // il valore del control
- short left; // il valore del control
- short styleID;
- int maxHorChar;
-
- /*** Procedura "mostaTesto()"
- *
- * Mosta la parte attuale del TextEdit.
- * Chiamare qggiustaScroll per sistemare il
- * testo.
- *
- ****/
- void mostraTesto(void);
-
- /*** keyStroke1st(TEHdl);
- *
- * Gestisce l'inserimento nel text edit
- *
- * Par INPUT: 'theEvent' il puntatore al record dell'evento attuale;
- *
- *****************************************************************/
- Boolean keyStroke1st( EventRecord *theEvent, GrafPtr &port,
- RGBColor *BackColor, Boolean &modified);
-
- /*** result = sostituisciTesto1st(ptrStr, len);
- *
- * Sostituisce il contenuto del textEdit con un teso qualunque.
- *
- * Par INPUT: 'ptrStr' il puntatore alla stringa,
- * 'len' la lunghezza del testo.
- * Val OUTPUT: false se tutto ok, true altrimenti.
- *
- ***/
- Boolean sostituisciTesto1st(Cstring_P *str);
-
- /*** result = cancellaTesto1st();
- *
- * Cancella il contenuto del textEdit.
- *
- * Val OUTPUT: false se tutto ok, true altrimenti.
- *
- ***/
- Boolean cancellaTesto1st();
-
- /*** result = aggiungiTesto1st(str);
- *
- * Sostituisce il contenuto del textEdit con un teso qualunque.
- *
- * Par INPUT: 'str' il descrittore della stringa.
- * Val OUTPUT: false se tutto ok, true altrimenti.
- *
- ***/
- Boolean CGestisci_TE::aggiungiTesto1st(Cstring_P *str);
-
- public:
- TEHandle edit; // il campo text edit;
- ControlHandle scroll; // il campo di scroll;
- ControlHandle horScroll; // lo scroll orizzontale.
- Boolean canModify; // se il text edit èpuò essere modificato (per ora non usato).
- short TEitem; // il numero di item del User Item relativo al Text Edit;
- Boolean frame;
- Boolean canModifyApparence;
- Boolean overBox;
- enum {kStdFont = systemFont, kStdHeight = 12};
-
- /*** constructor
- *
- ***/
- CGestisci_TE(void);
-
- /*** destructor
- *
- ***/
- ~CGestisci_TE(void);
-
- /*** TEHdl = IGestisci_TE(theDialog, TEitem, CTRLitem, &backGround, textFont, textHeight)
- *
- * Alloca la struttura dati "gestTERec" nello Heap.
- *
- * Par INPUT: 'theDialog' il puntatore al dialog,
- * 'TEitem' il numero di item del campo text edit,
- * 'CTRLitem' il numero di item del campo di scroll,
- * '*backGround' lo sfondo del campo text edit,
- * 'textFont' la fonte del campo text edit,
- * 'textHeight' l'altezza del campo text edit.
- * Val OUTPUT: false se tutto ok, true altrimenti.
- *
- ***/
- Boolean IGestisci_TE( DialogPtr theDialog, short TEitem, Rect &editRect,
- RGBColor *backGround, short textFont,
- short textHeight, Boolean hasScroll = true,
- Boolean hasOrizScroll = false,
- Boolean noWarpAround = false,
- Boolean canModify = true, short styleID = 0,
- Boolean canModifyApparence = true,
- Boolean useChicagoRef = false,
- Boolean maximizeField = true);
-
- /*** Dispose()
- *
- * Dealloca la struttura dati "dataHdl".
- * Nota: da chiamare prima della deallocazione del
- * dialog (**TEHdl)->theDialog.
- *
- ***/
- void Dispose(void);
-
- /*** unFrame()
- *
- * Toglie il frame.
- *
- ***/
- void unFrame(void);
-
- /*** result = cancellaTesto();
- *
- * Cancella il contenuto del textEdit.
- *
- * Val OUTPUT: false se tutto ok, true altrimenti.
- *
- ***/
- Boolean cancellaTesto(void);
-
- /*** result = sostituisciTesto(str);
- *
- * Sostituisce il contenuto del textEdit con un teso qualunque.
- *
- * Par INPUT: 'str' la stringa.
- * Val OUTPUT: false se tutto ok, true altrimenti.
- *
- ***/
- Boolean sostituisciTesto(Cstring_P *str);
-
- /*** result = aggiungiTesto(str);
- *
- * Sostituisce il contenuto del textEdit con un teso qualunque.
- *
- * Par INPUT: 'ptrStr' il puntatore alla stringa,
- * 'len' la lunghezza del testo.
- * Val OUTPUT: false se tutto ok, true altrimenti.
- *
- ***/
- Boolean aggiungiTesto(Cstring_P *str);
-
- /*** attivaTesto();
- *
- * Attiva il Text Edit.
- * Val OUTPUT: false se tutto ok, true altrimenti.
- *
- ***/
- Boolean attivaTesto(Boolean selectAll = false, Boolean frame = false);
-
- /*** disabilitaTesto();
- *
- * Attiva il Text Edit.
- * Val OUTPUT: false se tutto ok, true altrimenti.
- *
- ***/
- Boolean disattivaTesto();
-
- /*** blink(TEHdl);
- *
- * gestisce il blink del cursore nel Text Edit
- * Val OUTPUT: false se tutto ok, true altrimenti.
- *
- ****/
- Boolean blink(void);
-
- /*** keyStroke(TEHdl);
- *
- * Gestisce l'inserimento nel text edit
- *
- * Par INPUT: 'theEvent' il puntatore al record dell'evento attuale;
- * Val OUTPUT: false se tutto ok, true altrimenti.
- *
- *****************************************************************/
- virtual Boolean keyStroke(EventRecord *theEvent);
-
- /*** clickInTE(&theEvent);
- *
- * gestisce il click nel campo Text Edit.
- * Val OUTPUT: false se tutto ok, true altrimenti.
- *
- ****/
- Boolean clickInTE(EventRecord *theEvent);
-
- /*** Procedura "AggiustaScroll()"
- *
- * Aggiusta lo scroll del campo corrente.
- * Sulla base del contenuto del campo
- *
- ***/
- void AggiustaScroll(void);
-
- /*** "listaFont()"
- *
- * Gestisce l'updateEvt nei campi definiti come "user"
- *
- ***/
- void updateEvt(void);
-
- /*** scrollFactor(scrollAmt)
- *
- * scrolla il testo up and down.
- *
- ***/
- void scrollFactor(short scrollAmt);
-
- /*** "AggiustaTesto()"
- *
- * Aggiusta l'TE.
- *
- ***/
- void AggiustaTesto(void);
-
- /***
- *
- * Set the font of a new character
- *
- ***/
- Boolean setFont(short fontNum, Point *thePoint);
-
- /***
- *
- * Set the size of a new character
- *
- ***/
- Boolean setSize(short fontSize, Point *thePoint);
-
- /***
- *
- * Set the size of a new character
- *
- ***/
- Boolean setStyle(short fontSize, Point *thePoint);
-
- /*** GetFontInfo()
- *
- * get the font info.
- *
- ***/
- Boolean GetFontInfo(short *font, short *size, short *face);
-
- /*** copy()
- *
- ***/
- Boolean copy();
-
- /*** paste
- *
- ***/
- Boolean paste();
-
- /*** cut
- *
- ***/
- Boolean cut();
-
- /*** cancel
- *
- ***/
- Boolean cancel();
- };
- #endif
-
-