/*=========================================================================*/
/* CPAPopTB.hpp :	PopUpToolBar class. It's a kind of Icon Menu.*/
/* This is a part of the PCA project.*/
/**/
/* Version			1.0*/
/* Creation date	26/06/96*/
/* Revision date*/
/**/
/* (c) Ubi Studios 1996*/
/**/
/* DO NOT MODIFY THAT FILE. IF SOMETHING NEEDS TO BE CHANGE, PLEASE CONTACT*/
/* OLIVIER DIDELOT OR MARC VILLEMAIN.*/
/*=========================================================================*/
 
#ifndef __CPAPOPTB_HPP__
#define __CPAPOPTB_HPP__
 
/****************************************/
#ifndef CPA_EXPORT
#if defined(CPA_WANTS_IMPORT)
#define CPA_EXPORT __declspec(dllimport)
#elif defined(CPA_WANTS_EXPORT)
#define CPA_EXPORT __declspec(dllexport)
#else
#define CPA_EXPORT
#endif
#endif
/****************************************/
 
#ifdef ACTIVE_EDITOR
 
/* Messages that can be send by a toolbar*/
 
extern BOOL g_bMouseLocked;
 
#define C_MAX_POPUPTOOLBAR_BUTTONS 220 /* 11 * 20*/
#define C_MAX_POPUPTOOLBAR_FAMILY 20
#define C_MAX_BUTTON_PER_FAMILY 11
 
typedef struct tdstButton_
{
	long lId;
	long lIndexBitmap;
	BOOL bPermit;
	BOOL bVisible;
	BOOL bIsAMode;
	char szTipText[80];
} tdstButton;
 
typedef struct tdstButtonDef_
{
	long lId;
	BOOL bIsAMode;
	char szTip[80];
} tdstButtonDef;
 
#include "CPAWButo.hpp"
 
/*///////////////////////////////////////////////////////////////////////////*/
/* CPA_PopUpToolBar window*/
 
class CPA_EXPORT CPA_PopUpToolBar : public CToolBarCtrl
{
	/* Construction*/
public:
	CPA_PopUpToolBar();
	CPA_PopUpToolBar(CPA_PopUpToolBar&);
 
	long GetNbFamilies() { return m_lNbFamilies; };
	long GetIdResource() { return m_lIdResource; };
	long GetButtonSizeX() { return m_lButtonSizeX; };
	long GetButtonSizeY() { return m_lButtonSizeY; };
 
	void SetButton(long lId);
	void SetButtons(long pId[]);
	BOOL IsPermitted(long lId);
	BOOL IsAMode(long lId);
	BOOL IsDefined() { return m_bDefined; };
	int  Define(tdstButtonDef a_stButtonDef[],
				long lNbButtons,
				long lIdResource,
				long lIdEndFamily,
				long lSizeX,
				long lSizeY);
 
	BOOL GetToolTipText(LPTOOLTIPTEXT p_ToolTipText, UINT Id);
	void InitAllStatesArray(long aa_lSaveStates[][C_MAX_POPUPTOOLBAR_FAMILY]);
 
	void SetInitialStates(long a_lIdButtons[], long lNbButtons);
	void SetInitialState(long lIdButton);
	long GetInitialStates(long a_lIdButtons[]);
	long GetStates(long a_lStates[]);
 
	void SetInitialPermissions(long a_lIdButtons[], BOOL a_bPermit[], long lNbbuttons);
	void SetInitialPermission(long lIdButton,BOOL bPermit);
	long GetInitialPermissions(BOOL a_bPermissions[]);
	void SetPermissions(long a_lIdButtons[], BOOL a_bPermit[], long lNbbuttons);
	void SetPermission(long lId, BOOL bPermit);
	void SetPermissions(BOOL a_bPermit[]);
	long GetPermissions(BOOL a_bPermissions[]);
 
	long GetFamily(long lIdButton);
	void SetVisibility(long lId, BOOL bVisible);
	void SetVisibility(long a_lIdButtons[], BOOL a_bVisible[], long lNbButtons);
	long GetOtherAvailableButtonInFamily(long lIdButton,
										 BOOL a_bPermissions[] = NULL,
									     long lFamily = -1);
	long GetIndex(long lIdButton);
	BOOL IsPresent(long lIdButton);
	BOOL IsStandAlone(long lId);
	BOOL IsOnScreen(long lIdButton);
	long CreateToolBarCtrl(CWnd *p_WndParent, CPoint org);
private:
 
	void OnButton(UINT Id, UINT, long lIndexInTB);
	long GetNbButtonsTotalInFamily(long lFamily);
 
/* Attributes*/
private:
	tdstButton		m_a_stButtons[C_MAX_POPUPTOOLBAR_BUTTONS];
	BOOL			m_a_bInitialPermissions[C_MAX_POPUPTOOLBAR_BUTTONS];
 
	long			m_a_lFamiliesIndex[C_MAX_POPUPTOOLBAR_FAMILY];
	long			m_a_lButtonsInTBIndex[C_MAX_POPUPTOOLBAR_FAMILY];
	long			m_a_lInitialStates[C_MAX_POPUPTOOLBAR_FAMILY];
 
public:
	long			m_lNbFamilies;
	long			m_lNbButtonsTotal;
	CPA_WndButton	m_oWndButton;
	int				m_lIdResource;
	int				m_lIdCurrentButton;
	long			m_lIdEndFamily;
	long			m_lButtonSizeX;
	long			m_lButtonSizeY;
	BOOL			m_bMousePickedButton;
	BOOL			m_bCurrentButtonAlone;
	BOOL			m_bDefined;
	BOOL			m_bAllreadyCreated;
	BOOL			m_bJustPressed;
/* Operations*/
public:
 
/* Overrides*/
	/* ClassWizard generated virtual function overrides*/
	/*{{AFX_VIRTUAL(CPA_PopUpToolBar)*/
	/*}}AFX_VIRTUAL*/
 
/* Implementation*/
public:
	virtual ~CPA_PopUpToolBar();
 
	/* Generated message map functions*/
protected:
	/*{{AFX_MSG(CPA_PopUpToolBar)*/
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	/*}}AFX_MSG*/
 
	DECLARE_MESSAGE_MAP()
 
};
 
#endif /* ACTIVE_EDITOR*/
/*///////////////////////////////////////////////////////////////////////////*/
#endif /* __PCAPOPTB_HPP__*/
