soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SLinearLayout.cpp
1#include "souistd.h"
2#include "layout/SLinearLayout.h"
3#include "helper/SplitString.h"
4#include <core/SWnd.h>
5
6SNSBEGIN
7
12
13BOOL SLinearLayoutParam::IsMatchParent(ORIENTATION orientation) const
14{
15 switch (orientation)
16 {
17 case Horz:
18 return width.isMatchParent();
19 case Vert:
20 return height.isMatchParent();
21 case Any:
22 return IsMatchParent(Horz) || IsMatchParent(Vert);
23 case Both:
24 default:
25 return IsMatchParent(Horz) && IsMatchParent(Vert);
26 }
27}
28
29BOOL SLinearLayoutParam::IsWrapContent(ORIENTATION orientation) const
30{
31 switch (orientation)
32 {
33 case Horz:
34 return width.isWrapContent();
35 case Vert:
36 return height.isWrapContent();
37 case Any:
38 return IsWrapContent(Horz) || IsWrapContent(Vert);
39 case Both:
40 default:
41 return IsWrapContent(Horz) && IsWrapContent(Vert);
42 }
43}
44
45BOOL SLinearLayoutParam::IsSpecifiedSize(ORIENTATION orientation) const
46{
47 switch (orientation)
48 {
49 case Horz:
50 return width.isSpecifiedSize();
51 case Vert:
52 return height.isSpecifiedSize();
53 case Any:
54 return IsSpecifiedSize(Horz) || IsSpecifiedSize(Vert);
55 case Both:
56 default:
57 return IsSpecifiedSize(Horz) && IsSpecifiedSize(Vert);
58 }
59}
60
62{
63 switch (orientation)
64 {
65 case Horz:
66 return width;
67 case Vert:
68 return height;
69 case Any:
70 case Both:
71 default:
72 SASSERT_MSGA(FALSE, "GetSpecifiedSize can only be applied for Horz or Vert");
73 return SLayoutSize();
74 }
75}
76
77HRESULT SLinearLayoutParam::OnAttrSize(const SStringW &strValue, BOOL bLoading)
78{
79 SStringWList szStr;
80 if (2 != SplitString(strValue, L',', szStr))
81 return E_FAIL;
82
83 OnAttrWidth(szStr[0], bLoading);
84 OnAttrHeight(szStr[1], bLoading);
85 return S_OK;
86}
87
88HRESULT SLinearLayoutParam::OnAttrWidth(const SStringW &strValue, BOOL bLoading)
89{
90 if (strValue.CompareNoCase(L"matchParent") == 0)
91 width.setMatchParent();
92 else if (strValue.CompareNoCase(L"wrapContent") == 0)
93 width.setWrapContent();
94 else
95 width = GETLAYOUTSIZE(strValue);
96 return S_OK;
97}
98
99HRESULT SLinearLayoutParam::OnAttrHeight(const SStringW &strValue, BOOL bLoading)
100{
101 if (strValue.CompareNoCase(L"matchParent") == 0)
102 height.setMatchParent();
103 else if (strValue.CompareNoCase(L"wrapContent") == 0)
104 height.setWrapContent();
105 else
106 height = GETLAYOUTSIZE(strValue);
107 return S_OK;
108}
109
110HRESULT SLinearLayoutParam::OnAttrExtend(const SStringW &strValue, BOOL bLoading)
111{
112 SStringWList strList;
113 size_t nSeg = SplitString(strValue, L',', strList);
114 if (nSeg == 1)
115 {
116 extend_left = extend_top = extend_right = extend_bottom = GETLAYOUTSIZE(strList[0]);
117 return S_OK;
118 }
119 else if (nSeg == 4)
120 {
121 extend_left = GETLAYOUTSIZE(strList[0]);
122 extend_top = GETLAYOUTSIZE(strList[1]);
123 extend_right = GETLAYOUTSIZE(strList[2]);
124 extend_bottom = GETLAYOUTSIZE(strList[3]);
125 return S_OK;
126 }
127 return E_INVALIDARG;
128}
129
131{
132 width.setWrapContent();
133 height.setWrapContent();
134 weight = 0.0f;
135 gravity = G_Undefined;
136}
137
138void SLinearLayoutParam::SetMatchParent(ORIENTATION orientation)
139{
140 switch (orientation)
141 {
142 case Horz:
143 width.setMatchParent();
144 break;
145 case Vert:
146 height.setMatchParent();
147 break;
148 case Both:
149 width.setMatchParent();
150 height.setMatchParent();
151 break;
152 }
153}
154
155void SLinearLayoutParam::SetWrapContent(ORIENTATION orientation)
156{
157 switch (orientation)
158 {
159 case Horz:
160 width.setWrapContent();
161 break;
162 case Vert:
163 height.setWrapContent();
164 break;
165 case Both:
166 width.setWrapContent();
167 height.setWrapContent();
168 break;
169 }
170}
171
172void SLinearLayoutParam::SetSpecifiedSize(ORIENTATION orientation, const SLayoutSize &layoutSize)
173{
174 switch (orientation)
175 {
176 case Horz:
177 width = layoutSize;
178 break;
179 case Vert:
180 height = layoutSize;
181 break;
182 case Both:
183 width = height = layoutSize;
184 break;
185 }
186}
187
189{
190 return (SLinearLayoutParamStruct *)this;
191}
192
193ILayoutParam *SLinearLayoutParam::Clone() const
194{
196 memcpy(pRet->GetRawData(), (SLinearLayoutParamStruct *)this, sizeof(SLinearLayoutParamStruct));
197 return pRet;
198}
199
200//////////////////////////////////////////////////////////////////////////
202 : m_gravity(G_Undefined)
203{
204}
205
209
210void SLinearLayout::LayoutChildren(IWindow *pParent)
211{
212 CRect rcParent;
213 pParent->GetChildrenLayoutRect(&rcParent);
214
215 SIZE *pSize = new SIZE[pParent->GetChildrenCount()];
216 IWindow **pChilds = new IWindow *[pParent->GetChildrenCount()];
217 memset(pSize, 0, sizeof(SIZE) * pParent->GetChildrenCount());
218
219 int nChilds = 0;
220
221 int offset = 0;
222 float fWeight = 0.0f;
223
224 { // assign width or height
225
226 int iChild = 0;
227
228 IWindow *pChild = pParent->GetNextLayoutIChild(NULL);
229 while (pChild)
230 {
231 const SLinearLayoutParam *pLinearLayoutParam = (const SLinearLayoutParam *)pChild->GetLayoutParam();
232
233 int nScale = pChild->GetScale();
234
235 CSize szChild(SIZE_WRAP_CONTENT, SIZE_WRAP_CONTENT);
236 if (pLinearLayoutParam->IsMatchParent(Horz))
237 szChild.cx = rcParent.Width();
238 else if (pLinearLayoutParam->IsSpecifiedSize(Horz))
239 {
240 szChild.cx = pLinearLayoutParam->GetSpecifiedSize(Horz).toPixelSize(nScale);
241 szChild.cx += pLinearLayoutParam->extend_left.toPixelSize(nScale) + pLinearLayoutParam->extend_right.toPixelSize(nScale);
242 }
243
244 if (pLinearLayoutParam->IsMatchParent(Vert))
245 szChild.cy = rcParent.Height();
246 else if (pLinearLayoutParam->IsSpecifiedSize(Vert))
247 {
248 szChild.cy = pLinearLayoutParam->GetSpecifiedSize(Vert).toPixelSize(nScale);
249 szChild.cy += pLinearLayoutParam->extend_top.toPixelSize(nScale) + pLinearLayoutParam->extend_bottom.toPixelSize(nScale);
250 }
251
252 if (pLinearLayoutParam->weight > 0.0f)
253 {
254 fWeight += pLinearLayoutParam->weight;
255 }
256
257 if (szChild.cx == SIZE_WRAP_CONTENT || szChild.cy == SIZE_WRAP_CONTENT)
258 {
259 CSize szCalc;
260 pChild->GetDesiredSize(&szCalc, szChild.cx, szChild.cy);
261 if (szChild.cx == SIZE_WRAP_CONTENT)
262 {
263 szChild.cx = szCalc.cx;
264 szChild.cx += pLinearLayoutParam->extend_left.toPixelSize(nScale) + pLinearLayoutParam->extend_right.toPixelSize(nScale);
265 }
266 if (szChild.cy == SIZE_WRAP_CONTENT)
267 {
268 szChild.cy = szCalc.cy;
269 szChild.cy += pLinearLayoutParam->extend_top.toPixelSize(nScale) + pLinearLayoutParam->extend_bottom.toPixelSize(nScale);
270 }
271 }
272
273 pChilds[iChild] = pChild;
274 pSize[iChild] = szChild;
275 offset += m_orientation == Vert ? szChild.cy : szChild.cx;
276
277 iChild++;
278 pChild = pParent->GetNextLayoutIChild(pChild);
279 }
280
281 nChilds = iChild;
282 }
283
284 int size = m_orientation == Vert ? rcParent.Height() : rcParent.Width();
285 int interval = m_interval.toPixelSize(pParent->GetScale());
286 if (interval > 0)
287 {
288 offset += (nChilds - 1) * interval;
289 }
290 ORIENTATION orienOther = m_orientation == Vert ? Horz : Vert;
291 if (size > offset)
292 {
293 if (fWeight > 0.0f)
294 { // assign size by weight
295 int nRemain = size - offset;
296
297 for (int iChild = 0; iChild < nChilds; iChild++)
298 {
299 if (SLayoutSize::fequal(fWeight, 0.0f))
300 break;
301 IWindow *pChild = pChilds[iChild];
302 SLinearLayoutParam *pLinearLayoutParam = (SLinearLayoutParam *)pChild->GetLayoutParam();
303 int nScale = pChild->GetScale();
304 if (pLinearLayoutParam->weight > 0.0f)
305 {
306 int extra = int(nRemain * pLinearLayoutParam->weight / fWeight + 0.5f);
307 LONG &szChild = m_orientation == Vert ? pSize[iChild].cy : pSize[iChild].cx;
308 szChild += extra;
309 nRemain -= extra;
310 fWeight -= pLinearLayoutParam->weight;
311
312 if (pLinearLayoutParam->IsWrapContent(orienOther))
313 {
314 ILayoutParam *backup = pLinearLayoutParam->Clone();
315 pLinearLayoutParam->SetSpecifiedSize(m_orientation, SLayoutSize((float)szChild, SLayoutSize::dp));
316 int nWid = pSize[iChild].cx, nHei = pSize[iChild].cy;
317
318 if (orienOther == Vert)
319 nHei = SIZE_WRAP_CONTENT;
320 else
321 nWid = SIZE_WRAP_CONTENT;
322
323 CSize szCalc;
324 pChild->GetDesiredSize(&szCalc, nWid, nHei);
325 if (orienOther == Vert)
326 {
327 szCalc.cy += pLinearLayoutParam->extend_top.toPixelSize(nScale) + pLinearLayoutParam->extend_bottom.toPixelSize(nScale);
328 pSize[iChild].cy = szCalc.cy;
329 }
330 else
331 {
332 szCalc.cx += pLinearLayoutParam->extend_left.toPixelSize(nScale) + pLinearLayoutParam->extend_right.toPixelSize(nScale);
333 pSize[iChild].cx = szCalc.cx;
334 }
335 pChild->SetLayoutParam(backup);
336 backup->Release();
337 }
338 }
339 }
340 }
341 else if (interval < 0)
342 {
343 // handle interval==-1 or interval==-2
344 if (interval == SIZE_WRAP_CONTENT && nChilds > 1)
345 interval = (size - offset) / (nChilds - 1);
346 else if (interval == SIZE_MATCH_PARENT)
347 {
348 interval = (size - offset) / (nChilds + 1);
349 if (m_orientation == Vert)
350 rcParent.DeflateRect(0, interval, 0, interval);
351 else
352 rcParent.DeflateRect(interval, 0, interval, 0);
353 }
354 else
355 interval = 0;
356 }
357 }
358 { // assign position
359 offset = 0;
360 for (int iChild = 0; iChild < nChilds; iChild++)
361 {
362 SWindow *pChild = (SWindow *)pChilds[iChild];
363
364 SLinearLayoutParam *pLinearLayoutParam = (SLinearLayoutParam *)pChild->GetLayoutParam();
365 int nScale = pChild->GetScale();
366 Gravity gravity = pLinearLayoutParam->gravity == G_Undefined ? m_gravity : pLinearLayoutParam->gravity;
367 if (gravity == G_Undefined)
368 gravity = G_Left;
369
370 if (m_orientation == Vert)
371 {
372 CRect rcChild(CPoint(0, offset), pSize[iChild]);
373 rcChild.OffsetRect(rcParent.TopLeft());
374 if (gravity == G_Center)
375 rcChild.OffsetRect((rcParent.Width() - rcChild.Width()) / 2, 0);
376 else if (gravity == G_Right)
377 rcChild.OffsetRect(rcParent.Width() - rcChild.Width(), 0);
378
379 CRect rcChild2 = rcChild;
380 rcChild2.DeflateRect(pLinearLayoutParam->extend_left.toPixelSize(nScale), pLinearLayoutParam->extend_top.toPixelSize(nScale), pLinearLayoutParam->extend_right.toPixelSize(nScale), pLinearLayoutParam->extend_bottom.toPixelSize(nScale));
381
382 pChild->OnRelayout(rcChild2);
383
384 offset += rcChild.Height();
385 }
386 else
387 {
388 CRect rcChild(CPoint(offset, 0), pSize[iChild]);
389 rcChild.OffsetRect(rcParent.TopLeft());
390 if (gravity == G_Center)
391 rcChild.OffsetRect(0, (rcParent.Height() - rcChild.Height()) / 2);
392 else if (gravity == G_Right)
393 rcChild.OffsetRect(0, rcParent.Height() - rcChild.Height());
394
395 CRect rcChild2 = rcChild;
396 rcChild2.DeflateRect(pLinearLayoutParam->extend_left.toPixelSize(nScale), pLinearLayoutParam->extend_top.toPixelSize(nScale), pLinearLayoutParam->extend_right.toPixelSize(nScale), pLinearLayoutParam->extend_bottom.toPixelSize(nScale));
397
398 pChild->OnRelayout(rcChild2);
399
400 offset += rcChild.Width();
401 }
402 offset += interval;
403 }
404 }
405
406 delete[] pChilds;
407 delete[] pSize;
408}
409
410// nWidth,nHeight == -1:wrap_content
411SIZE SLinearLayout::MeasureChildren(const IWindow *pParent, int nWidth, int nHeight) const
412{
413 int nChildCount = pParent->GetChildrenCount();
414 SIZE *pSize = new SIZE[nChildCount];
415 memset(pSize, -1, sizeof(SIZE) * nChildCount); // init size to -1
416 const IWindow **ppChilds = new const IWindow *[nChildCount];
417 memset(ppChilds, 0, sizeof(IWindow *) * nChildCount);
418 const ILayoutParam *pParentLayoutParam = (const ILayoutParam *)pParent->GetLayoutParam();
419
420 bool bWaitingForLimit = true;
421 float fWeight = 0;
422 int nWaiting = 0;
423 int nChilds = 0;
424
425measureChilds:
426{
427 int iChild = 0;
428 const IWindow *pChild = pParent->GetNextLayoutIChild(NULL);
429 while (pChild)
430 {
431 while (!ppChilds[iChild])
432 {
433 const SLinearLayoutParam *pLinearLayoutParam = (const SLinearLayoutParam *)pChild->GetLayoutParam();
434 int nScale = pChild->GetScale();
435 CSize szChild(SIZE_WRAP_CONTENT, SIZE_WRAP_CONTENT);
436 if (pLinearLayoutParam->IsMatchParent(Horz))
437 {
438 if (!pParentLayoutParam->IsWrapContent(Horz))
439 {
440 szChild.cx = nWidth;
441 }
442 else if (bWaitingForLimit && nWidth == SIZE_WRAP_CONTENT && m_orientation == Vert)
443 {
444 nWaiting++;
445 break;
446 }
447 }
448 else if (pLinearLayoutParam->IsSpecifiedSize(Horz))
449 {
450 szChild.cx = pLinearLayoutParam->GetSpecifiedSize(Horz).toPixelSize(nScale);
451 szChild.cx += pLinearLayoutParam->extend_left.toPixelSize(nScale) + pLinearLayoutParam->extend_right.toPixelSize(nScale);
452 }
453 if (pLinearLayoutParam->IsMatchParent(Vert))
454 {
455 if (!pParentLayoutParam->IsWrapContent(Vert))
456 {
457 szChild.cy = nHeight;
458 }
459 else if (bWaitingForLimit && nHeight == SIZE_WRAP_CONTENT && m_orientation == Horz)
460 {
461 nWaiting++;
462 break;
463 }
464 }
465 else if (pLinearLayoutParam->IsSpecifiedSize(Vert))
466 {
467 szChild.cy = pLinearLayoutParam->GetSpecifiedSize(Vert).toPixelSize(nScale);
468 szChild.cy += pLinearLayoutParam->extend_top.toPixelSize(nScale) + pLinearLayoutParam->extend_bottom.toPixelSize(nScale);
469 }
470 if (szChild.cx == SIZE_WRAP_CONTENT || szChild.cy == SIZE_WRAP_CONTENT)
471 {
472 int nWid = szChild.cx, nHei = szChild.cy;
473
474 CSize szCalc;
475 ((IWindow *)pChild)->GetDesiredSize(&szCalc, nWid, nHei);
476 if (szChild.cx == SIZE_WRAP_CONTENT)
477 {
478 szChild.cx = szCalc.cx;
479 szChild.cx += pLinearLayoutParam->extend_left.toPixelSize(nScale) + pLinearLayoutParam->extend_right.toPixelSize(nScale);
480 }
481 if (szChild.cy == SIZE_WRAP_CONTENT)
482 {
483 szChild.cy = szCalc.cy;
484 szChild.cy += pLinearLayoutParam->extend_top.toPixelSize(nScale) + pLinearLayoutParam->extend_bottom.toPixelSize(nScale);
485 }
486 }
487 fWeight += pLinearLayoutParam->weight;
488
489 ppChilds[iChild] = pChild;
490 pSize[iChild] = szChild;
491 break;
492 }
493 pChild = pParent->GetNextLayoutIChild(pChild);
494 iChild++;
495 }
496 nChilds = iChild;
497}
498 if (nWaiting > 0)
499 {
500 //父窗口的非布局方向为自适应,同时存在子窗口在该方向上为填充父窗口,需要计算出该方向其它子窗口的最大值。
501 nWaiting = 0;
502 if (m_orientation == Vert)
503 {
504 SASSERT(nWidth == SIZE_WRAP_CONTENT);
505 for (int i = 0; i < nChilds; i++)
506 {
507 nWidth = smax(pSize[i].cx, nWidth);
508 }
509 bWaitingForLimit = false;
510 nChilds = 0;
511 goto measureChilds;
512 }
513 else
514 {
515 SASSERT(nHeight == SIZE_WRAP_CONTENT);
516 for (int i = 0; i < nChilds; i++)
517 {
518 nHeight = smax(pSize[i].cy, nHeight);
519 }
520 bWaitingForLimit = false;
521 nChilds = 0;
522 goto measureChilds;
523 }
524 }
525
526 int size = m_orientation == Vert ? nHeight : nWidth;
527 int nInterval = m_interval.toPixelSize(pParent->GetScale());
528 if (nInterval < 0)
529 nInterval = 0;
530 if (!SLayoutSize::fequal(fWeight, 0.0f) && size != SIZE_WRAP_CONTENT)
531 { // assign weight for elements. and calc size of other orientation again.
532 int offset = 0;
533 for (int i = 0; i < nChilds; i++)
534 {
535 offset += m_orientation == Vert ? pSize[i].cy : pSize[i].cx;
536 }
537 offset += nInterval * (nChilds - 1);
538 if (offset < size)
539 { // assign size by weight
540 int nRemain = size - offset;
541
542 ORIENTATION orienOther = m_orientation == Vert ? Horz : Vert;
543 for (int iChild = 0; iChild < nChilds; iChild++)
544 {
545 if (SLayoutSize::fequal(fWeight, 0.0f) && pSize[iChild].cx != -1 && pSize[iChild].cy != -1)
546 break;
547 IWindow *pChild = (IWindow *)ppChilds[iChild];
548 SLinearLayoutParam *pLinearLayoutParam = (SLinearLayoutParam *)pChild->GetLayoutParam();
549 int nScale = pChild->GetScale();
550 if (pLinearLayoutParam->weight > 0.0f)
551 {
552 int extra = int(nRemain * pLinearLayoutParam->weight / fWeight + 0.5f);
553 LONG &szChild = m_orientation == Vert ? pSize[iChild].cy : pSize[iChild].cx;
554 szChild += extra;
555 nRemain -= extra;
556 fWeight -= pLinearLayoutParam->weight;
557
558 if (!pLinearLayoutParam->IsSpecifiedSize(orienOther))
559 { // As pChild->GetDesiredSize may use layout param to get specified size, we
560 // must set it to new size.
561 ILayoutParam *backup = pLinearLayoutParam->Clone();
562 pLinearLayoutParam->SetSpecifiedSize(m_orientation, SLayoutSize((float)szChild, SLayoutSize::dp));
563 pLinearLayoutParam->SetWrapContent(orienOther);
564 int nWid = pSize[iChild].cx, nHei = pSize[iChild].cy;
565
566 if (orienOther == Vert)
567 nHei = SIZE_WRAP_CONTENT;
568 else
569 nWid = SIZE_WRAP_CONTENT;
570
571 CSize szCalc;
572 pChild->GetDesiredSize(&szCalc, nWid, nHei);
573 if (orienOther == Vert)
574 {
575 szCalc.cy += pLinearLayoutParam->extend_top.toPixelSize(nScale) + pLinearLayoutParam->extend_bottom.toPixelSize(nScale);
576 pSize[iChild].cy = szCalc.cy;
577 }
578 else
579 {
580 szCalc.cx += pLinearLayoutParam->extend_left.toPixelSize(nScale) + pLinearLayoutParam->extend_right.toPixelSize(nScale);
581 pSize[iChild].cx = szCalc.cx;
582 }
583 pChild->SetLayoutParam(backup);
584 backup->Release();
585 }
586 }
587 }
588 }
589 }
590
591 CSize szRet;
592 for (int i = 0; i < nChilds; i++)
593 {
594 if (m_orientation == Horz)
595 {
596 szRet.cy = smax(szRet.cy, pSize[i].cy);
597 szRet.cx += pSize[i].cx;
598 }
599 else
600 {
601 szRet.cx = smax(szRet.cx, pSize[i].cx);
602 szRet.cy += pSize[i].cy;
603 }
604 }
605 // add intervals
606 if (m_orientation == Horz)
607 {
608 szRet.cx += nInterval * (nChilds - 1);
609 }
610 else
611 {
612 szRet.cy += nInterval * (nChilds - 1);
613 }
614 delete[] pSize;
615 delete[] ppChilds;
616 return szRet;
617}
618
619BOOL SLinearLayout::IsParamAcceptable(const ILayoutParam *pLayoutParam) const
620{
621 return pLayoutParam->IsClass(SLinearLayoutParam::GetClassName());
622}
623
625{
626 return new SLinearLayoutParam();
627}
628
629SNSEND
SOUI基础DUI窗口模块
布局大小类
Definition SLayoutSize.h:10
static bool fequal(float a, float b)
比较两个浮点数是否相等
int toPixelSize(int scale) const
将大小转换为像素值
~SLinearLayout(void)
析构函数
void LayoutChildren(IWindow *pParent) OVERRIDE
布局子窗口
BOOL IsParamAcceptable(const ILayoutParam *pLayoutParam) SCONST OVERRIDE
检查布局参数是否可接受
ILayoutParam * CreateLayoutParam() SCONST OVERRIDE
创建布局参数对象
SIZE MeasureChildren(const IWindow *pParent, int nWidth, int nHeight) SCONST OVERRIDE
测量子窗口大小
SLinearLayout(void)
构造函数
线性布局参数类
SLayoutSize GetSpecifiedSize(ORIENTATION orientation) SCONST OVERRIDE
获取指定大小
void SetMatchParent(ORIENTATION orientation) OVERRIDE
设置匹配父容器大小
void Clear() OVERRIDE
清除布局参数
HRESULT OnAttrSize(const SStringW &strValue, BOOL bLoading)
处理大小属性
HRESULT OnAttrWidth(const SStringW &strValue, BOOL bLoading)
处理宽度属性
BOOL IsSpecifiedSize(ORIENTATION orientation) SCONST OVERRIDE
检查是否指定大小
void * GetRawData() OVERRIDE
获取原始数据指针
void SetWrapContent(ORIENTATION orientation) OVERRIDE
设置包裹内容大小
BOOL IsWrapContent(ORIENTATION orientation) SCONST OVERRIDE
检查是否包裹内容大小
void SetSpecifiedSize(ORIENTATION orientation, const SLayoutSize &layoutSize) OVERRIDE
设置指定大小
HRESULT OnAttrExtend(const SStringW &strValue, BOOL bLoading)
处理扩展属性
HRESULT OnAttrHeight(const SStringW &strValue, BOOL bLoading)
处理高度属性
BOOL IsMatchParent(ORIENTATION orientation) SCONST OVERRIDE
检查是否匹配父容器大小
ILayoutParam * Clone() SCONST OVERRIDE
克隆布局参数
SLinearLayoutParam()
构造函数
static LPCWSTR GetClassName()
Definition Sobject.hpp:41
A class representing an ASCII string.
Definition sstringw.h:96
int CompareNoCase(const wchar_t *psz) SCONST
Compares the string with another string, ignoring case.
Definition sstringw.cpp:929
Base class for SOUI DUI windows.
Definition SWnd.h:286
int GetScale() SCONST OVERRIDE
Retrieves the scale factor of the window.
Definition Swnd.cpp:3266
virtual BOOL OnRelayout(const CRect &rcWnd)
Handles window position changes during layout updates.
Definition Swnd.cpp:1587
ILayoutParam * GetLayoutParam() SCONST OVERRIDE
Retrieves the layout parameter object associated with the window.
Definition SWnd.h:405