//================================================================================
// Xe UI toolkit
//
// XeScrolledWindow
//  Composite widget to hold the WorkWindow widget of XeScrolledWindow
//
// AUTHOR:  Gabor Nagy
// DATE:    2026-Jun-07 16:33:11
//
// Copyright (C) 1996-2026 by Gabor Nagy. All rights reserved.
//================================================================================
#ifndef _XeScrolledWindowP_h
#define _XeScrolledWindowP_h

#include <Xe/ManagerP.h>
#include <Xe/ScrolledWindow.h>

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

//================================
// Class definition
//================================
// Class part
//================================
typedef struct _XeScrolledWindowClassPart
{
	EPointer  Extension;
} XeScrolledWindowClassPart;


//================================
// Class record
//================================
typedef struct
{
	XeCompositeClassCore;
	XeConstraintClassPart      Constraint;
	XeManagerClassPart         Manager;
	XeScrolledWindowClassPart  ScrolledWindow_class;
} XeScrolledWindowClassRec;

extern XeScrolledWindowClassRec  _XeScrolledWindow_class;


//================================
// Instance definition
//================================
// Instance part
//================================
typedef struct
{
// Resources
//
	XeColor       ButtonColor, SliderColor;

	XeColor       ScrollBarBackgroundColor, ScrollBarTroughColor;

	uint16_t      ShadowType, ScrollingPolicy;
	uint8_t       ScrollBarDisplayPolicyX, ScrollBarDisplayPolicyY;

	XeCoord2      MarginSize;                // Between the main shadows and the ScrollBars
	XeCoordinate  Spacing;                   // Between the ScrollBars and the WorkWindow

	XeCoordinate  ScrollBarShadowThickness;
	XeWidget      HScrollBarW, VScrollBarW,
	              WorkWindowW;               // The Widget to be scrolled
	EBool         ClipWindowResizableX, ClipWindowResizableY;  // The ClipWindow's size may be adjusted by the ScrolledWindow

// Scrolling state
//
	XeWidget      ClipWindowW;                       // The actual parent of Widget to be scrolled if ScrollingPolicy is XeAUTOMATIC

	EList(, XeWidget, TopHeaderDrivingMatrixWs);

	XeCoord2      WorkWindowOffset,                  // Pixel of WorkWindow Widget in the top-left corner of the ScrollerWindow's area
	              WorkWindowSize,                    // Total size of the WorkWindow
	              WorkWindowVisibleSize;

	XeCoord2      WorkWindowMarginTotalSize;         // Total unusable portion of WorkWindowSize. Viewable area: WorkWindowSize - WorkWindowMarginTotalSize

// Private variables
//
	XeCoord2      ClipWPos, HScrollbarPos, VScrollbarPos;
	XeCoordinate  WorkAreaShadowThickness;
	XeCoord2      HScrollBarSize, VScrollBarSize;
} XeScrolledWindowPart;


//================================
// Instance record
//================================
typedef struct _XeScrolledWindowRec
{
	XeCompositeWidgetCore;

	XeBasePart            Base;
	XeManagerPart         Manager;
	XeScrolledWindowPart  ScrolledWindow;
} XeScrolledWindowRec;


//----------------------------------------
// Function prototypes
//----------------------------------------
extern void  _XeScrolledWindow_UpdateScrollbars(XeScrolledWindowWidget PScrolledWindowW,  const int PSWSizeX, const int PSWSizeY);
extern void  _XeScrolledWindow_SetScrollbars(XeWidget PW, int PWorkWindowSizeX,  const int PWorkWindowSizeY,  const int PWorkAreaSizeX, const int PWorkAreaSizeY);
extern void  XeA_ScrollWheel(XeWidget PW, XeEvent* PEvent,  String* PP, Cardinal* PNP);


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

#endif // _XeScrolledWindowP_h
