Ejemplo n.º 1
0
BOOL CFileAskDlg::OnEraseBkgnd(CDC* pDC)
{
	CRect rc;
	GetWindowRect(&rc);
	ScreenToClient(&rc);

	if(StrCmp(gl_strLanguageId, CHINESE) == 0)
	{
		CUIHelper UIHelper(IDR_GIFMAP_ASK);
		UIHelper.SetBackPicture(pDC, rc);
	}
	else
	{
		CUIHelper UIHelper(IDR_GIFMAP_ASK_EN);
		UIHelper.SetBackPicture(pDC, rc);
	}
	return true; //CDialog::OnEraseBkgnd(pDC);
}
Ejemplo n.º 2
0
int CGItemListArea::CalcRowHeight (int iRow)

//	CalcRowHeight
//
//	Returns the height of the given row

	{
	//	Set the position

	int iOldPos = m_pListData->GetCursor();
	m_pListData->SetCursor(iRow);

	//	Compute the rect where we're painting (we only care about width)

	RECT rcRect = GetRect();

	//	Compute row height based on type of list

	int cyHeight;
	switch (m_iType)
		{
		case listItem:
			{
			//	Get the item

			if (!m_pListData->IsCursorValid())
				{
				cyHeight = DEFAULT_ROW_HEIGHT;
				break;
				}

			CUIHelper UIHelper(*g_pHI);
			cyHeight = UIHelper.CalcItemEntryHeight(m_pListData->GetSource(), m_pListData->GetItemAtCursor(), rcRect, 0);
			break;
			}

		case listCustom:
			cyHeight = m_cyRow;
			break;

		default:
			cyHeight = DEFAULT_ROW_HEIGHT;
			break;
		}

	//	Done

	m_pListData->SetCursor(iOldPos);
	return cyHeight;
	}
Ejemplo n.º 3
0
void CGItemListArea::PaintItem (CG32bitImage &Dest, const CItem &Item, const RECT &rcRect, bool bSelected)

//	PaintItem
//
//	Paints the item

	{
	CUIHelper UIHelper(*g_pHI);

	DWORD dwOptions = 0;
	if (bSelected)
		dwOptions |= CUIHelper::OPTION_SELECTED;

	UIHelper.PaintItemEntry(Dest, m_pListData->GetSource(), Item, rcRect, m_rgbTextColor, dwOptions);
	}
Ejemplo n.º 4
0
void CDockPane::SetDescription (const CString &sDesc)

//	SetDescription
//
//	Sets the description

	{
	m_sDesc = sDesc;

	SControl *pControl;
	if (pControl = GetControlByType(controlDesc))
		{
		CGTextArea *pTextArea = pControl->AsTextArea();
		CUIHelper UIHelper(*g_pHI);
		CString sRTF;
		UIHelper.GenerateDockScreenRTF(sDesc, &sRTF);

		pTextArea->SetRichText(sRTF);
		}
	}
Ejemplo n.º 5
0
bool CDockPane::SetControlValue (const CString &sID, ICCItem *pValue)

//	SetControlValue
//
//	Sets the value of the given control. Return FALSE if we could not find a 
//	control of the given ID.

	{
	CCodeChain &CC = g_pUniverse->GetCC();

	SControl *pControl;
	if (!FindControl(sID, &pControl))
		return false;

	switch (pControl->iType)
		{
		case controlCounter:
			{
			CGTextArea *pTextArea = pControl->AsTextArea();
			CString sText = strFromInt(pValue->GetIntegerValue());
			pTextArea->SetText(sText);
			pControl->bReplaceInput = true;
			return true;
			}

		case controlDesc:
			{
			CGTextArea *pTextArea = pControl->AsTextArea();
			CUIHelper UIHelper(*g_pHI);
			CString sRTF;
			UIHelper.GenerateDockScreenRTF(pValue->GetStringValue(), &sRTF);

			pTextArea->SetRichText(sRTF);
			return true;
			}

		case controlItemDisplay:
			{
			CGItemDisplayArea *pItemDisplayArea = pControl->AsItemDisplayArea();

			//	Nil means nil

			if (pValue->IsNil())
				{
				pItemDisplayArea->SetItem(NULL, CItem::NullItem());
				return true;
				}

			//	If a structure, we expect two fields:

			else if (pValue->IsSymbolTable())
				{
				ICCItem *pItemCC = pValue->GetElement(CONSTLIT("item"));
				if (pItemCC == NULL)
					{
					CString sTitle;
					CString sDesc;

					//	If no item, then we expect title and desc

					ICCItem *pTitleCC = pValue->GetElement(CONSTLIT("title"));
					if (pTitleCC)
						sTitle = pTitleCC->GetStringValue();

					ICCItem *pDescCC = pValue->GetElement(CONSTLIT("desc"));
					if (pDescCC)
						sDesc = pDescCC->GetStringValue();

					pItemDisplayArea->SetItem(NULL, CItem::NullItem());
					pItemDisplayArea->SetText(sTitle, sDesc);

					return true;
					}

				CItem Item = ::CreateItemFromList(CC, pItemCC);

				CSpaceObject *pSource = NULL;
				ICCItem *pSourceCC = pValue->GetElement(CONSTLIT("source"));
				if (pSourceCC)
					pSource = ::CreateObjFromItem(CC, pSourceCC);

				pItemDisplayArea->SetItem(pSource, Item);
				return true;
				}

			//	If this is a list then we expect an item value

			else if (pValue->IsList())
				{
				CItem Item = ::CreateItemFromList(CC, pValue);
				pItemDisplayArea->SetItem(NULL, Item);
				return true;
				}

			return false;
			}

		case controlTextInput:
			{
			CGTextArea *pTextArea = pControl->AsTextArea();
			CString sValue = pValue->GetStringValue();
			pTextArea->SetText(sValue);
			pTextArea->SetCursor(0, sValue.GetLength());
			return true;
			}
		}

	return false;
	}