custcont.h

Go to the documentation of this file.
00001 //**************************************************************************/
00002 // Copyright (c) 1998-2006 Autodesk, Inc.
00003 // All rights reserved.
00004 // 
00005 // These coded instructions, statements, and computer programs contain
00006 // unpublished proprietary information written by Autodesk, Inc., and are
00007 // protected by Federal copyright law. They may not be disclosed to third
00008 // parties or copied or duplicated in any form, in whole or in part, without
00009 // the prior written consent of Autodesk, Inc.
00010 //**************************************************************************/
00011 // FILE:        custcont.h
00012 // DESCRIPTION: Custom Controls for Max
00013 // AUTHOR:      Rolf Berteig
00014 // HISTORY:     created 17 November, 1994
00015 //**************************************************************************/
00016 
00017 #pragma once
00018 
00019 #include "maxheap.h"
00020 #include "winutil.h"
00021 #include "buildver.h"
00022 #include "strclass.h"
00023 #include "actiontableTypedefs.h"
00024 #include "acolor.h"
00025 #include "baseinterface.h"
00026 
00027 // Define CHILDWND_CUI to build MAX with a child-window based CUI system
00028 #define CHILDWND_CUI 
00029 
00030 // Standard Category for rollups
00031 #include "RollupConstants.h"
00032 #pragma warning(push)
00033 #pragma warning(disable:4100)
00034 
00036 #define I_EXEC_CB_NO_BORDER                 0xA000
00037 
00038 #define I_EXEC_CS_NO_BORDER                 0xA001 
00039 
00040 #define I_EXEC_SPINNER_RESET                0xA002 
00041 
00044 #define I_EXEC_SPINNER_IS_RESET_CHANGE      0xA003  
00045 
00047 #define I_EXEC_SPINNER_ALT_DISABLE          0xA004
00048 
00049 #define I_EXEC_SPINNER_ALT_ENABLE           0xA005
00050 
00051 #define I_EXEC_SPINNER_ONE_CLICK_DISABLE    0xA006
00052 
00053 #define I_EXEC_SPINNER_ONE_CLICK_ENABLE     0xA007
00054 
00055 #define I_EXEC_BUTTON_DAD_ENABLE            0xA008 
00056 
00057 #define I_EXEC_GET_TOOLTIP_HWND             0xA009
00058 
00059 // Values returned by DADMgr::SlotOwner()
00060 #define OWNER_MEDIT_SAMPLE      0
00061 #define OWNER_NODE              1
00062 #define OWNER_MTL_TEX           2  //  button in mtl or texture
00063 #define OWNER_SCENE             3  //  button in light, modifier, atmospheric, etc
00064 #define OWNER_BROWSE_NEW        4
00065 #define OWNER_BROWSE_LIB        5
00066 #define OWNER_BROWSE_MEDIT      6
00067 #define OWNER_BROWSE_SCENE      7
00068 #define OWNER_MATERIAL_EXPLORER 8
00069 
00070 class ReferenceTarget;
00071 class IParamBlock;
00072 class IParamBlock2;
00073 class FPInterface;
00074 
00113 class DADMgr : public InterfaceServer {
00114     public:
00125         virtual SClass_ID GetDragType(HWND hwnd, POINT p)=0;
00126 
00140         virtual BOOL IsNew(HWND hwnd, POINT p, SClass_ID type) { return FALSE; } 
00141 
00158         virtual BOOL OkToDrop(ReferenceTarget *dropThis, HWND hfrom, HWND hto, POINT p, SClass_ID type, BOOL isNew = FALSE)=0;
00159 
00178         virtual HCURSOR DropCursor(ReferenceTarget *dropThis, HWND hfrom, HWND hto, POINT p, SClass_ID type, BOOL isNew = FALSE){ return NULL;}
00179 
00203         virtual int SlotOwner() { return OWNER_MTL_TEX; } 
00204          
00213         virtual ReferenceTarget *GetInstance(HWND hwnd, POINT p, SClass_ID type)=0;
00214 
00226         virtual ReferenceTarget *GetDestinationInstance(HWND hwnd, POINT p, SClass_ID type)
00227         { return GetInstance(hwnd, p, type);}
00228 
00247         virtual void  Drop(ReferenceTarget *dropThis, HWND hwnd, POINT p, SClass_ID type, DADMgr* srcMgr = NULL, BOOL bSrcClone = FALSE)=0;
00248 
00260         virtual void  SameWinDragAndDrop(HWND h1, POINT p1, POINT p2) {}
00261 
00268         virtual BOOL  LetMeHandleLocalDAD() { return 0; }
00269 
00284         virtual void  LocalDragAndDrop(HWND h1, HWND h2, POINT p1, POINT p2){}
00285 
00292         virtual BOOL AutoTooltip(){ return FALSE; }
00293 
00307         virtual BOOL CopyOnly(HWND hwnd, POINT p, SClass_ID type) { return FALSE; } 
00308 
00314         virtual BOOL AlwaysSendButtonMsgsOnDrop(){ return FALSE; }
00315 
00333         virtual INT_PTR Execute(int cmd, ULONG_PTR arg1=0, ULONG_PTR arg2=0, ULONG_PTR arg3=0) { return 0; } 
00334 
00351         virtual BOOL OkToDropInstance(ReferenceTarget *dropThis, HWND hfrom, HWND hto, POINT p, SClass_ID type) { return TRUE; }
00352     };
00353 
00354 
00360 class ICustomControl : public InterfaceServer {
00361     public:
00363         virtual HWND GetHwnd()=0;
00367         virtual void Enable(BOOL onOff=TRUE)=0;
00371         virtual void Disable()=0;
00374         virtual BOOL IsEnabled()=0;
00375         // this second enable function is used to disable and enable custom controls
00376         // when the associated parameter has a non-keyframable parameter.
00377         // The effective enable state is the AND of these two enable bits.
00390         virtual void Enable2(BOOL onOff=TRUE)=0;
00391         // Generic expansion function
00404         virtual INT_PTR Execute(int cmd, ULONG_PTR arg1=0, ULONG_PTR arg2=0, ULONG_PTR arg3=0) { return 0; }
00406 
00413         virtual void SetTooltip(bool bEnable, const MCHAR* text)=0;
00414 
00416         virtual void SetTooltip(bool bEnable, MCHAR* text) { SetTooltip(bEnable, const_cast<const MCHAR*>(text)); }
00417 
00429         CoreExport void UpdateEnableState( Animatable * anim, int subNum );
00430     };
00431 
00432 // This is a bitmap brush where the bitmap is a gray and white checker board.
00433 CoreExport HBRUSH GetLTGrayBrush();
00434 CoreExport HBRUSH GetDKGrayBrush();
00435 
00436 // Makes the grid pattern brushes solid for screen shots
00437 CoreExport void MakeBrushesSolid(BOOL onOff);
00438 
00450 
00451 
00454 CoreExport HFONT GetFixedFont();
00455 
00457 
00460 CoreExport HFONT GetFixedFont_LocalCharSet();
00461 
00463 
00466 CoreExport HFONT GetFixedFontBold();
00467 
00469 
00472 CoreExport HFONT GetFixedFontBold_LocalCharSet();
00473 
00475 
00478 CoreExport LONG GetFixedFontHeight();
00479 
00481 
00484 CoreExport LONG GetFixedFontHeightSmall();
00485 
00487 
00490 CoreExport DWORD GetFixedFontCharset();
00491 
00493 
00496 CoreExport char* GetFixedFontFace();
00498 
00506 
00507 
00510 CoreExport HFONT GetUIFont();
00511 
00513 
00516 CoreExport HFONT GetUIFont_LocalCharSet();
00517 
00519 
00522 CoreExport HFONT GetUIFontBold();
00523 
00525 
00528 CoreExport HFONT GetUIFontBold_LocalCharSet();
00529 
00531 
00534 CoreExport LONG GetUIFontHeight();
00535 
00537 
00540 CoreExport LONG GetUIFontHeightSmall();
00541 
00543 
00546 CoreExport DWORD GetUIFontCharset();
00547 
00549 
00552 CoreExport const MCHAR* GetUIFontFace();
00554 // The hand cursor used for panning.
00555 CoreExport HCURSOR GetPanCursor();
00556 
00557 // Used to update the new mouse-tracking outlined buttons
00558 CoreExport void UpdateButtonOutlines();
00559 
00560 //----------------------------------------------------------------------------//
00561 // Customizable UI Frame 
00562 
00563 #define CUIFRAMECLASS _M("CUIFrame")
00564 
00565 // CUI Frame content types
00566 #define CUI_TOOLBAR         (1<<0)      //!< set if frame holds toolbars and/or tool palettes
00567 #define CUI_MENU            (1<<1)      //!< set if frame holds a menu
00568 #define CUI_HWND            (1<<2)      //!< set if frame hold a generic hWnd
00569 
00570 // CUI Frame position types
00575 #define CUI_TOP_DOCK        (1<<0)  //!< Can be docked at the top.
00576 #define CUI_BOTTOM_DOCK     (1<<1)  //!< Can be docked at the bottom.
00577 #define CUI_LEFT_DOCK       (1<<2)  //!< Can be docked on the left.
00578 #define CUI_RIGHT_DOCK      (1<<3)  //!< Can be docked at the right.
00579 #define CUI_ALL_DOCK        (CUI_TOP_DOCK|CUI_BOTTOM_DOCK|CUI_LEFT_DOCK|CUI_RIGHT_DOCK) //!< Can be docked at any of the four positions.
00580 #define CUI_HORIZ_DOCK      (CUI_TOP_DOCK|CUI_BOTTOM_DOCK)  //!<  Can be docked at the top or bottom.
00581 #define CUI_VERT_DOCK       (CUI_LEFT_DOCK|CUI_RIGHT_DOCK)  //!<  Can be docked at the left or right.
00582 #define CUI_FLOATABLE       (1<<4)  //!< Can be floated.
00583 #define CUI_FLOATING        (1<<4)  //!< Synonym for CUI_FLOATABLE.
00584 #define CUI_CONNECTABLE     (1<<5)  //!< Not currently implemented.
00585 #define CUI_SM_HANDLES      (1<<6)  //!< Set if frame should display size/move handles
00586 #define CUI_SLIDING         (1<<7)  //!< Frame doesn't butt up against the one next to it.
00587 #define CUI_MAX_SIZED       (1<<8)  //!< Frame takes up the entire row.  Nothing can be docked next to it.
00588 #define CUI_DONT_SAVE       (1<<9)  //!< Don't save this CUI frame in the .cui file
00589 #define CUI_HAS_MENUBAR     (1<<10) //!< CUI frames that have a menu bar need to be treated differently
00590 #define CUI_MINIMIZED_DOCKABLE (1<<11) //!< CUI frames can be minimized docked, which has an minimized handle to allow expanding.
00591 #define CUI_MINIMIZED_DOCK  (1<<12) //!< CUI frmaes are minimized docked
00592 
00593 
00594 // CUI Docking Panel locations
00599 #define CUI_NO_PANEL        0
00600 #define CUI_TOP_PANEL       CUI_TOP_DOCK
00601 #define CUI_BOTTOM_PANEL    CUI_BOTTOM_DOCK
00602 #define CUI_LEFT_PANEL      CUI_LEFT_DOCK
00603 #define CUI_RIGHT_PANEL     CUI_RIGHT_DOCK
00604 #define CUI_FIXED_PANELS    (CUI_TOP_PANEL|CUI_BOTTOM_PANEL|CUI_LEFT_PANEL|CUI_RIGHT_PANEL)
00605 #define CUI_FLOATING_PANELS (1<<4)
00606 #define CUI_ALL_PANELS      (CUI_FIXED_PANELS|CUI_FLOATING_PANELS)
00607 
00608 
00609 #define CUI_POSDATA_MSG             (WM_APP + 0x3412)   //!< used for retrieving CUIFrame position data
00610 #define CUI_SUBFRAME_ADDED_MSG      (WM_APP + 0x3413)   //!< tells a parent window that an ICUIFrame has been added
00611 #define CUI_SUBFRAME_REMOVED_MSG    (WM_APP + 0x3414)   //!< tells a parent window that an ICUIFrame has been removed
00612 #define CUI_PRESET_MACROBUTTONS     (WM_APP + 0x3415)   //!< Set MacroButtonStates is about to be called on the toolbar.
00613 #define CUI_SUBFRAME_ACTIVATE_MSG   (WM_APP + 0x3416)   //!< tells a parent window that a subframe's active state has changed
00614 
00615 // orientation parameters
00619 #define CUI_NONE            0
00620 #define CUI_HORIZ           CUI_HORIZ_DOCK  //!< Docked horizontally.
00621 #define CUI_VERT            CUI_VERT_DOCK   //!< Docked vertically.
00622 #define CUI_FLOAT           CUI_FLOATING    //!< Floating.
00623 
00624 
00625 #define CUI_MIN_TB_WIDTH    25      // minimum width of a CUIFrame-based toolbar
00626 
00627 #define CUI_MENU_HIDE           0
00628 #define CUI_MENU_SHOW_ENABLED   1
00629 #define CUI_MENU_SHOW_DISABLED  2
00630 
00631 // CUI size parameters
00634 #define CUI_MIN_SIZE            0   //!< The minimum size.
00635 #define CUI_MAX_SIZE            1   //!< The maximum size.
00636 
00637 #define CUI_PREF_SIZE           2   //!< The preferred size.
00638 
00639 
00640 // CUI bitmap button image size (in pixels: 16x15, 16x16 or 24x24)
00641 #define CUI_SIZE_16             16
00642 #define CUI_SIZE_24             24
00643 
00644 // CUI bitmap button image mask options
00645 #define CUI_MASK_NONE           0   // no mask -- MAX should generate one
00646 #define CUI_MASK_MONO           1   // normal Windows convention
00647 #define CUI_MASK_ALPHA          2   // 8-bit alpha channel present
00648 #define CUI_MASK_ALPHA_PREMULT  3   // 8-bit pre-multiplied alpha channel present
00649 
00650 // CUI edit types -- not all implemented (yet?)
00651 #define CUI_EDIT_NONE           0
00652 #define CUI_EDIT_KBD            (1<<0)
00653 #define CUI_EDIT_SCRIPT         (1<<1)
00654 #define CUI_EDIT_MACRO          (CUI_EDIT_KBD | CUI_EDIT_SCRIPT)
00655 #define CUI_EDIT_ORDER          (1<<2)
00656 
00665 class CUIPosData: public MaxHeapOperators 
00666 {
00667 public:
00671     virtual ~CUIPosData()                                   {}
00679     virtual int GetWidth(int sizeType, int orient)          { return 50; }
00686     virtual int GetHeight(int sizeType, int orient)         { return 50; }
00687 };
00688 
00689 // Provides a way for messages received by the CUIFrame to be processed
00690 // in a context-specific fashion.  ProcessMessage should return TRUE 
00691 // if the message is handled and FALSE if not.  If FALSE is returned (or
00692 // no handler is defined), then the CUIFrame simply passes WM_COMMAND
00693 // messages on to its parent.  Window position messages are passed from
00694 // the CUIFrame to the HWND of the 'content' (either toolbar or menu)
00695 // Other messages are passed on to DefaultWndProc.
00696 
00730 class CUIFrameMsgHandler: public MaxHeapOperators
00731 {
00732 public:
00734     virtual ~CUIFrameMsgHandler() {;}
00761     virtual int ProcessMessage(UINT message, WPARAM wParam, LPARAM lParam) { return FALSE; }
00762 };
00763 
00764 class ICustButton;
00765 class ICustStatus;
00766 
00781 class ICUIFrame : public ICustomControl {
00782 public:
00783     // CUIFrame attributes
00787     virtual void SetPosType(DWORD t)=0;
00790     virtual DWORD GetPosType()=0;
00795     virtual void SetPosRank(int rank, int subrank=0)=0;
00802     virtual int GetPosRank()=0;
00805     virtual int GetPosSubrank()=0;
00808     virtual BOOL IsFloating()=0;
00816     virtual void Hide(BOOL b)=0;
00818     virtual BOOL IsHidden()=0;
00820     virtual void SetCurPosition(DWORD pos)=0;
00833     virtual DWORD GetCurPosition()=0;
00846     virtual void SetContentType(DWORD t)=0;
00855     virtual DWORD GetContentType()=0;
00862     virtual void SetContentHandle(HWND hContent)=0;
00864     virtual HWND GetContentHandle()=0;
00868     virtual void SetTabbedToolbar(BOOL b)=0;
00871     virtual BOOL GetTabbedToolbar()=0;
00882     virtual void AddToolbarTab(HWND hTBar, CUIFrameMsgHandler *msgHandler, const MCHAR *name, int pos = -1)=0;
00887     virtual void DeleteToolbarTab(int pos)=0;
00889     virtual int GetToolbarCount()=0;
00894     virtual HWND GetToolbarHWnd(int pos)=0;
00898     virtual const MCHAR *GetTabName(int pos)=0;
00902     virtual void SetCurrentTab(int pos)=0;
00906     virtual int GetCurrentTab()=0;
00917     virtual int GetSize(int sizeType, int dir, int orient)=0;
00922     virtual BOOL InstallMsgHandler(CUIFrameMsgHandler *msgHandler)=0;
00928     virtual void SetName(const MCHAR *name)=0;  // name is used to store position info
00930     virtual const MCHAR *GetName()=0;
00936     virtual BOOL SetMenuDisplay(int md)=0;
00942     virtual int GetMenuDisplay()=0;
00949     virtual void SetSystemWindow(BOOL b)=0; // set to TRUE for main UI, only works if parent is the main MAX hWnd
00952     virtual BOOL GetSystemWindow()=0;
00954     virtual BOOL ReadConfig(const MCHAR *cfg, int startup=FALSE)=0; // returns FALSE if no position has been saved
00956     virtual void WriteConfig(const MCHAR *cfg)=0;
00957 };
00958 
00961 CoreExport ICUIFrame *GetICUIFrame( HWND hCtrl );
00964 CoreExport void ReleaseICUIFrame( ICUIFrame *icf );
00965 
00977 class ICUIFrameDestructorPolicy: public MaxHeapOperators 
00978 {
00979 public:
00980     static void Delete(ICUIFrame *iFrame)
00981     {
00982         ReleaseICUIFrame(iFrame);
00983     }
00984 };
00985 
01001 CoreExport HWND CreateCUIFrameWindow(HWND hParent, const MCHAR *title, int x, int y, int cx, int cy);
01002 
01003 #define CUI_MODE_NORMAL     0
01004 #define CUI_MODE_EDIT       1
01005 
01032 class CUIFrameMgr : public BaseInterfaceServer {
01033 private:
01034     HWND    hApp;
01035     void    RecalcPanel(int panel);
01036     int     GetMaxRank(int panel);
01037     int     GetMaxSubrank(int panel, int rank);
01038     void    GetDockRect(int panel, int rank, RECT *rp);
01039     int     GetDockingRank(int panel, RECT *rp = NULL);
01040     int     GetDockingSubrank(int panel, int rank, RECT *rp = NULL);
01041     void    AdjustRanks(int panel, int start, int incr);
01042     void    AdjustSubranks(int panel, int rank, int start, int incr);
01043     int     resSize[4];
01044     int     mode;
01045     int     horizTextBtns;
01046     int     fixedWidthTextBtns;
01047     int     btnWidth;
01048     int     imageSize;
01049     int     lockLayout;
01050     CUIFrameMsgHandler *defMsgHandler;
01051 protected:
01052     MSTR    cfgFile;
01054 
01057     CoreExport CUIFrameMgr();
01059 
01061     CUIFrameMgr(CUIFrameMgr& frame);
01063     CoreExport virtual ~CUIFrameMgr();
01064 
01065 public:
01067     CoreExport void SetAppHWnd(HWND hApp);
01068     HWND            GetAppHWnd() { return hApp; }
01071     CoreExport const MCHAR *GetCUIDirectory();
01072 
01079     CoreExport void ProcessCUIMenu(HWND hWnd, int x, int y);
01100     CoreExport void DockCUIWindow(HWND hWnd, int panel, RECT *rp = NULL, int init = FALSE);
01114     CoreExport void FloatCUIWindow(HWND hWnd, RECT *rp = NULL, int init = FALSE);
01115 
01125     CoreExport void MinimizeCUIWindow(HWND hWnd, int init = FALSE);
01126 
01128     CoreExport void SetReservedSize(int panel, int size);
01130     CoreExport int GetReservedSize(int panel);
01132     CoreExport int GetPanelSize(int panel, int incReserved = FALSE);
01133     CoreExport int GetPanelWidth(int panel);  // R4.5 and later only
01134 
01144     CoreExport void RecalcLayout(int entireApp=FALSE);
01148     CoreExport void DrawCUIWindows(int panels=CUI_ALL_PANELS);
01165     CoreExport void SetMacroButtonStates(BOOL force);
01173     CoreExport void ResetIconImages();
01174 
01189     CoreExport int OverDockRegion(LPPOINT pt, DWORD posType, int override = FALSE);
01191     CoreExport void SetMode(int md);
01193     CoreExport int GetMode();
01194 
01197     CoreExport void ExpertMode(int onOff);
01198 
01199     CoreExport void HideFloaters(int onOff);
01209     CoreExport HWND GetItemHwnd(int id);
01218     CoreExport ICustButton *GetICustButton( int id );
01229     CoreExport ICustStatus *GetICustStatus( int id );
01230 
01232     CoreExport void HorizTextButtons(BOOL b);
01234     CoreExport int GetHorizTextButtons();
01236     CoreExport void FixedWidthTextButtons(BOOL b);
01238     CoreExport int GetFixedWidthTextButtons();
01240     CoreExport void SetTextButtonWidth(int w);
01242     CoreExport int GetTextButtonWidth();
01243 
01245     CoreExport int GetCount();
01249     CoreExport ICUIFrame *GetICUIFrame(int i);
01252     CoreExport ICUIFrame *GetICUIFrame(const MCHAR *name);
01258     CoreExport ICUIFrame *GetICUIFrame(int panel, int rank, int subrank);
01259 
01261     CoreExport int SetConfigFile(const MCHAR *cfg);
01264     CoreExport const MCHAR *GetConfigFile();
01265 
01267     CoreExport int DeleteSystemWindows(int toolbarsOnly = TRUE);
01269     CoreExport int CreateSystemWindows(int reset = FALSE);
01270     CoreExport int GetSystemWindowCount();
01271 
01273     CoreExport void SetImageSize(int size)  { imageSize = size; }
01275     CoreExport int GetImageSize()           { return imageSize; }
01282     CoreExport int GetButtonHeight(int sz=0) { if(!sz) sz=imageSize; return sz==CUI_SIZE_16 ? 22 : 31; }
01287     CoreExport int GetButtonWidth(int sz=0)  { if(!sz) sz=imageSize; return sz==CUI_SIZE_16 ? 23 : 32; }
01288 
01290     CoreExport void SetDefaultData(CUIFrameMsgHandler *msg, HIMAGELIST img16, HIMAGELIST img24=NULL);
01291 
01297     CoreExport int GetDefaultImageListBaseIndex(SClass_ID sid, Class_ID cid);
01303     CoreExport MSTR* GetDefaultImageListFilePrefix(SClass_ID sid, Class_ID cid);
01304 
01314     CoreExport int AddToRawImageList(const MCHAR* pFilePrefix, int sz, HBITMAP image, HBITMAP mask);
01315 
01317     CoreExport int LoadBitmapFile(const MCHAR *filename);
01319     CoreExport int LoadBitmapImages();
01320 
01323     CoreExport CUIFrameMsgHandler *GetDefaultMsgHandler()   { return defMsgHandler; }
01324 
01327     CoreExport int ReadConfig();
01330     CoreExport int WriteConfig();
01331 
01333     CoreExport void SetLockLayout(BOOL lock)    { lockLayout = lock; }
01335     CoreExport BOOL GetLockLayout()             { return lockLayout; }
01336 
01338     CoreExport void EnableAllCUIWindows(int enabled);
01339 
01341 
01350     CoreExport virtual bool ResolveReadPath(const MSTR& aFilename, MSTR& aResult) = 0;
01352 
01361     CoreExport virtual bool ResolveWritePath(const MSTR& aFilename, MSTR& aResult) = 0;
01362 
01363 };
01364 
01368 CoreExport CUIFrameMgr *GetCUIFrameMgr();
01371 CoreExport void DoCUICustomizeDialog();
01373 CoreExport BOOL AllFloatersAreHidden();
01374 CoreExport void ResizeFloatingTB(HWND hWnd);
01375 
01376 
01377 #define MB_TYPE_KBD                 1
01378 #define MB_TYPE_SCRIPT              2
01379 #define MB_TYPE_ACTION              3
01380 #define MB_TYPE_ACTION_CUSTOM       4
01381 
01382 #define MB_FLAG_ENABLED           (1 << 0)
01383 #define MB_FLAG_CHECKED           (1 << 1)
01384 
01385 class ActionItem;
01386 
01447 class MacroButtonData: public MaxHeapOperators {
01448 public:
01451     CoreExport  MacroButtonData()   { label = tip = imageName = NULL; imageID = -1; }
01458     CoreExport  MacroButtonData(long tID, int cID, const MCHAR *lbl, const MCHAR *tp=NULL, int imID=-1, const MCHAR *imName=NULL);
01465     CoreExport  MacroButtonData(int msID, const MCHAR *lbl, const MCHAR *tp=NULL, int imID=-1, const MCHAR *imName=NULL)
01466         {
01467             macroType=MB_TYPE_SCRIPT; macroScriptID=msID; imageID=imID; 
01468             label=NULL; SetLabel(lbl); tip=NULL; SetTip(tp); imageName=NULL; SetImageName(imName);
01469         }
01472     CoreExport  ~MacroButtonData();
01473     
01475     CoreExport  MacroButtonData & operator=(const MacroButtonData& mbd);
01476     
01479     CoreExport  void SetLabel(const MCHAR *lbl);
01481     const MCHAR *GetLabel()     { return label; }
01484     CoreExport  void SetTip(const MCHAR *tp);
01486     MCHAR *GetTip()         { return tip; }
01489     void SetCmdID(int id)   { cmdID = id; }
01491     int GetCmdID()          { return cmdID; }
01494     void SetScriptID(int id){ macroScriptID = id; }
01496     int GetScriptID()       { return macroScriptID; }
01500     CoreExport  void SetImageName(const MCHAR *imName);
01502     const MCHAR *GetImageName() { return imageName; }
01505     void SetImageID(int id) { imageID = id; }
01507     int GetImageID()        { return imageID; }
01508     
01511     void SetTblID(ActionTableId id) { tblID = id; }
01513     ActionTableId GetTblID() { return tblID; }
01514     
01517     void SetActionItem(ActionItem* pAction) { actionItem = pAction; }
01519     ActionItem* GetActionItem() { return actionItem; }
01520     
01523     CoreExport BOOL IsActionButton() { return macroType == MB_TYPE_ACTION_CUSTOM ||
01524                                            macroType == MB_TYPE_ACTION; }
01525     
01526     int           macroType;
01527     ActionTableId tblID; 
01528     int           cmdID;
01529     int           macroScriptID;
01530     MCHAR *       label;
01531     MCHAR *       tip;
01532     
01533     MCHAR *       imageName;
01534     int           imageID;
01535     ActionItem*   actionItem;
01536 
01537 
01538     // flags constrains the last state when redrawing
01539     DWORD         flags;
01540 };
01541 
01542 //---------------------------------------------------------------------------//
01543 // Spinner control
01544 
01545 
01546 #define SPINNERWINDOWCLASS  _M("SpinnerControl")
01547 
01548 
01549 // LOWORD(wParam) = ctrlID, 
01550 // HIWORD(wParam) = TRUE if user is dragging the spinner interactively.
01551 // lParam = pointer to ISpinnerControl
01552 #define CC_SPINNER_CHANGE       WM_USER + 600   
01553 
01554 // LOWORD(wParam) = ctrlID, 
01555 // lParam = pointer to ISpinnerControl
01556 #define CC_SPINNER_BUTTONDOWN   WM_USER + 601
01557 
01558 // LOWORD(wParam) = ctrlID, 
01559 // HIWORD(wParam) = FALSE if user cancelled - TRUE otherwise
01560 // lParam = pointer to ISpinnerControl
01561 #define CC_SPINNER_BUTTONUP     WM_USER + 602
01562 
01563 
01564 enum EditSpinnerType {
01565     EDITTYPE_INT, 
01566     EDITTYPE_FLOAT, 
01567     EDITTYPE_UNIVERSE, 
01568     EDITTYPE_POS_INT, 
01569     EDITTYPE_POS_FLOAT, 
01570     EDITTYPE_POS_UNIVERSE,
01571     EDITTYPE_TIME
01572     };
01573 
01639 class ISpinnerControl : public ICustomControl {
01640     public:
01642         virtual float GetFVal()=0;
01644         virtual int GetIVal()=0;
01650         virtual void SetAutoScale(BOOL on=TRUE)=0;
01655         virtual void SetScale( float s )=0;
01670         virtual void SetValue( float v, int notify )=0;
01676         virtual void SetValue( int v, int notify )=0;
01683         virtual void SetLimits( int min, int max, int limitCurValue = TRUE )=0;
01690         virtual void SetLimits( float min, float max, int limitCurValue = TRUE )=0;
01714         virtual void LinkToEdit( HWND hEdit, EditSpinnerType type )=0;
01719         virtual void SetIndeterminate(BOOL i=TRUE)=0;
01722         virtual BOOL IsIndeterminate()=0;
01727         virtual void SetResetValue(float v)=0;
01732         virtual void SetResetValue(int v)=0;
01758         virtual void SetKeyBrackets(BOOL onOff)=0;
01759     };
01760 
01763 CoreExport ISpinnerControl *GetISpinner( HWND hCtrl );
01766 CoreExport void ReleaseISpinner( ISpinnerControl *isc );
01767 
01778 class ISpinnerControlDestructorPolicy: public MaxHeapOperators 
01779 {
01780 public:
01781     static void Delete(ISpinnerControl *spin)
01782     {
01783         ReleaseISpinner(spin);
01784     }
01785 };
01786 
01791 CoreExport void SetSnapSpinner(BOOL b);
01794 CoreExport BOOL GetSnapSpinner();
01800 CoreExport void SetSnapSpinValue(float f);
01802 CoreExport float GetSnapSpinValue();
01803 
01811 CoreExport void SetSpinnerPrecision(int p);
01819 CoreExport int GetSpinnerPrecision();
01820 
01821 #define SPINNER_WRAP_DISTANCE 40
01822 CoreExport void SetSpinnerWrap(int w);
01823 CoreExport int GetSpinnerWrap();
01824 
01825 
01826 // begin - mjm 12.18.98
01827 //---------------------------------------------------------------------------
01828 // Slider control
01829 
01830 #define SLIDERWINDOWCLASS   _M("SliderControl")
01831 
01832 // LOWORD(wParam) = ctrlID, 
01833 // HIWORD(wParam) = TRUE if user is dragging the slider interactively.
01834 // lParam = pointer to ISliderControl
01835 #define CC_SLIDER_CHANGE        WM_USER + 611
01836 
01837 // LOWORD(wParam) = ctrlID, 
01838 // lParam = pointer to ISliderControl
01839 #define CC_SLIDER_BUTTONDOWN    WM_USER + 612
01840 
01841 // LOWORD(wParam) = ctrlID, 
01842 // HIWORD(wParam) = FALSE if user cancelled - TRUE otherwise
01843 // lParam = pointer to ISliderControl
01844 #define CC_SLIDER_BUTTONUP      WM_USER + 613
01845 
01903 class ISliderControl : public ICustomControl
01904 {
01905 public:
01907     virtual float GetFVal()=0;
01909     virtual int GetIVal()=0;
01914     virtual void SetNumSegs( int num )=0;
01924     virtual void SetValue( float v, int notify )=0;
01934     virtual void SetValue( int v, int notify )=0;
01945     virtual void SetLimits( int min, int max, int limitCurValue = TRUE )=0;
01956     virtual void SetLimits( float min, float max, int limitCurValue = TRUE )=0;
01983     virtual void LinkToEdit( HWND hEdit, EditSpinnerType type )=0;
01990     virtual void SetIndeterminate(BOOL i=TRUE)=0;
01993     virtual BOOL IsIndeterminate()=0;
02000     virtual void SetResetValue(float v)=0;
02007     virtual void SetResetValue(int v)=0;
02017     virtual void SetKeyBrackets(BOOL onOff)=0;
02018 };
02019 
02022 CoreExport ISliderControl *GetISlider( HWND hCtrl );
02025 CoreExport void ReleaseISlider( ISliderControl *isc );
02026 
02037 class ISliderControlDestructorPolicy: public MaxHeapOperators 
02038 {
02039 public:
02040     static void Delete(ISliderControl *slider)
02041     {
02042         ReleaseISlider(slider);
02043     }
02044 };
02045 
02046 // mjm - 3.1.99 - use spinner precision for edit boxes linked to slider controls
02047 /*
02048 CoreExport void SetSliderPrecision(int p);
02049 CoreExport int  GetSliderPrecision();
02050 */
02051 
02052 // routines for setting up sliders.
02072 CoreExport ISliderControl *SetupIntSlider(HWND hwnd, int idSlider, int idEdit,  int min, int max, int val, int numSegs);
02092 CoreExport ISliderControl *SetupFloatSlider(HWND hwnd, int idSlider, int idEdit,  float min, float max, float val, int numSegs);
02113 CoreExport ISliderControl *SetupUniverseSlider(HWND hwnd, int idSlider, int idEdit,  float min, float max, float val, int numSegs);
02114 
02115 // controls whether or not sliders send notifications while the user adjusts them with the mouse
02122 CoreExport void SetSliderDragNotify(BOOL onOff);
02126 CoreExport BOOL GetSliderDragNotify();
02127 // end - mjm 12.18.98
02128 
02129 
02130 //---------------------------------------------------------------------------//
02131 // Rollup window control
02132 
02133 #define WM_CUSTROLLUP_RECALCLAYOUT WM_USER+876
02134 
02135 #define ROLLUPWINDOWCLASS _M("RollupWindow")
02136 
02137 typedef void *RollupState;
02138 
02139 // Flags passed to AppendRollup
02140 #define APPENDROLL_CLOSED       (1<<0)  // Starts the page out rolled up.
02141 #define DONTAUTOCLOSE           (1<<1)  // Don't close this rollup when doing Close All
02142 #define ROLLUP_SAVECAT          (1<<2)  // Save the category field in the RollupOrder.cfg
02143 #define ROLLUP_USEREPLACEDCAT   (1<<3)  // In case of ReplaceRollup, use the replaced rollups category
02144 #define ROLLUP_NOBORDER         (1<<4)  // Don't display a title or border, don't support drag-and-drop, right-click menu, or collapse/expand.
02145 
02146 class IRollupWindow;
02147 class IRollupPanel;
02148 
02154 class IRollupCallback : public InterfaceServer
02155 {
02156 public:
02175     virtual BOOL HandleDrop(IRollupPanel *src,IRollupPanel *targ, bool before){ return FALSE; }
02193     virtual BOOL GetEditObjClassID(SClass_ID &sid,Class_ID &cid){ return FALSE;}
02199     virtual BOOL HandleOpenAll(){return FALSE;}
02205     virtual BOOL HandleCloseAll(){ return FALSE;}
02209     virtual void HandleDestroy() {}
02210 };
02211 
02218 class IRollupPanel : public InterfaceServer
02219 {
02220 public:
02222     virtual HINSTANCE GetHInst()=0;
02224     virtual DWORD_PTR GetResID()=0;
02226     virtual BOOL operator==(const IRollupPanel& id)=0;
02228     virtual int GetCategory()=0;
02234     virtual void SetCategory(int cat)=0;
02236     virtual HWND GetHWnd()=0;
02239     virtual HWND GetRollupWindowHWND()=0;
02242     virtual HWND GetTitleWnd()=0;
02245     virtual HWND GetPanelWnd()=0;
02246 
02249     virtual void SetDlgHeight(int height)=0;
02250 
02253     virtual int GetDlgHeight()=0;
02254 };
02255 
02259 class IRollupRCMenuItem : public InterfaceServer {
02260 public:
02262     virtual MCHAR*      RRCMMenuText()=0;
02265     virtual void        RRCMExecute()=0;
02269     virtual bool        RRCMShowChecked()=0;
02272     virtual bool        RRCMHasSeparator()=0;
02273 };
02274 
02294 class IRollupWindow : public ICustomControl {
02295     public:
02296         // Shows or hides all
02298         virtual void Show()=0;
02301         virtual void Hide()=0;
02302 
02303         // Shows or hides by index
02309         virtual void Show(int index)=0;
02315         virtual void Hide(int index)=0;
02316 
02322         virtual HWND GetPanelDlg(int index)=0;
02327         virtual int GetPanelIndex(HWND hWnd)=0;
02335         virtual void SetPanelTitle(int index,const MCHAR *title)=0;
02336 
02337         // returns index of new panel
02372         virtual int AppendRollup( HINSTANCE hInst, const MCHAR *dlgTemplate, 
02373                 DLGPROC dlgProc, const MCHAR *title, LPARAM param=0,DWORD flags=0, int category = ROLLUP_CAT_STANDARD )=0;
02408         virtual int AppendRollup( HINSTANCE hInst, DLGTEMPLATE *dlgTemplate, 
02409                 DLGPROC dlgProc, const MCHAR *title, LPARAM param=0,DWORD flags=0, int category = ROLLUP_CAT_STANDARD )=0;
02430         virtual int ReplaceRollup( int index, HINSTANCE hInst, const MCHAR *dlgTemplate, 
02431                 DLGPROC dlgProc, const MCHAR *title, LPARAM param=0,DWORD flags=0, int category = ROLLUP_CAT_STANDARD)=0;
02469         virtual int ReplaceRollup( int index, HINSTANCE hInst, DLGTEMPLATE *dlgTemplate, 
02470                 DLGPROC dlgProc, const MCHAR *title, LPARAM param=0,DWORD flags=0, int category = ROLLUP_CAT_STANDARD)=0;
02478         virtual void DeleteRollup( int index, int count )=0;
02486         virtual void SetPageDlgHeight(int index,int height)=0;
02487 
02494         virtual void SaveState( RollupState *hState )=0;
02500         virtual void RestoreState( RollupState *hState )=0;
02501 
02502         // Passing WM_LBUTTONDOWN, WM_MOUSEMOVE, and WM_LBUTTONUP to
02503         // this function allows scrolling with unused areas in the dialog.
02517         virtual void DlgMouseMessage( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )=0;
02518 
02521         virtual int GetNumPanels()=0;
02524         virtual BOOL IsPanelOpen(int index) = 0;
02537         virtual void SetPanelOpen(int index, BOOL isOpen, BOOL ignoreFlags = TRUE) =0;
02539         virtual int GetScrollPos()=0;
02544         virtual void SetScrollPos(int spos)=0;
02545 
02546         // This methods moves a RollupPanel to another RollupWindow. It either inserts it
02547         // at the top, or appends it at the end (depending on the top parameter)
02548 
02559         virtual void MoveRollupPanelFrom(IRollupWindow *from, HWND hPanel, BOOL top)=0;
02560         
02561         // Returns the Height of a RollupPanel
02567         virtual int GetPanelHeight(int index)=0;
02568         
02569         // Returns the Height of a RollupWindow, that it is longer than the visible area
02572         virtual int GetScrollHeight()=0;
02573         
02574         // Used internally
02576         virtual void UpdateLayout()=0;
02577         
02583         virtual IRollupPanel *GetPanel(HWND hWnd)=0;
02584 
02590         virtual void RegisterRollupCallback( IRollupCallback *callb)=0;
02595         virtual void UnRegisterRollupCallback( IRollupCallback *callb)=0;
02596 
02605         virtual void RegisterRCMenuItem( IRollupRCMenuItem *item)=0;
02610         virtual void UnRegisterRCMenuItem( IRollupRCMenuItem *item)=0;
02611 
02618         virtual void ResetCategories(bool update = true)=0;
02619 
02621 
02624         virtual void SetBorderless( BOOL borderless )=0;
02626 
02628         virtual BOOL GetBorderless()=0;
02629     };
02630 
02631 // This function returns TRUE if a particular rollup panel is open given
02632 // a handle to the dialog window in the panel.
02638 CoreExport BOOL IsRollupPanelOpen(HWND hDlg);
02639 
02642 CoreExport IRollupWindow *GetIRollup( HWND hCtrl );
02645 CoreExport void ReleaseIRollup( IRollupWindow *irw );
02646 
02658 class IRollupWindowDestructorPolicy: public MaxHeapOperators 
02659 {
02660 public:
02661     static void Delete(IRollupWindow *rw)
02662     {
02663         ReleaseIRollup(rw);
02664     }
02665 };
02666 
02667 //----------------------------------------------------------------------------//
02668 // CustEdit control
02669 
02670 #define CUSTEDITWINDOWCLASS _M("CustEdit")
02671 
02672 // Sent when the user hits the enter key in an edit control.
02673 // wParam = cust edit ID
02674 // lParam = HWND of cust edit control.
02675 #define WM_CUSTEDIT_ENTER   (WM_USER+685)
02676 
02698 class ICustEdit : public ICustomControl {
02699     public:
02703         virtual void GetText( MCHAR *text, int ct )=0;
02706         virtual void GetText ( MSTR& text) const =0;
02711         virtual int GetTextLength() const =0;
02714         virtual void SetText( const MCHAR *text )=0;    
02719         virtual void SetText( int i )=0;
02728         virtual void SetText( float f, int precision=3 )=0;
02736         virtual int GetInt(BOOL *valid=NULL)=0;
02744         virtual float GetFloat(BOOL *valid=NULL)=0;
02748         virtual void SetLeading(int lead)=0;
02787         virtual void WantReturn(BOOL yesNo)=0;
02791         virtual BOOL GotReturn()=0;     // call this on receipt of EN_CHANGE
02793         virtual void GiveFocus()=0;
02796         virtual BOOL HasFocus()=0;
02801         virtual void WantDlgNextCtl(BOOL yesNo)=0;
02812         virtual void SetNotifyOnKillFocus(BOOL onOff)=0;
02816         virtual void SetBold(BOOL onOff)=0;
02817         virtual void SetParamBlock(ReferenceTarget* pb, int subNum)=0;
02818     };
02819 
02822 CoreExport ICustEdit *GetICustEdit( HWND hCtrl );
02825 CoreExport void ReleaseICustEdit( ICustEdit *ice );
02826 
02837 class ICustEditDestructorPolicy: public MaxHeapOperators 
02838 {
02839 public:
02840     static void Delete(ICustEdit *edit)
02841     {
02842         ReleaseICustEdit(edit);
02843     }
02844 };
02845 
02846 #define CUSTSTATUSEDITWINDOWCLASS _M("CustStatusEdit")
02847 
02854 class ICustStatusEdit : public ICustomControl {
02855     public:
02862         virtual void GetText( MCHAR *text, int ct )=0;
02867         virtual void GetText ( MSTR& text) const =0;
02872         virtual int GetTextLength() const =0;
02877         virtual void SetText( const MCHAR *text )=0;    
02884         virtual void SetText( int i )=0;
02896         virtual void SetText( float f, int precision=3 )=0;
02906         virtual int GetInt(BOOL *valid=NULL)=0;
02916         virtual float GetFloat(BOOL *valid=NULL)=0;
02922         virtual void SetLeading(int lead)=0;
02934         virtual void WantReturn(BOOL yesNo)=0;
02938         virtual BOOL GotReturn()=0;     // call this on receipt of EN_CHANGE
02941         virtual void GiveFocus()=0;
02944         virtual BOOL HasFocus()=0;
02951         virtual void WantDlgNextCtl(BOOL yesNo)=0;
02963         virtual void SetNotifyOnKillFocus(BOOL onOff)=0;
02969         virtual void SetBold(BOOL onOff)=0;
02975         virtual void SetReadOnly(BOOL onOff)=0;
02976     };
02977 
02980 CoreExport ICustStatusEdit *GetICustStatusEdit( HWND hCtrl );
02983 CoreExport void ReleaseICustStatusEdit( ICustStatusEdit *ice );
02984 
02995 class ICustStatusEditDestructorPolicy: public MaxHeapOperators 
02996 {
02997 public:
02998     static void Delete(ICustStatusEdit *statusEdit)
02999     {
03000         ReleaseICustStatusEdit(statusEdit);
03001     }
03002 };
03003 
03004 //----------------------------------------------------------------------------//
03005 // CustButton control
03006 
03007 #define CUSTBUTTONWINDOWCLASS _M("CustButton")
03008 
03009 #define CC_COMMAND          WM_USER + 700
03010 // send these with CC_COMMAND: wParam = CC_???
03011 #define CC_CMD_SET_TYPE         23      // lParam = CBT_PUSH, CBT_CHECK
03012 #define CC_CMD_SET_STATE        24      // lParam = 0/1 for popped/pushed
03013 #define CC_CMD_HILITE_COLOR     25      // lParam = RGB packed int
03014 
03015 #define RED_WASH    RGB(255,192,192)
03016 #define GREEN_WASH  (ColorMan()->GetColor(kActiveCommand))
03017 #define BLUE_WASH   (ColorMan()->GetColor(kPressedHierarchyButton))
03018 #define SUBOBJ_COLOR (ColorMan()->GetColor(kSubObjectColor))
03019 
03020 enum CustButType { CBT_PUSH, CBT_CHECK };
03021 
03022 // If the button is set to notify on button down, it will send a WM_COMMAND
03023 // with this notify code when the user touches the button.
03024 #define BN_BUTTONDOWN   8173
03025 // It will also send this message when the mouse is released regardless
03026 // if the mouse is released inside the tool button rectangle
03027 #define BN_BUTTONUP     8174
03028 
03029 // If a button is set to notify on right clicks,  it will send a WM_COMMAND
03030 // with this notify code when the user right clicks on the button.
03031 #define BN_RIGHTCLICK   8183
03032 
03033 // When the user chooses a new fly-off item, this notify code will be sent.
03034 #define BN_FLYOFF       8187
03035 
03036 
03037 // When the user presses a button a WM_MENUSELECT message is sent so that
03038 // the client can display a status prompt describing the function of
03039 // the tool. The fuFlags parameter is set to this value:
03040 #define CMF_TOOLBUTTON  9274
03041 
03042 class MaxBmpFileIcon;
03043 
03065 class FlyOffData {
03066     public:
03067         int iOutEn;
03068         int iInEn;
03069         int iOutDis;
03070         int iInDis;
03071         MaxBmpFileIcon* mpIcon;
03072         MaxBmpFileIcon* mpInIcon;
03073     };
03074 
03075 // Directions the fly off will go.
03076 #define FLY_VARIABLE    1
03077 #define FLY_UP          2
03078 #define FLY_DOWN        3
03079 #define FLY_HVARIABLE   4 // horizontal variable
03080 #define FLY_LEFT        5
03081 #define FLY_RIGHT       6
03082 
03083 typedef LRESULT CALLBACK PaintProc(HDC hdc, Rect rect, BOOL in, BOOL checked, BOOL enabled);
03084 
03117 class ICustButton : public ICustomControl {
03118     public:
03122         virtual void GetText( MCHAR *text, int ct )=0;
03125         virtual void SetText( const MCHAR *text )=0;
03126 
03129         virtual void GetText ( MSTR& text) const =0;
03134         virtual int GetTextLength() const =0;
03135 
03159         virtual void SetImage( HIMAGELIST hImage, 
03160                                int iOutEn, int iInEn, int iOutDis, int iInDis,
03161                                int w, int h )=0;
03162         // Alternate way to set an image on a button.   
03167         virtual void SetIcon ( MaxBmpFileIcon* pIcon, int w, int h) = 0;
03172         virtual void SetInIcon ( MaxBmpFileIcon* pInIcon, int w, int h) = 0;
03173 
03180         virtual void SetType( CustButType type )=0;
03181         
03225         virtual void SetFlyOff(int count,FlyOffData *data,int timeOut,
03226                                int init,int dir=FLY_VARIABLE, int columns=1)=0;
03227 
03233         virtual void SetCurFlyOff(int f,BOOL notify=FALSE)=0;
03236         virtual int GetCurFlyOff()=0;
03237 
03241         virtual BOOL IsChecked()=0;
03245         virtual void SetCheck( BOOL checked )=0;
03249         virtual void SetCheckHighlight( BOOL highlight )=0;
03250 
03260         virtual void SetButtonDownNotify(BOOL notify)=0;
03265         virtual void SetRightClickNotify(BOOL notify)=0;
03266 
03278         virtual void SetHighlightColor(COLORREF clr)=0;
03280         virtual COLORREF GetHighlightColor()=0;
03281 
03284         virtual void SetDADMgr(DADMgr *dad)=0;
03287         virtual DADMgr *GetDADMgr()=0;
03288 
03291         virtual void SetMacroButtonData(MacroButtonData *md)=0;
03292 
03295         virtual MacroButtonData *GetMacroButtonData()=0;
03296 
03301         virtual void SetDisplayProc(PaintProc *proc)=0;
03302 
03303         virtual const MCHAR* GetCaptionText(void)=0;
03304         virtual bool SetCaptionText(const MCHAR* text)=0;
03305     };
03306 
03309 CoreExport ICustButton *GetICustButton( HWND hCtrl );
03312 CoreExport void ReleaseICustButton( ICustButton *icb );
03313 
03326 class ICustButtonDestructorPolicy: public MaxHeapOperators 
03327 {
03328 public:
03329     static void Delete(ICustButton *btn)
03330     {
03331         ReleaseICustButton(btn);
03332     }
03333 };
03334 
03335 //---------------------------------------------------------------------------//
03336 // CustStatus
03337 
03338 #define CUSTSTATUSWINDOWCLASS _M("CustStatus")
03339 
03340 enum StatusTextFormat {
03341     STATUSTEXT_LEFT,
03342     STATUSTEXT_CENTERED,
03343     STATUSTEXT_RIGHT };
03344 
03345 
03359 class ICustStatus : public ICustomControl {
03360     public:
03365         virtual void SetText(const MCHAR *text)=0;
03377         virtual void SetTextFormat(StatusTextFormat f)=0;
03382         virtual void GetText ( MSTR& text) const =0;
03387         virtual int GetTextLength() const =0;
03394         virtual void GetText(MCHAR *text, int ct)=0;
03395     };
03396 
03399 CoreExport ICustStatus *GetICustStatus( HWND hCtrl );
03402 CoreExport void ReleaseICustStatus( ICustStatus *ics );
03403 
03414 class ICustStatusDestructorPolicy: public MaxHeapOperators 
03415 {
03416 public:
03417     static void Delete(ICustStatus *custStatus)
03418     {
03419         ReleaseICustStatus(custStatus);
03420     }
03421 };
03422 
03423 //---------------------------------------------------------------------------//
03424 // CustSeparator -- for use on toolbars
03425 
03426 #define CUSTSEPARATORWINDOWCLASS _M("CustSeparator")
03427 
03436 class ICustSeparator : public ICustomControl {
03437     public:
03442         virtual void SetVisibility(BOOL onOff)=0;
03445         virtual BOOL GetVisibility()=0;
03446     };
03447 
03450 CoreExport ICustSeparator *GetICustSeparator( HWND hCtrl );
03453 CoreExport void ReleaseICustSeparator( ICustSeparator *ics );
03454 
03465 class ICustSeparatorDestructorPolicy: public MaxHeapOperators 
03466 {
03467 public:
03468     static void Delete(ICustSeparator *custSep)
03469     {
03470         ReleaseICustSeparator(custSep);
03471     }
03472 };
03473 
03474 //----------------------------------------------------------------------------//
03475 // CustToolbar control
03476 
03477 #define CUSTTOOLBARWINDOWCLASS _M("CustToolbar")
03478 
03479 #ifdef _OSNAP 
03480     #define VERTTOOLBARWINDOWCLASS _M("VertToolbar")
03481 
03482 #endif
03483 
03484 // Sent in a WM_COMMAND when the user right clicks in open space
03485 // on a toolbar.
03486 #define TB_RIGHTCLICK   0x2861
03487 
03491 enum ToolItemType { 
03492     CTB_PUSHBUTTON,     
03493     CTB_CHECKBUTTON,    
03494     CTB_MACROBUTTON,    
03495     CTB_SEPARATOR,      
03496     CTB_STATUS,         
03497     CTB_OTHER           
03498 #ifdef _OSNAP
03499     , CTB_IMAGE         
03500 #endif
03501     };
03503 
03504 // toolbar orientation
03505 #define CTB_NONE        CUI_NONE
03506 #define CTB_HORIZ       CUI_HORIZ
03507 #define CTB_VERT        CUI_VERT
03508 #define CTB_FLOAT       CUI_FLOAT
03509 
03537 class ToolItem: public MaxHeapOperators {
03538     public: 
03539         ToolItemType type;
03540         int id;
03541         DWORD helpID;
03542         int w, h;
03543         int orient; // which orientations does this item apply to?
03545         virtual ~ToolItem() {}
03546     };
03547 
03549 
03551 class ToolButtonItem : public ToolItem 
03552 {
03553     public:
03555 
03562 
03563         int iOutEn;
03565         int iInEn;      
03567         int iOutDis;
03569         int iInDis;
03571 
03573 
03574 
03575         int iw;
03577         int ih;
03579 
03581 
03582 
03583         MCHAR *label;
03585         MaxBmpFileIcon* mpIcon;
03587         MaxBmpFileIcon* mpInIcon;
03589 
03591 
03592 
03593 
03608         ToolButtonItem(ToolItemType t,
03609             int iOE, int iIE, int iOD, int iID,
03610             int iW, int iH, int wd,int ht, int ID, DWORD hID=0, MCHAR *lbl = NULL,
03611             int or = CTB_HORIZ|CTB_VERT|CTB_FLOAT)
03612             { 
03613                 type = t; 
03614                 orient = or;
03615                 iOutEn = iOE; iInEn = iIE; iOutDis = iOD; iInDis = iID;
03616                 iw = iW; ih = iH; w = wd; h = ht; id = ID; helpID = hID;
03617                 label = lbl;
03618                 mpIcon = mpInIcon = NULL;
03619             }
03620 
03622 
03632         ToolButtonItem(ToolItemType t,
03633                        MaxBmpFileIcon* pIcon,
03634             int iW, int iH, int wd,int ht, int ID, DWORD hID=0, MCHAR *lbl = NULL,
03635             int or = CTB_HORIZ|CTB_VERT|CTB_FLOAT)
03636             { 
03637                 type = t; 
03638                 orient = or;
03639                 mpIcon = pIcon;
03640                 mpInIcon = NULL;
03641                 iOutEn = iInEn = iOutDis = iInDis = -1;
03642                 iw = iW; ih = iH; w = wd; h = ht; id = ID; helpID = hID;
03643                 label = lbl;
03644             }
03645 
03647 
03658         ToolButtonItem(ToolItemType t,
03659                        MaxBmpFileIcon* pIcon,
03660                        MaxBmpFileIcon* pInIcon,
03661             int iW, int iH, int wd,int ht, int ID, DWORD hID=0, MCHAR *lbl = NULL,
03662             int or = CTB_HORIZ|CTB_VERT|CTB_FLOAT)
03663             { 
03664                 type = t; 
03665                 orient = or;
03666                 mpIcon = pIcon;
03667                 mpInIcon = pInIcon;
03668                 iOutEn = iInEn = iOutDis = iInDis = -1;
03669                 iw = iW; ih = iH; w = wd; h = ht; id = ID; helpID = hID;
03670                 label = lbl;
03671             }
03673 };
03674 
03686 class ToolMacroItem : public ToolItem {
03687     public:     
03688         MacroButtonData md;
03702         ToolMacroItem(int wd, int ht, MacroButtonData *data, int or = CTB_HORIZ|CTB_VERT|CTB_FLOAT)
03703             { 
03704             type = CTB_MACROBUTTON;
03705             md = *data; 
03706             orient = or;
03707             w = wd; h = ht; id = 0; helpID = 0;
03708             }
03709     };
03710 
03719 class ToolSeparatorItem : public ToolItem {
03720     public:
03721         int vis;
03736         ToolSeparatorItem(int w, int h=16, BOOL vis=TRUE, int or=CTB_HORIZ|CTB_VERT|CTB_FLOAT) {
03737             type = CTB_SEPARATOR;
03738             id = 0;
03739             helpID = 0;
03740             this->w = w;
03741             this->h = h;
03742             h = 0;
03743             this->vis = vis;
03744             orient = or;
03745             } 
03746     };
03747 
03758 class ToolStatusItem : public ToolItem {
03759     public:
03760         BOOL fixed;
03774         ToolStatusItem(int w, int h,BOOL f,int id, DWORD hID=0, int or = CTB_HORIZ|CTB_FLOAT) {
03775             type = CTB_STATUS;
03776             this->w = w;
03777             this->h = h;
03778             this->id = id;
03779             this->helpID = hID;
03780             fixed = f;
03781             orient = or;
03782             }
03783     };
03784 
03785 #define CENTER_TOOL_VERTICALLY  0xffffffff
03786 
03815 class ToolOtherItem : public ToolItem {
03816     public:
03817         int   y;
03818         DWORD_PTR style;
03819         MCHAR *className;
03820         MCHAR *windowText;
03841         ToolOtherItem(MCHAR *cls,int w,int h,int id,DWORD_PTR style=WS_CHILD|WS_VISIBLE,
03842                     int y=CENTER_TOOL_VERTICALLY, MCHAR *wt=NULL,DWORD hID=0, int or=CTB_HORIZ|CTB_FLOAT) {
03843             type = CTB_OTHER;
03844             this->y = y;
03845             this->w = w;
03846             this->h = h;
03847             this->id = id;
03848             this->helpID = hID;
03849             this->style = style;
03850             orient = or;
03851             className = cls;
03852             windowText = wt;
03853             }       
03854     };
03855 
03856 
03857 #ifdef _OSNAP  //allow image controls on toolbars
03858 
03863 class ToolImageItem : public ToolItem {
03864     public:
03865         int   y;
03866         int il_index;
03869         ToolImageItem(int w,int h,int k,int id, int y=CENTER_TOOL_VERTICALLY,DWORD hID=0, int or=CTB_HORIZ|CTB_FLOAT) {
03870             type = CTB_IMAGE;
03871             this->y = y;
03872             this->w = w;
03873             this->h = h;
03874             this->il_index  = k;
03875             this->id = id;
03876             this->helpID = hID;
03877             orient = or;
03878             }       
03879     };
03880 #endif
03881 
03935 class ICustToolbar : public ICustomControl {
03936     public:
03950         virtual void SetImage( HIMAGELIST hImage )=0;
03961         virtual void AddTool( ToolItem& entry, int pos=-1)=0;
03969         virtual void AddTool2(ToolItem& entry, int pos=-1)=0; // Adds caption buttons to toolbars
03977         virtual void DeleteTools( int start, int num=-1 )=0;  // num = -1 deletes 'start' through count-1 tools
03984         virtual void SetBottomBorder(BOOL on)=0;
03991         virtual void SetTopBorder(BOOL on)=0;
03996         virtual int  GetNeededWidth(int rows)=0;    // return width needed for specified # of rows
04001         virtual void SetNumRows(int rows)=0;
04011         virtual ICustButton *GetICustButton( int id )=0;
04021         virtual ICustStatus *GetICustStatus( int id )=0;
04027         virtual HWND GetItemHwnd(int id)=0;
04029         virtual int GetNumItems()=0;
04043         virtual int GetItemID(int index)=0;
04049         virtual int FindItem(int id)=0;
04054         virtual void DeleteItemByID(int id)=0;
04063         virtual void LinkToCUIFrame( HWND hCUIFrame, CUIFrameMsgHandler *msgHandler)=0;
04073         virtual void GetFloatingCUIFrameSize(SIZE *sz, int rows=1)=0;
04081         virtual ICustStatusEdit *GetICustStatusEdit(int id)=0;
04088         virtual void ResetIconImages() = 0;
04089     };
04090 
04093 CoreExport ICustToolbar *GetICustToolbar( HWND hCtrl );
04096 CoreExport void ReleaseICustToolbar( ICustToolbar *ict );
04097 
04108 class ICustToolbarDestructorPolicy: public MaxHeapOperators 
04109 {
04110 public:
04111     static void Delete(ICustToolbar *custToolbar)
04112     {
04113         ReleaseICustToolbar(custToolbar);
04114     }
04115 };
04116 
04117 #ifdef _OSNAP
04118 
04130 class IVertToolbar : public ICustomControl {
04131     public:
04145         virtual void SetImage( HIMAGELIST hImage )=0;
04156         virtual void AddTool( const ToolItem& entry, int pos=-1 )=0;
04164         virtual void DeleteTools( int start, int num=-1 )=0;  // num = -1 deletes 'start' through count-1 tools
04170         virtual void SetBottomBorder(BOOL on)=0;
04176         virtual void SetTopBorder(BOOL on)=0;
04185         virtual ICustButton *GetICustButton( int id )=0;
04194         virtual ICustStatus *GetICustStatus( int id )=0;        
04200         virtual HWND GetItemHwnd(int id)=0;
04201         virtual void Enable(BOOL onOff=TRUE){};
04202     };
04203 
04206 CoreExport IVertToolbar *GetIVertToolbar( HWND hCtrl );
04209 CoreExport void ReleaseIVertToolbar( IVertToolbar *ict );
04210 
04221 class IVertToolbarDestructorPolicy: public MaxHeapOperators 
04222 {
04223 public:
04224     static void Delete(IVertToolbar *custVToolbar)
04225     {
04226         ReleaseIVertToolbar(custVToolbar);
04227     }
04228 };
04229 
04230 #endif
04231 
04232 //---------------------------------------------------------------------------//
04233 // CustImage
04234 
04235 
04236 #define CUSTIMAGEWINDOWCLASS _M("CustImage")
04237 
04251 class ICustImage : public ICustomControl {
04252     public:
04271         virtual void SetImage( HIMAGELIST hImage,int index, int w, int h )=0;       
04272     };
04273 
04276 CoreExport ICustImage *GetICustImage( HWND hCtrl );
04279 CoreExport void ReleaseICustImage( ICustImage *ici );
04280 
04291 class ICustImageDestructorPolicy: public MaxHeapOperators 
04292 {
04293 public:
04294     static void Delete(ICustImage *custImage)
04295     {
04296         ReleaseICustImage(custImage);
04297     }
04298 };
04299 
04300 #ifdef _OSNAP
04301 //---------------------------------------------------------------------------//
04302 // CustImage 2D Version for displaying osnap icons
04303 
04304 
04305 #define CUSTIMAGEWINDOWCLASS2D  _M("CustImage2D")
04306 
04307 class ICustImage2D : public ICustomControl {
04308     public:
04309         virtual void SetImage( HIMAGELIST hImage,int index, int w, int h )=0;       
04310     };
04311 
04312 #endif
04313 
04314 
04315 //------------------------------------------------------------------------
04316 // Off Screen Buffer
04317 
04324 class IOffScreenBuf: public MaxHeapOperators {
04325     public:
04327         virtual ~IOffScreenBuf() {;}
04331         virtual HDC GetDC()=0;
04337         virtual void Erase(Rect *rct=NULL)=0;
04344         virtual void Blit(Rect *rct=NULL)=0;
04346         virtual void Resize()=0;
04351         virtual void SetBkColor(COLORREF color)=0;
04355         virtual COLORREF GetBkColor()=0;
04356     };
04357 
04359 CoreExport IOffScreenBuf *CreateIOffScreenBuf(HWND hWnd);
04361 CoreExport void DestroyIOffScreenBuf(IOffScreenBuf *iBuf);
04362 
04363 
04364 //------------------------------------------------------------------------
04365 // Color swatch control
04366 // Puts up the ColorPicker when user right clicks on it.
04367 //
04368 
04369 // This message is sent as the color is being adjusted in the 
04370 // ColorPicker.
04371 // LOWORD(wParam) = ctrlID, 
04372 // HIWORD(wParam) = 1 if button UP 
04373 //                = 0 if mouse drag.
04374 // lParam = pointer to ColorSwatchControl
04375 #define CC_COLOR_CHANGE         WM_USER + 603
04376 
04377 // LOWORD(wParam) = ctrlID, 
04378 // lParam = pointer to ColorSwatchControl
04379 #define CC_COLOR_BUTTONDOWN     WM_USER + 606
04380 
04381 // LOWORD(wParam) = ctrlID, 
04382 // HIWORD(wParam) = FALSE if user cancelled - TRUE otherwise
04383 // lParam = pointer to ColorSwatchControl
04384 #define CC_COLOR_BUTTONUP       WM_USER + 607
04385 
04386 // This message is sent if the color has been clicked on, before 
04387 // bringing up the color picker.
04388 // LOWORD(wParam) = ctrlID, 
04389 // HIWORD(wParam) = 0 
04390 // lParam = pointer to ColorSwatchControl
04391 #define CC_COLOR_SEL            WM_USER + 604
04392 
04393 
04394 // This message is sent if another color swatch has been dragged and dropped
04395 // on this swatch. 
04396 // LOWORD(wParam) = toCtrlID, 
04397 // HIWORD(wParam) = 0
04398 // lParam = pointer to ColorSwatchControl
04399 #define CC_COLOR_DROP           WM_USER + 605
04400 
04401 // This message is sent when the color picker is closed
04402 // LOWORD(wParam) = ctrlID, 
04403 // HIWORD(wParam) = 0 
04404 // lParam = pointer to ColorSwatchControl
04405 // The following macro has been added
04406 // in 3ds max 4.2.  If your plugin utilizes this new
04407 // mechanism, be sure that your clients are aware that they
04408 // must run your plugin with 3ds max version 4.2 or higher.
04409 #define CC_COLOR_CLOSE          WM_USER + 608 //RK: 05/14/00, added this
04410 // End of 3ds max 4.2 Extension
04411 
04412 #define COLORSWATCHWINDOWCLASS _M("ColorSwatch")
04413 
04459 class IColorSwatch: public ICustomControl {
04460     public:
04461         // sets only the varying color of the color picker if showing
04472         virtual COLORREF SetColor(COLORREF c, int notify=FALSE)=0;  // returns old color
04473         COLORREF SetColor(Color c, int notify=FALSE) {return SetColor(c.toRGB(), notify);}  // returns old color
04474         virtual AColor SetAColor(AColor c, int notify=FALSE)=0;  // returns old color
04475 
04476         // sets both the varying color and the "reset"color of the color picker
04477         virtual COLORREF InitColor(COLORREF c, int notify=FALSE)=0;  // returns old color
04478         COLORREF InitColor(Color c, int notify=FALSE) {return InitColor(c.toRGB(), notify);}  // returns old color
04479         virtual AColor InitAColor(AColor c, int notify=FALSE)=0;  // returns old color
04480 
04481         virtual void SetUseAlpha(BOOL onOff)=0;
04482         virtual BOOL GetUseAlpha()=0;
04483 
04489         virtual COLORREF GetColor()=0;
04490         virtual AColor GetAColor()=0;
04496         virtual void ForceDitherMode(BOOL onOff)=0;
04500         virtual void SetModal()=0;
04509         virtual void Activate(int onOff)=0;
04518         virtual void EditThis(BOOL startNew=TRUE)=0;
04519         virtual void SetKeyBrackets(BOOL onOff)=0;
04520 
04530         virtual void SetNotifyAfterAccept(BOOL onOff)=0;
04536         virtual BOOL GetNotifyAfterAccept()=0;
04537     };
04538 
04543 CoreExport IColorSwatch *GetIColorSwatch( HWND hCtrl, COLORREF col, const MCHAR *name);
04548 CoreExport IColorSwatch *GetIColorSwatch( HWND hCtrl, Color col, const MCHAR *name);
04553 CoreExport IColorSwatch *GetIColorSwatch( HWND hCtrl, AColor col, const MCHAR *name);
04556 CoreExport IColorSwatch *GetIColorSwatch(HWND hCtrl);
04559 CoreExport void ReleaseIColorSwatch( IColorSwatch *ics );
04560 
04562 CoreExport void RefreshAllColorSwatches();
04563 
04574 class IColorSwatchDestructorPolicy: public MaxHeapOperators 
04575 {
04576 public:
04577     static void Delete(IColorSwatch *colorSwatch)
04578     {
04579         ReleaseIColorSwatch(colorSwatch);
04580     }
04581 };
04582 
04583 // This class is only available in versions 5.1 and later.
04584 #define COLOR_SWATCH_RENAMER_INTERFACE_51 Interface_ID(0x5a684953, 0x1fc043dc)
04585 
04624 class IColorSwatchRenamer : public BaseInterface {
04625 public:
04626     // The method we needed the interface for:
04629     virtual void SetName (const MCHAR *name) { }
04630 
04631     // Interface ID
04632     Interface_ID GetID() {return COLOR_SWATCH_RENAMER_INTERFACE_51;}
04633 };
04634 
04635 //---------------------------------------------------------------------------//
04636 // DragAndDrop Window
04637 
04638 
04639 #define DADWINDOWCLASS  _M("DragDropWindow")
04640 
04641 typedef LRESULT CALLBACK WindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
04642 
04651 class IDADWindow : public ICustomControl {
04652     public:
04653         // Installing this makes it do drag and drop.
04658         virtual void SetDADMgr( DADMgr *dadMgr)=0;
04661         virtual DADMgr *GetDADMgr()=0;
04662         
04663         // Install Window proc called to do all the normal things after 
04664         // drag/and/drop processing is done.
04686         virtual void SetWindowProc( WindowProc *proc)=0;
04687 
04688     };
04689 
04692 CoreExport IDADWindow *GetIDADWindow( HWND hWnd);
04695 CoreExport void ReleaseIDADWindow( IDADWindow *idw );
04696 
04707 class IDADWindowDestructorPolicy: public MaxHeapOperators 
04708 {
04709 public:
04710     static void Delete(IDADWindow *idw)
04711     {
04712         ReleaseIDADWindow(idw);
04713     }
04714 };
04715 
04716 //------------------------------------------------------------------------
04717 // Window thumb tack
04718 
04720 
04721 CoreExport void InstallThumbTack(HWND hwnd);
04722 CoreExport void RemoveThumbTack(HWND hwnd);
04723 
04724 
04738 CoreExport ISpinnerControl *SetupIntSpinner(HWND hwnd, int idSpin, int idEdit,  int min, int max, int val);
04739 
04768 CoreExport ISpinnerControl *SetupFloatSpinner(HWND hwnd, int idSpin, int idEdit,  float min, float max, float val, float scale = 0.1f);
04769 CoreExport ISpinnerControl *SetupUniverseSpinner(HWND hwnd, int idSpin, int idEdit,  float min, float max, float val, float scale = 0.1f);
04770 
04771 // Controls whether or not spinners send notifications while the user adjusts them with the mouse
04777 CoreExport void SetSpinDragNotify(BOOL onOff);
04780 CoreExport BOOL GetSpinDragNotify();
04781 
04782 //---------------------------------------------------------------------------
04783 //
04784 
04785 CoreExport void DisableAccelerators();
04786 CoreExport void EnableAccelerators();
04787 CoreExport BOOL AcceleratorsEnabled();
04788 
04790 
04801 CoreExport void SetSaveRequiredFlag(BOOL requireSave = TRUE, BOOL requireAutoBackupSave = TRUE);
04802 
04804 
04806 CoreExport BOOL GetSaveRequiredFlag();
04807 
04809 
04813 CoreExport BOOL IsSaveRequired();
04814 
04816 
04822 CoreExport BOOL IsAutoSaveRequired();
04823 
04824 #pragma warning(pop)
04825