public override void OnGUI(Rect position, int column)
            {
                if (column == 0)
                {
                    GUI.Box(HeEditorGUI.SpaceL(ref position, position.height), HeEditorStyles.csImage, HeEditorStyles.iconStyle);

                    //if (m_managedObject.gcHandlesArrayIndex != -1)
                    //{
                    //    if (HeEditorGUI.GCHandleButton(HeEditorGUI.SpaceR(ref position, position.height)))
                    //    {
                    //        m_owner.m_Window.OnGoto(new GotoCommand(new RichGCHandle(m_snapshot, m_snapshot.gcHandles[m_managedObject.gcHandlesArrayIndex])));
                    //    }
                    //}

                    if (m_Object.nativeObject.isValid)
                    {
                        if (HeEditorGUI.CppButton(HeEditorGUI.SpaceR(ref position, position.height)))
                        {
                            m_Owner.window.OnGoto(new GotoCommand(m_Object.nativeObject));
                        }
                    }
                }

                switch ((Column)column)
                {
                case Column.Type:
                    HeEditorGUI.TypeName(position, typeName);
                    break;

                case Column.CppCounterpart:
                    if (m_Object.nativeObject.isValid)
                    {
                        GUI.Label(position, m_Object.nativeObject.name);
                    }
                    break;

                case Column.Size:
                    HeEditorGUI.Size(position, size);
                    break;

                case Column.Address:
                    HeEditorGUI.Address(position, m_Object.address);
                    break;

                case Column.Assembly:
                    GUI.Label(position, assembly);
                    break;
                }
            }
Exemple #2
0
        void TryDrawObjectButton(PropertyGridItem itm, ref Rect rect)
        {
            // We do not test against address==0 here, because if it is a static field its address might be 0
            if (itm.type.managedTypesArrayIndex < 0 || (itm is BaseClassPropertyGridItem))
            {
                return;
            }

            // If it is not a pointer, it does not point to another object
            //var type = m_snapshot.managedTypes[itm.typeIndex];
            if (!itm.type.isPointer)
            {
                return;
            }

            // If it points to null, it has no object
            var pointer = itm.myMemoryReader.ReadPointer(itm.address);

            if (pointer == 0)
            {
                return;
            }

            // Check if it is a managed object
            var managedObjIndex = m_Snapshot.FindManagedObjectOfAddress(itm.type.isArray ? itm.address : pointer);

            if (managedObjIndex != -1)
            {
                if (HeEditorGUI.CsButton(HeEditorGUI.SpaceR(ref rect, rect.height)))
                {
                    m_Owner.window.OnGoto(new GotoCommand(new RichManagedObject(m_Snapshot, managedObjIndex)));
                }
            }

            // Check if it is a native object
            var nativeObjIndex = m_Snapshot.FindNativeObjectOfAddress(pointer);

            if (nativeObjIndex != -1)
            {
                if (HeEditorGUI.CppButton(HeEditorGUI.SpaceR(ref rect, rect.height)))
                {
                    m_Owner.window.OnGoto(new GotoCommand(new RichNativeObject(m_Snapshot, nativeObjIndex)));
                }
            }
        }
Exemple #3
0
            public override void OnGUI(Rect position, int column)
            {
                if (column == 0)
                {
                    GUI.Box(HeEditorGUI.SpaceL(ref position, position.height), HeEditorStyles.gcHandleImage, HeEditorStyles.iconStyle);

                    if (m_GCHandle.nativeObject.isValid)
                    {
                        if (HeEditorGUI.CppButton(HeEditorGUI.SpaceR(ref position, position.height)))
                        {
                            m_Owner.window.OnGoto(new GotoCommand(m_GCHandle.nativeObject));
                        }
                    }

                    if (m_GCHandle.managedObject.isValid)
                    {
                        if (HeEditorGUI.CsButton(HeEditorGUI.SpaceR(ref position, position.height)))
                        {
                            m_Owner.window.OnGoto(new GotoCommand(m_GCHandle.managedObject));
                        }
                    }
                }

                switch ((Column)column)
                {
                case Column.GCHandle:
                    HeEditorGUI.TypeName(position, typeName);
                    break;

                case Column.Size:
                    HeEditorGUI.Size(position, size);
                    break;

                case Column.Address:
                    HeEditorGUI.Address(position, address);
                    break;
                }
            }