//================================================================
// Xe UI toolkit
//
// XeToggleButton
//  Private header file
//
// AUTHOR:  Gabor Nagy
// DATE:    2026-Jul-12 19:17:25
//
// Copyright (C) 1996-2026 by Gabor Nagy. All rights reserved.
//================================================================
#ifndef _XeToggleButtonP_h
#define _XeToggleButtonP_h

#include <Xe/LabelP.h>
#include <Xe/MenuButtonP.h>
#include <Xe/ToggleButton.h>

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

//================================
// Class definition
//================================

#define XeToggleButtonClassCore\
	XeLabelClassCore

typedef struct _XeToggleButtonClassRec
{
	XeToggleButtonClassCore;
} XeToggleButtonClassRec;

extern XeToggleButtonClassRec  _XeToggleButton_class;


//================================
// Instance definition
//================================
// Instance part
//================================
typedef struct
{
// Resources
//
	XeColor         ArmColor, IndicatorColor, SelectColor;

	EpImage*        ArmImage;
	EpImage*        ActiveImage;

	XeCallbackList  ArmCallback, DisarmCallback, ActivateCallback, ValueChangedCallback;
	int             DefaultButtonShadowThickness;
	XeCoordinate    IndicatorSize, IndicatorGapWidth, IndicatorShadowThickness, SpacingX, Spacing;
	uint8_t         ButtonType, IndicatorType, SubButtonType;
	EBool           DrawButton,    // Draw button background even if ShadowThickness is 0
	                Editable, ActivateOnArm, Set,
	                IndicatorOn, CheckMarkOn,
	                FillOnSelect, VisibleWhenOff, ShowAsDefault,
	                SortDirectionArrowOn;
	XeWidget        FolderWidget;
	EBool           TurningOffEnabled;

// Private variables
//
	int             DefShadowSpacing;
	int             SubButtonSizeX;
	XeCoord2        IndicatorSizeP;
	XeCoord2        IndicatorPosition;
	EBool           IndicatorSizeXGiven, IndicatorSizeYGiven,
	                IndicatorSizeGiven;

	uint16_t        State;   // XeACTIVE | XeARMED | XeSUB_ARMED
	uint8_t         DragMode;
	uint8_t         ArrowDirection;  // ToggleButtons may have an arrow when used for opening / closing drop-down folders
} XeToggleButtonPart;


//================================
// Instance record
//================================
typedef struct _XeToggleButtonRec
{
	XeWidgetCore;
	XeBasePart          Base;
	XePrimitivePart     Primitive;
	XeLabelPart         Label;
	XeMenuButtonPart    MenuButton;
	XeToggleButtonPart  ToggleButton;
} XeToggleButtonRec;




//--------------------------------------------------------------------------------------------------------
// "Deferred" ToggleButton, added from plugins etc. e.g. before the app's top-level UI is created
//--------------------------------------------------------------------------------------------------------

//-----------------------------
// Class
//-----------------------------
typedef struct
{
	XeDWidgetClassCore;
// ToggleButtonClassRec is empty
} _XeDToggleButtonClass;

extern _XeDToggleButtonClass  _XeDToggleButton_class;

//-----------------------------
// Instance
//-----------------------------
typedef struct
{
	XeCallbackFunc    Callback;
	EPointer          ClientData;
	char              Mnemonic;
	char*             Accel;char*  AccelText;char*  ToolTip;
	EguiCallbackList  ValueChangedCallback;
	EBool             State;
} XeDToggleButtonPart;

typedef struct
{
	XeDeferredWidget_Core;
	XeDToggleButtonPart  ToggleButton;
} XeDToggleButton;


extern ECoreClass  XeToggleButtonCallbackStruct_class[];


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

#endif // _XeToggleButtonP_h
