//================================================================================
// Xe UI toolkit
//
// Shell Widgets private header file
//
// AUTHOR:  Gabor Nagy
// DATE:    2023-Dec-22 22:22:31
//
// Copyright (C) 1996-2026 by Gabor Nagy. All rights reserved.
//===============================================================================
#ifndef _XeShellP_h
#define _XeShellP_h

#include <Xe/XeP.h>
#include <Xe/Shell.h>
#include <Xe/CompositeP.h>


//------------------------------------------------
// Shell
//------------------------------------------------

typedef struct
{
	EPointer  Extension;
} XeShellClassPart;

typedef struct _XeShellClassRec
{
	XeCompositeClassCore;
	XeShellClassPart      Shell;
} XeShellClassRec;

externalref XeShellClassRec  _XeShellWidget_class;


#define _XeShellPOSITION_VALID   0x01
#define _XeShellNOT_REPARENTED   0x02
#define _XeShellPOSITION_OK      0x04
#define _XeShellGEOMETRY_PARSED  0x08

typedef struct
{
	char*                   GeometryString;
	XeCreatePopupChildFunc  CreatePopupChildFunc;
	XeGrabMode              GrabMode;
	uint8_t                 AppSpecified;

	XeCoord2                SizeProposedForChild;

// Old-school checkerboard cast shadow for systems with no compositing window managers
//
	int                     ShadowSizeX, ShadowSizeY;          // Size of the shadows
#ifdef EX11
	Window                  X_ShadowBWindow, X_ShadowRWindow;  // Cast shadow windows (one below and one to the right of the MenuPane)
	Pixmap                  X_ShadowBMask, X_ShadowRMask;      // Cast shadow masks
#endif

	EBool	                  SpringLoaded;
	EBool	                  PoppedUp;
	EBool	                  AllowShellResize;
	EBool	                  SaveUnder;
	EBool	                  OverrideRedirect;
} XeShellPart;

typedef  struct
{
	XeCompositeWidgetCore;
	XeShellPart  Shell;
} XeShellRec, *XeShellWidget;



//------------------------------------------------
// OverrideShell
//------------------------------------------------

typedef struct
{
	EPointer  Extension;  // Pointer to extension record
} XeOverrideShellClassPart;

typedef struct _XeOverrideShellClassRec
{
	XeCompositeClassCore;
	XeShellClassPart          Shell;
	XeOverrideShellClassPart  OverrideShell_class;
} XeOverrideShellClassRec;

externalref XeOverrideShellClassRec  _XeOverrideShell_class;

// No new fields for the override shell widget

typedef struct
{
	int  Nothing;
} XeOverrideShellPart;

typedef struct
{
	XeCompositeWidgetCore;
	XeShellPart          Shell;
	XeOverrideShellPart  OverrideShell;
} XeOverrideShellRec, *XeOverrideShellWidget;


//------------------------------------------------
// WMShell
//------------------------------------------------

typedef struct
{
	EPointer  Extension;
} XeWMShellClassPart;

typedef struct _XeWMShellClass
{
	XeCompositeClassCore;
	XeShellClassPart      Shell;
	XeWMShellClassPart    WMShell;
} _XeWMShellClass;

externalref _XeWMShellClass  _XeWMShell_class;

typedef struct
{
	char*         Title;
	int 	        WMTimeout;  // In milliseconds
	EBool	        WaitForWM;  // Wait for the window manager
	EBool	        Transient;
	EBool         Urgency;
	XeWidget      ClientLeader;
	String        WindowRole;
	struct _XeSizeHints
	{
		long       Flags;
		EInt32_2   Position;
		EInt32_2   Size;
		EInt32_2   SizeMin;
		EInt32_2   SizeMax;
		EInt32_2   SizeInc;
		struct
		{
			int  X, Y;
		} AspectMin, AspectMax;
	} SizeHints;

	XeImage    IconImage;

	XeCoord2      BaseSize;
	int           WindowGravity;

	EList(, XeExtension*, Extensions);  // Extension objects (dialog box, file selection box, etc.)

#ifdef EX11
	XWMHints      X_WMHints;
	Atom          X_TitleEncoding;
	Pixmap        X_IconPixmap;
#endif
} XeWMShellPart;

typedef struct
{
	XeCompositeWidgetCore;
	XeShellPart      Shell;
	XeWMShellPart    WMShell;
} _XeWMShell, *XeWMShellWidget;


typedef struct
{
	EPointer  Extension;
} XeVendorShellClassPart;


// Contents of the XeWM_HINTS property.
//
typedef struct
{
// These correspond to XmRInt resources. (VendorSE.c)
	int  Flags;
	int  Functions;
	int  Decorations;
	int  InputMode;
	int  SStatus;
} XeWMHints;


typedef struct _VendorShellClassRec
{
	XeCompositeClassCore;
	XeShellClassPart        Shell;
	XeWMShellClassPart      WMShell;
	XeVendorShellClassPart  VendorShell;
} VendorShellClassRec;

externalref VendorShellClassRec  _XeVendorShellWidget_class;


typedef struct
{
// Resources
//
	XeWidget        LogicalParent;
	XeCallbackList  WMCallback;      // Callbacks to call when the user ckicks the window "close" button etc.
	uint8_t         DeleteResponse;  // How to respond to the user clicing the window "close" button: XeDESTROY = 0, XeUNMAP_SHELL, XeDO_NOTHING
	unsigned char   FocusPolicy;

	XeWMHints       MWMHints;        // Window manager hints
	String          MWMMenu;
} XeVendorShellPart;


typedef  struct
{
	XeCompositeWidgetCore;
	XeShellPart        Shell;
	XeWMShellPart      WMShell;
	XeVendorShellPart  VendorShell;
} XeVendorShellRec, *XeVendorShellWidget;


//------------------------------------------------
// TransientShell
//------------------------------------------------

// New fields for the TransientShell widget class record

typedef struct
{
	EPointer  Extension;  // Pointer to extension record
} XeTransientShellClassPart;

typedef struct _XeTransientShellClass
{
	XeCompositeClassCore;
	XeShellClassPart           Shell;
	XeWMShellClassPart         WMShell;
	XeVendorShellClassPart     VendorShell;
	XeTransientShellClassPart  TransientShell;
} _XeTransientShellClass;

externalref _XeTransientShellClass _XeTransientShell_class;

// New fields for the transient shell widget

typedef struct
{
	XeWidget  TransientFor;
} XeTransientShellPart;

typedef  struct
{
	XeCompositeWidgetCore;
	XeShellPart           Shell;
	XeWMShellPart         WMShell;
	XeVendorShellPart     VendorShell;
	XeTransientShellPart  TransientShell;
} XeTransientShellRec, *XeTransientShellWidget;



//------------------------------------------------
// TopLevelShell
//------------------------------------------------

typedef struct
{
	EPointer  Extension;  // Pointer to extension record
} XeTopLevelShellClassPart;

typedef struct _XeTopLevelShellClass
{
	XeCompositeClassCore;
	XeShellClassPart          Shell;
	XeWMShellClassPart        WMShell;
	XeVendorShellClassPart    VendorShell;
	XeTopLevelShellClassPart  TopLevelShell;
} _XeTopLevelShellClass;

externalref _XeTopLevelShellClass  _XeTopLevelShell_class;

typedef struct
{
	char*    IconName;
	EBool    Iconized;

#ifdef EX11
	Atom     X_IconNameEncoding;
#endif
} XeTopLevelShellPart;

typedef struct
{
	XeCompositeWidgetCore;
	XeShellPart          Shell;
	XeWMShellPart        WMShell;
	XeVendorShellPart    VendorShell;
	XeTopLevelShellPart  TopLevelShell;
} _XeTopLevelShell, *XeTopLevelShellWidget;



//------------------------------------------------
// ApplicationShell
//------------------------------------------------

typedef struct
{
	EPointer  Extension;  // Pointer to extension record
} XeApplicationShellClassPart;

typedef struct _XeApplicationShellClassRec
{
	XeCompositeClassCore;
	XeShellClassPart             Shell;
	XeWMShellClassPart           WMShell;
	XeVendorShellClassPart       VendorShell;
	XeTopLevelShellClassPart     TopLevelShell;
	XeApplicationShellClassPart  ApplicationShell;
} XeApplicationShellClassRec;

externalref XeApplicationShellClassRec  _XeApplicationShell_class;

// New fields for the application shell widget

typedef struct
{
	char*     AppClassName;
	char**    Args;int  NArgs;
} XeApplicationShellPart;

typedef struct
{
	XeCompositeWidgetCore;
	XeShellPart             Shell;
	XeWMShellPart           WMShell;
	XeVendorShellPart       VendorShell;
	XeTopLevelShellPart     TopLevelShell;
	XeApplicationShellPart  ApplicationShell;
} XeApplicationShellRec, *XeApplicationShellWidget;


#endif // _XeShellP_h
