Example #1
0
void CToolbarBottom::UpdateButton(ToolbarButtonType btnNeedUpdate, buttonStatusType btnStatus)
{
	CButtonUI* button = GetButton(btnNeedUpdate);
	if(NULL == button)
		return;

	switch(btnNeedUpdate)
	{
	case Toolbar_Button_Audio:
		{
			if(Button_UnMuted==btnStatus)
			{
				wchar_t* strText = L"Mute Audio";
				button->SetText(strText);
				int nWidth = max(button->GetFixedWidth(), button->GetMinWidth());
				button->SetFixedWidth(nWidth);
				int nImageRight = 0;
				UpdateButtonImage((void*)button, _T("toolbar_btn_mute.png"), nImageRight);
			}
			else if(Button_Muted == btnStatus)
			{
				wchar_t* strText = L"Unmute Audio";
				button->SetText(strText);
				int nWidth = max(button->GetFixedWidth(), button->GetMinWidth());
				button->SetFixedWidth(nWidth);
				int nImageRight = 0;
				UpdateButtonImage((void*)button, _T("toolbar_btn_unmute.png"), nImageRight);				
			}
			else if(Button_Enabled == btnStatus)
			{
				button->SetEnabled(true);
			}
			else if(Button_Disabled == btnStatus)
			{
				button->SetEnabled(false);
			}
		}
		break;
	case Toolbar_Button_Video:
		{
			if(Button_UnMuted == btnStatus)
			{
				wchar_t* strText = L"Hide Video";
				button->SetText(strText);
				int nWidth = max(button->GetFixedWidth(), button->GetMinWidth());
				button->SetFixedWidth(nWidth);
				int nImageRight = 0;
				UpdateButtonImage((void*)button, _T("toolbar_btn_stopVideo.png"), nImageRight);
			}
			else if(Button_Muted == btnStatus)
			{
				wchar_t* strText = L"Start Video";
				button->SetText(strText);
				int nWidth = max(button->GetFixedWidth(), button->GetMinWidth());
				button->SetFixedWidth(nWidth);
				int nImageRight = 0;
				UpdateButtonImage((void*)button, _T("toolbar_btn_startVideo.png"), nImageRight);				
			}
			else if(Button_Enabled == btnStatus)
			{
				button->SetEnabled(true);
			}
			else if(Button_Disabled == btnStatus)
			{
				button->SetEnabled(false);
			}
		}
		break;
	case Toolbar_Button_Invite:
		break;
	case Toolbar_Button_Chat:
		{
			if(Button_UnMuted == btnStatus)
			{
				wchar_t* strText = L"Show Chat";
				button->SetText(strText);
			}
			else if(Button_Muted == btnStatus)
			{
				wchar_t* strText = L"Hide Chat";
				button->SetText(strText);
			}
		}
		break;
	case Toolbar_Button_Participant:
		{
			if(Button_UnMuted == btnStatus)
			{
				wchar_t* strText = L"Show Participant";
				button->SetText(strText);
			}
			else if(Button_Muted == btnStatus)
			{
				wchar_t* strText = L"Hide Participant";
				button->SetText(strText);
			}
		}
		break;
	case Toolbar_Button_ThumbnailVideo:
		{
			if(Button_UnMuted == btnStatus)
			{
				wchar_t* strText = L"Show Gallery";
				button->SetText(strText);
			}
			else if(Button_Muted == btnStatus)
			{
				wchar_t* strText = L"Hide Gallery";
				button->SetText(strText);
			}
		}
		break;
	case Toolbar_Button_Share:
		{
			if(Button_UnMuted == btnStatus)
			{
				wchar_t* strText = L"Share";
				button->SetText(strText);
			}
			else if(Button_Muted == btnStatus)
			{
				wchar_t* strText = L"Stop Share";
				button->SetText(strText);
			}
		}
		break;
	case Toolbar_Button_Leave:
		break;
	default:
		break;
	}
}
Example #2
0
void CQuizWnd::InitWindow()
{
	assert(m_songInfo);
	CenterWindow();
	auto& quizInfo = m_songInfo->GetQuizInfo();

	// show title
	CTextUI* title = static_cast<CTextUI*>(m_PaintManager.FindControl(L"title"));
	if (!title) return;
	title->SetText(quizInfo.get_title().c_str());
	
	// show questoins button
	CHorizontalLayoutUI* questions_btn = static_cast<CHorizontalLayoutUI*>(m_PaintManager.FindControl(L"questions_btn"));
	if (!questions_btn) return;
	wchar_t ndx[3] = L"1";
	auto cnt = quizInfo.get_quiz_count();
	static const int FIXED_LENGTH = 64;
	SIZE sz = { 1,1 };
	for (auto i = 0; i < cnt; i++) {
		CButtonUI* btn = new CButtonUI();
		btn->SetName(((wstring)BTN_QUESTION_PREFIX + ndx).c_str());
		btn->SetFloat();
		btn->SetFixedXY(sz);
		btn->SetFixedHeight(FIXED_LENGTH);
		btn->SetFixedWidth(FIXED_LENGTH);
		btn->SetNormalImage(((wstring)NORMAL_PREFIX + ndx + POSTFIX_PNG).c_str());
		btn->SetFocusedImage(((wstring)NORMAL_PREFIX + ndx + POSTFIX_PNG).c_str());
		btn->SetHotImage(((wstring)HOT_PREFIX + ndx + POSTFIX_PNG).c_str());
		btn->SetPushedImage(((wstring)HOT_PREFIX + ndx + POSTFIX_PNG).c_str());
		questions_btn->Add(btn);
		ndx[0]++;
		sz.cx += FIXED_LENGTH + 1;
		if (ndx[0] == 58) {
			ndx[0] = L'1';
			ndx[1] = L'0';
		}
	}

	// show doen button
	if (cnt > 0) {
		CButtonUI* btn = new CButtonUI();
		btn->SetName(((wstring)BTN_QUESTION_PREFIX + DONE).c_str());
		btn->SetFloat();
		btn->SetFixedXY(sz);
		btn->SetFixedHeight(FIXED_LENGTH);
		btn->SetFixedWidth(FIXED_LENGTH);
		btn->SetNormalImage(((wstring)NORMAL_PREFIX + DONE + POSTFIX_PNG).c_str());
		btn->SetFocusedImage(((wstring)NORMAL_PREFIX + DONE + POSTFIX_PNG).c_str());
		btn->SetHotImage(((wstring)HOT_PREFIX + DONE + POSTFIX_PNG).c_str());
		btn->SetPushedImage(((wstring)HOT_PREFIX + DONE + POSTFIX_PNG).c_str());
		questions_btn->Add(btn);

	}

	// init question container
	CActiveXUI* question = static_cast<CActiveXUI*>(m_PaintManager.FindControl(_T("question")));
	if (!question) return;
	question->SetDelayCreate(false);              // 相当于界面设计器里的DelayCreate属性改为FALSE,在duilib自带的FlashDemo里可以看到此属性为TRUE             
	question->CreateControl(CLSID_WebBrowser);    // 相当于界面设计器里的Clsid属性里填入{8856F961-340A-11D0-A96B-00C04FD705A2},建议用CLSID_WebBrowser,如果想看相应的值,请见<ExDisp.h>
	question->GetControl(IID_IWebBrowser2, (void**)&m_question);
	assert(m_question);

	// show 1st question
	ShowQuiz(1);
}