//================================================================
// 3DPanel header file
//
// AUTHOR:  Gabor Nagy
// DATE:    2026-Jan-07 22:53:49
//
// Copyright (C) 1996-2026 By Gabor Nagy. All rights reserved.
//================================================================
#ifndef _E3D_Panels_h
#define _E3D_Panels_h

#include <Xe/DropDownPanel.h>

#if defined (__cplusplus) && (!(defined (__CPLUSLIBS)))
extern "C" {
#endif

// Object panel
//
typedef struct
{
	XeInfoPanelCore;

	XeWidget    NameW, InstancesLabelW, OutputsLabelW, OutputsEnableW, OutputsShowW, OutputsReplaceInputW;
	XeDrawer    NotesDrawer;
	XeWidget    NotesTextW;

	E3dObject*  Object;       // Currently edited object
	EObject*    SubObject;    // PolyGroup, if Object is a Mesh, contour Spline of a Face

	EIndex      PointIndex;   // E.g. Current CV of a Spline

	EInterface  InputInterface;
} E3dObjectPanel;


typedef struct
{
	XeWidget  NameW, TypeW,  ValuesMatrixW, XW, YW, ZW, WW,  RemoveW;
} E3dTransformGUI;


// Node panel
//
typedef struct
{
	XeInfoPanelCore;

	XeWidget  NameW;
	E3dNode*  Node;

	XeWidget  TopMatrixW,
	          NodeOutputsMatrixW,
	          NodeOutputsLabelW, NodeOutputsEnabledW, NodeOutputsShowW,
	          BranchOutputsLabelW, BranchOutputsEnabledW, BranchOutputsShowW,
	          RotOrderMatrixW, RotOrderW,
	          TransformsScrolledWindowW, TransformsVScrollBarW, TransformsMatrixW,
	          StatsLW, StatsValLW,
	          BBoxValuesW;
	XeDrawer  NotesDrawer;
	XeWidget  NotesTextW;

	EIndex    ObjectIdx;			// E.g. Current object index passed to E3dNodePanel_New and E3dNodePanel_Update

	EBool     ConvertEulerAnglesWhenOrderChanges;  // When the user changes the rotation order on a Node, convert the rotation angles (to maintain the same orientation), on the selected Node or branch

	EListA(, E3dTransformGUI, Transforms);
} E3dNodePanel;


#define E3dNAME_FIELD                 0x01
#define E3dFOLLOW_SELECTION_CHECKBOX  0x02


//--------------------------------
// Panel/ObjectPanel.c
//--------------------------------
EList(extern, E3dObjectPanel*, E3dp_ObjectPanels);

extern void       (*E3dObject_EditFunc)(E3dModel* PModel, E3dObject* PObject, EIndex PLODIndex,  EObject* PSubObject, const EIndex PPointIndex,  E3dObjectComponentClass* POpenFolderForThisComponentClass);
extern EBool      (*E3dObject_IsEditedFunc)(E3dObject* PObject);

extern EBool      (*E3dPolyGroup_IsEditedFunc)(E3dPolyGroup* PPolyGroup);
extern void       (*E3dPolyGroup_UpdateDialogFunc)(const E3dPolyGroup* PPolyGroup);

extern E3dObjectPanel*  E3dObjectPanel_New(XeWidget PParentW, const uint32_t PFlags, E3dObject* PObject, EObject* PSubObject, EIndex PSubSubObjIndex, E3dObjectComponentClass* POpenFolderForThisComponentClass);
extern void       E3dObjectPanel_UpdateSubSub(E3dObjectPanel* PObjectPanel, E3dObject* PObject, EObject* PSubObject, EIndex PPointIndex, E3dObjectComponentClass* PUpdateFolderForThisComponentClass, E3dObjectComponentClass* POpenFolderForThisComponentClass);
extern void       E3dObjectPanel_Update(E3dObjectPanel* PObjectPanel, E3dObject* PObject,  E3dObjectComponentClass* PUpdateFolderForThisComponentClass, E3dObjectComponentClass* POpenFolderForThisComponentClass);
extern void       E3dObjectPanel_Free(E3dObjectPanel* PObjectPanel);

extern void       E3dObject_Edit(E3dObject* PObject, E3dObjectComponentClass* POpenFolderForThisClass);
extern EBool      E3dObject_IsEdited(E3dObject* PObject);

//--------------------------------
// Panel/NodePanel.c
//--------------------------------
extern void           (*E3dNode_EditFunc)(E3dNode* PNode, E3dNodeComponentClass* POpenFolderForThisClass);
extern EBool          (*E3dNode_IsEditedFunc)(E3dNode* PNode);

extern E3dNodePanel*  E3dNodePanel_New(XeWidget PParentW, E3dNode* PNode, const EIndex PObjectIndex, E3dNodeComponentClass* POpenFolderForThisComponentClass);
extern void      E3dNodePanel_Update(E3dNodePanel* PNodePanel, E3dNode* PNode, const EIndex PObjectIndex,  E3dNodeComponentClass* PUpdateFolderForThisComponentClass, E3dNodeComponentClass* POpenFolderForThisComponentClass);
extern void      E3dNodePanel_UpdateValues(E3dNodePanel* PPanel,  E3dNodeComponentClass* PUpdateFolderForThisComponentClass, E3dNodeComponentClass* POpenFolderForThisComponentClass);
extern void      E3dNodePanel_Free(E3dNodePanel* PNodePanel);

extern XeWidget  E3dNode_DialogBoxNew(char* PName, E3dNode* PNode, E3dNodePanel** PNodePanelPtr, XeCallbackFunc PCB, EpImage* PIconImage);
extern XeWidget  E3dNode_DialogBoxNewVa(char* PName, E3dNode* PNode, E3dNodePanel** PNodePanelPtr, ...);
extern void      E3dNode_Edit(E3dNode* PNode, E3dNodeComponentClass* POpenFolderForThisClass);
extern EBool     E3dNode_IsEdited(E3dNode* PNode);
extern void      E3dNode_Edit(E3dNode* PNode, E3dNodeComponentClass* POpenFolderForThisComponentClass);
extern void      E3dNodePanel_Exit(void);

extern void      E3dJointNodeComponent_GUI(E3dNode* PNode, E3dNodeComponent* PComponent, XeInfoPanel* PPanel, void* PDrawer, const int PAction);


#if defined (__cplusplus) && (!(defined (__CPLUSLIBS)))
}	// Close scope of 'extern "C"' declaration
#endif


#endif	// _E3D_Panels_h
