// AsOptionList.h : header file
//
#if !defined(_ASOPTIONLIST_H_)
#define _ASOPTIONLIST_H_
#include <map>
#include "IAsOptionGroupListener.h"
#include "AsFontInfo.h"
#include "cmString.h"
using namespace std;
class CAsOptionGroup;
class CAsBaseCell;
class IAsOptionListListener;
/////////////////////////////////////////////////////////////////////////////
// CAsOptionList window
typedef map<cmString, CAsOptionGroup*> AsOptionGroupMap;
class CAsOptionList : public CWnd,
public IAsOptionGroupListener
{
// Construction
public:
CAsOptionList();
// implementation of IAsOptionGroupListener
//
void OnGroupSizeChanged(bool redraw = true);
void OnSelectionInfoChanged(CAsOptionGroup* selectedGroup, bool redraw = true);
void GetSelectedItemInfo(cmString& title, cmString& description);
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAsOptionList)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CAsOptionList();
BOOL Create(const CRect& rc, CWnd* parentWnd, DWORD style = WS_CHILD | WS_VISIBLE, UINT nID = 0);
void SetBorderColor(COLORREF borderColor, bool redraw = true );
COLORREF GetBorderColor() const;
void SetBkColor(COLORREF bkColor, bool redraw = true);
COLORREF GetBkColor() const;
AsOptionGroupMap* GetOptionGroupMap();
CAsOptionGroup* AddGroup(const cmString& name);
CAsOptionGroup* GetGroup(const cmString& name);
void SetVerticalStripWidth(int width);
int GetVerticalStripWidth() const;
void SetVerticalSplitterPos(int pos);
int GetVerticalSplitterPos() const;
void SetFontInfo(const cmString& fontName, int fontSize = 10, bool fontBold = false);
void SetFontInfo(const CAsFontInfo& fontInfo);
void RegisterListener(IAsOptionListListener* listener);
void SetSorted(bool sorted);
bool GetSorted() const;
// Generated message map functions
protected:
//{{AFX_MSG(CAsOptionList)
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg void OnPaint();
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
afx_msg void OnSizing(UINT fwSide, LPRECT pRect);
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
//}}AFX_MSG
DECLARE_MESSAGE_MAP();
void DrawBackground(CDC* pDC);
void DrawGroups(CDC* pDC);
void DrawBorder(CDC* pDC);
long UpdateDrawArea();
void UpdateWindowSize();
void EnsureCellVisible(CAsBaseCell* cell);
bool HitSplitter(const CPoint& point);
CAsBaseCell* GetFocusedCell();
CRect GetGlobalDrawArea();
COLORREF borderColor_;
COLORREF bkColor_;
COLORREF verticalSplitBkColor_;
AsOptionGroupMap groups_;
int verticalStripWidth_;
int verticalSplitterPos_;
long offset_;
bool draggingSplitter_;
bool sorted_;
// font info
//
CAsFontInfo fontInfo_;
IAsOptionListListener* listener_;
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(_ASOPTIONLIST_H_)