7 :
m_pSkin(GETBUILTINSKIN(SKIN_SYS_SWITCH_BG))
12 m_animator->setDuration(200);
13 m_animator->addListener(
this);
14 m_animator->addUpdateListener(
this);
23 SLOGI2(
"switch") <<
"fraction:" << pAnimator->getAnimatedFraction();
36 m_pSkin->DrawByState(pRT, rcWnd, 0);
40 int dwSpace = rcWnd.Width() - skSize.cx;
43 rcDst.bottom = skSize.cy;
44 if (m_animator->isRunning())
46 float fac = m_animator->getAnimatedFraction();
47 if (m_animator->GetID() == 0)
50 rcDst.right = skSize.cx;
51 rcDst.OffsetRect((
int)(fac * (rcWnd.Width() - skSize.cx)), 0);
55 rcDst.right = rcWnd.Width();
56 rcDst.left = rcDst.right - skSize.cx;
57 rcDst.OffsetRect(-(
int)(fac * (rcWnd.Width() - skSize.cx)), 0);
59 rcDst.OffsetRect(rcWnd.TopLeft());
61 BYTE alpha2 = (BYTE)(fac * 255);
62 BYTE alpha1 = 255 - alpha2;
72 rcDst.right = skSize.cx;
75 rcDst.OffsetRect(rcWnd.Width() - skSize.cx, 0);
77 rcDst.OffsetRect(rcWnd.TopLeft());
87 __baseCls::GetDesiredSize(ret, wid, hei);
103 if (nChar == VK_SPACE)
113 m_animator->addListener(
this);
114 m_animator->addUpdateListener(
this);
121 return bLoading ? S_OK : S_FALSE;
Definition of the SSwitch class.
static LPCWSTR GetClassName()
static SApplication * getSingletonPtr(void)
A class representing an ASCII string.
void onAnimationEnd(IValueAnimator *pAnimator) override
Handles the end of an animation.
void onAnimationUpdate(IValueAnimator *pAnimator) override
Handles the update of an animation.
~SSwitch()
Destructor for SSwitch.
HRESULT OnAttrAnimator(const SStringW &value, BOOL bLoading)
Handles the 'animator' attribute.
void OnPaint(IRenderTarget *pRT)
Handles the paint event.
SAutoRefPtr< ISkinObj > m_pSkin
void OnLButtonUp(UINT nFlags, CPoint point)
Handles the left mouse button up event.
void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
Handles the key down event.
HRESULT OnAttrCheck(const SStringW &strValue, BOOL bLoading)
Handles the 'checked' attribute.
void GetDesiredSize(SIZE *psz, int nParentWid, int nParentHei) OVERRIDE
Calculates the desired size of the control.
SAutoRefPtr< ISkinObj > m_pSkinForce
SSwitch()
Constructor for SSwitch.
DWORD GetState() SCONST OVERRIDE
Retrieves the current state of the window.
CRect GetWindowRect() const
Retrieves the bounding rectangle of the window.
ISwndContainer * GetContainer() OVERRIDE
Retrieves the container associated with this window.
void SetCheck(BOOL bCheck) OVERRIDE
Sets the check state of the window.
BOOL IsChecked() SCONST OVERRIDE
Checks if the window is checked.
void Invalidate() OVERRIDE
Invalidates the entire window.
DWORD ModifyState(DWORD dwStateAdd, DWORD dwStateRemove, BOOL bUpdate=FALSE) OVERRIDE
Modifies the state of the window.
BOOL ReleaseCapture() OVERRIDE
Releases the mouse capture from the window.
Interface for rendering target objects.