home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2000 February
/
PCWorld_2000-02_cd.bin
/
Software
/
TemaCD
/
tcvpa
/
data1.cab
/
MyFileGroup
/
INCLUDE
/
PfForm.hpp
< prev
next >
Wrap
C/C++ Source or Header
|
1999-06-03
|
19KB
|
492 lines
#ifndef _INC_PFFORM_HPP
#define _INC_PFFORM_HPP
class TC_CPfField;
class TC_CPfArea;
class TC_CPfObjSet;
class TC_CPfTable;
class TC_CPfTree;
class TC_CPfTreeItem;
// **********************************************************************
struct TC_EvObjAction
: TC_Event
{
public:
enum EEvCode {
id_Undefined,
id_Inserted,
id_Changed,
id_Undone,
id_Restored,
id_BeforeStored,
id_AfterStored,
id_BeforeRemoved,
id_AfterRemoved,
};
public: EEvCode code ;
public: TC_CPsInstID inst_id ;
public: const char * attr_name ;
public: BOOL is_new ;
public: TC_EvObjAction () ;
public: TC_EvObjAction (EEvCode evCode, TC_CPsInstID instID) ;
}; // end of class TC_EvObjAction
// **********************************************************************
// **********************************************************************
class TC_CPfField
: public TC_CWindow
{
friend class TC_CPfArea;
private:
TC_CPfField(const TC_CPfField &);
TC_CPfField();
TC_CPfField & operator = (const TC_CPfField &);
protected: TC_CPfArea * m_Area ;
protected: TC_CPsAttribInfo m_AtInfo ;
public: TC_CIDataType * m_IDataType ;
protected: TC_CWindow * m_LabelWin ;
protected: TC_CWindow * m_ButtonWin ;
public: TC_CPfArea * m_AgentArea ;
protected: BOOL m_Modified ;
protected: TC_CPfHistory * m_History ;
protected: TC_CPfTimer m_SATimer ;
protected: void * m_Rsc ;
public: TC_CPfField (TC_CPfArea *cls, TC_CPsAttribInfo &atInfo) ;
public: virtual ~TC_CPfField () ;
public: BOOL IsCID () ;
public: BOOL IsOID () ;
public: BOOL IsObject () ;
public: BOOL IsAgent () ;
public: BOOL IsSuperAgent () ;
public: BOOL IsReadonly () ;
public: BOOL IsRightAlign () ;
public: BOOL IsRequired () ;
public: BOOL IsHidden () ;
public: BOOL IsNeedHistory () ;
public: TCPsHAttrib HAttrib () ;
public: const char * Name () ;
public: const char * Label () ;
public: const char * InFmt () ;
public: const char * OutFmt () ;
public: int RawSize () ;
public: int Type () ;
public: TC_CPsAttribUIData * AttribData () ;
public: BOOL HasValSet () ;
public: int ValSetCount () ;
public: const char * RscName () ;
protected: void FillFormer (TC_Former &f) ;
protected: void InitFormed () ;
protected: void DestroyMe () ;
private: void SubclassHidden (TC_Former &f) ;
public: void AttribToMe (TC_CPsObject *obj) ;
public: void MeToAttrib (TC_CPsObject *obj) ;
public: void AttribToBuffer (TC_CPsObject *obj, char *buf) ;
public: void InitAgentArea () ;
public: void RestoreAgentArea (TC_CPsObject * obj) ;
public: void SetDefaultValue () ;
public: BOOL Validate () ;
public: void Clear () ;
public: virtual void* GetInterface (LPCSTR name) ;
public: BOOL EvFmt (TC_Event_WIN *ev) ;
public: BOOL EvCallAid (TC_Event *) ;
public: BOOL EvCalendar (TC_Event *) ;
public: BOOL EvChange (TC_Event *) ;
public: BOOL EvSATimer (TC_Event_WM *ev) ;
public: BOOL EvHistList (TC_Event *) ;
public: BOOL EvHistPrev (TC_Event *) ;
public: BOOL EvDrawItem (TC_Event_WIN *ev) ;
protected: void SuperAgentQuery () ;
}; // end of class TC_CPfField
// **********************************************************************
// **********************************************************************
class TC_CPfArea
: public TC_CWindow
{
friend class TC_CPfField;
friend class TC_CPfObjSet;
private:
enum ERestoreParam {
rp_Restore,
rp_Undo,
};
protected: TC_CPsInstID m_InstID ;
public: TC_TArrayPTR<TC_CPfField> m_Fields ;
public: BOOL m_Modified ;
protected: TC_CPfObjSet * m_ObjSet ;
protected: TC_CPfField * m_AgentOf ;
protected: TC_TArrayPTR<TC_CPfArea> m_Details ;
public: TC_CPfArea * m_MasterArea ;
public: TC_CPsAttribInfo m_AtInfoFK ;
public: TC_CPfArea () ;
protected: void _Init (TC_CPsInstID inst_id) ;
protected: void _Reset () ;
protected: void _Clear () ;
protected: void ObjToFields (TC_CPsObject * obj) ;
protected: void FieldsToObj (TC_CPsObject *obj) ;
protected: TCPsRetCode DoRestore (TC_CPsInstID inst_id, ERestoreParam rp) ;
protected: TCPsRetCode RestoreAsAgent (TC_CPsInstID inst_id) ;
protected: void SetDefaultValues () ;
protected: void OnObjNotFound (TCPsHClass hCls) ;
public: TCPsHClass HClass () ;
public: BOOL HasCID () ;
public: ULONG GetOID () ;
public: BOOL CanInsert () ;
public: TC_CString RegEntry () ;
public: int IndexOf (const char *name) ;
public: int IndexOf (TC_CPsAttribInfo at_info) ;
public: TC_CPfField * Field (int idx) ;
public: TC_CPfField * Field (const char *name) ;
public: TC_CPfField * Field (TC_CPsAttribInfo at_info) ;
public: BOOL Store () ;
public: BOOL Restore (TC_CPsInstID inst_id) ;
public: BOOL Insert (TC_CPsInstID inst_id) ;
public: BOOL Remove () ;
public: void Undo () ;
public: void RestoreAssocs () ;
public: BOOL StoreAssocs () ;
public: void UndoAssocs () ;
public: void SetAssocValues (TC_CPsObject * obj) ;
public: void ResetAssocs () ;
public: void RestoreAsAssoc () ;
public: BOOL Associate (TC_CPfArea * area2assoc, TC_CPsAttribInfo atInfoCltn) ;
public: void Disassociate (TC_CPfArea * area) ;
public: void DisassociateAll () ;
public: void PrepareForClass (TCPsHClass hClass) ;
public: BOOL Validate () ;
public: BOOL CallDesigner () ;
public: virtual void* GetInterface (LPCSTR name) ;
public: virtual BOOL OnChange (const char *at_name) ;
public: void SetModified () ;
public: BOOL OnClose () ;
protected: static char bmpMarkers [];
public:
enum {
Mrk_Ok,
Mrk_Modified,
Mrk_New,
Mrk_NewModified,
Mrk_Empty,
};
public: void DrawMarker () ;
public: void MenuRightBtn (TC_CMenu *menu) ;
public: BOOL TC_CPfArea_RB_0 (TC_Event *e) ;
public: BOOL TC_CPfArea_RB_1 (TC_Event *e) ;
public: BOOL TC_CPfArea_RB_3 (TC_Event *e) ;
public: BOOL EvCreate (TC_Event*) ;
public: BOOL EvAccel (TC_Event_WIN *ev) ;
public: BOOL EvWmPaint (TC_Event*) ;
public: BOOL EvRBtnDown (TC_Event_WM *ev) ;
public: BOOL EvDesigner (TC_Event*) ;
public: BOOL EvClose (TC_Event*) ;
public: BOOL EvDestroy (TC_Event*) ;
public: BOOL CanAnyAction () ;
}; // end of class TC_CPfArea
// **********************************************************************
// **********************************************************************
class TC_CPfObjSet
: public TC_CWindow
{
friend class TC_CPfArea;
public: TC_CPfArea * m_Area ;
public: TC_CPsQuery m_Query ;
public: BOOL m_UsePopulateThread ;
protected: ULONG m_InitOID ;
protected: TCArrayINT m_NavigKeys ;
public: TC_CPfObjSet (TC_CPfArea * fClass) ;
public: virtual void Init (TCPsHClass hCls) ;
public: TCPsHClass HClass () ;
public: virtual void Reset () ;
public: virtual void MenuRightBtn (TC_CMenu*) =0 ;
public: virtual BOOL IsEmpty () =0 ;
public: void SetInitOID (ULONG oid) ;
public: virtual BOOL EvNavigate (TC_Event * ev) =0 ;
public: virtual const char * GetWinClass () =0 ;
public: virtual void SetObjClickEvent (TC_CWindow * win, C_EVENT_HANDLER id_h) =0 ;
public: virtual void Retrieve (TCPsHClass hCls) ;
public: virtual BOOL Populate () =0 ;
public: virtual ULONG GetCurOID () =0 ;
public: virtual BOOL CanAnyAction () =0 ;
public: virtual long GetWinStyle () ;
protected: void ResetAssocs () ;
public: virtual void OnObjRestored (TC_CPsInstID inst_id) =0 ;
public: virtual void OnObjStored (TC_CPsInstID inst_id, BOOL is_new) =0 ;
public: virtual void OnObjChanged (TC_CPsInstID inst_id, const char * attr_name) =0 ;
public: virtual void OnObjUndone (TC_CPsInstID inst_id) =0 ;
public: virtual void OnObjInserted (TC_CPsInstID inst_id) =0 ;
public: virtual void OnObjRemoved (TC_CPsInstID inst_id) =0 ;
public: virtual void OnObjNotFound (TC_CPsInstID inst_id) =0 ;
}; // end of class TC_CPfObjSet
// **********************************************************************
// **********************************************************************
class TC_CPfColumn
: public TC_CWindow
{
protected: TC_CPfTable * m_Tbl ;
public: TC_CPsAttribInfo m_AtInfo ;
protected: TC_CIDataType * m_IDataType ;
public: TC_CPfColumn* m_AgentOf ;
protected: TC_CString m_Title ;
public: TC_CPfColumn (TC_CPfTable *tbl, TC_CPsAttribInfo &atInfo, TC_CPfColumn *agent_of=0) ;
public: ~TC_CPfColumn () ;
public: void Preform (ADDTBLCOLUMN &tc) ;
public: void InitFormed (HWND hw) ;
public: BOOL IsCID () ;
public: BOOL IsOID () ;
public: BOOL IsHidden () ;
public: BOOL IsObject () ;
public: BOOL IsRightAlign () ;
public: TCPsHClass HClass () ;
public: TCPsHAttrib HAttrib () ;
public: int RawSize () ;
public: int Type () ;
public: const char * Name () ;
public: char * Heading () ;
public: TC_CPsAttribUIData * AttribData () ;
public: BOOL HasValSet () ;
public: int ValSetCount () ;
public: const char * InFmt () ;
public: const char * OutFmt () ;
public: TC_CPsClassInfo RelatedTo () ;
public: void Data2Ctrl (char *data) ;
public: void Data2Draw (char *data, long &index) ;
public: void AttribToBuffer (TC_CPsObject *obj, char *buf) ;
}; // end of class TC_CPfColumn
// **********************************************************************
// **********************************************************************
class TC_CPfTable
: public TC_CPfObjSet
{
public: TC_TArrayPTR<TC_CPfColumn> m_Cols ;
protected: TC_CPfTimer m_RowingTimer ;
protected: BOOL m_UseTimer ;
protected: BOOL m_IgnoreRowChanged ;
public: BOOL m_UseSortDlg ;
public: TC_CPfTable (TC_CPfArea * fClass) ;
public: void MenuRightBtn (TC_CMenu *menu) ;
public: BOOL TC_CPfTable_RB_0 (TC_Event *e) ;
public: BOOL TC_CPfTable_RB_1 (TC_Event *e) ;
public: BOOL TC_CPfTable_RB_3 (TC_Event *e) ;
public: BOOL TC_CPfTable_RB_4 (TC_Event *e) ;
public: BOOL TC_CPfTable_RB_6 (TC_Event *e) ;
public: BOOL TC_CPfTable_RB_7 (TC_Event *e) ;
protected: TC_CEvent m_EvKillPopulateThread ;
protected: TC_CEvent m_EvPopulateThreadKilled ;
protected: TC_CEvent m_EvPopulateDone ;
protected: TC_TThreadAction <TC_CPfTable> m_PopulateAction ;
protected: TC_CInstThread * m_PopulateThread ;
protected: TC_CPfThreadKiller * m_ThreadKiller ;
public: void PopulateInThread () ;
public: BOOL EvPopulateDone (TC_Event_WM *) ;
public: long PopulateThreadProc () ;
public: void KillThread () ;
public: BOOL EvKillPopulate (TC_Event *) ;
protected: void ObjToRow (long row, TC_CPsObject *obj, WNDPROC wnd_proc=0) ;
protected: void SetCellData (int col, TBL_GETFIELD *gf, WNDPROC wnd_proc) ;
protected: void AreaToRow () ;
protected: void SetCurRow () ;
protected: void RegEntry (TC_CString &name) ;
protected: void DefineSort () ;
public: virtual void Init (TCPsHClass hCls) ;
public: virtual void Reset () ;
public: virtual BOOL Populate () ;
public: virtual const char * GetWinClass () ;
public: virtual void SetObjClickEvent (TC_CWindow * win, C_EVENT_HANDLER id_h) ;
public: virtual BOOL CanAnyAction () ;
public: virtual BOOL IsEmpty () ;
public: virtual void WinName (TC_CString &dst) ;
public: void Find () ;
public: ULONG GetOID (long row) ;
public: virtual ULONG GetCurOID () ;
public: long CurRow () ;
public: long NumRows () ;
public: int IndexOf (const char *name) ;
public: BOOL EvCreate (TC_Event*) ;
public: BOOL EvAccel (TC_Event_WIN *ev) ;
public: BOOL EvNotify (TC_Event_NM *ev) ;
public: BOOL EvTimer (TC_Event_WM *ev) ;
public: BOOL EvDestroy (TC_Event_WM *ev) ;
public: virtual BOOL EvNavigate (TC_Event *ev) ;
public: BOOL EvMouseClick (TC_Event*) ;
public: BOOL EvRBtnDown (TC_Event_WM *ev) ;
public: BOOL EvCallSortDlg (TC_Event*) ;
public: virtual void OnObjRestored (TC_CPsInstID inst_id) ;
public: virtual void OnObjStored (TC_CPsInstID inst_id, BOOL is_new) ;
public: virtual void OnObjChanged (TC_CPsInstID inst_id, const char *at_name) ;
public: virtual void OnObjUndone (TC_CPsInstID inst_id) ;
public: virtual void OnObjInserted (TC_CPsInstID inst_id) ;
public: virtual void OnObjRemoved (TC_CPsInstID inst_id) ;
public: virtual void OnObjNotFound (TC_CPsInstID inst_id) ;
}; // end of class TC_CPfTable
// **********************************************************************
// **********************************************************************
class TC_CPfTreeItem
{
public: int m_OID ;
public: TC_CPfTreeItem* m_Parent ;
public: TC_TArrayPTR<TC_CPfTreeItem> m_Children ;
public: short m_ChildrenCnt ;
public: short m_Level ;
public: TC_CString m_Text ;
public: int m_IsExpanded ;
public: TC_CPfTreeItem (TC_CPfTree *tree, TC_CPsObject *obj, TC_CPfTreeItem *parent_item) ;
public: ~TC_CPfTreeItem ()
{
} // end of func
// **********************************************************************
public: BOOL IsNew ()
{
return !m_OID;
} // end of func
// **********************************************************************
public: char * GetText () ;
public: BOOL MayBeExpanded ()
{
return m_ChildrenCnt;
} // end of func
// **********************************************************************
}; // end of class TC_CPfTreeItem
// **********************************************************************
// **********************************************************************
class TC_CPfTree
: public TC_CPfObjSet
{
public: TC_TArrayPTR<TC_CPfTreeItem> m_Items ;
protected: TC_CPfTimer m_RowingTimer ;
protected: BOOL m_UseTimer ;
public: BOOL m_InsertChildHelper ;
public: static TC_CPfTree * sm_DragDropTree ;
public: static TC_CPfTreeItem * sm_DragDropItem ;
protected: BOOL m_IgnoreRowChanged ;
protected: static char bmpItems [];
public: TC_CPfTree (TC_CPfArea * fClass) ;
public: virtual void Init (TCPsHClass hClass) ;
public: virtual void Reset () ;
public: virtual BOOL Populate () ;
public: BOOL LoadChildren (TC_CPfTreeItem *item) ;
public: virtual void DefineItemText (TC_CPsObject *obj, TC_CString &dest) ;
public: virtual void SetObjClickEvent (TC_CWindow * win, C_EVENT_HANDLER id_h) ;
public: virtual BOOL IsEmpty () ;
public: BOOL IsItemUnaltered (TC_CPfTreeItem *item) ;
public: void MenuRightBtn (TC_CMenu *menu) ;
public: BOOL TC_CPfTree_RB_0 (TC_Event *e) ;
public: BOOL TC_CPfTree_RB_1 (TC_Event *e) ;
public: BOOL TC_CPfTree_RB_3 (TC_Event *e) ;
public: BOOL TC_CPfTree_RB_4 (TC_Event *e) ;
public: BOOL TC_CPfTree_RB_5 (TC_Event *e) ;
public: BOOL TC_CPfTree_RB_7 (TC_Event *e) ;
public: virtual ULONG GetCurOID () ;
public: TC_CPfTreeItem* GetCurItem () ;
public: virtual const char * GetWinClass () ;
public: virtual long GetWinStyle () ;
public: virtual BOOL CanAnyAction ()
{
return true;
} // end of func
// **********************************************************************
public: BOOL IsModified () ;
public: BOOL EvCreate (TC_Event*) ;
public: BOOL EvAccel (TC_Event_WIN *e) ;
public: BOOL EvTimer (TC_Event_WM*) ;
public: BOOL EvNotify (TC_Event_NM *e) ;
public: virtual BOOL EvNavigate (TC_Event * ev) ;
public: BOOL EvInsertChild (TC_Event*) ;
public: BOOL EvObjAction (TC_EvObjAction *e) ;
public: BOOL EvRBtnDown (TC_Event_WM *ev) ;
public: BOOL Ev_DragDrop (TC_Event_WIN *e) ;
public: BOOL StartDrag () ;
public: BOOL CanDrop (int x, int y) ;
public: void DoDrop (int x, int y) ;
public: TC_CPfTreeItem* ItemFromPoint (int x, int y) ;
public: BOOL IsTheSameBranch (TC_CPfTreeItem *parent_item, TC_CPfTreeItem *child_item) ;
public: void InsertSubTree (TC_CPfTreeItem *item, TC_CPfTreeItem *parent_item) ;
public: void ExpandSubTree (TC_CPfTreeItem *item) ;
public: void BeforeStore (TC_CPsInstID &inst_id, BOOL is_new) ;
public: void UpdateSubTree (TC_CPsObject *obj, TC_CPsObject *parent_obj) ;
public: void BeforeRemove (TC_CPsInstID &inst_id) ;
public: void DeleteSubTree (TC_CPsObject *obj) ;
public: virtual void OnObjRestored (TC_CPsInstID inst_id) ;
public: virtual void OnObjStored (TC_CPsInstID inst_id, BOOL is_new) ;
public: virtual void OnObjChanged (TC_CPsInstID inst_id, const char * attr_name) ;
public: virtual void OnObjUndone (TC_CPsInstID inst_id) ;
public: virtual void OnObjInserted (TC_CPsInstID inst_id) ;
public: virtual void OnObjRemoved (TC_CPsInstID inst_id) ;
public: virtual void OnObjNotFound (TC_CPsInstID inst_id) ;
public: TC_CPsCollection* GetChildren (TC_CPsObject *obj) ;
public: short GetChildrenCnt (TC_CPsObject *obj) ;
public: void SetChildrenCnt (TC_CPsObject *obj, short cnt) ;
public: void IncrChildrenCnt (TC_CPsObject *obj) ;
public: void DecrChildrenCnt (TC_CPsObject *obj) ;
public: void GetCode (TC_CPsObject *obj, TC_CString &dest) ;
public: void SetCode (TC_CPsObject *obj, const char *val) ;
public: void GetThisCode (TC_CPsObject *obj, TC_CString &dest) ;
public: short GetLevel (TC_CPsObject *obj) ;
public: void SetLevel (TC_CPsObject *obj, short level) ;
public: TC_CPsObject* GetParent (TC_CPsObject *obj) ;
}; // end of class TC_CPfTree
// **********************************************************************
TC_CPfObjSet * tcCreateObjSet (TC_CPfArea * pfClass, TCPsHClass hClass) ;
// **********************************************************************
class TC_CPfAutoForm
: public TC_CWindow
{
protected: TCPsHClass m_hCls ;
protected: TC_CPfArea * m_Area ;
protected: TC_CPfObjSet * m_ObjSet ;
protected: TC_CString m_WinNameBuf ;
public: TC_CPfAutoForm (TCPsHClass hCls) ;
public: virtual BOOL Form_Creator (TC_CWindow *frame) ;
public: virtual BOOL Form_OnCreate () ;
protected: virtual void Populate () ;
public: BOOL EvCommand (TC_Event_WIN *ev) ;
}; // end of class TC_CPfAutoForm
// **********************************************************************
// **********************************************************************
class TC_CPfAidDlg
: public TC_CPfAutoForm
{
protected: ULONG * m_AffectedOID ;
public: TC_CPfAidDlg (TCPsHClass hCls, ULONG *oid) ;
public: static int Run (TCPsHClass hClass, ULONG * oid) ;
public: virtual BOOL Form_OnCreate () ;
protected: virtual void Populate () ;
public: BOOL EvDestroy (TC_Event *) ;
public: BOOL EvObjClick (TC_Event *) ;
}; // end of class TC_CPfAidDlg
// **********************************************************************
#endif // _INC_PFFORM_HPP