home *** CD-ROM | disk | FTP | other *** search
- #ifndef _DTOBJECT_HPP
- #define _DTOBJECT_HPP
-
- #include "mtdef.hpp"
- #if 0
- # include "dtcodebk.hpp"
- # include "mmdata.hpp"
- # include "dttype.hpp"
- #endif
-
- class MetaObject;
- class FormEdit;
- class DTFormEditBase;
- class WStringList;
- class MMStyle;
- class MMProperty;
- class MMEvent;
- class MTPropertyDialog;
- class DTWPopupMenu;
- class OleEventDialog;
- class MTIPropertyList;
- class MTIEventList;
- class DTCodeBlockList;
- class SaveSource;
- class SaveBlock;
- class DTCodeBlockBase;
- struct DTObjectImp;
-
- typedef WInt DT_TextifyV;
-
- enum MMCodeGeneration {
- MM_CG_AppInit, // "WRichTextBox::GetRegistered.."
- MM_CB_HPP, // form1.hpp
- MM_CB_CPP, // form1.cpp
- MM_CB_RC, // form1.rc
-
- MM_CG_FORM_BaseClasses, // base classes needed by this component
- MM_CG_FORM_CreateDecl, // "WBool Create( WWindow * );"
- MM_CG_FORM_CreateDefn, // "WBool Form1::Create( WWindow * )"
- MM_CG_FORM_CallCreate, // "ok = WWindow::Create( parent, ... )"
-
- MM_CG_HPP_EnumeratorID, // "CB_1 = 101,"
- MM_CG_HPP_EventDecl, // "WBool cb_1_Clicked( ... );"
- MM_CG_HPP_MemberDecl, // "WCommandButton * cb_1;"
-
- MM_CG_IncludeFiles, // "spindial.hpp"
- MM_CG_IncludePaths, // "f:\mystuff\mycontrol\hpp"
- MM_CG_Libraries, // "mycontrol.lib"
- MM_CG_LibraryPaths, // "f:\mystuff\mycontrol\lib"
-
- MM_CG_ConstructorInitializer, // " , cb_1( NULL )"
- MM_CG_ConstructorCode, // "// any constructor code"
-
- MM_CG_InitNew, // "cb_1 = new WCommandButton;"
- MM_CG_InitEventHandlerList, // "WEventHandlerList cb_1_Event..."
- MM_CG_InitEventHandlers, // "cb_1->SetEventHandlerList( ... );"
- MM_CG_RemoveEventHandlers, // "cb_1->RemoveEventHandlerList( ... );"
- MM_CG_InitDDXDataSource, // "cb_1->SetDDXDataSource( ... );"
- MM_CG_InitCreate, // "cb_1->Create( ... );"
- MM_CG_InitProperties, // "cb_1->SetFont( ... );"
- MM_CG_CallCreateEventHandler, // "cb_1->CallEventHandler( ... );"
- MM_CG_CallDestroyEventHandler, // "cb_1->CallEventHandler( ... );"
- MM_CG_InitTransaction, // "trans_1->Connect( ... );"
- MM_CG_InitQuery, // "query_1->Open( ... );"
- MM_CG_AutoOpenQuery, // "WOptima::AuotOpen...;"
- MM_CG_InitTabControl, // "_TabForm1->Create( this, ...);"
-
- MM_CG_FiniTransaction, // "trans_1->Disconnect();"
- MM_CG_FiniQuery, // "query_1->Close();"
- MM_CG_FiniDelete, // "delete cb_1;"
- MM_CG_FiniReset, // "cb_1 = NULL;"
-
- MM_CG_MemberFunctions, // "WBool Form1::..."
-
- MM_CG_DDXMember, // "WString ddxNum;"
- MM_CG_DDXGetDefault, // "ddx->gender = 'M';"
-
- MM_CG_RC_Defines, // "#define CB_1 101"
- MM_CG_RC_MainLevel, // "SPINDIAL_1_DATA RCDATA"
- MM_CG_RC_Control, // "CB_1 CONTROL ..."
- };
-
- #undef GetForm
- #if defined( _UNICODE )
- #define GetForm GetFormW
- #define SetForm SetFormW
- #else
- #define GetForm GetFormA
- #define SetForm SetFormA
- #endif
-
- class METAEXPORTCLASSDEF DTObject : public WObject {
- public:
- virtual ~DTObject();
-
- virtual WBool operator== ( const DTObject & ) const;
- virtual const MetaObject *GetMeta() const;
-
-
- virtual void DTGetRectangle( WRect & r,
- WBool abs = FALSE ) const;
- virtual void DTGetClientRectangle( WRect & r ) const;
- virtual void DTSetRectangle( const WRect & r );
- virtual void DTGetRCRectangle( WRect & r ) const;
-
- virtual WRect DTMapPixelsToDLU( const WRect & pix ) const;
- virtual WRect DTMapDLUToPixels( const WRect & dlu ) const;
-
- virtual void DTBringToTop();
- virtual void DTRepaint();
- virtual void DTWindowMoved();
- virtual WWindow * DTGetParent() const;
- virtual WBool DTSetEventHandler( WEventID id,
- WObject * object,
- WEventHandler handler,
- void *userdata=NULL );
-
- virtual void DTSetName( const WString & name );
- virtual WString DTGetName() const;
-
- virtual void SetClassDefinition( const WString & );
- virtual WString GetClassDefinition() const;
-
- virtual void SetClassIncludes( const WString & );
- virtual WString GetClassIncludes() const;
-
- virtual WObject * GetWImplementation() const;
- virtual void SetWImplementation( WObject * wobj );
-
- virtual WWindow * GetWindow() const;
-
- // ResourceID: the id of the control in the .res file
- virtual void SetResourceID( long id );
- virtual long GetResourceID() const;
-
- // TabIndex: tabbing order of control
- virtual void SetTabIndex( long idx );
- virtual long GetTabIndex() const;
-
- // AmendPopup: modify the context popup. Before is true before
- // the popup is displayed
- virtual void AmendPopup( WPopupMenu *popup, WBool before );
-
- // CodeBlockList: list of Event's associated with object
- virtual const DTCodeBlockList & GetCodeBlockList() const;
- virtual DTCodeBlockList & GetCodeBlockList();
- virtual DTCodeBlockBase * RemoveEvent( DTCodeBlockBase * );
-
- // Form, DTForm: interface to the stored form editor
- virtual FormEdit * GetForm() const;
- virtual DTFormEditBase *GetDTForm() const;
- virtual void SetForm( DTFormEditBase * );
-
- // DTPopupMenu for window natured objects.
- virtual WBool SetDTPopupMenu( DTWPopupMenu * );
- virtual DTWPopupMenu * GetDTPopupMenu() const;
-
- // Style: the style property of the window nature (if applicable)
- virtual WStyle GetStyle() const;
- virtual WBool SetStyle( WStyle stl, WBool clone=FALSE );
- virtual WStyle GetDefaultStyle() const;
-
- // ExtendedStyle: the ExtendedStyle property of the window nature
- virtual WStyle GetExtendedStyle() const;
- virtual WBool SetExtendedStyle( WStyle style, WBool clone=FALSE );
- virtual WStyle GetDefaultExtendedStyle() const;
-
- // Create: create the windowed object
- virtual WBool Create( WWindow * parent, const WRect & r,
- const WChar * text, WStyle style,
- WStyle exStyle, void * data = NULL,
- WBool isLoading = FALSE );
-
- virtual WBool GetNonVisual() const;
-
- // Save and Load DTInfo
- virtual WBool HasDTInfo();
- virtual WBool SaveDTInfo( SaveSource & );
- virtual WBool LoadDTInfo( SaveBlock *, WBool beforeCreate );
-
- virtual WBool CreateEventPopupMenu( WPopupMenu * popup );
- virtual WBool HandleEventClick( WMenuItem *, WEventData * );
- virtual WBool HandleOleEventClick( WMenuItem *, WEventData * );
- virtual void RemoveOleEventDialog();
-
- virtual WBool GetIsResizeable();
- virtual WBool GetIsMoveable();
-
- virtual WBool GetIsHollow(); // groupbox
- virtual WRect GetHollowRect(); // interior of groupbox
-
- // Property Editting
- public:
- virtual WBool EditProperties( WWindow *,
- WBool child = FALSE );
- virtual void ClearPropertyEditor( WBool deleteNow = FALSE );
- virtual WBool UpdatePropertyRect();
- virtual MTPropertyDialog * GetPropDialog();
- virtual void FillInspectProperties( MTIPropertyList & ) const;
- virtual void FillInspectEvents( MTIEventList & ) const;
-
- virtual WBool HasProperty( const WString & name ) const;
- virtual WString GetProperty( const WString & name, DT_TextifyV t = 1 ) const;
- virtual WBool GetPropertyBool( const WString & name ) const;
- virtual WLong GetPropertyEnum( const WString & name ) const;
- virtual WRect GetPropertyRect( const WString & name ) const;
- virtual WLong GetPropertyLong( const WString & name ) const;
- virtual WBool SetProperty( const WString & name, const WString & val, DT_TextifyV t = 1 );
- virtual WBool SetPropertyBool( const WString & name, WBool val );
- virtual void SetPropertyEnum( const WString & name, WLong val );
- virtual void SetPropertyRect( const WString & name, const WRect & r );
- virtual void SetPropertyLong( const WString & name, WLong r );
- virtual void PropertyChanged( const WString & name );
-
-
- // mapped properties
- public:
- virtual WString GetMappedValue( WUInt i ) const;
- virtual void SetMappedValue( WUInt i, const WString & s );
-
-
- /* Code Generation
- */
- public:
- virtual WString GetObjectPrefix() const;
-
- virtual void GenName( WUInt id, WString & ) const;
- virtual void GenClassName( WString & ) const;
- virtual void GenResourceName( WString & ) const;
- virtual void GenResourceStyles( WStringList &, WStringList & ) const;
- virtual void GenCode( MMCodeGeneration, WStringList & ) const;
-
- /* Searching
- */
- public:
- virtual const MMStyle * FindStyle( const char * ) const;
- virtual const MMProperty * FindProperty( const char * ) const;
- virtual DTCodeBlockBase * FindEvent( const char * ) const;
-
-
- /* Dialog Data Exchange
- */
- public:
- virtual WBool GetDDXEnabled() const;
- virtual void SetDDXEnabled( WBool e );
-
- virtual WString GetDDXFieldName() const;
- virtual void SetDDXFieldName( const WString & );
-
- virtual WString GetDDXFieldType() const;
- virtual void SetDDXFieldType( const WString & );
-
- virtual WString GetDDXModifiedFieldName() const;
- virtual void SetDDXModifiedFieldName( const WString & );
-
- virtual WString GetDDXAdditional( unsigned i ) const;
- virtual void SetDDXAdditional( unsigned i, const WString & );
- virtual void EscapeCString( WString &, const WString & ) const;
-
- virtual void InitializeFromObject();
-
- protected:
- DTObject( const MetaObject * meta = NULL );
- virtual void SetWindow( WWindow * );
- virtual void SetMeta( const MetaObject * );
-
- virtual WString TabTo( const WString & str, unsigned col ) const;
-
-
- private:
- DTObjectImp * _imp;
- };
-
- typedef DTObject DTWObject;
-
- #endif // _DTOBJECT_HPP
-