2#include <control/SRealWnd.h>
4#include <helper/obj-ref-impl.hpp>
8class DefRealWndHandler :
public TObjRefImpl2<IRealWndHandler, DefRealWndHandler> {
10 DefRealWndHandler(SRealWnd *pRealWnd)
15 HWND WINAPI OnRealWndCreate(IWindow *pRealWnd) OVERRIDE
17 EventRealWndCreate evt(m_owner);
19 m_owner->FireEvent(&evt);
22 void WINAPI OnRealWndDestroy(IWindow *pRealWnd) OVERRIDE
24 EventRealWndDestroy evt(m_owner);
25 m_owner->FireEvent(&evt);
27 BOOL WINAPI OnRealWndInit(IWindow *pRealWnd) OVERRIDE
29 EventRealWndInit evt(m_owner);
31 m_owner->FireEvent(&evt);
35 BOOL WINAPI OnRealWndPosition(IWindow *pRealWnd,
const RECT *rcWnd) OVERRIDE
37 EventRealWndPosition evt(m_owner);
40 m_owner->FireEvent(&evt);
88 __baseCls::OnShowWindow(bShow, nStatus);
98 __baseCls::OnDestroy();
105 BOOL bRet = __baseCls::InitFromXml(pNode);
145 if (!__baseCls::OnRelayout(rcWnd))
149 if (::IsWindow(hRealWnd))
160 CPoint pt = prc->TopLeft();
161 if (GetWindowLong(hRealWnd, GWL_STYLE) & WS_POPUP)
165 ::SetWindowPos(hRealWnd, 0, pt.x, pt.y, prc->Width(), prc->Height(), SWP_NOZORDER);
Interface for handling real window creation and destruction.
BOOL addEvent(DWORD dwEventID, LPCWSTR pszEventHandlerName)
添加一个新事件到事件集
HWND GetRealHwnd(BOOL bAutoCreate=TRUE) OVERRIDE
Get the handle of the real window.
void OnDestroy()
Handle destroy event.
SAutoRefPtr< IRealWndHandler > m_pRealWndHandler
virtual BOOL NeedRedrawWhenStateChange()
Determine if the control needs to be redrawn when its state changes.
virtual ~SRealWnd()
Destructor.
BOOL InitRealWnd()
Initialize the real window.
virtual BOOL WINAPI InitFromXml(IXmlNode *pNode)
Initialize the control from an XML node.
void SetRealWndPos(HWND hRealWnd, const CRect *prc)
Set the position of the real window.
void ShowRealWindow()
Show the real window.
virtual BOOL OnRelayout(const CRect &rcWnd)
Handle layout changes.
void OnShowWindow(BOOL bShow, UINT nStatus)
Handle show window event.
BOOL IsVisible(BOOL bCheckParent=FALSE) SCONST OVERRIDE
Checks if the window is visible.
ISwndContainer * GetContainer() OVERRIDE
Retrieves the container associated with this window.
virtual CRect GetClientRect() const
Retrieves the client rectangle of the window.
SEventSet * GetEventSet()
Retrieves the event set associated with the window.
HWND GetHostHwnd() OVERRIDE
Retrieves the host window handle.
Class representing an XML node.
SXmlNode child(const wchar_t *name, bool bCaseSensitive=false) const
Gets the child node, attribute, or next/previous sibling with the specified name.
Template class extending TObjRefImpl with a specific final release behavior.