3#include "core/SNcPainter.h"
4#include "helper/SColor.h"
5#include "helper/SplitString.h"
6#include "layout/SouiLayout.h"
7#include "interface/sacchelper-i.h"
8#include "helper/SwndFinder.h"
9#include "helper/STime.h"
10#include "animation/STransformation.h"
11#include "core/SCaret.h"
12#include <atl.mini/SComCli.h>
58 LPCWSTR pszBuf = strText;
63 if (pszBuf[i] == L
'\\' && i + 1 < strText.
GetLength())
65 if (pszBuf[i + 1] == L
'n')
67 strCvt += strText.
Mid(iBegin, i - iBegin);
72 else if (pszBuf[i + 1] == L
't')
74 strCvt += strText.
Mid(iBegin, i - iBegin);
79 else if (pszBuf[i + 1] == L
'\\')
81 strCvt += strText.
Mid(iBegin, i - iBegin);
96 strCvt += strText.
Mid(iBegin);
145 , m_nMainThreadId(::GetCurrentThreadId())
154 m_evtSet.addEvent(EVENTID(EventGetCaret));
155 m_evtSet.addEvent(EVENTID(EventSwndCreate));
156 m_evtSet.addEvent(EVENTID(EventSwndInitFinish));
157 m_evtSet.addEvent(EVENTID(EventSwndDestroy));
158 m_evtSet.addEvent(EVENTID(EventSwndSize));
159 m_evtSet.addEvent(EVENTID(EventSwndPos));
160 m_evtSet.addEvent(EVENTID(EventSwndMouseHover));
161 m_evtSet.addEvent(EVENTID(EventSwndMouseLeave));
162 m_evtSet.addEvent(EVENTID(EventSwndStateChanged));
163 m_evtSet.addEvent(EVENTID(EventSwndVisibleChanged));
164 m_evtSet.addEvent(EVENTID(EventSwndCaptureChanged));
165 m_evtSet.addEvent(EVENTID(EventSwndUpdateTooltip));
166 m_evtSet.addEvent(EVENTID(EventMouseClick));
167 m_evtSet.addEvent(EVENTID(EventCmd));
168 m_evtSet.addEvent(EVENTID(EventCtxMenu));
169 m_evtSet.addEvent(EVENTID(EventSetFocus));
170 m_evtSet.addEvent(EVENTID(EventKillFocus));
172 m_evtSet.addEvent(EVENTID(EventSwndAnimationStart));
173 m_evtSet.addEvent(EVENTID(EventSwndAnimationStop));
174 m_evtSet.addEvent(EVENTID(EventSwndAnimationRepeat));
185#ifdef SOUI_ENABLE_ACC
188 SComPtr<IAccHelper> accHelper;
189 if (m_pAcc->QueryInterface(__uuidof(IAccHelper), (
void **)&accHelper) == S_OK)
191 SASSERT(accHelper->GetOwner() == NULL);
227 memcpy(prect, &rcWnd,
sizeof(RECT));
239 rc.DeflateRect(
GetStyle().GetMargin());
258 SStringA strA = S_CT2A(strText, CP_UTF8);
260 return pStr->GetLength();
267 return str.GetLength();
268 int nRet = smin(nBufLen, str.GetLength());
269 _tcsncpy(pBuf, str.c_str(), nRet);
286 SRect src = SRect::IMake(tipInfo.
rcTarget);
292 EventSwndUpdateTooltip evt(
this);
293 evt.bUpdated = FALSE;
294 evt.strToolTip = &strTip;
300 return !tipInfo.
strTip.IsEmpty();
320 SStringT str = S_CA2T(lpszText, CP_UTF8);
348 if (IsBadWritePtr(
this,
sizeof(
SWindow)))
350 SASSERT_MSGA(FALSE,
"this is null!!!");
356 tid_t dwCurThreadID = GetCurrentThreadId();
357 DWORD dwProcID = GetCurrentProcessId();
358 SASSERT_FMTW(m_nMainThreadId == dwCurThreadID, L
"ProcessID:%d,请准备好红包再到群里提问", dwProcID);
370 if (pOwner && uMsg != WM_DESTROY)
373 SWNDMSG msgCur = { uMsg, wParam, lParam };
377 BOOL bMsgHandled =
SwndProc(uMsg, wParam, lParam, &lResult);
379 *pbMsgHandled = bMsgHandled;
383 if (pOwner && uMsg != WM_DESTROY)
424 CRect rcNew(x, y, x + cx, y + cy);
431 HCURSOR hCursor = GETRESPROVIDER->LoadCursor(
GetStyle().m_strCursor);
432 ::SetCursor(hCursor);
450 dwNewState &= ~dwStateRemove;
451 dwNewState |= dwStateAdd;
549 pInsertAfter = ICWND_LAST;
551 if (pInsertAfter == ICWND_LAST)
561 else if (pInsertAfter == ICWND_FIRST)
574 SASSERT(pInsertAfter->
m_pParent ==
this);
589 ILayoutParam *pLayoutParam =
GetLayout()->CreateLayoutParam();
591 pLayoutParam->Release();
731 if (pChild->
GetID() ==
id)
783 if (
id == SWindowMgr::SWND_INVALID || nDeep == 0)
797 if (pszName == NULL || nDeep == 0)
818const static wchar_t KLabelInclude[] = L
"include";
819const static wchar_t KTempNamespace[] = L
"t:";
820const static wchar_t KTempData[] = L
"data";
821const static wchar_t KTempParamFmt[] = L
"{{%s}}";
829 if (xmlChild.type() != node_element)
832 if (_wcsicmp(xmlChild.name(), KLabelInclude) == 0)
834 SStringT strSrc = S_CW2T(xmlChild.attribute(L
"src").value());
836 if (LOADXML(xmlDoc, strSrc))
839 if (_wcsicmp(xmlInclude.
name(), KLabelInclude) == 0)
848 if (_wcsicmp(
attr.name(), L
"src") == 0)
867 else if (!xmlChild.get_userdata())
873 SStringW strXmlTemp = GETUIDEF->GetTemplateString(strName);
874 SASSERT(!strXmlTemp.
IsEmpty());
885 strValue.
Replace(L
"\"", L
""");
886 strXml.
Replace(strParam, strValue);
962 SetAttribute(attrLayout.
name(), attrLayout.
value(), TRUE);
970 SetAttribute(attrClass.
name(), attrClass.
value(), TRUE);
973 __baseCls::InitFromXml(pNode);
1018 EventSwndInitFinish evt(
this);
1027 if (!xmlDoc.
load_buffer(pszXml, wcslen(pszXml) *
sizeof(
wchar_t), xml_parse_default,
sizeof(
wchar_t) == 2 ? enc_utf16 : enc_utf32))
1035 if (!LOADXML(xmlDoc, pszResId))
1071 swndChild = pChild->
SwndFromPoint(pt2, bIncludeMsgTransparent);
1123 pRTCache->SelectObject(oldFont, NULL);
1124 pRTCache->SetTextColor(crOld);
1127 pRTCache->EndDraw();
1129 pRT->
AlphaBlend(rcWnd, pRTCache, rcWnd, 255);
1143 if (rcWnd == rcClient)
1158 pRT->
AlphaBlend(rcWnd, pRTCache, rcWnd, 255);
1172 if (rcWnd == rcClient)
1183 GETRENDERFACTORY->CreateRegion(&pRet);
1186 SRect sRc = SRect::IMake(rc);
1190 CRect rc2 = sRc.toRect();
1191 pRet->CombineRect(&rc2, RGN_COPY);
1198 for (
int i = 0; i < 4; i++)
1200 pts[i] = quad[i].toPoint();
1202 pRet->CombinePolygon(pts, 4, WINDING, RGN_COPY);
1207 pRet->CombineRect(&rc, RGN_COPY);
1215 GETRENDERFACTORY->CreateRegion(&pRet);
1216 pRet->CombineRgn(r1, RGN_COPY);
1217 pRet->CombineRgn(r2, RGN_AND);
1218 return !pRet->IsEmpty();
1227 if (mtx.
isIdentity() && !rc2.IntersectRect(rc2, rc))
1230 return RgnInRgn(rgn, rgn2);
1245 if (pNextChild->
m_uZorder <= iBeginZorder)
1247 pChild = pNextChild;
1258 if (pLastChild->
m_uZorder < iBeginZorder)
1284 BOOL bRgnInClient = FALSE;
1287 CRect rcRgn = rcWnd;
1292 CRect rcRgnUnionClient;
1293 rcRgnUnionClient.UnionRect(rcClient, rcRgn);
1294 bRgnInClient = rcRgnUnionClient == rcClient;
1303 GETRENDERFACTORY->CreateRenderTarget(&pRT, rcWnd.Width(), rcWnd.Height());
1324 m_clipPath->offset((
float)rcWnd.left, (
float)rcWnd.top);
1326 m_clipPath->offset(-(
float)rcWnd.left, -(
float)rcWnd.top);
1388 SPoint spt = SPoint::IMake(pt);
1397 SList<const SWindow *> lstParent;
1398 const SWindow *pParent =
this;
1401 lstParent.AddHead(pParent);
1404 SPOSITION pos = lstParent.GetHeadPosition();
1407 pParent = lstParent.GetNext(pos);
1448 CRect rect = *lprect;
1466 CRect rcIntersect = rect & rcWnd;
1467 if (rcIntersect.IsRectEmpty())
1478 SRect fRc = SRect::IMake(rcIntersect);
1480 rcIntersect = fRc.toRect();
1526 if (pInsertAfter != ICWND_FIRST && pInsertAfter != ICWND_LAST && pInsertAfter->
GetParent() != pParent)
1530 if (pInsertAfter ==
this)
1552 if (!evt->IsBubbleUp())
1554 bRet = evt->HandleCount() > 0;
1561 SStringW strEvtName = evt->GetName();
1565 if (!strScriptHandler.
IsEmpty())
1567 GetScriptModule()->executeScriptedEventHandler(strScriptHandler, evt);
1568 if (!evt->IsBubbleUp())
1570 bRet = evt->HandleCount() > 0;
1589 if (m_rcWindow.EqualRect(&rcWnd) &&
m_layoutDirty == dirty_clean)
1593 CPoint ptDiff = (rcWnd.left - m_rcWindow.left, rcWnd.top - m_rcWindow.top);
1594 if (!m_rcWindow.EqualRect(&rcWnd))
1601 if (m_rcWindow.left > m_rcWindow.right)
1602 m_rcWindow.right = m_rcWindow.left;
1603 if (m_rcWindow.top > m_rcWindow.bottom)
1604 m_rcWindow.bottom = m_rcWindow.top;
1611 if (ptDiff.x != 0 || ptDiff.y != 0)
1622 CPoint ptRelative(rcChild.left - rcLayout.left, rcChild.top - rcLayout.top);
1623 rcChild.MoveToXY(rcLayout2.left + ptRelative.x, rcLayout2.top + ptRelative.y);
1624 pChild->
Move(rcChild);
1644 EventSwndPos evt(
this);
1645 evt.rcWnd = m_rcWindow;
1650 SSendMessage(WM_SIZE, 0, MAKELPARAM(rcClient.Width(), rcClient.Height()));
1664 EventSwndCreate evt(
this);
1695 pChild = pNextChild;
1707 EventSwndDestroy evt(
this);
1711#ifdef SOUI_ENABLE_ACC
1714 SComPtr<IAccHelper> accHelper;
1715 if (m_pAcc->QueryInterface(__uuidof(IAccHelper), (
void **)&accHelper) == S_OK)
1717 accHelper->SetOwner(NULL);
1740 if (CR_INVALID != crBg)
1750 m_pBgSkin->DrawByIndex(pRT, rcClient, idx);
1763 if (crTxt != CR_INVALID)
1809 if (!
GetStyle().GetMargin().IsRectNull())
1824 m_pNcSkin->DrawByIndex(pRT, &rcWnd, nState);
1829 if (CR_INVALID != crBg)
1838static const int KWnd_MaxSize = 10000;
1844 BOOL bRet =
m_funSwndProc(
this, UM_GETDESIREDSIZE, nParentHei, nParentHei, (LRESULT *)psz);
1852 bool bSaveHorz = nParentWid == SIZE_WRAP_CONTENT && pLayoutParam->IsMatchParent(Horz);
1853 bool bSaveVert = nParentHei == SIZE_WRAP_CONTENT && pLayoutParam->IsMatchParent(Vert);
1855 pLayoutParam->SetWrapContent(Horz);
1857 pLayoutParam->SetWrapContent(Vert);
1859 CSize szRet(KWnd_MaxSize, KWnd_MaxSize);
1860 if (pLayoutParam->IsSpecifiedSize(Horz))
1864 else if (pLayoutParam->IsMatchParent(Horz) && nParentWid >= 0)
1866 szRet.cx = nParentWid;
1869 if (pLayoutParam->IsSpecifiedSize(Vert))
1873 else if (pLayoutParam->IsMatchParent(Vert) && nParentHei >= 0)
1875 szRet.cy = nParentHei;
1878 if (szRet.cx == KWnd_MaxSize || szRet.cy == KWnd_MaxSize)
1880 int nTestDrawMode =
GetTextAlign() & ~(DT_CENTER | DT_RIGHT | DT_VCENTER | DT_BOTTOM);
1890 CSize szParent(nParentWid, nParentHei);
1893 szParent.cx -= rcMargin.left + rcPadding.left + rcMargin.right + rcPadding.right;
1894 if (szParent.cx < 0)
1899 szParent.cy -= rcMargin.top + rcPadding.top + rcMargin.bottom + rcPadding.bottom;
1900 if (szParent.cy < 0)
1906 CRect rcTest(0, 0, smax(szChilds.cx, szContent.cx), smax(szChilds.cy, szContent.cy));
1908 rcTest.InflateRect(rcMargin);
1909 rcTest.InflateRect(rcPadding);
1911 if (pLayoutParam->IsWrapContent(Horz) || (pLayoutParam->IsMatchParent(Horz) && nParentWid < SIZE_WRAP_CONTENT))
1912 szRet.cx = rcTest.Width();
1913 if (pLayoutParam->IsWrapContent(Vert) || (pLayoutParam->IsMatchParent(Vert) && nParentHei < SIZE_WRAP_CONTENT))
1914 szRet.cy = rcTest.Height();
1918 pLayoutParam->SetMatchParent(Horz);
1920 pLayoutParam->SetMatchParent(Vert);
1933 if (!strText.IsEmpty())
1935 int nTestDrawMode =
GetTextAlign() & ~(DT_CENTER | DT_RIGHT | DT_VCENTER | DT_BOTTOM);
1936 rcTest4Text = CRect(0, 0, nParentWid, nParentHei);
1937 int nMaxWid = pLayoutParam->IsWrapContent(Horz) ?
m_nMaxWidth.toPixelSize(
GetScale()) : nParentWid;
1938 if (nMaxWid == SIZE_WRAP_CONTENT)
1940 nMaxWid = KWnd_MaxSize;
1944 nMaxWid -= rcPadding.left + rcPadding.right;
1945 nTestDrawMode |= DT_WORDBREAK;
1947 rcTest4Text.right = smax(nMaxWid, 10);
1949 GETRENDERFACTORY->CreateRenderTarget(&pRT, 0, 0);
1951 DrawText(pRT, strText, strText.GetLength(), rcTest4Text, nTestDrawMode | DT_CALCRECT);
1953 return rcTest4Text.Size();
1958 return GetLayout()->MeasureChildren(
this, nParentWid, nParentHei);
1964 rcClient.DeflateRect(
GetStyle().GetPadding());
1970 pRT->
DrawText(pszBuf, cchText, pRect, uFormat);
1983 rcFocus.DeflateRect(2, 2);
1985 pRT->
CreatePen(PS_DOT, RGBA(88, 88, 88, 0xFF), 1, &pPen);
2039 pChild = pNextChild;
2054 EventSwndVisibleChanged evtShow(
this);
2055 evtShow.bVisible = bShow;
2143 EventSwndMouseHover evtHover(
this);
2155 EventSwndMouseLeave evtLeave(
this);
2163 bRet = (BOOL)
m_pParent->SSendMessage(WM_MOUSEWHEEL, MAKEWPARAM(nFlags, zDelta), MAKELPARAM(pt.x, pt.y));
2171 EventMouseClick evt(
this);
2172 evt.clickId = MouseClickId(uMsg - WM_LBUTTONDOWN);
2173 evt.uFlags = (UINT)wParam;
2174 evt.pt.x = GET_X_LPARAM(lParam);
2175 evt.pt.y = GET_Y_LPARAM(lParam);
2185 rcRet.DeflateRect(
GetStyle().GetPadding());
2234 if (bSourceResizable)
2269 EventSetFocus evt(
this);
2270 evt.wndOld = wndOld;
2277 EventKillFocus evt(
this);
2278 evt.wndFocus = wndFocus;
2284 int nScale = (int)wParam;
2294 else if (hr == S_OK)
2332 rcRT.IntersectRect(pRc, &rcRT);
2335 GETRENDERFACTORY->CreateRegion(&rgn);
2336 rgn->CombineRect(rcRT, RGN_COPY);
2349 GETRENDERFACTORY->CreateRenderTarget(&pRT, 0, 0);
2359 GETRENDERFACTORY->CreateRenderTarget(&pRT, rcRT.Width(), rcRT.Height());
2399 SRect sRcRT = SRect::IMake(rcRT);
2401 rcRT = sRcRT.toRect();
2407 GETRENDERFACTORY->CreateRegion(&rgn);
2414 for (
int i = 0; i < 4; i++)
2416 pts[i] = quad[i].toPoint();
2418 rgn->CombinePolygon(pts, 4, WINDING, RGN_COPY);
2422 rgn->CombineRect(rcRT, RGN_COPY);
2428 if (!rgn->IsEmpty())
2479 EventSwndCaptureChanged evt(
this);
2480 evt.bCaptured = bCaptured;
2522 if (
m_animation->getStartTime() == START_ON_FIRST_FRAME)
2552 animation->setStartTime(START_ON_FIRST_FRAME);
2650 return !rcClient.PtInRect(pt);
2660 if (iChild == CHILDID_SELF)
2661 return (IWindow *)
this;
2663 for (
int i = 0; i < iChild - 1 && pChild; i++)
2677 rcDraw.IntersectRect(rcDraw, pRc);
2682 GETRENDERFACTORY->CreateRegion(&pRgn);
2683 pRgn->CombineRect(&rcDraw, RGN_COPY);
2698 rcDraw.IntersectRect(rcDraw, pRc);
2700 GETRENDERFACTORY->CreateRegion(&pRgn);
2701 pRgn->CombineRect(&rcDraw, RGN_COPY);
2721 EventCtxMenu evt(
this);
2722 evt.bCancel = FALSE;
2741 BOOL bVisible = STRINGASBOOL(strValue);
2751 BOOL bEnable = STRINGASBOOL(strValue);
2791 SXmlNode xmlStyle = GETSTYLE(strValue);
2798 SetAttribute(attrLayout.
name(), attrLayout.
value(), bLoading);
2805 SetAttribute(
attr.name(),
attr.value(), bLoading);
2861 EventSwndSize evt(
this);
2893 BYTE byAlpha = _wtoi(strValue);
2895 return bLoading ? S_FALSE : S_OK;
2900 static struct SystemID
2904 } systemID[] = { IDOK, L
"IDOK", IDCANCEL, L
"IDCANCEL", IDCLOSE, L
"IDCLOSE", IDHELP, L
"IDHELP", IDABORT, L
"IDABORT", IDYES, L
"IDYES", IDNO, L
"IDNO", IDRETRY, L
"IDRETRY", IDIGNORE, L
"IDIGNORE" };
2909 for (
int i = 0; i < ARRAYSIZE(systemID); i++)
2913 m_nID = systemID[i].id;
2922 m_nID = _wtoi(strValue);
2939 m_nID = STR2ID(strValue);
2969 SStringW strText = GETSTRING(strValue);
2970 SStringT strCvt2 = S_CW2T(strText);
3003 EventSwndStateChanged evt(
this);
3004 evt.dwOldState = dwOldState;
3005 evt.dwNewState = dwNewState;
3019 HRESULT hr = E_FAIL;
3022 if (
m_evtSet.setEventScriptHandler(strAttribName, S_CW2A(strValue, CP_UTF8)))
3029 m_attrStorage->OnSetAttribute(&strAttribName, &strValue,
false);
3046 EventGetCaret evt(
this);
3047 evt.strCaret = &strCaret;
3054 xmlCaret = xmlDoc.
root().
child(L
"caret");
3059 xmlCaret = GETUIDEF->GetUiDef()->GetCaretInfo();
3061 m_caret->InitFromXml(&xmlCaret);
3063 return m_caret->Init(pBmp, nWid, nHeight);
3072 CRect rcCaret =
m_caret->GetRect();
3085 CRect rcCaret =
m_caret->GetRect();
3090 CRect rcCaret =
m_caret->GetRect();
3104 bRet = rc.PtInRect(pt);
3119 GETRENDERFACTORY->CreateRegion(&
m_clipRgn);
3180 if (pLayout == NULL)
3181 return E_INVALIDARG;
3192 m_attrStorage->OnSetAttribute(&strAttribName, &strValue,
true);
3194 if ((hr & 0x0000ffff) == S_OK && !bLoading)
3196 HRESULT hFlag = hr & 0xFFFF0000;
3208 else if ((hr & 0x0000ffff) == S_OK)
3225 return __baseCls::GetAttribute(pszAttr, strValue);
3254 SStringT str = S_CA2T(pszText, CP_UTF8);
3294 SStringW strName = pSkin->GetName();
3297 ISkinObj *pNewSkin = GETSKIN(strName, nScale);
3309IAccessible *SWindow::GetAccessible()
3311#ifdef SOUI_ENABLE_ACC
3323#ifdef SOUI_ENABLE_ACC
3336#ifdef SOUI_ENABLE_ACC
3345 if (!pParent->
GetLayout()->IsParamAcceptable(pLayoutParam))
3353 EventSwndAnimationStart evt(
this);
3369 EventSwndAnimationStop evt(
this);
3376 EventSwndAnimationRepeat evt(
this);
3504 if (pCurChild == NULL)
3525 if (pParent == pWnd)
3527 pParent = pParent->GetIParent();
3574 return E_NOINTERFACE;
3579 pRtDest->
AlphaBlend(pRcDest, pRtSrc, pRcSrc, alpha);
3604 bRet = ProcessSwndMessage(uMsg, wParam, lParam, *lResult);
3628 return m_evtSet.addEvent(dwEventID, pszEventHandlerName);
3633 return m_evtSet.removeEvent(dwEventID);
3648 rcWnd = rcWnd & rcParent;
3649 if (rcWnd.IsRectEmpty())
3681SWindow::SAnimationHandler::SAnimationHandler(
SWindow *pOwner)
3683 , m_bFillAfter(false)
3684 , m_pPrevSiblingBackup(ICWND_NONE)
3688void SWindow::SAnimationHandler::OnAnimationStart()
3690 IAnimation *pAni = m_pOwner->GetAnimation();
3692 if (pAni->getZAdjustment() != ZORDER_NORMAL)
3695 if (m_pPrevSiblingBackup == NULL)
3696 m_pPrevSiblingBackup = ICWND_FIRST;
3698 if (pAni->getZAdjustment() == ZORDER_TOP)
3699 m_pOwner->AdjustZOrder(ICWND_LAST);
3701 m_pOwner->AdjustZOrder(ICWND_FIRST);
3705 m_pPrevSiblingBackup = ICWND_NONE;
3707 m_pOwner->GetEventSet()->subscribeEvent(EventSwndSize::EventID, Subscriber(&SWindow::SAnimationHandler::OnOwnerResize,
this));
3708 if (m_pOwner->GetParent())
3710 m_pOwner->GetParent()->GetEventSet()->subscribeEvent(EventSwndSize::EventID, Subscriber(&SWindow::SAnimationHandler::OnOwnerResize,
this));
3712 OnOwnerResize(NULL);
3715void SWindow::SAnimationHandler::OnAnimationStop()
3717 m_pOwner->GetEventSet()->unsubscribeEvent(EventSwndSize::EventID, Subscriber(&SWindow::SAnimationHandler::OnOwnerResize,
this));
3720 m_pOwner->GetParent()->GetEventSet()->unsubscribeEvent(EventSwndSize::EventID, Subscriber(&SWindow::SAnimationHandler::OnOwnerResize,
this));
3722 if (m_pPrevSiblingBackup != ICWND_NONE)
3724 m_pOwner->AdjustZOrder(m_pPrevSiblingBackup);
3725 m_pPrevSiblingBackup = ICWND_NONE;
3729const STransformation &SWindow::SAnimationHandler::GetTransformation()
const
3734void SWindow::SAnimationHandler::OnNextFrame()
3736 IAnimation *pAni =
m_pOwner->GetAnimation();
3740 uint64_t tm = pAni->getStartTime();
3743 m_pOwner->OnAnimationInvalidate(pAni,
true);
3745 m_pOwner->OnAnimationInvalidate(pAni,
false);
3748 if (pAni->isFillEnabled() && pAni->getFillAfter())
3750 m_bFillAfter =
true;
3754 m_bFillAfter =
false;
3762BOOL SWindow::SAnimationHandler::OnOwnerResize(IEvtArgs *e)
3764 CSize szOwner =
m_pOwner->GetWindowRect().Size();
3765 CSize szParent = szOwner;
3771 m_pOwner->GetAnimation()->initialize(szOwner.cx, szOwner.cy, szParent.cx, szParent.cy,
m_pOwner->GetScale());
3775bool SWindow::SAnimationHandler::getFillAfter()
const
3777 return m_bFillAfter;
IAttrStorageFactory * GetAttrStorageFactory() OVERRIDE
Get the attribute storage factory.
virtual IWindow * CreateWindowByName(LPCWSTR pszWndClass) const
Create a window by name.
A helper class to enable or disable private UI definitions for the host container.
Smart pointer class for managing COM-style reference-counted objects.
BOOL subscribeEvent(DWORD dwEventID, const IEvtSlot &subscriber)
订阅事件
BOOL unsubscribeEvent(DWORD dwEventID, const IEvtSlot *subscriber)
取消订阅事件
void setMutedState(BOOL setting)
设置事件集的静音状态
int toPixelSize(int scale) const
将大小转换为像素值
The SMatrix class holds a 3x3 matrix for transforming coordinates. SMatrix does not have a constructo...
bool invert(SMatrix *inverse) const
If this matrix can be inverted, return true and if inverse is not null, set inverse to be the inverse...
void postTranslate(float dx, float dy)
Post-concats the matrix with the specified translation.
void mapRectToQuad(SPoint dst[4], const SRect &rect) const
Apply this matrix to the src rectangle, and write the four transformed points into dst....
void mapPoints(SPoint dst[], const SPoint src[], int count) const
Apply this matrix to the array of points specified by src, and write the transformed points into the ...
void preTranslate(float dx, float dy)
Pre-concats the matrix with the specified translation.
IxForm * Data() SCONST OVERRIDE
Returns a pointer to the matrix data.
void preConcat(const SMatrix &other)
Pre-concats the matrix with the specified matrix.
bool mapRect(SRect *dst, const SRect &src) const
Apply this matrix to the src rectangle, and write the transformed rectangle into dst....
bool rectStaysRect() const
Returns true if the matrix will map a rectangle to another rectangle. This can be true if the matrix ...
BOOL isIdentity() SCONST OVERRIDE
Checks if the matrix is the identity matrix.
void postConcat(const SMatrix &other)
Post-concats the matrix with the specified matrix.
static int toNcBuiltinID(const SStringW &str)
Converts a string to a built-in non-client ID.
static void MarkAttributeHandled(SXmlAttr xmlAttr, bool bHandled)
int GetID() SCONST OVERRIDE
Retrieves the object's ID.
LPCWSTR GetName() SCONST OVERRIDE
static bool IsAttributeHandled(SXmlAttr xmlAttr)
Helper class for painting.
SAutoRefPtr< IFontS > oldFont
static SWindowFinder * getSingletonPtr(void)
static SApplication & getSingleton(void)
static int GetDefIndex(DWORD dwState, bool checkAsPushdown=false)
Gets the default index for a given state.
A class representing an ASCII string.
BOOL IsEmpty() SCONST
Checks if the string is empty.
A class representing an ASCII string.
int CompareNoCase(const wchar_t *psz) SCONST
Compares the string with another string, ignoring case.
void ReleaseBuffer(int nNewLength=-1)
Releases the buffer and sets the new length of the string.
void TrimBlank()
Trims leading and trailing whitespace characters from the string.
int Replace(const wchar_t *pszOld, const wchar_t *pszNew)
Replaces all occurrences of a substring with another substring.
BOOL IsEmpty() SCONST
Checks if the string is empty.
SStringW Mid(int nFirst) const
Extracts a substring from the string.
BOOL __cdecl Format(HINSTANCE hInst, UINT nFormatID,...)
Formats a string using a format string and variable arguments.
SStringW Right(int nCount) const
Extracts the rightmost part of the string.
wchar_t * GetBuffer(int nMinBufLength=-1)
Retrieves a modifiable buffer for the string.
int GetLength() SCONST
Retrieves the length of the string.
SStringW Left(int nCount) const
Extracts the leftmost part of the string.
bool StartsWith(const SStringW &prefix, bool IgnoreCase=false) const
Checks if the string starts with a specified prefix.
static uint64_t GetCurrentTimeMs()
获取当前时间的毫秒数
Structure representing a timer ID.
void SetOwner(SWindow *pOwner)
Sets the owner window.
void TranslateText()
Translates the text.
void SetText(const SStringT &strText, bool bAutoEscape=true)
Sets the text.
SStringT GetText(BOOL bRawText=FALSE) const
Gets the text.
static SStringW EscapeString(const SStringW &str)
Escapes a string.
STrText(SWindow *pOwner=NULL)
Constructor.
void CacheResultForID(SWindow *pParent, int nID, int nDeep, SWindow *pResult)
缓存通过ID查找的结果
SWindow * FindChildByName(SWindow *pParent, const SStringW &strName, int nDeep)
通过名称查找子窗口
SWindow * FindChildByID(SWindow *pParent, int nID, int nDeep)
通过ID查找子窗口
void CacheResultForName(SWindow *pParent, const SStringW &strName, int nDeep, SWindow *pResult)
缓存通过名称查找的结果
Base class for SOUI DUI windows.
IWindow * GetISelectedSiblingInGroup() OVERRIDE
Retrieves the selected sibling window in a group.
virtual SIZE MeasureChildren(int nParentWid, int nParentHei)
Measures the size of all child windows.
virtual LPCWSTR GetTrCtx() const
Get translation context.
void StartAnimation(IAnimation *animation) OVERRIDE
Starts an animation for the window.
virtual void OnAnimationInvalidate(IAnimation *pAni, bool bErase)
Called when an animation requires a redraw.
virtual void OnCommitSurface(IRenderTarget *pRtDest, LPCRECT pRcDest, IRenderTarget *pRtSrc, LPCRECT pRcSrc, BYTE alpha)
Commits surface changes.
BOOL CreateChild(SXmlNode xmlChild)
Creates a child window from an XML node.
BOOL IsClipClient() SCONST OVERRIDE
Checks if client area clipping is enabled.
HRESULT OnAttrTip(const SStringW &strValue, BOOL bLoading)
Handles the 'tip' attribute.
BOOL SetTimer(char id, UINT uElapse) OVERRIDE
Sets a timer for the window.
UINT OnGetDlgCode() SCONST OVERRIDE
Retrieves the dialog code for the window.
void UpdateCacheMode()
Updates the cache mode for the window.
IScriptModule * GetScriptModule()
Retrieves the script module interface.
BOOL FireEvent(IEvtArgs *evt) OVERRIDE
Fires an event.
SAutoRefPtr< ISkinObj > m_pNcSkin
BOOL DestroyChild(SWindow *pChild)
Destroys a child window.
void SetMatrix(const IMatrix *mtx) OVERRIDE
Sets the transformation matrix for the window.
void GetDesiredSize(SIZE *psz, int nParentWid, int nParentHei) OVERRIDE
Retrieves the desired size of the window.
SWND GetSwnd() SCONST OVERRIDE
Retrieves the window handle.
void accNotifyEvent(DWORD dwEvt)
Notifies an accessibility event.
virtual BOOL UpdateToolTip(CPoint pt, SwndToolTipInfo &tipInfo)
Handle tooltip updates.
HRESULT OnAttrName(const SStringW &strValue, BOOL bLoading)
Handles the 'name' attribute.
BOOL IsDisplay() SCONST OVERRIDE
Checks if the window is displayed.
virtual void OnContainerChanged(ISwndContainer *pOldContainer, ISwndContainer *pNewContainer)
Called when the container of the window changes.
void OnMouseMove(UINT nFlags, CPoint pt)
Handles the mouse move event.
SWindow * GetParent() const
Retrieves the parent window.
void OnMouseHover(UINT nFlags, CPoint ptPos)
Handles the mouse hover event.
HRESULT QueryInterface(REFGUID id, IObjRef **ppRet) OVERRIDE
Queries an interface.
IWindow * GetIOwner() SCONST OVERRIDE
Retrieves the owner window.
void SetVisible(BOOL bVisible, BOOL bUpdate=FALSE) OVERRIDE
Sets the visibility of the window.
IWindow * GetIParent() SCONST OVERRIDE
Retrieves the parent window.
BOOL SubscribeEvent(DWORD evtId, const IEvtSlot *pSlot) OVERRIDE
Subscribes to an event.
void InsertIChild(IWindow *pNewChild, IWindow *pInsertAfter=NULL) OVERRIDE
Inserts a child window into the window tree.
HRESULT OnAttrID(const SStringW &strValue, BOOL bLoading)
Handles the 'id' attribute.
LRESULT OnSetLanguage(UINT uMsg, WPARAM wParam, LPARAM lParam)
Handles setting the language of the window.
void Move2(int x, int y, int cx=-1, int cy=-1) OVERRIDE
Moves the window to a new position and optionally resizes it.
void OnDestroy()
Handles the destruction of the window.
void CreateChilds(SXmlNode xmlNode)
Creates multiple child windows from XML nodes.
BOOL UnregisterDragDrop() OVERRIDE
Unregisters a drop target for the window.
LRESULT OnMouseClick(UINT uMsg, WPARAM wParam, LPARAM lParam)
Handles general mouse click events.
IWindow * GetIRoot() SCONST OVERRIDE
Retrieves the root window in the hierarchy.
void UnlockUpdate() OVERRIDE
Unlocks updates to the window.
SWindow * GetOwner() const
Retrieves the current owner of the window.
BOOL Destroy() OVERRIDE
Destroys the window.
DWORD GetState() SCONST OVERRIDE
Retrieves the current state of the window.
SWindow * _GetCurrentLayeredWindow()
Retrieves the host window for the current render layer.
BOOL AdjustIZOrder(IWindow *pInsertAfter) OVERRIDE
Adjusts the Z-order of the window.
HRESULT OnAttrAlpha(const SStringW &strValue, BOOL bLoading)
Handles the 'alpha' attribute.
ULONG_PTR GetUserData() SCONST OVERRIDE
Retrieves the user data associated with the window.
void OnAnimationStop(IAnimation *animation)
Called when an animation stops.
void SetCaretPos(int x, int y) OVERRIDE
Sets the caret position.
SWindow * GetChild(int iChild) const
Retrieves a child window by index.
SAutoRefPtr< IRegionS > m_clipRgn
void SetWindowTextU8(LPCSTR lpszText) OVERRIDE
Sets the window text using a UTF-8 string.
HRESULT OnAttrVideoCanvas(const SStringW &strValue, BOOL bLoading)
Handles the 'videoCanvas' attribute.
void EnableWindow(BOOL bEnable, BOOL bUpdate=FALSE) OVERRIDE
Enables or disables the window.
SWND SwndFromPoint(POINT *pt, BOOL bIncludeMsgTransparent=FALSE) SCONST OVERRIDE
Retrieves the window handle at a specified point.
HRESULT OnAttrClass(const SStringW &strValue, BOOL bLoading)
Handles the 'class' attribute.
BOOL GetAttribute(LPCWSTR pszName, IStringW *strValue) SCONST OVERRIDE
Retrieves an attribute value from the window.
void GetClientRect(LPRECT prect) SCONST OVERRIDE
Retrieves the client rectangle of the window.
void OnNcPaint(IRenderTarget *pRT)
Handles the painting of the non-client area.
HRESULT OnAttrText(const SStringW &strValue, BOOL bLoading)
Handles the 'text' attribute.
void ReleaseRenderTarget(IRenderTarget *pRT)
Releases the RenderTarget obtained via GetRenderTarget.
BOOL IsSiblingsAutoGroupped() SCONST OVERRIDE
Checks if siblings are auto-grouped.
IAccProxy * GetAccProxy()
Retrieves the accessibility proxy for the window.
int GetWindowTextU8(IStringA *pStr, BOOL bRawText) OVERRIDE
Retrieves the window text as a UTF-8 string.
int GetWindowText(TCHAR *pBuf, int nBufLen, BOOL bRawText) OVERRIDE
Retrieves the window text.
IWindow * GetNextLayoutIChild(const IWindow *pCurChild) SCONST OVERRIDE
Retrieves the next layout child window.
void SetToolTipText(LPCTSTR pszText) OVERRIDE
Sets the tooltip text for the window.
BOOL IsLayoutDirty() SCONST OVERRIDE
Checks if the layout is dirty.
virtual SWindow * _FindChildByName(const SStringW &strName, int nDeep)
Finds a child window by name.
void SetAnimation(IAnimation *animation) OVERRIDE
Sets an animation for the window.
UINT GetTextAlign() const
Retrieves the text alignment of the window.
HRESULT OnAttrCache(const SStringW &strValue, BOOL bLoading)
Handles the 'cache' attribute.
void OnAnimationStart(IAnimation *animation)
Called when an animation starts.
UINT GetChildrenCount() SCONST OVERRIDE
Retrieves the number of child windows.
SAutoRefPtr< ILayoutParam > m_pLayoutParam
SAutoRefPtr< IPathS > m_clipPath
BOOL RemoveChild(SWindow *pChild)
Removes a child window from the window tree.
BOOL SwndProc(UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *lResult) OVERRIDE
Processes a window message.
void OnKillFocus(SWND wndFocus)
Handles losing focus.
void SDispatchMessage(UINT uMsg, WPARAM wParam=0, LPARAM lParam=0) OVERRIDE
Dispatches a message to the window.
void BringWindowToTop() OVERRIDE
Brings the window to the top of the Z-order.
void OnPaint(IRenderTarget *pRT)
Handles the painting of the window.
int GetScale() SCONST OVERRIDE
Retrieves the scale factor of the window.
void GetMatrix(IMatrix *mtx) SCONST OVERRIDE
Retrieves the transformation matrix of the window.
BOOL IsMsgHandled() const
Checks if the message is handled.
void GetVisibleRect(LPRECT prect) SCONST OVERRIDE
Retrieves the visible rectangle of the window.
COLORREF GetColorizeColor() SCONST OVERRIDE
Retrieves the colorization color of the window.
BOOL IsVideoCanvas() SCONST OVERRIDE
Checks if the window is a video canvas.
BOOL DestroyIChild(IWindow *pChild) OVERRIDE
Destroys a child window.
void SetWindowPath(IPathS *pPath, BOOL bRedraw=TRUE) OVERRIDE
Sets the window path.
CRect GetWindowRect() const
Retrieves the bounding rectangle of the window.
virtual void OnCaptureChanged(BOOL bCaptured)
Called when the capture state of the window changes.
BOOL IsVisible(BOOL bCheckParent=FALSE) SCONST OVERRIDE
Checks if the window is visible.
LRESULT OnSetScale(UINT uMsg, WPARAM wParam, LPARAM lParam)
Handles setting the scale of the window.
STransformation m_transform
void PaintForeground(IRenderTarget *pRT, LPRECT pRc, SWindow *pStartFrom=NULL)
Draws the foreground content of the window.
virtual void DispatchPaint(IRenderTarget *pRT, IRegionS *pRgn, UINT iZorderBegin, UINT iZorderEnd)
Handles paint dispatching for the window.
void _RedrawNonClient()
Redraws the non-client area of the window.
virtual SWindow * GetSelectedChildInGroup()
Get selected child in group.
virtual SIZE MeasureContent(int nParentWid, int nParentHei)
Measures the size of the content within the window.
virtual void OnScaleChanged(int scale)
Called when the scale of the window changes.
virtual void OnContentChanged()
Called when the content of the window changes.
BOOL UnsubscribeEvent(DWORD evtId, const IEvtSlot *pSlot) OVERRIDE
Unsubscribes from an event.
ISwndContainer * GetContainer() OVERRIDE
Retrieves the container associated with this window.
void _PaintChildren(IRenderTarget *pRT, IRegionS *pRgn, UINT iBeginZorder, UINT iEndZorder)
Renders child windows within a specific Z-order range.
void SetEventMute(BOOL bMute) OVERRIDE
Sets the event mute state.
void OnLButtonDbClick(UINT nFlags, CPoint point)
Handles the left mouse button double-click event.
BOOL IsFloat() SCONST OVERRIDE
Checks if the window is floating.
BOOL IsFocused() SCONST OVERRIDE
Checks if the window has focus.
void DoColorize(COLORREF cr) OVERRIDE
Applies colorization to the window.
BYTE GetAlpha() SCONST OVERRIDE
Retrieves the alpha value of the window.
STransformation GetTransformation() const
Retrieves the current transformation matrix of the window.
void OnMouseLeave()
Handles the mouse leave event.
void SetAlpha(BYTE byAlpha) OVERRIDE
Sets the alpha value for the window.
void SetSwndProc(FunSwndProc swndProc) OVERRIDE
Sets the window procedure.
void _PaintRegion(IRenderTarget *pRT, IRegionS *pRgn, UINT iZorderBegin, UINT iZorderEnd)
Renders a specific region of the window onto the RenderTarget.
int OnCreate(LPVOID)
Handles the creation of the window.
FunSwndProc m_funSwndProc
SWindow * GetNextLayoutChild(const SWindow *pCurChild) const
Retrieves the next layout child after a specified child.
void TransformPointEx(CPoint &pt) const
Extends the transformation of a point.
void SetOwner(SWindow *pOwner)
Sets the owner of the window.
HRESULT OnAttrLayout(const SStringW &strValue, BOOL bLoading)
Handles the 'layout' attribute.
virtual HRESULT OnLanguageChanged()
Called when the language of the window changes.
void PaintBackground(IRenderTarget *pRT, LPRECT pRc)
Draws the background content of the window.
void GetChildrenLayoutRect(RECT *prc) SCONST OVERRIDE
Retrieves the layout rectangle of the children.
virtual BOOL NeedRedrawWhenStateChange()
Determine if redraw is needed on state change.
void TestMainThread()
Tests if the current thread is the main UI thread.
HRESULT OnAttrDisplay(const SStringW &strValue, BOOL bLoading)
Handles the 'display' attribute.
void OnSize(UINT nType, CSize size)
Handles the resizing of the window.
SWindow * FindChildByName(LPCWSTR strName, int nDeep=-1)
Finds a child window by its name.
IAnimation * GetAnimation() SCONST OVERRIDE
Retrieves the animation object associated with the window.
void OnFinalRelease()
Called when the last reference to the object is released.
void OnRButtonUp(UINT nFlags, CPoint point)
Handles the right mouse button up event.
virtual ~SWindow()
Destructor.
virtual BOOL IsLayeredWindow() const
Determines if the window requires a render layer.
virtual CRect GetClientRect() const
Retrieves the client rectangle of the window.
void InsertChild(SWindow *pNewChild, SWindow *pInsertAfter=NULL)
Inserts a child window into the window tree.
BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
Handles the mouse wheel event.
void OnLButtonUp(UINT nFlags, CPoint pt)
Handles the left mouse button up event.
SWindow * GetRoot() const
Retrieves the root window in the hierarchy.
LRESULT SSendMessage(UINT uMsg, WPARAM wParam=0, LPARAM lParam=0, BOOL *pbMsgHandled=NULL) OVERRIDE
Sends a message to the window.
void SetCheck(BOOL bCheck) OVERRIDE
Sets the check state of the window.
IWindow * GetIWindow(int uCode) SCONST OVERRIDE
Retrieves a window based on a given code.
IWindow * GetISelectedChildInGroup() OVERRIDE
Retrieves the selected child window in a group.
void MarkCacheDirty(bool bDirty)
Marks the cache as dirty.
IWindow * FindIChildByNameA(LPCSTR pszName) OVERRIDE
Finds a child window by its name (ANSI version).
HRESULT OnAttrVisible(const SStringW &strValue, BOOL bLoading)
Handles the 'visible' attribute.
BOOL CreateChildrenFromXml(LPCWSTR pszXml) OVERRIDE
Creates child windows from XML.
HRESULT OnAttrEnable(const SStringW &strValue, BOOL bLoading)
Handles the 'enable' attribute.
virtual void BeforePaint(IRenderTarget *pRT, SPainter &painter)
Prepare rendering environment.
void SetToolTipTextU8(LPCSTR pszText) OVERRIDE
Sets the tooltip text using a UTF-8 string.
static SStringW GetXmlText(const SXmlNode &xmlNode)
Gets the XML text from a node.
void InvalidateRect(LPCRECT lprect) OVERRIDE
Invalidates a specific rectangle area of the window.
virtual void OnAfterRemoveChild(SWindow *pChild)
Called after a child window has been removed from this window.
void UpdateLayout() OVERRIDE
Updates the layout of the window.
BOOL OnEraseBkgnd(IRenderTarget *pRT)
Handles the erasing of the background.
void _PaintClient(IRenderTarget *pRT)
Renders the client area of the window onto the RenderTarget.
virtual SStringW tr(const SStringW &strSrc) const
Translation function.
virtual SWindow * _FindChildByID(int nID, int nDeep)
Finds a child window by ID.
SMatrix _GetMatrixEx() const
Retrieves the extended transformation matrix for the window.
BOOL IsMsgTransparent() SCONST OVERRIDE
Checks if the window is message transparent.
void UpdateChildrenPosition() OVERRIDE
Updates the position of child windows.
BOOL IsChecked() SCONST OVERRIDE
Checks if the window is checked.
virtual SWindow * CreateChildByName(LPCWSTR pszName)
Create child window by name.
LayoutDirtyType m_layoutDirty
SAutoRefPtr< IRenderTarget > m_cachedRT
IRegionS * GetWindowRgn() SCONST OVERRIDE
Retrieves the window region.
virtual void DrawFocus(IRenderTarget *pRT)
Draw focus state.
LRESULT OnSetColorize(UINT uMsg, WPARAM wParam, LPARAM lParam)
Handles setting the colorization of the window.
virtual HRESULT AfterAttribute(const SStringW &strAttribName, const SStringW &strValue, BOOL bLoading, HRESULT hr)
Called after an attribute is processed.
bool _ApplyMatrix(IRenderTarget *pRT, SMatrix &oriMtx)
Applies a transformation matrix to the RenderTarget.
void OnLButtonDown(UINT nFlags, CPoint pt)
Handles the left mouse button down event.
virtual void OnUpdateFloatPosition(const CRect &rcParent)
Update floating window position.
BOOL RemoveIChild(IWindow *pChild) OVERRIDE
Removes a child window from the window tree.
void SetContainer(ISwndContainer *pContainer) OVERRIDE
Sets the container for the window.
BOOL IsContainPoint(POINT pt, BOOL bClientOnly) SCONST OVERRIDE
Checks if the window contains a specified point.
virtual BOOL OnRelayout(const CRect &rcWnd)
Handles window position changes during layout updates.
SWND SetCapture() OVERRIDE
Sets the window to capture the mouse.
void OnAnimationRepeat(IAnimation *animation)
Called when an animation repeats.
SAutoRefPtr< ICaret > m_caret
void ClearAnimation() OVERRIDE
Clears the animation for the window.
void SetFocus() OVERRIDE
Sets the focus to the window.
virtual void OnBeforeRemoveChild(SWindow *pChild)
Called before a child window is removed from this window.
HRESULT DefAttributeProc(const SStringW &strAttribName, const SStringW &strValue, BOOL bLoading)
Default attribute processing function.
virtual void OnRebuildFont()
Called when the font of the window needs to be rebuilt.
void OnAnimationPauseChange(IAnimation *animation, BOOL bPaused)
Called when the pause state of an animation changes.
virtual void OnAfterInsertChild(SWindow *pChild)
Called after a child window has been inserted into this window.
BOOL AdjustZOrder(SWindow *pInsertAfter)
Adjusts the Z-order of the window.
virtual void OnBeforeInsertChild(SWindow *pChild)
Called before a child window is inserted into this window.
SWND GetCapture() SCONST OVERRIDE
Retrieves the window that has captured the mouse.
virtual void GetTextRect(LPRECT pRect)
Calculate text display rectangle.
void SetIOwner(IWindow *pOwner) OVERRIDE
Sets the owner window.
BOOL IsUpdateLocked(BOOL bCheckParent=FALSE) SCONST OVERRIDE
Checks if updates to the window are locked.
void SetWindowRgn(IRegionS *pRgn, BOOL bRedraw=TRUE) OVERRIDE
Sets the window region.
virtual void AfterPaint(IRenderTarget *pRT, SPainter &painter)
Restore rendering environment.
ILayoutParam * GetLayoutParam() SCONST OVERRIDE
Retrieves the layout parameter object associated with the window.
SWindow * GetWindow(int uCode) const
Retrieves a window based on a given code.
void ShowCaret(BOOL bShow) OVERRIDE
Shows or hides the caret.
void TransformPoint(CPoint &pt) const
Transforms a point based on the current window's transformation matrix.
BOOL IsDisabled(BOOL bCheckParent=FALSE) SCONST OVERRIDE
Checks if the window is disabled.
virtual void DrawText(IRenderTarget *pRT, LPCTSTR pszBuf, int cchText, LPRECT pRect, UINT uFormat)
Draw text content.
void DrawDefFocusRect(IRenderTarget *pRT, CRect rc)
Draws the default focus rectangle.
void KillFocus() OVERRIDE
Kills the focus from the window.
IWindow * FindIChildByName(LPCWSTR pszName) OVERRIDE
Finds a child window by its name.
void DestroyAllChildren() OVERRIDE
Destroys all child windows.
SEventSet * GetEventSet()
Retrieves the event set associated with the window.
BOOL KillTimer(char id) OVERRIDE
Kills a timer for the window.
BOOL IsFocusable() SCONST OVERRIDE
Checks if the window is focusable.
SAutoRefPtr< ISkinObj > m_pBgSkin
bool _WndRectInRgn(const CRect &rc, const IRegionS *rgn) const
Checks if the window rectangle lies within a specified region.
void RedrawRegion(IRenderTarget *pRT, IRegionS *pRgn)
Renders the content of the window and its child windows onto the RenderTarget.
void OnShowWindow(BOOL bShow, UINT nStatus)
Handles showing or hiding the window.
virtual void OnColorize(COLORREF cr)
Adjusts the color tone of the window.
virtual BOOL OnSetCursor(const CPoint &pt)
Sets the cursor when the mouse hovers over the window.
BOOL FireCtxMenu(POINT pt) OVERRIDE
Fires a context menu event.
void Invalidate() OVERRIDE
Invalidates the entire window.
bool IsCacheDirty() const
Checks if the cache is marked as dirty.
IPathS * GetWindowPath() SCONST OVERRIDE
Retrieves the window path.
BOOL CreateCaret(HBITMAP pBmp, int nWid, int nHeight) OVERRIDE
Creates a caret.
void SetWindowText(LPCTSTR lpszText) OVERRIDE
Sets the window text.
BOOL IsDescendant(const IWindow *pWnd) SCONST OVERRIDE
Checks if a window is a descendant of this window.
virtual SWindow * GetSelectedSiblingInGroup()
Get selected sibling in group.
virtual bool IsDrawToCache() const
Checks if the window content is being drawn to the cache.
void RequestRelayout() OVERRIDE
Requests a relayout of the window.
BOOL AddEvent(DWORD dwEventID, LPCWSTR pszEventHandlerName) OVERRIDE
Adds an event handler.
void GetWindowRect(LPRECT prect) SCONST OVERRIDE
Retrieves the bounding rectangle of the window.
COLORREF GetBkgndColor() SCONST OVERRIDE
Retrieves the background color of the window.
virtual void OnStateChanging(DWORD dwOldState, DWORD dwNewState)
Called before the state of the window changes.
virtual BOOL CreateChildren(SXmlNode xmlNode)
Create child windows from XML node.
ILayout * GetLayout() OVERRIDE
Retrieves the layout object associated with the window.
void SetMsgHandled(BOOL bHandled)
Sets the message handled flag.
void OnRButtonDown(UINT nFlags, CPoint point)
Handles the right mouse button down event.
HRESULT OnAttrTrackMouseEvent(const SStringW &strValue, BOOL bLoading)
Handles the 'trackMouseEvent' attribute.
virtual SStringT GetToolTipText()
Retrieves the tooltip text of the window.
ULONG_PTR SetUserData(ULONG_PTR uData) OVERRIDE
Sets the user data for the window.
BOOL RegisterDragDrop(IDropTarget *pDragTarget) OVERRIDE
Registers a drop target for the window.
void GetScaleSkin(SAutoRefPtr< ISkinObj > &pSkin, int nScale)
Retrieves a scaled skin object based on the current scale factor.
BOOL InitFromXml(IXmlNode *pNode) OVERRIDE
Initializes the window from an XML node.
IWindow * GetIChild(int iChild) SCONST OVERRIDE
Retrieves a child window by index.
BOOL FireCommand() OVERRIDE
Fires a command event.
void OnEnable(BOOL bEnable, UINT nStatus)
Handles enabling or disabling the window.
void _PaintNonClient(IRenderTarget *pRT)
Renders the non-client area of the window onto the RenderTarget.
void Update(BOOL bForce=FALSE) OVERRIDE
Updates the window.
void OnSetFocus(SWND wndOld)
Handles gaining focus.
SAnimationHandler m_animationHandler
DWORD ModifyState(DWORD dwStateAdd, DWORD dwStateRemove, BOOL bUpdate=FALSE) OVERRIDE
Modifies the state of the window.
SAutoRefPtr< IAttrStorage > m_attrStorage
const SwndStyle & GetStyle() const
Retrieves the style of the window.
void LockUpdate() OVERRIDE
Locks updates to the window.
virtual void OnStateChanged(DWORD dwOldState, DWORD dwNewState)
Called after the state of the window changes.
HWND GetHostHwnd() OVERRIDE
Retrieves the host window handle.
IWindow * FindIChildByID(int nId) OVERRIDE
Finds a child window by its ID.
SWND m_swnd
Member variables representing various properties of the window.
SWindow * FindChildByID(int nID, int nDeep=-1)
Finds a child window by its ID.
void BeforePaintEx(IRenderTarget *pRT)
Prepares the drawing environment for the current window's RenderTarget, starting from the top-level w...
void Move(LPCRECT prect) OVERRIDE
Moves the window to a new position and size.
ISwndContainer * m_pContainer
HRESULT OnAttrSkin(const SStringW &strValue, BOOL bLoading)
Handles the 'skin' attribute.
ITimelineHandlersMgr * GetTimelineHandlersMgr() OVERRIDE
Retrieves the timeline handlers manager.
SAutoRefPtr< ILayout > m_pLayout
virtual BOOL OnNcHitTest(CPoint pt)
Non-client area hit test.
BOOL RemoveEvent(DWORD dwEventID) OVERRIDE
Removes an event handler.
BOOL CreateChildrenFromResId(LPCTSTR pszResId) OVERRIDE
Creates child windows from a resource ID.
SAutoRefPtr< IAnimation > m_animation
LRESULT OnUpdateFont(UINT uMsg, WPARAM wParam, LPARAM lParam)
Handles updating the font of the window.
BOOL ReleaseCapture() OVERRIDE
Releases the mouse capture from the window.
BOOL SetLayoutParam(ILayoutParam *pLayoutParam) OVERRIDE
Sets the layout parameter object for the window.
IRenderTarget * GetRenderTarget(LPCRECT pRc=NULL, GrtFlag gdcFlags=GRT_NODRAW, BOOL bClientRT=TRUE)
Retrieves a memory DC compatible with the SWND window.
Manages DUI windows in the SOUI system.
static bool IsWindow(SWND swnd)
Checks if a given handle is a valid window handle.
static BOOL DestroyWindow(SWND swnd)
Destroys a window with the specified handle.
Class representing an XML attribute.
SXmlAttr next_attribute() const
Gets the next attribute in the attribute list of the parent node.
bool set_value(const wchar_t *rhs)
Sets the attribute value.
const wchar_t * name() const
Gets the attribute name.
const wchar_t * value() const
Gets the attribute value.
Implementation of IXmlDoc.
bool load_buffer_inplace(void *contents, size_t size, unsigned int options=xml_parse_default, XmlEncoding encoding=enc_auto)
Loads the document from a buffer using in-place parsing.
SXmlNode root() const
Retrieves the root node of the document.
bool load_buffer(const void *contents, size_t size, unsigned int options=xml_parse_default, XmlEncoding encoding=enc_auto)
Loads the document from a buffer.
Class representing an XML node.
SXmlNode next_sibling() const
Gets the next sibling node in the children list of the parent node.
SXmlAttr first_attribute() const
Gets the first attribute of the node.
SXmlNode first_child() const
Gets the first child node of the node.
const wchar_t * name() const
Gets the name of the node.
const wchar_t * child_value() const
Gets the child value of the current node.
SXmlAttr attribute(const wchar_t *name, bool bCaseSensitive=false) const
Gets the attribute with the specified name.
SXmlAttr append_attribute(const wchar_t *name)
Adds an attribute with the specified name.
SXmlNode child(const wchar_t *name, bool bCaseSensitive=false) const
Gets the child node, attribute, or next/previous sibling with the specified name.
const wchar_t * Text() SCONST OVERRIDE
Gets the node text.
Manages the style attributes of SOUI windows.
UINT GetTextAlign() const
Retrieves the text alignment.
IFontPtr GetTextFont(int iState)
Retrieves the text font for a specific state.
int GetScale() const
Retrieves the scale factor.
void SetScale(int nScale)
Sets the scale factor.
int GetStates()
Retrieves the number of states.
COLORREF GetTextColor(int iState)
Retrieves the text color for a specific state.
CRect GetMargin() const
Retrieves the margin rectangle.
CRect GetPadding() const
Retrieves the padding rectangle.
long AddRef() override
Increments the reference count.
Interface for reference counting.
BOOL IsEmpty() SCONST PURE
Checks if the region is empty.
void GetRgnBox(LPRECT lprect) SCONST PURE
Retrieves the bounding rectangle of the region.
Base class for all renderable objects.
Interface for rendering target objects.
HRESULT DrawRectangle(LPCRECT pRect) PURE
Draw a rectangle outline.
HRESULT DrawText(LPCTSTR pszText, int cchLen, LPRECT pRc, UINT uFormat) PURE
Draw text within a rectangle.
HRESULT SetViewportOrg(POINT pt) PURE
Set the viewport origin.
HRESULT AlphaBlend(LPCRECT pRcDest, IRenderTarget *pRTSrc, LPCRECT pRcSrc, BYTE byAlpha) PURE
Performs an alpha-blended transfer from one render target to another.
long Release() PURE
Decrement the reference count and destroy the object if the count reaches zero.
HRESULT GetTransform(float matrix[9]) SCONST PURE
Retrieves the current coordinate transformation matrix.
IRenderObj * GetCurrentObject(OBJTYPE uType) PURE
Retrieves the current rendering object of the specified type.
HRESULT SelectObject(IRenderObj *pObj, IRenderObj **pOldObj=NULL) PURE
Selects a new rendering object and optionally retrieves the previous one.
HRESULT SetTransform(const float matrix[9], float oldMatrix[9]=NULL) PURE
Sets the coordinate transformation matrix.
void EndDraw() PURE
End a drawing operation.
HRESULT PushClipRect(LPCRECT pRect, UINT mode=RGN_AND) PURE
Push a rectangular clip region.
HRESULT CreatePen(int iStyle, COLORREF cr, int cWidth, IPenS **ppPen) PURE
Create a pen object.
HRESULT RestoreClip(int nState=-1) PURE
Restore a previously saved clip state.
HRESULT PopClip() PURE
Pop the last clip region from the stack.
HRESULT FillSolidRect(LPCRECT pRect, COLORREF cr) PURE
Fill a rectangle with a solid color.
void BeginDraw() PURE
Start a drawing operation.
HRESULT PushClipPath(const IPathS *path, UINT mode, BOOL doAntiAlias=FALSE) PURE
Modifies the current clipping region using a path.
HRESULT SaveClip(int *pnState) PURE
Save the current clip state.
HRESULT OffsetViewportOrg(int xOff, int yOff, LPPOINT lpPoint=NULL) PURE
Offset the viewport origin.
COLORREF GetTextColor() PURE
Retrieves the current text color.
HRESULT ClearRect(LPCRECT pRect, COLORREF cr) PURE
Clear a rectangle with a solid color.
COLORREF SetTextColor(COLORREF color) PURE
Sets the current text color.
HRESULT PushClipRegion(IRegionS *pRegion, UINT mode=RGN_AND) PURE
Push a region-based clip.
Interface for Skin Objects.
SOUI Window Container Interface.
void OnSetSwndFocus(SWND swnd) PURE
Sets the focus to the specified Swnd object.
BOOL RegisterDragDrop(SWND swnd, IDropTarget *pDropTarget) PURE
Registers an IDropTarget with a Swnd.
BOOL RegisterVideoCanvas(SWND swnd) PURE
Registers a VideoCanvas window.
HWND GetHostHwnd() PURE
Retrieves the handle to the host window.
IScriptModule * GetScriptModule() PURE
Retrieves the script module.
void BuildWndTreeZorder() PURE
Rebuilds the window tree's z-order.
BOOL RegisterTimelineHandler(ITimelineHandler *pHandler) PURE
Registers an animation frame handler.
SWND GetFocus() SCONST PURE
Retrieves the Swnd object that has focus.
BOOL OnReleaseSwndCapture() PURE
Releases the mouse capture from the Swnd object.
void MarkWndTreeZorderDirty() PURE
Marks the window tree's z-order as dirty.
BOOL UnregisterTrackMouseEvent(SWND swnd) PURE
Unregisters a Swnd as a TrackMouseEvent window.
void UpdateTooltip() PURE
Requests an update of the tooltip.
LPCWSTR GetTranslatorContext() SCONST PURE
Retrieves the translation context.
SWND OnGetSwndCapture() SCONST PURE
Retrieves the Swnd object that has captured the mouse.
BOOL OnFireEvent(IEvtArgs *evt) PURE
Fires an event.
BOOL UnregisterTimelineHandler(ITimelineHandler *pHandler) PURE
Unregisters an animation frame handler.
void OnRedraw(LPCRECT rc, BOOL bClip) PURE
Requests a redraw of the specified area.
void UpdateRegion(IRegionS *rgn) PURE
Updates the specified region of the memory bitmap.
BOOL UnregisterDragDrop(SWND swnd) PURE
Unregisters an IDropTarget from a Swnd.
BOOL UpdateWindow(BOOL bForce=TRUE) PURE
Requests an immediate update of the window.
BOOL UnregisterVideoCanvas(SWND swnd) PURE
Unregisters a VideoCanvas window.
BOOL RegisterTrackMouseEvent(SWND swnd) PURE
Registers a Swnd as a TrackMouseEvent window.
SWND OnSetSwndCapture(SWND swnd) PURE
Sets the Swnd object to capture the mouse.
Structure representing a window message.
Bitfield structure for font style attributes.