interface.h

Go to the documentation of this file.
00001 
00002 //**************************************************************************/
00003 // Copyright (c) 2008 Autodesk, Inc.
00004 // All rights reserved.
00005 //
00006 // Use of this software is subject to the terms of the Autodesk license
00007 // agreement provided at the time of installation or download, or which
00008 // otherwise accompanies this software in either electronic or hard copy form.
00009 //
00010 //**************************************************************************/
00011 // DESCRIPTION:
00012 // CREATED: October 2008
00013 //**************************************************************************/
00014 
00015 #ifndef __MUDBOXSDK_INTERFACE_H__
00016 #define __MUDBOXSDK_INTERFACE_H__
00017 #pragma once
00018 
00019 
00020 namespace mudbox
00021 {
00022     class MBDLL_DECL KeyboardEventNotifier : public Node
00023     {
00024         DECLARE_CLASS;
00025 
00027         enum Type
00028         {
00029             ePressed,
00030             eReleased
00031         } m_eType;
00033         int m_iKey;
00037         int m_iModifiers;
00038     };
00039 
00043     class MBDLL_DECL Interface : public Node
00044     {
00045     public:
00046         Interface( void );
00047 
00048         enum LayerUIType
00049         {
00050             ltSculptUI,     
00051             ltPaintUI       
00052         };
00053         enum MessageBoxType
00054         {
00055             msgInformation,
00056             msgWarning,
00057             msgQuestion,
00058             msgError
00059         };
00060         enum MessageBoxButton
00061         {
00062             buttonNone      = 0x00000000,
00063             buttonOk        = 0x00000400,
00064             buttonCancel    = 0x00400000,
00065             buttonClose     = 0x00200000,
00066             buttonYes       = 0x00004000,
00067             buttonYesToAll  = 0x00008000,
00068             buttonNo        = 0x00010000,
00069             buttonNoToAll   = 0x00020000,
00070             buttonAbort     = 0x00040000,
00071             buttonRetry     = 0x00080000,
00072             buttonIgnore    = 0x00100000,
00073             buttonHelp      = 0x01000000
00074         };
00075         enum HUDMessageType
00076         {
00077             HUDmsgPin,      
00078             HUDmsgFade      
00079         };
00080 
00081         enum StatusType
00082         {
00083             stNormal,       
00084             stWarning,      
00085             stError         
00086         };
00087 
00088         enum HotkeySetName
00089         {
00090             HotkeySetMudbox     = 0,
00091             HotkeySetMaya       = 1,
00092             HotkeySet3dsMax     = 2,
00093             HotkeySetSoftimage  = 3
00094         };
00095 
00096         static QString menuFile;
00097         static QString menuEdit;
00098         static QString menuCreate;
00099         static QString menuCurves;
00100         static QString menuDisplay;
00101         static QString menuHelp;
00102         static QString menuPlugins;
00103         static QString menuMesh;
00104         static QString menuRender;
00105         static QString menuScripts;
00106         static QString menuMaps;
00107         static QString menuWindows;
00108 
00109 
00111         QWidget *MainWindow( void ) const;
00112 
00113         void ShowNewPaintLayerDialog( void );
00114 
00116         void ShowBrushRing( bool bShow );
00117 
00119         bool RestorePreviousBrush( void );
00120 
00123         aptr<BrushOperation> SelectedBrush;
00124 
00126         void ActivateLayerSystem( 
00127             LayerUIType eType  
00128             );
00129 
00135         void Load( 
00136             QString filename, 
00137             Scene::LoadData& cData  
00138             );
00139 
00141         void ShowProperties( 
00142             Node *pNode,    
00143             bool bFloating  
00144             ) const;
00145 
00147         int MessageBox(
00148             MessageBoxType iType,   
00149             const QString &sTitle,  
00150             const QString &sText,   
00151             int iButtons = buttonNone,  
00152             int iDefaultButton = buttonNone 
00153             );
00154 
00158         int OneTimeMessageBox (
00159             MessageBoxType iType,   
00160             const QString &sTitle,  
00161             const QString &sText,   
00162             int buttons = 0  
00163             );
00164 
00171         void HUDMessageShow(
00172             const QString &sMessage, 
00173             HUDMessageType iType = HUDmsgFade   
00174             );
00175             
00180         void HUDMessageHide();
00181         
00183         void SetStatus(
00184             StatusType iType,   
00185             const QString& sMsg 
00186             );
00187 
00203         void AddClassMenuItem(
00204             const QString &sMenu,           
00205             const QString &sSubmenu,        
00206             const ClassDesc *pClass,        
00207             const QString &sCreatorText,    
00208             const int &index = -1,          
00209             const int &subindex = -1,       
00210             const bool addSeparator = false 
00211             );
00212 
00219         void AddCallbackMenuItem(
00220             const QString &sMenu,       
00221             const QString &sSubmenu,        
00222             const QString &sItemName,   
00223             void (*pCallback)(),        
00224             const QString &sID = "",    
00225             const int &index = -1,      
00226             const int &subindex = -1,   
00227             const bool addSeparator = false 
00228             );
00229 
00231         void SelectHotkeySet(
00232             HotkeySetName newKeySet,        
00233             bool forceSetHotkey = false     
00234             );
00235 
00237         HotkeySetName CurrentHotkeySet() const; 
00238 
00240         void AddToCreateMeshMenu(QFileInfo fileInfo);
00241     
00242         void AddObjectListContextMenuItem(
00243             const ClassDesc *pObjectType,
00244             const QString &sItemName,
00245             void (*pCallback)(),
00246             int index = -1,
00247             bool addSeparator = false
00248             );
00249 
00250         void AddLayerCallbackMenuItem(
00251             mudbox::Interface::LayerUIType ltType,
00252             const QString &sItemName,
00253             void (*pCallback)()
00254             );
00255 
00257         void ProgressStart(
00258             const QString &sDescription,        
00259             unsigned int iMaxValue          
00260             );
00261         
00263         void ProgressSet(
00264             unsigned int iValue     
00265             );
00266         
00268         void ProgressAdd( void );
00269         
00271         void ProgressEnd( void );
00272         
00278         bool ProgressIsCancelRequested( void );
00279 
00283         QString LoadFileDialog(
00284             const QString &sTitle,  
00285             const QString &sPath,   
00286             const QString &sFilter, 
00287             QString* sSelectedFilter = 0        
00288             ) const;
00289         
00293         QString SaveFileDialog(
00294             const QString &sTitle,          
00295             const QString &sPath,           
00296             const QString &sFilter,         
00297             bool bAskForOverwrite = true,   
00298             QString* sSelectedFilter = 0        
00299             ) const;
00300 
00304         QString GetDirectoryDialog(
00305             const QString &sTitle,  
00306             const QString &sPath    
00307             ) const;
00308 
00312         QStringList LoadFilesDialog(
00313             const QString &sTitle,  
00314             const QString &sPath,   
00315             const QString &sFilter  
00316             ) const;
00317 
00319         void WaitCursorStart( void );
00320         
00322         void WaitCursorEnd( void );
00323 
00325         void RefreshUI( void ) const;
00326 
00328         void AddView(QString className, QString windowTitle, const bool select = false) const;
00329 
00336         mutable aptr<KeyboardEventNotifier> KeyboardEvent;
00337 
00341         aevent PostUIInitializationEvent;
00342     };
00343 
00348     class MBDLL_DECL Action : public Node
00349     {
00350         DECLARE_CLASS;
00351 
00352         enum Hotkeys
00353         {
00354             keyAlt = 0x00010000,        
00355             keyShift = 0x00020000,  
00356             keyCtrl = 0x00040000,   
00357             keyMeta = 0x00080000,
00358             keyLMB = 0x00000100,    
00359             keyMMB   = 0x00000200,  
00360             keyRMB = 0x00000400,    
00361             keyWheel = 0x00000800,
00362             keyLeft = 0x01000012,   
00363             keyUp = 0x01000013,     
00364             keyRight = 0x01000014,  
00365             keyDown = 0x01000015    
00366         };
00367 
00368     public:
00369         Action( void );
00370         ~Action( void );
00371 
00373         virtual int DefaultHotkey( void ) const;
00375         virtual bool IsSticky( void ) const;
00377         virtual bool IsHide( void ) const;
00378 
00380         virtual bool IsEnabled( void ) const;
00381 
00383         virtual void SetEnabled( bool bEnabled );
00384 
00386         virtual void OnActivate( 
00387             bool bRepeat    
00388             );
00390         virtual void OnDeactivate( void );
00392         virtual void OnCursorMove( 
00393             float fXPosition,   
00394             float fYPosition,   
00395             float fXChange, 
00396             float fYChange  
00397             );
00399         virtual void OnOptions( void );
00400     };
00401 };
00402 
00403 #endif
00404