// Borland C++ Builder
// Copyright (c) 1995, 1999 by Borland International
// All rights reserved

// (DO NOT EDIT: machine generated header) 'XPMenu.pas' rev: 5.00

#ifndef XPMenuHPP
#define XPMenuHPP

#pragma delphiheader begin
#pragma option push -w-
#pragma option push -Vx
#include <Buttons.hpp>	// Pascal unit
#include <StdCtrls.hpp>	// Pascal unit
#include <ExtCtrls.hpp>	// Pascal unit
#include <Commctrl.hpp>	// Pascal unit
#include <Menus.hpp>	// Pascal unit
#include <Forms.hpp>	// Pascal unit
#include <ComCtrls.hpp>	// Pascal unit
#include <Controls.hpp>	// Pascal unit
#include <Graphics.hpp>	// Pascal unit
#include <Classes.hpp>	// Pascal unit
#include <SysUtils.hpp>	// Pascal unit
#include <Messages.hpp>	// Pascal unit
#include <Windows.hpp>	// Pascal unit
#include <SysInit.hpp>	// Pascal unit
#include <System.hpp>	// Pascal unit

//-- user supplied -----------------------------------------------------------

namespace Xpmenu
{
//-- type declarations -------------------------------------------------------
#pragma option push -b-
enum TXPContainer { xccForm, xccFrame, xccToolbar, xccCoolbar, xccControlbar, xccPanel, xccScrollBox, 
	xccGroupBox, xccTabSheet, xccPageScroller };
#pragma option pop

typedef Set<TXPContainer, xccForm, xccPageScroller>  TXPContainers;

#pragma option push -b-
enum TXPControl { xcMainMenu, xcPopupMenu, xcToolbar, xcControlbar, xcCombo, xcListBox, xcEdit, xcMaskEdit, 
	xcMemo, xcRichEdit, xcMiscEdit, xcCheckBox, xcRadioButton, xcButton, xcBitBtn, xcSpeedButton, xcUpDown, 
	xcPanel, xcGroupBox, xcTreeView, xcListView, xcProgressBar, xcHotKey };
#pragma option pop

typedef Set<TXPControl, xcMainMenu, xcHotKey>  TXPControls;

class DELPHICLASS TControlSubClass;
class DELPHICLASS TXPMenu;
class PASCALIMPLEMENTATION TXPMenu : public Classes::TComponent 
{
	typedef Classes::TComponent inherited;
	
private:
	bool FActive;
	Forms::TScrollingWinControl* FForm;
	Graphics::TFont* FFont;
	Graphics::TColor FColor;
	Graphics::TColor FIconBackColor;
	Graphics::TColor FMenuBarColor;
	Graphics::TColor FCheckedColor;
	Graphics::TColor FSeparatorColor;
	Graphics::TColor FSelectBorderColor;
	Graphics::TColor FSelectColor;
	Graphics::TColor FDisabledColor;
	Graphics::TColor FSelectFontColor;
	int FIconWidth;
	bool FDrawSelect;
	bool FUseSystemColors;
	bool FColorsChanged;
	Graphics::TColor FFColor;
	Graphics::TColor FFIconBackColor;
	Graphics::TColor FFSelectColor;
	Graphics::TColor FFSelectBorderColor;
	Graphics::TColor FFSelectFontColor;
	Graphics::TColor FCheckedAreaColor;
	Graphics::TColor FCheckedAreaSelectColor;
	Graphics::TColor FFCheckedColor;
	Graphics::TColor FFMenuBarColor;
	Graphics::TColor FFDisabledColor;
	Graphics::TColor FFSeparatorColor;
	Graphics::TColor FMenuBorderColor;
	Graphics::TColor FMenuShadowColor;
	bool Is16Bit;
	bool FOverrideOwnerDraw;
	bool FGradient;
	bool FFlatMenu;
	bool FAutoDetect;
	TXPContainers FXPContainers;
	TXPControls FXPControls;
	Byte FGrayLevel;
	Byte FDimLevel;
	bool FDrawMenuBar;
	bool FUseDimColor;
	int FDimParentColor;
	int FDimParentColorSelect;
	bool FSettingWindowRng;
	bool FIsW2k;
	bool FIsWXP;
	bool FIsWNT;
	bool FDisableSubclassing;
	void __fastcall SetDisableSubclassing(const bool Value);
	void __fastcall SetActive(const bool Value);
	void __fastcall SetAutoDetect(const bool Value);
	void __fastcall SetForm(const Forms::TScrollingWinControl* Value);
	void __fastcall SetFont(const Graphics::TFont* Value);
	void __fastcall SetColor(const Graphics::TColor Value);
	void __fastcall SetIconBackColor(const Graphics::TColor Value);
	void __fastcall SetMenuBarColor(const Graphics::TColor Value);
	void __fastcall SetCheckedColor(const Graphics::TColor Value);
	void __fastcall SetDisabledColor(const Graphics::TColor Value);
	void __fastcall SetSelectColor(const Graphics::TColor Value);
	void __fastcall SetSelectBorderColor(const Graphics::TColor Value);
	void __fastcall SetSeparatorColor(const Graphics::TColor Value);
	void __fastcall SetSelectFontColor(const Graphics::TColor Value);
	void __fastcall SetIconWidth(const int Value);
	void __fastcall SetDrawSelect(const bool Value);
	void __fastcall SetUseSystemColors(const bool Value);
	void __fastcall SetOverrideOwnerDraw(const bool Value);
	void __fastcall SetGradient(const bool Value);
	void __fastcall SetFlatMenu(const bool Value);
	void __fastcall SetXPContainers(const TXPContainers Value);
	void __fastcall SetXPControls(const TXPControls Value);
	void __fastcall SetDrawMenuBar(const bool Value);
	void __fastcall SetUseDimColor(const bool Value);
	
protected:
	virtual void __fastcall Loaded(void);
	void __fastcall InitItems(Controls::TWinControl* wForm, bool Enable, bool Update);
	void __fastcall InitItem(Classes::TComponent* Comp, bool Enable, bool Update);
	void __fastcall DrawItem(System::TObject* Sender, Graphics::TCanvas* ACanvas, const Windows::TRect 
		&ARect, bool Selected);
	void __fastcall MenueDrawItem(System::TObject* Sender, Graphics::TCanvas* ACanvas, const Windows::TRect 
		&ARect, bool Selected);
	void __fastcall ToolBarDrawButton(Comctrls::TToolBar* Sender, Comctrls::TToolButton* Button, Comctrls::TCustomDrawState 
		State, bool &DefaultDraw);
	void __fastcall ControlBarPaint(System::TObject* Sender, Controls::TControl* Control, Graphics::TCanvas* 
		Canvas, Windows::TRect &ARect, Extctrls::TBandPaintOptions &Options);
	void __fastcall SetGlobalColor(Graphics::TCanvas* ACanvas);
	void __fastcall DrawTopMenuItem(System::TObject* Sender, Graphics::TCanvas* ACanvas, const Windows::TRect 
		&ARect, Graphics::TColor BckColor, bool IsRightToLeft);
	void __fastcall DrawCheckedItem(Menus::TMenuItem* FMenuItem, bool Selected, bool Enabled, bool HasImgLstBitmap
		, Graphics::TCanvas* ACanvas, const Windows::TRect &CheckedRect);
	void __fastcall DrawTheText(System::TObject* Sender, AnsiString txt, AnsiString ShortCuttext, Graphics::TCanvas* 
		ACanvas, const Windows::TRect &TextRect, bool Selected, bool Enabled, bool Default, bool TopMenu, 
		bool IsRightToLeft, Graphics::TFont* &TxtFont, int TextFormat);
	void __fastcall DrawIcon(System::TObject* Sender, Graphics::TCanvas* ACanvas, Graphics::TBitmap* B, 
		const Windows::TRect &IconRect, bool Hot, bool Selected, bool Enabled, bool Checked, bool FTopMenu
		, bool IsRightToLeft);
	void __fastcall MeasureItem(System::TObject* Sender, Graphics::TCanvas* ACanvas, int &Width, int &Height
		);
	Windows::TPoint __fastcall GetImageExtent(Menus::TMenuItem* MenuItem, Menus::TMenu* FTopMenu);
	Graphics::TColor __fastcall TopMenuFontColor(Graphics::TCanvas* ACanvas, Graphics::TColor Color);
	void __fastcall DrawGradient(Graphics::TCanvas* ACanvas, const Windows::TRect &ARect, bool IsRightToLeft
		);
	void __fastcall DrawWindowBorder(HWND hWnd, bool IsRightToLeft);
	virtual void __fastcall Notification(Classes::TComponent* AComponent, Classes::TOperation Operation
		);
	
public:
	__fastcall virtual TXPMenu(Classes::TComponent* AOwner);
	__fastcall virtual ~TXPMenu(void);
	void __fastcall InitComponent(Classes::TComponent* Comp);
	void __fastcall ActivateMenuItem(Menus::TMenuItem* MenuItem, bool SubMenus);
	__property Forms::TScrollingWinControl* Form = {read=FForm, write=SetForm};
	__property bool IsWXP = {read=FIsWXP, nodefault};
	__property bool IsW2k = {read=FIsW2k, nodefault};
	__property bool IsWNT = {read=FIsWNT, nodefault};
	
__published:
	__property Byte DimLevel = {read=FDimLevel, write=FDimLevel, nodefault};
	__property Byte GrayLevel = {read=FGrayLevel, write=FGrayLevel, nodefault};
	__property Graphics::TFont* Font = {read=FFont, write=SetFont};
	__property Graphics::TColor Color = {read=FColor, write=SetColor, nodefault};
	__property bool DrawMenuBar = {read=FDrawMenuBar, write=SetDrawMenuBar, nodefault};
	__property Graphics::TColor IconBackColor = {read=FIconBackColor, write=SetIconBackColor, nodefault
		};
	__property Graphics::TColor MenuBarColor = {read=FMenuBarColor, write=SetMenuBarColor, nodefault};
	__property Graphics::TColor SelectColor = {read=FSelectColor, write=SetSelectColor, nodefault};
	__property Graphics::TColor SelectBorderColor = {read=FSelectBorderColor, write=SetSelectBorderColor
		, nodefault};
	__property Graphics::TColor SelectFontColor = {read=FSelectFontColor, write=SetSelectFontColor, nodefault
		};
	__property Graphics::TColor DisabledColor = {read=FDisabledColor, write=SetDisabledColor, nodefault
		};
	__property Graphics::TColor SeparatorColor = {read=FSeparatorColor, write=SetSeparatorColor, nodefault
		};
	__property Graphics::TColor CheckedColor = {read=FCheckedColor, write=SetCheckedColor, nodefault};
	__property int IconWidth = {read=FIconWidth, write=SetIconWidth, nodefault};
	__property bool DrawSelect = {read=FDrawSelect, write=SetDrawSelect, nodefault};
	__property bool UseSystemColors = {read=FUseSystemColors, write=SetUseSystemColors, nodefault};
	__property bool UseDimColor = {read=FUseDimColor, write=SetUseDimColor, nodefault};
	__property bool OverrideOwnerDraw = {read=FOverrideOwnerDraw, write=SetOverrideOwnerDraw, nodefault
		};
	__property bool Gradient = {read=FGradient, write=SetGradient, nodefault};
	__property bool FlatMenu = {read=FFlatMenu, write=SetFlatMenu, nodefault};
	__property bool AutoDetect = {read=FAutoDetect, write=SetAutoDetect, nodefault};
	__property TXPContainers XPContainers = {read=FXPContainers, write=SetXPContainers, default=1023};
	__property TXPControls XPControls = {read=FXPControls, write=SetXPControls, default=8388607};
	__property bool Active = {read=FActive, write=SetActive, nodefault};
	__property bool DisableSubclassing = {read=FDisableSubclassing, write=SetDisableSubclassing, default=0
		};
};


class PASCALIMPLEMENTATION TControlSubClass : public Classes::TComponent 
{
	typedef Classes::TComponent inherited;
	
private:
	Controls::TControl* Control;
	bool FBuilding;
	bool FMouseInControl;
	bool FLButtonBressed;
	bool FBressed;
	bool FIsKeyDown;
	bool FIsFocused;
	Controls::TWndMethod orgWindowProc;
	TXPMenu* XPMenu;
	bool FCtl3D;
	Forms::TFormBorderStyle FBorderStyle;
	bool FDefaultDrawing;
	int FSelCol;
	int FSelRow;
	unsigned FMsg;
	void __fastcall ControlSubClass(Messages::TMessage &Message);
	void __fastcall PaintControlXP(void);
	void __fastcall PaintCombo(void);
	void __fastcall PaintDBLookupCombo(void);
	void __fastcall PaintEdit(void);
	void __fastcall PaintRichEdit(void);
	void __fastcall PaintCheckBox(void);
	void __fastcall PaintRadio(void);
	void __fastcall PaintButton(void);
	void __fastcall PaintBitButn(void);
	void __fastcall PaintUpDownButton(void);
	void __fastcall PaintSpeedButton(void);
	void __fastcall PaintPanel(void);
	void __fastcall PaintGroupBox(void);
	void __fastcall PaintNCWinControl(void);
	void __fastcall PaintProgressBar(void);
	void __fastcall PaintHotKey(void);
public:
	#pragma option push -w-inl
	/* TComponent.Create */ inline __fastcall virtual TControlSubClass(Classes::TComponent* AOwner) : Classes::TComponent(
		AOwner) { }
	#pragma option pop
	#pragma option push -w-inl
	/* TComponent.Destroy */ inline __fastcall virtual ~TControlSubClass(void) { }
	#pragma option pop
	
};


class DELPHICLASS TXPMenuManager;
class PASCALIMPLEMENTATION TXPMenuManager : public Classes::TPersistent 
{
	typedef Classes::TPersistent inherited;
	
private:
	Classes::TList* FXPMenuList;
	Classes::TList* FPendingFormsList;
	Classes::TList* FFormList;
	TXPMenu* FActiveXPMenu;
	bool FDisableSubclassing;
	bool __fastcall MainWindowHook(Messages::TMessage &Message);
	void __fastcall CollectForms(void);
	void __fastcall RemoveChildSubclassing(Forms::TCustomForm* AForm);
	void __fastcall SetDisableSubclassing(bool AValue);
	TXPMenu* __fastcall FindSubclassingXPMenu(TXPMenu* Exclude);
	
protected:
	void __fastcall Notification(Classes::TComponent* AComponent, Classes::TOperation Operation);
	
public:
	__fastcall TXPMenuManager(void);
	__fastcall virtual ~TXPMenuManager(void);
	void __fastcall Add(TXPMenu* AXPMenu);
	void __fastcall Delete(TXPMenu* AXPMenu);
	void __fastcall UpdateActiveXPMenu(TXPMenu* AXPMenu);
	void __fastcall AddForm(Forms::TCustomForm* AForm);
	void __fastcall RemoveForm(Forms::TCustomForm* AForm);
	bool __fastcall IsFormSubclassed(Forms::TCustomForm* AForm);
	bool __fastcall IsComponentSubclassed(Classes::TComponent* AComponent);
	__property TXPMenu* ActiveXPMenu = {read=FActiveXPMenu};
	__property bool DisableSubclassing = {read=FDisableSubclassing, write=SetDisableSubclassing, default=0
		};
};


//-- var, const, procedure ---------------------------------------------------
static const Word WM_DRAWMENUBORDER = 0xbcb3;
static const Word WM_DRAWMENUBORDER2 = 0xbcb4;
extern PACKAGE TXPMenuManager* XPMenuManager;
extern PACKAGE void __fastcall Register(void);
extern PACKAGE void __fastcall GetSystemMenuFont(Graphics::TFont* Font);
extern PACKAGE Graphics::TColor __fastcall GetShadeColor(Graphics::TCanvas* ACanvas, Graphics::TColor 
	clr, int Value);
extern PACKAGE Graphics::TColor __fastcall MergColor(const Graphics::TColor * Colors, const int Colors_Size
	);
extern PACKAGE Graphics::TColor __fastcall NewColor(Graphics::TCanvas* ACanvas, Graphics::TColor clr
	, int Value);
extern PACKAGE Graphics::TColor __fastcall GetInverseColor(Graphics::TColor AColor);
extern PACKAGE Graphics::TColor __fastcall GrayColor(Graphics::TCanvas* ACanvas, Graphics::TColor clr
	, int Value);
extern PACKAGE void __fastcall GrayBitmap(Graphics::TBitmap* ABitmap, int Value);
extern PACKAGE void __fastcall DimBitmap(Graphics::TBitmap* ABitmap, int Value);
extern PACKAGE void __fastcall DrawArrow(Graphics::TCanvas* ACanvas, int X, int Y)/* overload */;
extern PACKAGE void __fastcall DrawArrow(Graphics::TCanvas* ACanvas, int X, int Y, int Orientation)/* overload */
	;
extern PACKAGE void __fastcall DrawBitmapShadow(Graphics::TBitmap* B, Graphics::TCanvas* ACanvas, int 
	X, int Y, Graphics::TColor ShadowColor);
extern PACKAGE void __fastcall DrawCheckMark(Graphics::TCanvas* ACanvas, int X, int Y);

}	/* namespace Xpmenu */
#if !defined(NO_IMPLICIT_NAMESPACE_USE)
using namespace Xpmenu;
#endif
#pragma option pop	// -w-
#pragma option pop	// -Vx

#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif	// XPMenu
