00001 //============================================================================= 00002 // filename: RmUtilControlPlacement.h 00003 // 00004 // author: Ben Mistal 00005 // ATI Research, Inc. 00006 // 3D Application Research Group 00007 // 00008 // description: Definition of the RmControlPlacementContainer class. 00009 // This class is a utility for quickly allowing dynamically positioned 00010 // controls within a dialog. 00011 // 00012 //============================================================================= 00013 // $File: //depot/3darg/Tools/RenderMonkey/sdk/Include/Utilities/RmUtilControlPlacement.h $ 00014 // $Author: bmistal $ $Revision: #7 $ 00015 //============================================================================= 00016 // (C) 2002 ATI Research, Inc. All rights reserved. 00017 //============================================================================= 00018 00019 #ifndef _RM_UTILITIES_CONTROL_PLACEMENT_H_ 00020 #define _RM_UTILITIES_CONTROL_PLACEMENT_H_ 00021 00022 //============================================================================= 00026 //============================================================================= 00027 00028 //============================================================================= 00033 //============================================================================= 00034 class RMUTIL_API RmControlPlacementContainer 00035 { 00036 //----------------------------------------------------------------------------- 00037 // Public Definitions 00038 //----------------------------------------------------------------------------- 00039 public: 00040 00041 //-------------------------------------------------------------------------- 00044 //-------------------------------------------------------------------------- 00045 typedef enum RmControlLocationType 00046 { 00047 LocationLeft = 0, 00048 LocationRight, 00049 LocationTop, 00050 LocationBottom, 00051 LocationLeftRightLerp, 00052 LocationTopBottomLerp, 00053 LocationVisibility, 00054 00055 }; // end typedef enum RmControlLocationType 00056 00057 //----------------------------------------------------------------------------- 00058 // Protected Definitions 00059 //----------------------------------------------------------------------------- 00060 protected: 00061 00062 //-------------------------------------------------------------------------- 00065 //-------------------------------------------------------------------------- 00066 typedef struct RmControlLocationPlacementInfo 00067 { 00068 HWND hDestinationWnd; 00069 RmControlLocationType rmDestinationControlLocationType; 00070 00071 HWND hSourceWnd; 00072 RmControlLocationType rmSourceControlLocationType; 00073 int nOffset; 00074 float fInterpolationValue; 00075 bool bVisible; 00076 00077 RmControlPlacementContainer* pRmControlPlacementContainer; 00078 00079 }; // end typedef struct RmControlLocationPlacementInfo 00080 00081 //-------------------------------------------------------------------------- 00084 //-------------------------------------------------------------------------- 00085 typedef struct RmHwndRectInfo 00086 { 00087 HWND hWnd; 00088 RECT rect; 00089 00090 }; // end typedef struct RmHwndRectInfo 00091 00092 // Definitions for hwnd rect info lists 00093 typedef RmLinkedList< RmHwndRectInfo* > RmHwndRectInfoList; 00094 typedef RmHwndRectInfoList::iterator RmHwndRectInfoListIterator; 00095 typedef RmHwndRectInfoList::const_iterator RmHwndRectInfoListConstIterator; 00096 00097 // Definitions for control location placement info lists 00098 typedef RmLinkedList< RmControlLocationPlacementInfo* > RmControlLocationPlacementInfoList; 00099 typedef RmControlLocationPlacementInfoList::iterator RmControlLocationPlacementInfoIterator; 00100 typedef RmControlLocationPlacementInfoList::const_iterator RmControlLocationPlacementInfoConstIterator; 00101 00102 //----------------------------------------------------------------------------- 00103 // Public Member Functions 00104 //----------------------------------------------------------------------------- 00105 public: 00106 00107 //-------------------------------------------------------------------------- 00109 //-------------------------------------------------------------------------- 00110 virtual ~RmControlPlacementContainer() 00111 { 00112 EmptyControlPlacementContainer(); 00113 00114 } // end virtual ~RmControlPlacementContainer() 00115 00116 //----------------------------------------------------------------------------- 00117 // Public Member Functions 00118 //----------------------------------------------------------------------------- 00119 public: 00120 00121 //-------------------------------------------------------------------------- 00125 //-------------------------------------------------------------------------- 00126 void EmptyControlPlacementContainer(); 00127 00128 //-------------------------------------------------------------------------- 00132 //-------------------------------------------------------------------------- 00133 void ProcessControlPlacementContainer(); 00134 00135 //-------------------------------------------------------------------------- 00140 //-------------------------------------------------------------------------- 00141 void Attach( RmControlPlacementContainer* pRmControlPlacementContainer ); 00142 00143 //-------------------------------------------------------------------------- 00153 //-------------------------------------------------------------------------- 00154 void Bind( HWND hDestinationWnd, 00155 RmControlLocationType rmDestinationControlLocationType, 00156 HWND hSourceWnd, 00157 RmControlLocationType rmSourceControlLocationType, 00158 int nOffset = 0, 00159 float fInterpolationValue = 0.0f, 00160 bool bVisible = true ); 00161 00162 //-------------------------------------------------------------------------- 00167 //-------------------------------------------------------------------------- 00168 void BindControlRelativeLeft( HWND hControlWnd, int nOffset = 0 ); 00169 00170 //-------------------------------------------------------------------------- 00175 //-------------------------------------------------------------------------- 00176 void BindControlRelativeRight( HWND hControlWnd, int nOffset = 0 ); 00177 00178 //-------------------------------------------------------------------------- 00183 //-------------------------------------------------------------------------- 00184 void BindControlRelativeTop( HWND hControlWnd, int nOffset = 0 ); 00185 00186 //-------------------------------------------------------------------------- 00191 //-------------------------------------------------------------------------- 00192 void BindControlRelativeBottom( HWND hControlWnd, int nOffset = 0 ); 00193 00194 //-------------------------------------------------------------------------- 00199 //-------------------------------------------------------------------------- 00200 void BindControlLeft( HWND hControlWnd, int nOffset = 0 ); 00201 00202 //-------------------------------------------------------------------------- 00207 //-------------------------------------------------------------------------- 00208 void BindControlRight( HWND hControlWnd, int nOffset = 0 ); 00209 00210 //-------------------------------------------------------------------------- 00215 //-------------------------------------------------------------------------- 00216 void BindControlTop( HWND hControlWnd, int nOffset = 0 ); 00217 00218 //-------------------------------------------------------------------------- 00223 //-------------------------------------------------------------------------- 00224 void BindControlBottom( HWND hControlWnd, int nOffset = 0 ); 00225 00226 //-------------------------------------------------------------------------- 00233 //-------------------------------------------------------------------------- 00234 void BindControlLeftOf( HWND hControlWnd, HWND hSourceWnd, int nOffset = 0 ); 00235 00236 //-------------------------------------------------------------------------- 00243 //-------------------------------------------------------------------------- 00244 void BindControlRightOf( HWND hControlWnd, HWND hSourceWnd, int nOffset = 0 ); 00245 00246 //-------------------------------------------------------------------------- 00253 //-------------------------------------------------------------------------- 00254 void BindControlTopOf( HWND hControlWnd, HWND hSourceWnd, int nOffset = 0 ); 00255 00256 //-------------------------------------------------------------------------- 00263 //-------------------------------------------------------------------------- 00264 void BindControlBottomOf( HWND hControlWnd, HWND hSourceWnd, int nOffset = 0 ); 00265 00266 //-------------------------------------------------------------------------- 00272 //-------------------------------------------------------------------------- 00273 void BindControlRelativeTo( HWND hControlWnd, HWND hSourceWnd ); 00274 00275 //-------------------------------------------------------------------------- 00281 //-------------------------------------------------------------------------- 00282 void BindControlVisibility( HWND hControlWnd, bool bVisible ); 00283 00284 //----------------------------------------------------------------------------- 00285 // Protected Member Functions 00286 //----------------------------------------------------------------------------- 00287 protected: 00288 00289 //-------------------------------------------------------------------------- 00295 //-------------------------------------------------------------------------- 00296 LONG* GetRectLocationValuePtr( RECT* pRect, 00297 RmControlLocationType rmControlLocationType ); 00298 00299 //-------------------------------------------------------------------------- 00305 //-------------------------------------------------------------------------- 00306 LONG GetRectLocationValue( RECT* pRect, 00307 RmControlLocationType rmControlLocationType, 00308 float fInterpolationValue ); 00309 00310 //-------------------------------------------------------------------------- 00315 //-------------------------------------------------------------------------- 00316 RECT* GetHwndRect( HWND hWnd ); 00317 00318 //----------------------------------------------------------------------------- 00319 // Public Member Variables 00320 //----------------------------------------------------------------------------- 00321 protected: 00322 00323 RmControlLocationPlacementInfoList m_rmControlLocationPlacementInfoList; 00324 RmHwndRectInfoList m_rmHwndRectInfoList; 00325 00326 }; // end class RMUTIL_API RmControlPlacementContainer 00327 00328 #endif // _RM_UTILITIES_CONTROL_PLACEMENT_H_
1.3.6