Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

RmMFCVariableEditCtrl.h

00001 //=================================================================================================//
00002 // filename: RmMFCVariableEditCtrl.h                                                               //
00003 //                                                                                                 //
00004 //           ATI Research, Inc.                                                                    //
00005 //           3D Application Research Group                                                         //
00006 //                                                                                                 //
00007 // description: Defines the CRmColorPickerCtrl class.                                              //
00008 //                                                                                                 //
00009 //=================================================================================================//
00010 //   (C) 2004 ATI Research, Inc.  All rights reserved.                                             //
00011 //=================================================================================================//
00012 
00013 #ifndef _RM_MFC_UTILITIES_VARIABLE_EDIT_CTRL_H_
00014 #define _RM_MFC_UTILITIES_VARIABLE_EDIT_CTRL_H_
00015 
00016 #if _MSC_VER > 1000
00017 #pragma once
00018 #endif // _MSC_VER > 1000
00019 // RmMFCVariableEditCtrl.h : header file
00020 //
00021 
00022 #include <Utilities/RmUtilControlPlacement.h>
00023 #include <MFCUtilities/RmMFCTypes.h>
00024 #include <MFCUtilities/RmMFCNumericEdit.h>
00025 #include <MFCUtilities/RmMFCSliderEdit.h>
00026 #include <MFCUtilities/RmMFCUtilitiesResource.h>
00027 #include <MFCUtilities/RmMFCUtilitiesResource.h>
00028 #include <MFCUtilities/RmMFCScrollWnd.h>
00029 
00030 #define RM_INCLUDE_SCROLLING_VALUE_CONTROL_WINDOW 0
00031 
00032 //=================================================================================================//
00033 // Class:         CRmVariableEditCtrl                                                              //
00034 //                                                                                                 //
00035 // Description:   Class definition for CRmVariableEditCtrl                                         //
00036 //                Derived from CDialog, this class                                                 //
00037 //                creates a control for the associated node                                        //
00038 //=================================================================================================//
00039 class RMMFCUTIL_API CRmVariableEditCtrl : public CDialog
00040 {
00041 public: // Public Definitions
00042    
00043    enum SetupOrientationType
00044    {
00045       SetupOrientationTop,
00046       SetupOrientationRight,
00047       SetupOrientationBottom,
00048       
00049    }; // end enum SetupOrientationType
00050    
00051 protected: // Protected Definitions
00052 
00053    //==============================================================================================//
00054    // Class:         CRmSetupButton                                                                //
00055    //                                                                                              //
00056    // Description:   Class definition for CRmSetupButton                                           //
00057    //                Derived from CButton, this class                                              //
00058    //                creates a simple setup button control                                         //
00059    //==============================================================================================//
00060    class CRmSetupButton : public CButton
00061    {
00062       public: // Public member functions
00063       
00064          CRmSetupButton()
00065          {
00066             m_bCheck = false;
00067             
00068          } // end CRmSetupButton()
00069          
00070          virtual void DrawItem( LPDRAWITEMSTRUCT lpDrawItemStruct );
00071          
00072          virtual bool GetCheck()                { return( m_bCheck ); }
00073          virtual void SetCheck( bool bCheck )   { m_bCheck = bCheck; }
00074       
00075       protected: // Protected member variables
00076       
00077          bool m_bCheck;
00078          
00079    }; // end class CRmSetupButton : public CButton
00080    
00081 public: // Public Member Functions
00082 
00083    // Constructor:
00084    CRmVariableEditCtrl();
00085    
00086    BOOL Create(   HWND                 hwndParent,
00087                   RmVariable           *pVariable,
00088                   bool                 bShowSetup = true,
00089                   RmPlugInID           *pRmPlugInID = NULL );
00090 
00091    BOOL Create(   HWND                 hwndParent,
00092                   RmVariable           *pVariable,
00093                   SetupOrientationType setupOrientation,
00094                   bool                 bShowSetup = true,
00095                   RmPlugInID           *pRmPlugInID = NULL );
00096                   
00097    // Called to return the associated node
00098    RmNode* GetEditNode() { return( m_pVariable ); }
00099    
00100    // These functions get called by the plug in 
00101    // to handle incomming application messages
00102    void ShowSetup();
00103    void InitializeControls( bool bInitializeAll );
00104    
00105    bool GetIsSetupShown()                    { return( m_bShowSetup ); }
00106    void SetIsSetupShown( bool bShowSetup )   { m_bShowSetup = bShowSetup; }
00107    
00108    SetupOrientationType GetSetupOrientation()                        { return( m_setupOrientation ); }
00109    void SetSetupOrientation( SetupOrientationType setupOrientation ) { m_setupOrientation = setupOrientation; }
00110    
00111 protected: // Protected Member Functions
00112 
00113    //{{AFX_VIRTUAL(CRmVariableEditCtrl)
00114         virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00115         virtual BOOL OnInitDialog();
00116    virtual BOOL PreTranslateMessage(MSG* pMsg);
00117         //}}AFX_VIRTUAL
00118         
00119         //{{AFX_MSG(CRmVariableEditCtrl)
00120         afx_msg void OnSize(UINT nType, int cx, int cy);
00121         afx_msg void OnValueControlChange( UINT uID );
00122         afx_msg void OnMinControlChange();
00123         afx_msg void OnMaxControlChange();
00124    afx_msg void OnBnClickedShowSetupCheck();
00125    afx_msg void OnBnClickedClampCheck();
00126    afx_msg void OnDestroy();
00127    afx_msg void OnEnKillfocusRowsEdit();
00128    afx_msg void OnEnKillfocusColumnsEdit();
00129    afx_msg void OnDeltaposRowsSpin(NMHDR *pNMHDR, LRESULT *pResult);
00130    afx_msg void OnDeltaposColumnsSpin(NMHDR *pNMHDR, LRESULT *pResult);
00131    afx_msg void OnBnClickedActionButton();
00132    afx_msg LRESULT OnValueSliderControlUpdated( WPARAM wParam, LPARAM lParam );  
00133    afx_msg void OnGetMinMaxInfo(MINMAXINFO* lpMMI);
00134         //}}AFX_MSG
00135         
00136    DECLARE_MESSAGE_MAP()
00137 
00138 private: // Private Member Functions
00139 
00140    // Sends an update message to the application
00141    void SendChangeMessage( int nMessage );
00142       
00143    // Helper function to show / hide / enable / disable a group of related controls
00144    void ShowValues();
00145    
00146    // Helper funcitons to re-create the control matrix
00147    void DeleteValueControls();
00148    void RepositionValueControls( CRect *pValueControlActualBoundingRect,
00149                                  CRect *pValueControlMinBoundingRect );
00150    
00151    void CalculateIdealDlgRect(   CRect *pValueControlBoundingRect,
00152                                  CRect *pIdealDlgRect );
00153    
00154    // Helper function to refit the controls in the available area
00155    void RepositionDialogControls();
00156   
00157   // Helper function to convert a float into an integer value (with rounding)
00158    int  FloatToInt( float fValue )
00159    {
00160       return( ( fValue >= 0.0f ) ? ( int )( fValue + 0.5f ) : ( int )( fValue - 0.5f ) );
00161       
00162    } // end FloatToInt( float fValue )
00163 
00164 
00165    //----------------------------------------//
00166    // Variable Interaction Wrapper Functions //
00167    //----------------------------------------//
00168    
00169    // Function to determine the underlying variable data type
00170    RmDynamicVariable::DynamicVariableType GetDynamicVariableType();
00171    
00172    // Normalization functions
00173    void  SetIsNormalized(  bool bIsNormalized );
00174    bool  IsNormalized();
00175    
00176    // Row / Column functions
00177    int   GetNumRows();
00178    int   GetNumColumns();
00179    void  SetNumRows(    int nRows );
00180    void  SetNumColumns( int nColumns );
00181    bool  IsFixedSize();
00182    
00183    // Clamped functions
00184    void  SetIsClamped(  bool bIsClamped );
00185    bool  IsClamped();
00186      
00187    // Min / Max functions 
00188    void  SetFloatMinMax(   float  fMin, float fMax, bool bUpdateDatabase );
00189    void  SetIntegerMinMax( int    nMin, int   nMax, bool bUpdateDatabase );
00190    void  SetBooleanMinMax( BOOL   bMin, BOOL  bMax, bool bUpdateDatabase );
00191    
00192    void  GetFloatMinMax(   float  &fMin, float &fMax );
00193    void  GetIntegerMinMax( int    &nMin, int   &nMax );
00194    void  GetBooleanMinMax( BOOL   &bMin, BOOL  &bMax );
00195    
00196    // Set Data functions
00197    void  SetFloatData(     int nRow, int nCol, float  fData, bool bUpdateDatabase );
00198    void  SetIntegerData(   int nRow, int nCol, int    nData, bool bUpdateDatabase  );
00199    void  SetBooleanData(   int nRow, int nCol, BOOL   bData, bool bUpdateDatabase  );
00200    
00201    // Get Data functions
00202    float GetFloatData(     int nRow, int nCol );
00203    int   GetIntegerData(   int nRow, int nCol );
00204    BOOL  GetBooleanData(   int nRow, int nCol );
00205    
00206 public: // Public Member Variables
00207 
00208         //{{AFX_DATA(CRmVariableEditCtrl)
00209         enum { IDD = IDD_RM_VARIABLE_EDIT_DIALOG };
00210    CRmSetupButton    m_checkShowSetup;
00211    CButton           m_checkClamp;
00212    CButton           m_btnAction;
00213    CStatic           m_staticSetupGroup;
00214    CStatic           m_staticValuesGroup;
00215    CStatic           m_staticRows;
00216    CStatic           m_staticColumns;
00217    CStatic           m_staticMinimum;
00218    CStatic           m_staticMaximum;
00219    CEdit             m_editRows;
00220    CEdit             m_editColumns;
00221    CRmSliderEdit     m_editMinimum;
00222    CRmSliderEdit     m_editMaximum;
00223    CEdit             m_editValueControlPlacement;
00224    CEdit             m_editValueLabelPlacement;
00225    CStatic           m_scrollWindowStatic;
00226    int               m_nNumRows;
00227    int               m_nNumColumns;
00228         //}}AFX_DATA
00229 
00230 protected: // Protected Member Variables
00231 
00232    bool m_bShowSetup;
00233    bool m_bAllowSetupOption;
00234    bool m_bValidClampType;
00235    bool m_bValidActionType;
00236 
00237 private: // Private Member Variables
00238 
00239    RmVariable  *m_pVariable;     // The variable that the dialog is editing
00240    RmPlugInID  *m_pRmPlugInID;   // The plug-In ID that will accompanay  any broadcast message
00241    
00242    // These numerical values are used to maintain relative 
00243    // distances when dynamically resizing the dialog
00244    SetupOrientationType m_setupOrientation;
00245 
00246    bool     m_bInitializingDialog;
00247    
00248    int      m_nShowSetupGroupHeight;   
00249    int      m_nShowSetupGroupWidth;
00250    int      m_nHideSetupGroupHeight;   
00251    int      m_nHideSetupGroupWidth;
00252    
00253    int      m_nScrollWindowToGroupLeft;
00254    int      m_nScrollWindowToGroupTop;
00255    int      m_nScrollWindowToGroupRight;
00256    int      m_nScrollWindowToGroupBottom;
00257    
00258    CPoint   m_firstValueControlOffset;
00259    CPoint   m_firstValueLabelOffset;
00260    CPoint   m_valueControlSize;
00261    CPoint   m_valueLabelSize;
00262    int      m_nLabelControlSeperation;
00263       
00264    RmControlPlacementContainer   m_setupControlPlacementContainer;
00265       
00266    // These arrays hold the dynamic control and label matrixes
00267    int            m_nNumAllocatedRows;
00268    int            m_nNumAllocatedColumns;
00269    CWnd           **m_pValueControlArray;
00270    CWnd           **m_pValueLabelArray;
00271    CRect          m_lastValueControlActualBoundingRect;
00272    CRect          m_lastValueControlMinBoundingRect;
00273    
00274 #if RM_INCLUDE_SCROLLING_VALUE_CONTROL_WINDOW
00275    CRmScrollWnd   m_valueControlScrollWindow;
00276 #endif // RM_INCLUDE_SCROLLING_VALUE_CONTROL_WINDOW
00277 
00278    CWnd           m_scrollChildWindow;
00279    
00280    CToolTipCtrl   m_toolTipCtrl;
00281                   
00282 }; // end class RMMFCUTIL_API CRmVariableEditCtrl : public CDialog
00283 
00284 
00285 #endif // _RM_MFC_UTILITIES_VARIABLE_EDIT_CTRL_H_

Generated on Fri Feb 25 16:08:39 2005 for RenderMonkey SDK by doxygen 1.3.6