// CodeGear C++Builder
// Copyright (c) 1995, 2008 by CodeGear
// All rights reserved

// (DO NOT EDIT: machine generated header) 'Wclpowerevents.pas' rev: 20.00

#ifndef WclpowereventsHPP
#define WclpowereventsHPP

#pragma delphiheader begin
#pragma option push
#pragma option -w-      // All warnings off
#pragma option -Vx      // Zero-length empty class member functions
#pragma pack(push,8)
#include <System.hpp>	// Pascal unit
#include <Sysinit.hpp>	// Pascal unit
#include <Wclmessaging.hpp>	// Pascal unit
#include <Wclerrors.hpp>	// Pascal unit
#include <Wclsync.hpp>	// Pascal unit
#include <Windows.hpp>	// Pascal unit

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

namespace Wclpowerevents
{
//-- type declarations -------------------------------------------------------
#pragma option push -b
enum TwclPowerState { psPowerStatusChanged, psResumeAutomatic, psResume, psSuspend, psUnknown };
#pragma option pop

#pragma option push -b
enum TwclACLineStatus { lsOffline, lsOnline, lsBackup, lsUnknown };
#pragma option pop

#pragma option push -b
enum TwclBatteryChargeStatus { csCapacityHigh, csCapacityLow, csCapacityCritical, csCharging, csNoSystemBattery, csUnknown };
#pragma option pop

typedef Set<TwclBatteryChargeStatus, csCapacityHigh, csUnknown>  TwclBatteryChargeStatusFlags;

struct TwclPowerStatus
{
	
public:
	TwclACLineStatus ACLineStatus;
	TwclBatteryChargeStatusFlags BatteryChargeStatus;
	System::Byte BatteryLifePercent;
	bool BatterySavingState;
	unsigned BatteryLifeTime;
	unsigned BatteryFullLifeTime;
};


typedef void __fastcall (__closure *TwclPowerStateChangedEvent)(System::TObject* Sender, const TwclPowerState State);

class DELPHICLASS TwclPowerEventsMonitor;
class PASCALIMPLEMENTATION TwclPowerEventsMonitor : public System::TObject
{
	typedef System::TObject inherited;
	
private:
	Wclmessaging::TwclMessageProcessingMethod FMessageProcessing;
	Wclmessaging::TwclMessageReceiver* FReceiver;
	unsigned FPowerDll;
	unsigned FPowerReg;
	HWND FWnd;
	Wclsync::TwclThread* FWndThread;
	Wclsync::TwclManualResetEvent* FWndThreadInitEvent;
	int FWndThreadInitResult;
	TwclPowerStateChangedEvent FOnPowerStateChanged;
	bool __fastcall RegisterPowerChanges(void);
	void __fastcall UnregisterPowerChanges(void);
	int __fastcall CreatePowerEventWindow(void);
	void __fastcall DestroyPowerEventWindow(void);
	bool __fastcall WndProc(const unsigned uMsg, const int wParam, const int lParam);
	void __fastcall WndThread(void);
	bool __fastcall GetActive(void);
	void __fastcall SetMessageProcessing(const Wclmessaging::TwclMessageProcessingMethod Value);
	
protected:
	virtual void __fastcall MessageReceived(const Wclmessaging::TwclMessage* Message);
	virtual void __fastcall DoPowerStateChanged(const TwclPowerState State);
	
public:
	__fastcall virtual TwclPowerEventsMonitor(void);
	__fastcall virtual ~TwclPowerEventsMonitor(void);
	int __fastcall Close(void);
	int __fastcall Open(void);
	int __fastcall GetPowerStatus(/* out */ TwclPowerStatus &Status);
	__property bool Active = {read=GetActive, nodefault};
	__property Wclmessaging::TwclMessageProcessingMethod MessageProcessing = {read=FMessageProcessing, write=SetMessageProcessing, nodefault};
	__property TwclPowerStateChangedEvent OnPowerStateChanged = {read=FOnPowerStateChanged, write=FOnPowerStateChanged};
};


//-- var, const, procedure ---------------------------------------------------

}	/* namespace Wclpowerevents */
using namespace Wclpowerevents;
#pragma pack(pop)
#pragma option pop

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