예제 #1
1
LRESULT COption::ExtractProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
{
	static CFolderDialog FolderDlg;
	static SOption* pOption = &m_option_tmp;

	// Extraction Settings

	static constexpr std::array<LPCTSTR, 3> ExtractCheckText{{
		_T("Extract each folder"),
		_T("Fix the CRC of OGG files upon extraction"),
		_T("Enable simple decoding")
	}};

	static const std::array<BOOL*, 4> ExtractCheckFlag{{
		&pOption->bCreateFolder, &pOption->bFixOgg, &pOption->bEasyDecrypt, &pOption->bRenameScriptExt
	}};

	static std::array<CCheckBox, ExtractCheckText.size()> ExtractCheck;
	static CCheckBox ExtractCheckAlpha;
	static CLabel ExtractLabelPng, ExtractLabelAlpha, ExtractLabelBuf, ExtractLabelTmp;
	static CRadioBtn ExtractRadioImage, ExtractRadioSave;
	static CUpDown ExtractUpDownPng;
	static CEditBox ExtractEditPng, ExtractEditAlpha, ExtractEditSave, ExtractEditBuf, ExtractEditTmp;
	static CButton ExtractBtnSave, ExtractBtnTmp;
	static CGroupBox ExtractGroupImage, ExtractGroupSave;

	switch (msg)
	{
		case WM_INITDIALOG:
		{
			UINT ID = 10000;
			const int x = 10;
			const int xx = 15;
			int y = 0;

			// Extraction Settings

			for (size_t i = 0; i < ExtractCheckText.size(); i++)
			{
				ExtractCheck[i].Create(hWnd, ExtractCheckText[i], ID++, x, y += 20, 230, 20);
				ExtractCheck[i].SetCheck(*ExtractCheckFlag[i]);
			}

			//

			int y_image = y;
			ExtractGroupImage.Create(hWnd, _T("Output image format"), ID++, x, y_image += 34, 240, 110);
			ExtractRadioImage.Close();
			ExtractRadioImage.Create(hWnd, _T("BMP"), ID++, x + xx, y_image += 18, 50, 20);
			ExtractRadioImage.Create(hWnd, _T("PNG"), ID++, x + xx, y_image += 20, 50, 20);
			ExtractRadioImage.SetCheck(0, pOption->bDstBMP);
			ExtractRadioImage.SetCheck(1, pOption->bDstPNG);
			ExtractLabelPng.Create(hWnd, _T("Compression Level"), ID++, x + xx + 50, y_image + 3, 100, 20);
			ExtractEditPng.Create(hWnd, _T(""), ID++, x + xx + 150, y_image, 40, 22);
			ExtractEditPng.SetLimit(1);
			ExtractUpDownPng.Create(hWnd, ExtractEditPng.GetCtrlHandle(), pOption->CmplvPng, ID++, 9, 0);

			//

			ExtractCheckAlpha.Create(hWnd, _T("Enable alpha blending"), ID++, x + xx, y_image += 22, 140, 20);
			ExtractCheckAlpha.SetCheck(pOption->bAlphaBlend);
			ExtractLabelAlpha.Create(hWnd, _T("Background color"), ID++, x + xx * 2 + 4, y_image += 24, 100, 20);
			ExtractEditAlpha.Create(hWnd, pOption->szBgRGB, ID++, x + xx * 2 + 100, y_image - 4, 100, 22);
			ExtractEditAlpha.SetLimit(6);
			ExtractEditAlpha.Enable(pOption->bAlphaBlend);

			//

			const int x_save = x + 200;
			int y_save = y;

			ExtractGroupSave.Create(hWnd, _T("Destination"), ID++, x_save + 50, y_save += 34, 290, 110);
			ExtractRadioSave.Close();
			ExtractRadioSave.Create(hWnd, _T("Specify each time"), ID++, x_save + xx + 50, y_save += 18, 220, 20);
			ExtractRadioSave.Create(hWnd, _T("Same folder as input source"), ID++, x_save + xx + 50, y_save += 20, 200, 20);
			ExtractRadioSave.Create(hWnd, _T("The following folder"), ID++, x_save + xx + 50, y_save += 20, 200, 20);
			ExtractRadioSave.SetCheck(0, pOption->bSaveSel);
			ExtractRadioSave.SetCheck(1, pOption->bSaveSrc);
			ExtractRadioSave.SetCheck(2, pOption->bSaveDir);
			ExtractEditSave.Create(hWnd, pOption->SaveDir, ID++, x_save + xx * 2 + 40, y_save += 20, 200, 22);
			ExtractEditSave.Enable(pOption->bSaveDir);
			ExtractBtnSave.Create(hWnd, _T("Browse"), ID++, x_save + xx * 2 + 250, y_save + 1, 50, 20);
			ExtractBtnSave.Enable(pOption->bSaveDir);

			//

			y = (y_image > y_save) ? y_image : y_save;
			ExtractLabelBuf.Create(hWnd, _T("Buffer Size(KB)"), ID++, x, y += 44, 100, 20);
			ExtractEditBuf.Create(hWnd, pOption->BufSize, ID++, x + 100, y - 4, 110, 22);

			//

			ExtractLabelTmp.Create(hWnd, _T("Temporary Folder"), ID++, x, y += 24, 100, 20);
			ExtractEditTmp.Create(hWnd, pOption->TmpDir, ID++, x + 100, y - 4, 200, 22);
			ExtractBtnTmp.Create(hWnd, _T("Browse"), ID++, x + 310, y - 3, 50, 20);

			break;
		}

		case WM_COMMAND:
			// Checkbox
			if (LOWORD(wp) >= ExtractCheck.front().GetID() && LOWORD(wp) <= ExtractCheck.back().GetID())
			{
				PropSheet_Changed(::GetParent(hWnd), hWnd);
				break;
			}

			// Alpha blend check box
			if (LOWORD(wp) == ExtractCheckAlpha.GetID())
			{
				ExtractEditAlpha.Enable(ExtractCheckAlpha.GetCheck());
				PropSheet_Changed(::GetParent(hWnd), hWnd);
				break;
			}

			//Output image format radio button
			if (LOWORD(wp) >= ExtractRadioImage.GetID(0) && LOWORD(wp) <= ExtractRadioImage.GetID(1))
			{
				PropSheet_Changed(::GetParent(hWnd), hWnd);
				break;
			}

			// Destination radio button
			if (LOWORD(wp) >= ExtractRadioSave.GetID(0) && LOWORD(wp) <= ExtractRadioSave.GetID(2))
			{
				ExtractEditSave.Enable(ExtractRadioSave.GetCheck(2));
				ExtractBtnSave.Enable(ExtractRadioSave.GetCheck(2));
				PropSheet_Changed(::GetParent(hWnd), hWnd);
				break;
			}

			// Output folder browse
			if (LOWORD(wp) == ExtractBtnSave.GetID())
			{
				TCHAR szSaveDir[_MAX_DIR];
				ExtractEditSave.GetText(szSaveDir, sizeof(szSaveDir));
				if (FolderDlg.DoModal(hWnd, _T("Select the output folder"), szSaveDir))
					ExtractEditSave.SetText(szSaveDir);
				break;
			}

			// Temporary folder browse
			if (LOWORD(wp) == ExtractBtnTmp.GetID())
			{
				TCHAR szTmpDir[_MAX_DIR];
				ExtractEditTmp.GetText(szTmpDir, sizeof(szTmpDir));
				if (FolderDlg.DoModal(hWnd, _T("Select a temporary folder"), szTmpDir))
					ExtractEditTmp.SetText(szTmpDir);
				break;
			}

			// Contents of the edit box have been changed
			if (HIWORD(wp) == EN_CHANGE)
			{
				PropSheet_Changed(::GetParent(hWnd), hWnd);
				break;
			}
			break;

		case WM_NOTIFY:
		{
			const auto* const hdr = reinterpret_cast<LPNMHDR>(lp);
			switch (hdr->code)
			{
				// OK/Apply, Tabbing
				case PSN_APPLY:
				case PSN_KILLACTIVE:
					// Extraction Settings
					for (size_t i = 0; i < ExtractCheck.size(); i++)
						*ExtractCheckFlag[i] = ExtractCheck[i].GetCheck();
					//
					pOption->bDstBMP = ExtractRadioImage.GetCheck(0);
					pOption->bDstPNG = ExtractRadioImage.GetCheck(1);
					ExtractEditPng.GetText(&pOption->CmplvPng, FALSE);
					//
					pOption->bAlphaBlend = ExtractCheckAlpha.GetCheck();
					ExtractEditAlpha.GetText(&pOption->BgRGB, TRUE);
					_stprintf(pOption->szBgRGB, _T("%06x"), pOption->BgRGB);
					//
					pOption->bSaveSel = ExtractRadioSave.GetCheck(0);
					pOption->bSaveSrc = ExtractRadioSave.GetCheck(1);
					pOption->bSaveDir = ExtractRadioSave.GetCheck(2);
					ExtractEditSave.GetText(pOption->SaveDir);
					//
					ExtractEditBuf.GetText(&pOption->BufSize, FALSE);
					//
					ExtractEditTmp.GetText(pOption->TmpDir);
					// OK/Apply
					if (hdr->code == PSN_APPLY)
						Apply();
					return TRUE;
			}
			break;
		}
	}

	return FALSE;
}
예제 #2
0
파일: Frame.cpp 프로젝트: Floppy/alienation
void CFrame::renderFrameControls()
{
	int iCount;

	for (iCount = 0 ; iCount < m_arrControls.size() ; iCount++)
	{
		switch(m_arrControls[iCount]->getType())
		{
		case 2:
			CButton * poButton;
			poButton = (CButton *)m_arrControls[iCount]->getControl();
			poButton->render();
			break;
		case 3:
			CCheckBox * poCheckBox;
			poCheckBox = (CCheckBox *)m_arrControls[iCount]->getControl();
			poCheckBox->render();
			break;
		case 4:
			CRadioContainer * poRadioContainer;
			poRadioContainer = (CRadioContainer *)m_arrControls[iCount]->getControl();
			poRadioContainer->render();
			break;
		}
	}
}
예제 #3
0
		void configToUI() {
			for ( unsigned i = 0; i < PFC_TABSIZE( flagsAndButtons ); ++ i ) {
				auto rec = flagsAndButtons[i];
				// CCheckBox: WTL-PP class overlaying ToggleCheck(bool) and bool IsChecked() over WTL CButton
				CCheckBox cb ( GetDlgItem( rec.btnID ) );
				cb.ToggleCheck( (m_flags & rec.flag ) != 0 );
			}
		}
예제 #4
0
bool CCheckBoxBasicTest::init()
{
	CCheckBoxTestSceneBase::init();
	setTitle("CCheckBoxBasicTest");
	setDescription("checkbox face, click it");

	CCheckBox* pCheckBox = CCheckBox::create();
	pCheckBox->setNormalImage("ckb_normal_01.png");
	pCheckBox->setNormalPressImage("ckb_normal_02.png");
	pCheckBox->setCheckedImage("ckb_selected_01.png");
	pCheckBox->setCheckedPressImage("ckb_selected_02.png");
	pCheckBox->setDisabledNormalImage("ckb_disable_01.png");
	pCheckBox->setDisabledCheckedImage("ckb_disable_02.png");
	pCheckBox->setOnClickListener(this, ccw_click_selector(CCheckBoxBasicTest::onClick));
	pCheckBox->setPosition(CCPoint(480, 320));
	m_pWindow->addChild(pCheckBox);

	CCheckBox* pCheckBox2 = CCheckBox::create();
	pCheckBox2->setNormalImage("ckb_normal_01.png");
	pCheckBox2->setCheckedImage("ckb_selected_01.png");
	pCheckBox2->setOnClickListener(this, ccw_click_selector(CCheckBoxBasicTest::onClick));
	pCheckBox2->setPosition(CCPoint(560, 320));
	m_pWindow->addChild(pCheckBox2);

	m_pText = CLabel::create();
	m_pText->setAnchorPoint(CCPoint(0, 0.5));
	m_pText->setPosition(CCPoint(380, 400));
	m_pText->setFontSize(35.0f);
	m_pText->setString("none");
	m_pWindow->addChild(m_pText);

	return true;
}
예제 #5
0
CCheckBox* CCheckBox::create()
{
	CCheckBox* pRet = new CCheckBox();
	if( pRet && pRet->init() )
	{
		pRet->autorelease();
		return pRet;
	}
	CC_SAFE_DELETE(pRet);
	return NULL;
}
예제 #6
0
void CCheckBoxBasicTest::onClick(CCObject* pSender)
{
	CCheckBox* pCheckBox = (CCheckBox*) pSender;
	if( pCheckBox->isChecked() )
	{
		m_pText->setString("checked");
	}
	else
	{
		m_pText->setString("unchecked");
	}
}
예제 #7
0
void ViewScene::checkBoxClick(CCObject* pSender){
	CCheckBox* pCheckBox = (CCheckBox*) pSender;
	int userTag = pCheckBox->getUserTag();
	if (pCheckBox->isChecked())
	{
		dltList.push_back(userTag);
	}else{
		std::vector<int>::iterator pos = std::find(dltList.begin(),dltList.end(),userTag);
		if (pos != dltList.end())
		{
			dltList.erase(pos);
		}
	}
}
예제 #8
0
int CSmeltArmor::updateInfoToUIAndReturnCount( CLayout* pLayout[], int iNameId[], int iValue[], const char* sRange[], int iMax, const char* sTitle )
{
	int iMaxLineCount = 0;

	for(unsigned int i=0; i<iMax; i++)
	{
		//有值
		if(iValue[i] > 0)
		{
			pLayout[iMaxLineCount]->setVisible(true);
			//设置名称
			CLabel* pInfoType = (CLabel*)pLayout[iMaxLineCount]->findWidgetById("info_type");
			pInfoType->setString(GETLANGSTR(iNameId[i]));
			//设置值大小
			CLabel* pValue = (CLabel*)pLayout[iMaxLineCount]->findWidgetById("value");
			if(atoi(pValue->getString())!=iValue[i])
			{
				pValue->setString(ToString(iValue[i]));
				pValue->runAction(CCRollLabelAction::create(0.3f, 0, iValue[i], pValue));
			}
			//目标值大小
			CLabel* pAimValue = (CLabel*)pLayout[iMaxLineCount]->findWidgetById("aim_value");
			pAimValue->setString(sRange[i]);
			//存ID
			CCheckBox* pCheck = (CCheckBox*)pLayout[iMaxLineCount]->findWidgetById("check");
			pCheck->setTag(i+1);

			iMaxLineCount++;
		}

		//找到四个了,退出循环
		if(iMaxLineCount>=4)
		{
			break;
		}
	}
	//隐藏掉没有数据填充的cell
	hideNoneValueCell(iMaxLineCount, pLayout);

	//如果一个都没有,隐藏标题
	if(sTitle != nullptr)
	{
		CCNode* pNode = (CCNode*)m_ui->findWidgetById(sTitle);
		if(pNode)
		{
			pNode->setVisible(iMaxLineCount != 0);
		}
	}
	return iMaxLineCount;
}
예제 #9
0
void CSignLayer::onEnter()
{
	BaseLayer::onEnter();

	//签到grid的cell
	m_cell = (CLayout*)(m_ui->findWidgetById("Cell"));
	m_cell->retain();
    m_ui->removeChild(m_cell);

	m_gridView = (CGridView*)m_ui->findWidgetById("scroll");
	m_gridView->setDirection(eScrollViewDirectionVertical);	
	m_gridView->setCountOfCell(0);
	m_gridView->setSizeOfCell(m_cell->getContentSize());
	m_gridView->setAnchorPoint(ccp(0,0));
	m_gridView->setColumns(5);
	m_gridView->setAutoRelocate(false);
	m_gridView->setDeaccelerateable(true);
	m_gridView->setDataSourceAdapter(this,ccw_datasource_adapter_selector(CSignLayer::gridviewDataSource));
	m_gridView->reloadData();


	m_signLay = (CLayout*)(m_ui->findWidgetById("Sign"));


	//退出
	CButton* pClose = CButton::create("common/back.png", "common/back.png");
	pClose->getSelectedImage()->setScale(1.1f);
	pClose->setPosition(VLEFT+50, VTOP-50);
	pClose->setOnClickListener(this,ccw_click_selector(CSignLayer::onClose));
	this->addChild(pClose, 999);

	//book
	CCheckBox* pBook = (CCheckBox*)(m_ui->findWidgetById("book"));
	pBook->setOnCheckListener(this,ccw_check_selector(CSignLayer::showHeroBook));

	//按钮补签
	CButton* pResign = (CButton*)m_ui->findWidgetById("buqian_btn");
	pResign->setOnClickListener(this, ccw_click_selector(CSignLayer::onBtnResignDay));

	//按钮签到
	CButton* pSign = (CButton*)m_ui->findWidgetById("qiandao_btn");
	pSign->setOnClickListener(this, ccw_click_selector(CSignLayer::onBtnSignDay));

	GetTcpNet->registerMsgHandler(SignDataMsg,this, CMsgHandler_selector(CSignLayer::ProcessMsg));
	GetTcpNet->registerMsgHandler(SignReqMsg,this, CMsgHandler_selector(CSignLayer::ProcessMsg));
}
예제 #10
0
void CSmeltArmor::onRefineItem(CCObject* pSender)
{
	//检查货币是否足够
	CLabel *money = (CLabel *)(m_ui->findWidgetById("money"));
	int iCost = atoi(money->getString());
	if(m_iStrengthType==0)
	{
		if(!CheckCoin(iCost))
		{
			//ShowPopTextTip(GETLANGSTR(205));
			CShowToBuyResource* pShow = CShowToBuyResource::create();
			pShow->showToBuyResourceByType(ShowBuyResourceCoin);
			return;
		}
	}
	else
	{
		if(!CheckGold(iCost))
		{
			//ShowPopTextTip(GETLANGSTR(203));
			CShowToBuyResource* pShow = CShowToBuyResource::create();
			pShow->showToBuyResourceByType(ShowBuyResourceGold);
			return;
		}
	}

	vector<int> checkVec;
	if(m_iStrengthType != 0)
	{
		for (unsigned int i=0; i<4; ++i)
		{
			CCheckBox* pCheckBtn = (CCheckBox*)(m_pBaseInfo[i]->findWidgetById("check"));
			if (pCheckBtn->isChecked())
			{
				checkVec.push_back(pCheckBtn->getTag());
			}
		}
	}

	if (m_armor.id>0)
	{
	   CPlayerControl::getInstance().sendSmeltArmor(m_armor.id, checkVec);
	}
}
예제 #11
0
void CSmeltArmor::initSpandAndCheckBox()
{
	CCSprite *coin = (CCSprite *)(m_ui->findWidgetById("coin"));
	coin->setVisible(true);

	//m_coin = m_armor.useLevel *360;
	m_diamond = 0;

	m_coin = 0; 
	switch (m_armor.quality)
	{
	case 1:
		m_coin =10000;
		break;
	case 2:
		m_coin =20000;
		break;
	case 3:
		m_coin =40000;
		break;
	case 4:
		m_coin =80000;
		break;
	case 5:
		m_coin =160000;
		break;
	default:
		break;
	}

	CCSprite *diamond = (CCSprite *)(m_ui->findWidgetById("diamond"));
	diamond->setVisible(false);

	CLabel *money = (CLabel *)(m_ui->findWidgetById("money"));
	money->setString(ToString(m_coin));

	for (unsigned int i=0; i< 4; ++i)
	{
		CCheckBox* checkBtn = (CCheckBox*)(m_pBaseInfo[i]->findWidgetById("check"));
		checkBtn->setChecked(false);
	}
}
예제 #12
0
		void OnButtonClicked(UINT uNotifyCode, int nID, CWindow wndCtl) {

			uint32_t flagToFlip = 0;
			for ( unsigned i = 0; i < PFC_TABSIZE( flagsAndButtons ); ++ i ) {
				auto rec = flagsAndButtons[i];
				if ( rec.btnID == nID ) {
					flagToFlip = rec.flag;
				}
			}
			if ( flagToFlip != 0 ) {
				uint32_t newFlags = m_flags;
				CCheckBox cb ( wndCtl );
				if (cb.IsChecked()) {
					newFlags |= flagToFlip;
				} else {
					newFlags &= ~flagToFlip;
				}
				if ( newFlags != m_flags ) {
					m_flags = newFlags;
					m_callback->on_min_max_info_change();
				}
			}
		}
예제 #13
0
void CSmeltArmor::onEnter()
{
	BaseLayer::onEnter();

	//四个选择框
	for (unsigned int i=0; i<4; ++i)
	{
		CCheckBox *checkBtn = (CCheckBox*)(m_pBaseInfo[i]->findWidgetById("check"));
		checkBtn->setOnCheckListener(this,ccw_check_selector(CSmeltArmor::onCheckAttr));
	}

	//选择武器
	CButton *select = (CButton*)(m_ui->findWidgetById("select"));
	select->setOnClickListener(this, ccw_click_selector(CSmeltArmor::onSelectItem));

	//洗练
	CButton *refine = (CButton*)(m_ui->findWidgetById("refine"));
	refine->setOnClickListener(this, ccw_click_selector(CSmeltArmor::onRefineItem));
	
	//初始化火
	initFire();

	//旋转圈
	CImageView *circleFire = (CImageView*)(m_ui->findWidgetById("fire_circle"));
	circleFire->setScale(1.95f);
	circleFire->runAction(CCRepeatForever::create(CCRotateBy::create(1.0f, 60)));
	circleFire->runAction(CCRepeatForever::create(CCSequence::createWithTwoActions(CCScaleTo::create(1.2f, 2.1f), CCScaleTo::create(1.2f, 1.95f))));


	GetTcpNet->registerMsgHandler(SmeltArmorMsg,this,CMsgHandler_selector(CSmeltArmor::proceesMessage));
	GetTcpNet->registerMsgHandler(SmeltDataRequestMsg,this,CMsgHandler_selector(CSmeltArmor::proceesMessage));

	CSceneManager::sharedSceneManager()->addMsgObserver(UPDATE_HERO, this, GameMsghandler_selector(CSmeltArmor::roleUpdate));
	
	CSceneManager::sharedSceneManager()->addMsgObserver(UPDATE_ITEM_DATA, this, GameMsghandler_selector(CSmeltArmor::updateStar));
}
예제 #14
0
LRESULT COption::SusieProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
{
	static CFolderDialog FolderDlg;
	static SOption* pOption = &m_option_tmp;

	static CCheckBox SusieCheckUse, SusieCheckFirst;
	static CLabel SusieLabelDir;
	static CEditBox SusieEditDir;
  static CButton SusieBtnDir, SusieBtnUpdate;
  static std::array<CButton, 2> SusieBtn;
	static CSusieListView SusieListView;
	static CSusie susie;

	switch (msg)
	{
		case WM_INITDIALOG:
		{
			UINT ID = 10000;
			const int x = 10;
			const int xx = 15;
			int y = 0;

			SusieCheckUse.Create(hWnd, _T("Use Susie Plugins"), ID++, x + 15, y += 20, 200, 20);
			SusieCheckUse.SetCheck(pOption->bSusieUse);

			SusieLabelDir.Create(hWnd, _T("Susie Folder"), ID++, x + xx, y += 24, 75, 20);
			SusieEditDir.Create(hWnd, pOption->SusieDir, ID++, x + xx + 75, y - 4, 200, 22);
			SusieEditDir.Enable(pOption->bSusieUse);
			SusieBtnDir.Create(hWnd, _T("Browse"), ID++, x + xx + 280, y - 3, 50, 20);
			SusieBtnDir.Enable(pOption->bSusieUse);

			SusieCheckFirst.Create(hWnd, _T("Give Susie plugins priority when decoding"), ID++, x + xx, y += 20, 250, 20);
			SusieCheckFirst.SetCheck(pOption->bSusieFirst);
			SusieCheckFirst.Enable(pOption->bSusieUse);

			SusieListView.Create(hWnd, *pOption, x + xx, y += 30, 500, 190);
			SusieListView.Close();
			SusieListView.Enable(pOption->bSusieUse);
			SusieListView.Show();

			SusieBtnUpdate.Create(hWnd, _T("Update"), ID++, x + 290, y += 200, 50, 20);
			SusieBtnUpdate.Enable(pOption->bSusieUse);
			SusieBtn[0].Create(hWnd, _T("All ON"), ID++, x + 350, y, 80, 20);
			SusieBtn[0].Enable(pOption->bSusieUse);
			SusieBtn[1].Create(hWnd, _T("All OFF"), ID++, x + 430, y, 80, 20);
			SusieBtn[1].Enable(pOption->bSusieUse);

			break;
		}

		case WM_COMMAND:
			// Use Susie plugins
			if (LOWORD(wp) == SusieCheckUse.GetID())
			{
				const BOOL flag = SusieCheckUse.GetCheck();
				SusieEditDir.Enable(flag);
				SusieBtnDir.Enable(flag);
				SusieCheckFirst.Enable(flag);
				SusieListView.Enable(flag);
				SusieBtnUpdate.Enable(flag);
				SusieBtn[0].Enable(flag);
				SusieBtn[1].Enable(flag);
				PropSheet_Changed(::GetParent(hWnd), hWnd);
				// Click here to show / hide the list of checkboxes, de-selected state
				pOption->bSusieUse = flag;
				SusieListView.SetItemSelAll(0);
				break;
			}

			// Susie Folder Browse
			if (LOWORD(wp) == SusieBtnDir.GetID())
			{
				TCHAR szSusieDir[_MAX_DIR];
				SusieEditDir.GetText(szSusieDir, sizeof(szSusieDir));
				if (FolderDlg.DoModal(hWnd, _T("Select the Susie folder"), szSusieDir))
					SusieEditDir.SetText(szSusieDir);
			}

			// Give Susie plugins priority on decoding
			if (LOWORD(wp) == SusieCheckFirst.GetID())
			{
				PropSheet_Changed(::GetParent(hWnd), hWnd);
				break;
			}

			// Update
			if (LOWORD(wp) == SusieBtnUpdate.GetID())
			{
				susie.LoadSpi(pOption->SusieDir);
				susie.Init();
				SusieListView.Show();
				SusieListView.Update();
				break;
			}

			// All ON
			if (LOWORD(wp) == SusieBtn[0].GetID())
			{
				SusieListView.SetCheckAll(true);
				PropSheet_Changed(::GetParent(hWnd), hWnd);
				break;
			}

			// All OFF
			if (LOWORD(wp) == SusieBtn[1].GetID())
			{
				SusieListView.SetCheckAll(false);
				PropSheet_Changed(::GetParent(hWnd), hWnd);
				break;
			}

			// Settings
			if (LOWORD(wp) == IDM_SUSIE_SET)
			{
				const SSusieInfo* const susie_info = SusieListView.GetFocusSusieInfo();

				// Get ConfigurationDlg()
				const auto ConfigurationDlg = reinterpret_cast<ConfigurationDlgProc>(susie_info->plugin.GetProcAddress(_T("ConfigurationDlg")));

				if (ConfigurationDlg == nullptr)
					break;

				// Call settings
				ConfigurationDlg(hWnd, 1);

				break;
			}

			// Contents of the editbox have changed
			if (HIWORD(wp) == EN_CHANGE)
			{
				PropSheet_Changed(::GetParent(hWnd), hWnd);
				break;
			}
			break;

		case WM_NOTIFY:
		{
			const auto* const hdr = reinterpret_cast<LPNMHDR>(lp);

			switch (hdr->code)
			{
				// OK/Apply, Tabbing
				case PSN_APPLY:
				case PSN_KILLACTIVE:
					pOption->bSusieUse = SusieCheckUse.GetCheck();
					pOption->bSusieFirst = SusieCheckFirst.GetCheck();
					SusieEditDir.GetText(pOption->SusieDir);
					SusieListView.SaveIni();
					// OK/Apply
					if (hdr->code == PSN_APPLY)
					{
						const bool update = m_option.SusieDir == pOption->SusieDir;
						Apply();
						// Re-acquire plugin folder only when Susie has been changed
						if (pOption->bSusieUse && update)
						{
							susie.LoadSpi(pOption->SusieDir);
							susie.Init();
							SusieListView.Show();
							SusieListView.Update();
						}
					}
					return TRUE;
				// Check processing
				case NM_CLICK:
				case NM_DBLCLK:
					if (hdr->idFrom == idsSusieList)
					{
						if (SusieListView.SetCheck())
							PropSheet_Changed(::GetParent(hWnd), hWnd);
						break;
					}
			}

			// List view
			if (wp == idsSusieList)
			{
				const auto* const plv = reinterpret_cast<LPNMLISTVIEW>(lp);
				switch (plv->hdr.code)
				{
					// Custom draw
					case NM_CUSTOMDRAW:
						return SusieListView.CustomDraw(reinterpret_cast<LPNMLVCUSTOMDRAW>(lp));
					// Show tool tip
					case LVN_GETINFOTIP:
						SusieListView.ShowTip(reinterpret_cast<LPNMLVGETINFOTIP>(lp));
						break;
					// View
					case LVN_GETDISPINFO:
						SusieListView.Show(reinterpret_cast<NMLVDISPINFO*>(lp));
						break;
				}
			}

			break;
		}

		case WM_MOUSEWHEEL:
		{
			POINT pos;
			GetCursorPos(&pos);
			HWND pWnd = WindowFromPoint(pos);
			if (pWnd == SusieListView.GetHandle())
				SendMessage(pWnd, WM_MOUSEWHEEL, wp, lp);
			break;
		}

		// Right-click menu (Context menu)
		case WM_CONTEXTMENU:
		{
			if (wp == reinterpret_cast<WPARAM>(SusieListView.GetHandle()))
				SusieListView.CreateMenu(lp);
			break;
		}
	}

	return FALSE;
}
예제 #15
0
void CCheckBoxExclusionTest::onClick(CCObject* pSender)
{
	CCheckBox* pCheckBox = (CCheckBox*)m_pWindow->getChildByTag(1);
	pCheckBox->setChecked(true);
}
예제 #16
0
LRESULT COption::StdProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
{
	static SOption* pOption = &m_option_tmp;

	// Listview settings
	static CGroupBox ListGroup;
	static CLabel ListLabelBk, ListLabelText;
	static CEditBox ListEditBk, ListEditText;
	// Search settings
	static std::array<CCheckBox, search_files_labels.size()> SearchCheck;
	static const size_t SearchCheckNum = search_files_labels.size();
	static std::array<CButton, 2> SearchBtn;
	static CGroupBox SearchGroup;
	// Search accuracy
	static CGroupBox HighSearchGroup;
	static CCheckBox HighSearchCheckOgg;

	switch (msg)
	{
		case WM_INITDIALOG:
		{
			CWindowBase::Init(::GetParent(hWnd));

			UINT ID = 10000;
			const int x = 10;
			const int xx = 15;
			int y = 0;

			// Listview settings
			ListGroup.Create(hWnd, _T("List Settings"), ID++, x, y += 20, 510, 75);
			ListLabelBk.Create(hWnd, _T("Background Color"), ID++, x + xx, y += 24, 100, 20);
			ListEditBk.Create(hWnd, pOption->szListBkColor, ID++, x + xx + 100, y - 4, 70, 22);
			ListEditBk.SetLimit(6);
			ListLabelText.Create(hWnd, _T("Text Color"), ID++, x + xx, y += 24, 100, 20);
			ListEditText.Create(hWnd, pOption->szListTextColor, ID++, x + xx + 100, y - 4, 70, 22);
			ListEditText.SetLimit(6);

			// Search Settings
			SearchGroup.Create(hWnd, _T("Files to be searched"), ID++, x, y += 40, 510, 100);
			//y += 20;
			for (size_t i = 0, xxx = 0; i < SearchCheckNum; i++, xxx += 55)
			{
				if ((i % 8) == 0)
				{
					 xxx = 0, y += 20;
				}

				SearchCheck[i].Create(hWnd, search_files_labels[i], ID++, x + xx + static_cast<int>(xxx), y, 50, 20);
				SearchCheck[i].SetCheck(pOption->bSearch[i]);
			}

			SearchBtn[0].Create(hWnd, _T("Select all"), ID++, 350, y += 30, 80, 20);
			SearchBtn[1].Create(hWnd, _T("Deselect all"),   ID++, 430, y, 80, 20);

			// Search Accuracy Settings
			HighSearchGroup.Create(hWnd, _T("Search Accuracy"), ID++, x, y += 40, 510, 50);
			HighSearchCheckOgg.Create(hWnd, _T("Increase the accuracy of OGG searches"), ID++, x + xx, y += 20, 220, 20);
			HighSearchCheckOgg.SetCheck(pOption->bHighSearchOgg);

			break;
		}

		case WM_COMMAND:
			// Check the file search box
			if (LOWORD(wp) >= SearchCheck[0].GetID() && LOWORD(wp) <= SearchCheck[SearchCheckNum-1].GetID())
			{
				const int number = LOWORD(wp) - SearchCheck[0].GetID();
				pOption->bSearch[number] ^= 1;
				SearchCheck[number].SetCheck(pOption->bSearch[number]);
				PropSheet_Changed(::GetParent(hWnd), hWnd);
				break;
			}

			// Select all
			if (LOWORD(wp) == SearchBtn[0].GetID())
			{
				for (size_t i = 0; i < SearchCheckNum; i++)
				{
					pOption->bSearch[i] = TRUE;
					SearchCheck[i].SetCheck(pOption->bSearch[i]);
				}
				PropSheet_Changed(::GetParent(hWnd), hWnd);
				break;
			}

			// Deselect
			if (LOWORD(wp) == SearchBtn[1].GetID())
			{
				for (size_t i = 0; i < SearchCheckNum; i++)
				{
					pOption->bSearch[i] = FALSE;
					SearchCheck[i].SetCheck(pOption->bSearch[i]);
				}
				PropSheet_Changed(::GetParent(hWnd), hWnd);
				break;
			}

			if (LOWORD(wp) == HighSearchCheckOgg.GetID())
			{
				PropSheet_Changed(::GetParent(hWnd), hWnd);
				break;
			}

			// The contents of the editbox have been changed
			if (HIWORD(wp) == EN_CHANGE)
			{
				PropSheet_Changed(::GetParent(hWnd), hWnd);
				break;
			}
			break;

		case WM_NOTIFY:
		{
			const auto* const hdr = reinterpret_cast<LPNMHDR>(lp);
			switch (hdr->code)
			{
				// Apply/OK, Tabbing
				case PSN_APPLY:
				case PSN_KILLACTIVE:
					ListEditBk.GetText(&pOption->ListBkColor, TRUE);
					_stprintf(pOption->szListBkColor, _T("%06x"), pOption->ListBkColor);
					ListEditText.GetText(&pOption->ListTextColor, TRUE);
					_stprintf(pOption->szListTextColor, _T("%06x"), pOption->ListTextColor);

					pOption->bHighSearchOgg = HighSearchCheckOgg.GetCheck();
					// OK/Apply
					if (hdr->code == PSN_APPLY)
						Apply();
					return TRUE;
			}
			break;
		}
	}

	return FALSE;
}
예제 #17
0
파일: TuiManager.cpp 프로젝트: Kudoo/Tui-x
CCheckBox* TuiManager::createCheckBox(float tag,const char* normal1,const char* normal2,const char* select1,
	const char* select2,const char* disable1,const char* disable2,float x,float y,float rotation){
	CCheckBox* pCheckBox = NULL;
	if(m_isUseSpriteFrame){
		pCheckBox = CCheckBox::create();
		pCheckBox->setNormalSpriteFrameName(normal1);
		pCheckBox->setNormalPressSpriteFrameName(normal2);
		pCheckBox->setCheckedSpriteFrameName(select1);
		pCheckBox->setCheckedPressSpriteFrameName(select2);
		pCheckBox->setDisabledNormalSpriteFrameName(disable1);
		pCheckBox->setDisabledCheckedSpriteFrameName(disable2);
	}else{
		pCheckBox = CCheckBox::create(); 
		pCheckBox->setNormalImage(normal1); 
		pCheckBox->setNormalPressImage(normal2); 
		pCheckBox->setCheckedImage(select1); 
		pCheckBox->setCheckedPressImage(select2); 
		pCheckBox->setDisabledNormalImage(disable1); 
		pCheckBox->setDisabledCheckedImage(disable2); 
	}
	pCheckBox->setRotation(rotation);
	pCheckBox->setPosition(Point(x,-y));
	pCheckBox->setTag(tag);
	return pCheckBox;
}
예제 #18
0
CCObject* ViewScene::gridViewDataSource(CCObject* pContentView, unsigned int idx){
	CGridViewCell* pCell = (CGridViewCell*) pContentView;
	CButton* pButton = NULL;
	CCheckBox* pCheckbox = NULL;
	Notes = SQLiteData::getNote(unit_id,zi_id);
	vector<string> oneNote = Notes.at(idx);			//oneNote 中第一个元素为ID,第二个元素为笔画序列

	if (!pCell)
	{
		pCell = new CGridViewCell();
		pCell->autorelease();

		pButton = CButton::create("strangedesign/Dlg_cancel_button.png","strangedesign/Dlg_cancel_button_down.png");
		pButton->setPosition(CCPoint(360/2, 350-pButton->getContentSize().height/2));

		pCheckbox = CCheckBox::create();
		pCheckbox->setNormalImage("ckb_normal_01.png");
		pCheckbox->setNormalPressImage("ckb_normal_02.png");
		pCheckbox->setCheckedImage("ckb_selected_01.png");
		pCheckbox->setCheckedPressImage("ckb_selected_02.png");
		pCheckbox->setDisabledNormalImage("ckb_disable_01.png");
		pCheckbox->setDisabledCheckedImage("ckb_disable_02.png");
		pCheckbox->setPosition(CCPoint(360-pCheckbox->getContentSize().width, 350-pButton->getContentSize().height/2));

		pCell->addChild(pCheckbox,10);
		//pCell->addChild(pButton,10);

		HcharacterDrawnode* handwritingHz = HcharacterDrawnode::create();
		
		vector< vector<CCPoint> > strokesvec = DataTool::spliteString(oneNote.at(1));
		for (unsigned int i = 0; i < strokesvec.size(); i++)
		{
			vector<CCPoint> oneStrokeVec = strokesvec[i];
			Stroke stroke(oneStrokeVec);
			handwritingHz->addStroke(stroke);
		}
		
		handwritingHz->setContentSize(CCSize(320,320));
		CCPoint position = ccp(360/2- handwritingHz->getContentSize().width/2, 350/2- handwritingHz->getContentSize().height/2);
		handwritingHz->setPosition(position);
		pCell->addChild(handwritingHz,1);



	}else
	{
		pButton = CButton::create("strangedesign/Dlg_cancel_button.png","strangedesign/Dlg_cancel_button_down.png");
		pButton->setPosition(CCPoint(360/2, 350-pButton->getContentSize().height/2));

		pCheckbox = CCheckBox::create();
		pCheckbox->setNormalImage("ckb_normal_01.png");
		pCheckbox->setNormalPressImage("ckb_normal_02.png");
		pCheckbox->setCheckedImage("ckb_selected_01.png");
		pCheckbox->setCheckedPressImage("ckb_selected_02.png");
		pCheckbox->setDisabledNormalImage("ckb_disable_01.png");
		pCheckbox->setDisabledCheckedImage("ckb_disable_02.png");
		pCheckbox->setPosition(CCPoint(360-pCheckbox->getContentSize().width, 350-pButton->getContentSize().height/2));

		pCell->addChild(pCheckbox,10);

		//pCell->addChild(pButton,10);

		HcharacterDrawnode* handwritingHz = HcharacterDrawnode::create();
		vector<string> oneNote = Notes.at(idx);			//oneNote 中第一个元素为ID,第二个元素为笔画序列
		vector< vector<CCPoint> > strokesvec = DataTool::spliteString(oneNote.at(1));
		for (unsigned int i = 0; i < strokesvec.size(); i++)
		{
			vector<CCPoint> oneStrokeVec = strokesvec[i];
			Stroke stroke(oneStrokeVec);
			handwritingHz->addStroke(stroke);
		}

 		handwritingHz->setContentSize(CCSize(320,320));
		CCPoint position = ccp(360/2- handwritingHz->getContentSize().width/2, 350/2- handwritingHz->getContentSize().height/2);
		handwritingHz->setPosition(position);
		pCell->addChild(handwritingHz,1);
	}

	char buff[64];
	sprintf(buff, "%u", idx);
	pButton->getLabel()->setString(buff);
	int userTag = DataTool::stringToInt(oneNote.at(0));
	pButton->setUserTag(userTag);
	pCheckbox->setUserTag(userTag);

	pButton->setOnClickListener(this,ccw_click_selector(ViewScene::buttonClick));
	pCheckbox->setOnClickListener(this,ccw_click_selector(ViewScene::checkBoxClick));

	return pCell;
}
예제 #19
0
void CSmeltArmor::onCheckAttr(CCObject *pSender, bool bChecked)
{
	int checknum =0;
	int iShowCount = 0;

	for (unsigned int i=0; i<4; ++i)
	{
		CCheckBox* pCheckBtn = (CCheckBox*)(m_pBaseInfo[i]->findWidgetById("check"));
		if (pCheckBtn->isChecked())
		{
			checknum++;
		}
		if(m_pBaseInfo[i]->isVisible())
		{
			iShowCount++;
		}
		setYellowBgState(pCheckBtn, pCheckBtn->isChecked());
	}

	//如果选中了四个,则屏蔽掉一个,提示不能全选
	if(checknum>=iShowCount && pSender!=nullptr)
	{
		CCheckBox* pCheck = (CCheckBox*)pSender;
		pCheck->setEnabled(false);
		pCheck->setChecked(false);
		pCheck->setEnabled(true);
		setYellowBgState(pCheck, false);
		ShowPopTextTip(GETLANGSTR(1182));
		return;
	}

	if (checknum==0)
	{
		CCSprite *coin = (CCSprite *)(m_ui->findWidgetById("coin"));
		coin->setVisible(true);

		m_coin = 0; 
		switch (m_armor.quality)
		{
		case 1:
			m_coin =10000;
			break;
		case 2:
			m_coin =20000;
			break;
		case 3:
			m_coin =40000;
			break;
		case 4:
			m_coin =80000;
			break;
		case 5:
			m_coin =160000;
			break;
		default:
			break;
		}
		m_diamond = 0;

		CCSprite *diamond = (CCSprite *)(m_ui->findWidgetById("diamond"));
		diamond->setVisible(false);

		CLabel *money = (CLabel *)(m_ui->findWidgetById("money"));
		money->setString(ToString(m_coin));
		//检查货币数量
		if(!CheckCoin(atoi(money->getString())))
		{
			money->setColor(RGB_RED);
		}
		else
		{
			money->setColor(RGB_WHITE);
		}

		showFireWithType(0);
	}
	else
	{
		CCSprite *coin = (CCSprite *)(m_ui->findWidgetById("coin"));
		coin->setVisible(false);

		CCSprite *diamond = (CCSprite *)(m_ui->findWidgetById("diamond"));
		diamond->setVisible(true);

		CLabel *money = (CLabel *)(m_ui->findWidgetById("money"));
		money->setString(ToString(100*checknum));
		//检查货币数量
		if(!CheckGold(atoi(money->getString())))
		{
			money->setColor(RGB_RED);
		}
		else
		{
			money->setColor(RGB_WHITE);
		}

		m_coin = 0;
		m_diamond = 100*checknum;

		showFireWithType(1);
	}
}