Example #1
0
C3Slider::C3Slider(
	AUI_ERRCODE *retval,
	uint32 id,
	sint32 x,
	sint32 y,
	sint32 width,
	sint32 height,
	BOOL isVertical,
	MBCHAR *pattern,
	ControlActionCallback *ActionFunc,
	void *cookie )
	:
	aui_ImageBase( (sint32)0 ),
	aui_TextBase( NULL ),
	aui_Ranger()
{
	*retval = aui_Region::InitCommon( id, x, y, width, height );
	Assert( AUI_SUCCESS(*retval) );
	if ( !AUI_SUCCESS(*retval) ) return;

	*retval = aui_Control::InitCommon( ActionFunc, cookie );
	Assert( AUI_SUCCESS(*retval) );
	if ( !AUI_SUCCESS(*retval) ) return;

	*retval = aui_Ranger::InitCommon(
		AUI_RANGER_TYPE_SLIDER,
		isVertical ?
			AUI_RANGER_ORIENTATION_VERTICAL :
			AUI_RANGER_ORIENTATION_HORIZONTAL );
	Assert( AUI_SUCCESS(*retval) );
	if ( !AUI_SUCCESS(*retval) ) return;

	*retval = aui_SoundBase::InitCommon((MBCHAR **)NULL );
	Assert( AUI_SUCCESS(*retval) );
	if ( !AUI_SUCCESS(*retval) ) return;

	*retval = PatternBase::InitCommon( pattern );
	Assert( AUI_SUCCESS(*retval) );
	if ( !AUI_SUCCESS(*retval) ) return;

	*retval = InitCommon();
	Assert( AUI_SUCCESS(*retval) );
	if ( !AUI_SUCCESS(*retval) ) return;

	*retval = CreateThumb( NULL );
	Assert( AUI_SUCCESS(*retval) );
}
Example #2
0
C3Slider::C3Slider(
	AUI_ERRCODE *retval,
	uint32 id,
	MBCHAR *ldlBlock,
	ControlActionCallback *ActionFunc,
	void *cookie )
	:
	aui_ImageBase( ldlBlock ),
	aui_TextBase( ldlBlock, (MBCHAR const *) NULL ),
	aui_Ranger()
{
	*retval = aui_Region::InitCommonLdl( id, ldlBlock );
	Assert( AUI_SUCCESS(*retval) );
	if ( !AUI_SUCCESS(*retval) ) return;

	*retval = aui_Control::InitCommonLdl( ldlBlock, ActionFunc, cookie );
	Assert( AUI_SUCCESS(*retval) );
	if ( !AUI_SUCCESS(*retval) ) return;

	*retval = aui_Ranger::InitCommonLdl( ldlBlock );
	Assert( AUI_SUCCESS(*retval) );
	if ( !AUI_SUCCESS(*retval) ) return;

	*retval = aui_SoundBase::InitCommonLdl( ldlBlock);
	Assert( AUI_SUCCESS(*retval) );
	if ( !AUI_SUCCESS(*retval) ) return;

	*retval = PatternBase::InitCommonLdl( ldlBlock, (MBCHAR *)NULL );
	Assert( AUI_SUCCESS(*retval) );
	if ( !AUI_SUCCESS(*retval) ) return;

	*retval = InitCommon( ldlBlock );
	Assert( AUI_SUCCESS(*retval) );
	if ( !AUI_SUCCESS(*retval) ) return;

	*retval = CreateThumb( ldlBlock );
	Assert( AUI_SUCCESS(*retval) );
}
Example #3
0
void CPlayerSeekBar::OnPaint()
{
    CPaintDC dc(this);

    COLORREF
    dark   = GetSysColor(COLOR_GRAYTEXT),
    white  = GetSysColor(COLOR_WINDOW),
    shadow = GetSysColor(COLOR_3DSHADOW),
    light  = GetSysColor(COLOR_3DHILIGHT),
    bkg    = GetSysColor(COLOR_BTNFACE);

    // Thumb
    {
        auto& pThumb = m_bEnabled ? m_pEnabledThumb : m_pDisabledThumb;
        if (!pThumb) {
            CreateThumb(m_bEnabled, dc);
            ASSERT(pThumb);
        }
        CRect r(GetThumbRect());
        CRect ri(GetInnerThumbRect(m_bEnabled, r));

        CRgn rg, rgi;
        VERIFY(rg.CreateRectRgnIndirect(&r));
        VERIFY(rgi.CreateRectRgnIndirect(&ri));

        ExtSelectClipRgn(dc, rgi, RGN_DIFF);
        VERIFY(dc.BitBlt(r.TopLeft().x, r.TopLeft().y, r.Width(), r.Height(), pThumb.get(), 0, 0, SRCCOPY));
        ExtSelectClipRgn(dc, rg, RGN_XOR);

        m_lastThumbRect = r;
    }

    const CRect channelRect(GetChannelRect());

    // Chapters
    if (m_bHasDuration) {
        CAutoLock lock(&m_csChapterBag);
        if (m_pChapterBag) {
            for (DWORD i = 0; i < m_pChapterBag->ChapGetCount(); i++) {
                REFERENCE_TIME rtChap;
                if (SUCCEEDED(m_pChapterBag->ChapGet(i, &rtChap, nullptr))) {
                    long chanPos = channelRect.left + ChannelPointFromPosition(rtChap);
                    CRect r(chanPos, channelRect.top, chanPos + 1, channelRect.bottom);
                    if (r.right < channelRect.right) {
                        r.right++;
                    }
                    ASSERT(r.right <= channelRect.right);
                    dc.FillSolidRect(&r, dark);
                    dc.ExcludeClipRect(&r);
                } else {
                    ASSERT(FALSE);
                }
            }
        }
    }

    // Channel
    {
        dc.FillSolidRect(&channelRect, m_bEnabled ? white : bkg);
        CRect r(channelRect);
        r.InflateRect(1, 1);
        dc.Draw3dRect(&r, shadow, light);
        dc.ExcludeClipRect(&r);
    }

    // Background
    {
        CRect r;
        GetClientRect(&r);
        dc.FillSolidRect(&r, bkg);
    }
}