|
#pragma once
#include <vector>
class CTranslucentWnd;
struct IRenderListener
{
virtual ~IRenderListener() { }
virtual void OnRenderEvent(CTranslucentWnd* translucentWnd) = 0;
};
enum TranslucentWndState
{
TWS_NORMAL = 0,
TWS_DISABLED,
//TWS_FOCUSED,
TWS_MOUSEOVER,
TWS_PRESSED,
TWS_SELECTED,
TWS_BUTTON_NUM = TWS_SELECTED + 1,
TWS_FORCE_DWORD = 0x7fffffff,
};
// CTranslucentWnd
class CTranslucentWnd : public CWnd
{
DECLARE_DYNAMIC(CTranslucentWnd)
public:
CTranslucentWnd();
virtual ~CTranslucentWnd();
virtual void Render(Gdiplus::Graphics& g) = 0;
BOOL ShowWindow(int nCmdShow);
void SetRenderListener(IRenderListener* pRenderListener) { m_pRenderListener = pRenderListener; }
void NotifyRender();
void DestroyImageList();
void DestroyImage(UINT index);
bool IsDisabled() const { return m_bDisabled; }
bool IsVisible() const { return m_bVisible; }
protected:
virtual void UpdateState();
virtual void PreSubclassWindow();
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnEnable(BOOL bEnable);
protected:
typedef std::vector<Gdiplus::Image*> ImageList;
ImageList m_imageList;
IRenderListener* m_pRenderListener;
bool m_bDisabled;
bool m_bVisible;
};
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
D.K.Wang is working for a leading interactive entertainment media company located in Shanghai, China. Skilled in Windows C++, MFC, WTL, PHP etc. Started with professional games development since 2005, now devoted to the core functionality such as graphics rendering, physics simulation and scene management for a household game engine.