fbmanipulator.h

Go to the documentation of this file.
00001 #ifndef __FBMANIPULATOR_H__
00002 #define __FBMANIPULATOR_H__
00003 /**************************************************************************
00004  Copyright (c) 1994 - 2009 Autodesk, Inc. and/or its licensors.
00005  All Rights Reserved.
00006  
00007  The coded instructions, statements, computer programs, and/or related 
00008  material (collectively the "Data") in these files contain unpublished 
00009  information proprietary to Autodesk, Inc. and/or its licensors, which is 
00010  protected by Canada and United States of America federal copyright law 
00011  and by international treaties.
00012  
00013  The Data may not be disclosed or distributed to third parties, in whole 
00014  or in part, without the prior written consent of Autodesk, Inc. 
00015  ("Autodesk").
00016  
00017  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00018  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO 
00019  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR 
00020  ARISING BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES 
00021  OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR 
00022  PURPOSE OR USE. WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT 
00023  WARRANT THAT THE OPERATION OF THE DATA WILL BE UNINTERRUPTED OR ERROR 
00024  FREE.
00025  
00026  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS 
00027  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR 
00028  EXPENSES OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE 
00029  DAMAGES OR OTHER SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS 
00030  OF PROFITS, REVENUE OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR 
00031  DAMAGES OF ANY KIND), HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF 
00032  LIABILITY, WHETHER DERIVED FROM CONTRACT, TORT (INCLUDING, BUT NOT 
00033  LIMITED TO, NEGLIGENCE), OR OTHERWISE, ARISING OUT OF OR RELATING TO THE 
00034  DATA OR ITS USE OR ANY OTHER PERFORMANCE, WHETHER OR NOT AUTODESK HAS 
00035  BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.
00036  
00037 **************************************************************************/
00038 
00043 #include <kaydaradef.h>
00044 #ifndef FBSDK_DLL 
00045 
00048     #define FBSDK_DLL K_DLLIMPORT
00049 #endif
00050 
00051 #include <fbsdk/fbcomponent.h>
00052 #include <fbcontrols/fbcontrols.h>
00053 
00054 #ifdef FBSDKUseNamespace
00055     namespace FBSDKNamespace {
00056 #endif
00057 
00058 FB_FORWARD( FBModel );
00059 
00060 FB_DEFINE_COMPONENT( FBSDK_DLL, Manipulator );
00061 FB_DEFINE_COMPONENT( FBSDK_DLL, Camera  );
00062 
00069 #define FBRegisterManipulator( ClassName, Label, Description, IconFilename ) \
00070     HIObject RegisterManipulator##ClassName( HIObject /*pOwner*/,char * pName,void * /*pData*/) \
00071     { \
00072       ClassName *Class = new ClassName( Label ); \
00073         if (Class->FBCreate()) { \
00074             return Class->GetHIObject(); \
00075         } else { \
00076             delete Class; \
00077             return NULL; \
00078         } \
00079     } \
00080     FBLibraryModule( ClassName )    \
00081     {   \
00082         FBRegisterObject( ClassName,"Manipulators",Label,Description,RegisterManipulator##ClassName,true, IconFilename );   \
00083     }
00084 
00089 #define FBManipulatorDeclare( ClassName, Parent  ) \
00090     FBClassDeclare( ClassName,Parent); \
00091   public: \
00092     ClassName(char * pName):Parent(pName) { FBClassInit; } \
00093   private:
00094 
00098 #define FBManipulatorImplementation( ThisComponent ) \
00099         FBClassImplementation( ThisComponent )
00100 
00102 // FBManipulator
00105 enum FBManipulatorPickType      { 
00106     FBPickObjects,      
00107     FBPickPoints,       
00108     FBPickSurfaces      
00109 };
00110 
00111 __FB_FORWARD( FBManipulator );
00112 
00114 class FBSDK_DLL FBManipulator : public FBComponent {
00115     __FBClassDeclare( FBManipulator,FBComponent );
00116 public:
00121     FBManipulator(char *pName, HIObject pObject=NULL);
00122 
00123     virtual bool FBCreate   ();
00124 
00125     // ***** Picking routines ******
00126     //---- Rectangle -----
00127 
00131     void        PickRectStart(FBManipulatorPickType pType);
00132 
00134     void        PickRectMotion();
00135 
00137     void        PickRectStop();
00138 
00139     //---- Single Pick -----
00140 
00144     void        Pick(FBManipulatorPickType pType);
00145 
00146     //---- Pick Result -----
00147 
00151     int         PickGetCount();
00152 
00157     HFBModel    PickGetModel(int pIndex);
00158 
00163     FBVertex    PickGetPoint(int pIndex);
00164 
00168     int         GetViewerWidth();
00169 
00173     int         GetViewerHeight();
00174 
00178     int         GetPanePosX();
00179 
00183     int         GetPanePosY();
00184 
00188     int         GetPaneWidth();
00189 
00193     int         GetPaneHeight();
00194 
00195     // Render begin/end 
00201     void        FBModelRenderBegin(HFBModel pModel);
00202 
00204     void        FBModelRenderEnd();
00205 
00215     virtual bool    ViewInput(int pMouseX, int pMouseY, FBInputType pAction, int pButtonKey,int pModifier); // same as FBView
00216 
00220     virtual void    ViewExpose();
00221 
00222 public:
00223     FBPropertyBool              Active;                     
00224     FBPropertyBool              AlwaysActive;               
00225     FBPropertyBool              Visible;                    
00226     FBPropertyBool              DefaultBehavior;            
00227     FBPropertyString            ViewerText;                 
00228     FBPropertyCamera            CurrentCamera;              
00229 };
00230 
00232 // Property list
00234 FB_DEFINE_LIST( FBSDK_DLL, Manipulator );
00235 
00237 class FBSDK_DLL FBPropertyListManipulator : public FBPropertyBaseList< HFBManipulator >
00238 {
00243     virtual int  Add    ( HFBManipulator pItem );
00247     virtual void RemoveAt( int pIndex );
00248 public:
00253     virtual HFBManipulator operator[](int pIndex);
00257     virtual int  GetCount();
00258 };
00259 
00261 // FBManipulatorTransform
00263 __FB_FORWARD( FBManipulatorTransform );
00264 
00265 FB_DEFINE_COMPONENT( FBSDK_DLL, ManipulatorTransform );
00266 
00268 enum FBManipulatorTransformType { 
00269     kFBManipulatorTransformNone,        
00270     kFBManipulatorTransformTranslation, 
00271     kFBManipulatorTransformRotation,    
00272     kFBManipulatorTransformScaling      
00273 };
00274 
00275 FB_DEFINE_ENUM( FBSDK_DLL, ManipulatorTransformType );
00276 
00278 class FBSDK_DLL FBManipulatorTransform : public FBManipulator {
00279     __FBClassDeclare( FBManipulatorTransform,FBManipulator );
00280 public:
00285     FBManipulatorTransform(char *pName,HIObject pObject=NULL);
00286 
00287     FBPropertyManipulatorTransformType      Type;                       
00288     FBPropertyBool                          IconVisible;                
00289     FBPropertyBool                          VertexSelectionEnabled;     
00290     FBPropertyBool                          VertexManipulationEnabled;  
00291 };
00292 
00293 #ifdef FBSDKUseNamespace
00294     }
00295 #endif
00296 #endif