Skip to content

Commit e2892bb

Browse files
committed
调整SButton, SImgButton自适应窗口的代码。
1 parent e5832c1 commit e2892bb

File tree

2 files changed

+19
-21
lines changed

2 files changed

+19
-21
lines changed

SOUI/include/control/SCmnCtrl.h

+4-13
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,6 @@ class SOUI_EXP SButton : public SWindow
164164
*/
165165
SButton();
166166

167-
public:
168-
/**
169-
* SButton::GetDesiredSize
170-
* @brief 获得期望的大小值
171-
* @param LPRECT pRcContainer -- 内容窗体矩形
172-
*
173-
* Describe 根据内容窗体矩形大小,计算出适合的大小
174-
*/
175-
virtual CSize GetDesiredSize(LPCRECT pRcContainer);
176167

177168
protected:
178169
/**
@@ -278,10 +269,10 @@ class SOUI_EXP SImageButton : public SButton
278269
{
279270
SOUI_CLASS_NAME(SImageButton, L"imgbtn")
280271
public:
281-
SImageButton()
282-
{
283-
m_bDrawFocusRect=FALSE;
284-
}
272+
SImageButton();
273+
274+
protected:
275+
virtual CSize GetDesiredSize(int nParentWid, int nParentHei) override;
285276
};
286277

287278
/**

SOUI/src/control/SCmnCtrl.cpp

+15-8
Original file line numberDiff line numberDiff line change
@@ -388,14 +388,6 @@ HRESULT SButton::OnAttrAccel( SStringW strAccel,BOOL bLoading )
388388
return S_FALSE;
389389
}
390390

391-
CSize SButton::GetDesiredSize( LPCRECT pRcContainer )
392-
{
393-
SASSERT(m_pBgSkin);
394-
CSize szRet=m_pBgSkin->GetSkinSize();
395-
if(szRet.cx==0 || szRet.cy==0)
396-
szRet=__super::GetDesiredSize(pRcContainer);
397-
return szRet;
398-
}
399391

400392
void SButton::OnStateChanged( DWORD dwOldState,DWORD dwNewState )
401393
{
@@ -438,6 +430,21 @@ void SButton::OnNextFrame()
438430
Invalidate();
439431
}
440432

433+
434+
////////////////////////////////////////////////////////////////////////////
435+
436+
SImageButton::SImageButton()
437+
{
438+
m_bDrawFocusRect=FALSE;
439+
}
440+
441+
CSize SImageButton::GetDesiredSize(int nParentWid, int nParentHei)
442+
{
443+
SASSERT(m_pBgSkin);
444+
return m_pBgSkin->GetSkinSize();
445+
}
446+
447+
441448
//////////////////////////////////////////////////////////////////////////
442449
// Image Control
443450
// Use src attribute specify a resource id

0 commit comments

Comments
 (0)