visualmaxscript.h

Go to the documentation of this file.
00001 /*  
00002  *      IVisualMS.h - public interfaces to VisualMS
00003  *
00004  *        IVisualMSMgr  -  core interface to the VisualMS manager
00005  *        IVisualMSForm -  interface to an existing form
00006  *
00007  *          Copyright (c) Autodesk, Inc, 2000.  John Wainwright.
00008  *
00009  */
00010 
00011 #pragma once
00012 
00013 #include "..\..\iFnPub.h"
00014 #include "..\..\GetCOREInterface.h"
00015 
00016 // forward declarations
00017 class IVisualMSMgr;
00018 class IVisualMSForm;
00019 class IVisualMSItem;
00020 class IVisualMSCallback;
00021 
00022 // -------- Core interface to the VisualMS manager -----------
00023 class IVisualMSMgr : public FPStaticInterface 
00024 {
00025 public:
00026     virtual IVisualMSForm* CreateForm()=0;                      // create a new form
00027     virtual IVisualMSForm* CreateFormFromFile(MCHAR* fname)=0;  // create form from a .vms file
00028 
00029     // function IDs 
00030     enum { createForm,
00031            createFormFromFile,
00032         }; 
00033 }; 
00034 
00035 #define VISUALMS_MGR_INTERFACE   Interface_ID(0x423d2cf2, 0x526706b5)
00036 inline IVisualMSMgr* GetVisualMSMgr() { return (IVisualMSMgr*)GetCOREInterface(VISUALMS_MGR_INTERFACE); }
00037 
00038 // ------- interface to individual VisiualMS forms ------------
00039 class IVisualMSForm : public FPMixinInterface 
00040 {
00041 public:
00042     virtual void            Open(IVisualMSCallback* cb=NULL, MCHAR* source=NULL)=0; // open the form editor on this form
00043     virtual void            Close()=0;                                  // close the form editor
00044 
00045     virtual void            InitForm(MCHAR* formType, MCHAR* formName, MCHAR* caption)=0;
00046     virtual void            SetWidth(int w)=0;
00047     virtual void            SetHeight(int h)=0;
00048     virtual IVisualMSItem*  AddItem(MCHAR* itemType, MCHAR* itemName, MCHAR* text, int src_from=-1, int src_to=-1)=0;
00049     virtual IVisualMSItem*  AddCode(MCHAR* code, int src_from=-1, int src_to=-1)=0;
00050     virtual IVisualMSItem*  FindItem(MCHAR* itemName)=0;
00051     virtual BOOL            GenScript(MSTR& script, MCHAR* indent=NULL)=0;
00052 
00053     virtual BOOL            HasSourceBounds(int& from, int& to)=0;
00054     virtual void            SetSourceBounds(int from, int to)=0;
00055 
00056     FPInterfaceDesc*        GetDesc();
00057 
00058     // function IDs 
00059     enum { open,
00060            close,
00061            genScript,
00062         }; 
00063 
00064     // dispatch map
00065     BEGIN_FUNCTION_MAP
00066         VFN_0(open,                 Open); 
00067         VFN_0(close,                Close); 
00068         FN_1( genScript, TYPE_BOOL, GenScript, TYPE_TSTR_BR); 
00069     END_FUNCTION_MAP 
00070 
00071 };
00072 
00073 #define VISUALMS_FORM_INTERFACE   Interface_ID(0x446b6824, 0x39502f75)
00074 
00075 // ------- interface to individual VisiualMS form items ------------
00076 class IVisualMSItem : public FPMixinInterface
00077 {
00078 public:
00079     virtual void    SetPropery(MCHAR* propName, float f)=0;
00080     virtual void    SetPropery(MCHAR* propName, int i)=0;
00081     virtual void    SetPropery(MCHAR* propName, bool b)=0;
00082     virtual void    SetPropery(MCHAR* propName, MCHAR* s)=0;
00083     virtual void    SetProperyLit(MCHAR* propName, MCHAR* s)=0;
00084     virtual void    SetPropery(MCHAR* propName, Point2 pt)=0;
00085     virtual void    SetPropery(MCHAR* propName, Point3 pt)=0;
00086     virtual void    SetPropery(MCHAR* propName, Tab<MCHAR*>* sa)=0;
00087 
00088     virtual void    SetHandler(MCHAR* eventName, MCHAR* source, int arg_start, int arg_end, int body_start, int body_end)=0;
00089 
00090     virtual void    GetShape(int& left, int& top, int& width, int& height)=0;
00091     virtual void    SetShape(int left, int top, int width, int height)=0;
00092 
00093     virtual void    AddComment(MCHAR* code, int src_from, int src_to)=0;
00094 
00095     FPInterfaceDesc* GetDesc();
00096 };
00097 
00098 #define VISUALMS_ITEM_INTERFACE   Interface_ID(0x13a403e4, 0x5f920eed)
00099 
00100 // ------- base class for VMS edit callbacks ------------
00101 //   instances supplied to VMSMgr::CreateForm() and called-back
00102 //   when edit events happen
00103 
00104 #define VISUALMS_CALLBACK_INTERFACE   Interface_ID(0x612b70df, 0xef77884)
00105 
00106 class IVisualMSCallback : public FPMixinInterface 
00107 {
00108 public:
00109     virtual void            Save() { }              // save changes
00110     virtual void            Close() { }             // form editor close (already saved)
00111 
00112     virtual void            DeleteThis() { }
00113 
00114     virtual HWND            GetEditBox() { return NULL; }
00115 
00116     FPInterfaceDesc*        GetDesc() { return (FPInterfaceDesc*)GetCOREInterface(VISUALMS_CALLBACK_INTERFACE); }
00117 
00118     // function IDs 
00119     enum
00120     {
00121         save,
00122         close,
00123     }; 
00124 
00125     // dispatch map
00126     #pragma warning(push)
00127     #pragma warning(disable:4100)
00128     BEGIN_FUNCTION_MAP
00129         VFN_0(save,   Save); 
00130         VFN_0(close,  Close); 
00131     END_FUNCTION_MAP 
00132     #pragma warning(pop)
00133 };
00134