Esempio n. 1
0
static void ListDrawDataFunc(Int16 itemNum, RectangleType *bounds, Char **itemsText)
{
	char string[20];
	
	StrNCopy(string, GetDisplayString(itemNum), 19);

	WinSetUnderlineMode(noUnderline);
	FntSetFont(stdFont);
	Int16 width = bounds->extent.x;
	Int16 len = StrLen(string);
	Boolean noFit = false;
	FntCharsInWidth(string, &width, &len, &noFit);

	WinEraseRectangle(bounds, 0);
	WinDrawChars(string, len, bounds->topLeft.x, bounds->topLeft.y);
}
Esempio n. 2
0
static void ListDrawDataFunc(Int16 itemNum, RectangleType *bounds, Char **itemsText)
{
	char string[50];
	
	if (itemNum < g_PhoneGroups.size()) {
		PhoneGroupPtr group = g_PhoneGroups[itemNum];
		StrNCopy(string, group->GetGroupName(), 49);
	} else {
		StrCopy(string, "");
	}

	WinSetUnderlineMode(noUnderline);
	FntSetFont(stdFont);
	Int16 width = bounds->extent.x;
	Int16 len = StrLen(string);
	Boolean noFit = false;
	FntCharsInWidth(string, &width, &len, &noFit);

	WinEraseRectangle(bounds, 0);
	WinDrawChars(string, len, bounds->topLeft.x, bounds->topLeft.y);
}
Esempio n. 3
0
void PrivDrawCell(void* table, Int16 row, Int16 column, RectanglePtr bounds)
{
	char string[50];
	FontID font = stdFont;

	if (g_CurrentRow != row) {
		if (g_CurrentMemHandle) {
			MemHandleUnlock(g_CurrentMemHandle);
			g_CurrentMemHandle = NULL;
		}
	}
	if (g_CurrentMemHandle == NULL) {
		Err err = GetSMSRecord(g_SmsDb, g_SelectedCategory, row + g_CurrentPage * TABLE_PAGE_SIZE, 
			g_CurrentRecord, g_CurrentMemHandle, true);
		if (err) return;
		g_CurrentRow = row;
	}
		
	switch(column) {
		case 0:
			StrCopy(string, "");
			if (g_SelectedCategory == CAT_INBOX) {
				if (IsRecordRead(&g_CurrentRecord)) {
					StrCopy(string, "");
				} else {
					font = symbolFont;
					StrCopy(string, "\020");
				}
			} else if (g_SelectedCategory == CAT_SENT) {
				if (IsRecordRequestReport(&g_CurrentRecord)) {
					font = symbolFont;
					if (IsRecordDelivered(&g_CurrentRecord)) {
						StrCopy(string, "\026");
					} else {
						StrCopy(string, "\024");
					}
				}
			}
			break;
		case 1:
			StrNCopy(string, g_CurrentRecord.personName, 48);
			if (StrLen(string) == 0) {
				StrNCopy(string, g_CurrentRecord.phoneNumber, 48);
			}
			break;
		case 2:
			StrNCopy(string, g_CurrentRecord.content, 48);
			break;
		case 3:
			{
				DateTimeType smsDatetime;
				TimSecondsToDateTime(g_CurrentRecord.time, &smsDatetime);

				UInt32 nowSeconds = TimGetSeconds();
				DateTimeType nowDatetime;
				TimSecondsToDateTime(nowSeconds, &nowDatetime);
				
				if ((nowDatetime.year == smsDatetime.year) && 
					(nowDatetime.month == smsDatetime.month) &&
					(nowDatetime.day == smsDatetime.day)) {
					TimeToAscii(smsDatetime.hour, smsDatetime.minute, tfColon24h, string);
				} else {
					StrCopy(string, DayOfWeekInChinese[DayOfWeek(smsDatetime.month, smsDatetime.day, smsDatetime.year)]);
					DateTemplateToAscii(" ^3z-^0z", smsDatetime.month, smsDatetime.day, smsDatetime.year, string + 2, 47);
				}
				MemHandleUnlock(g_CurrentMemHandle);
				g_CurrentMemHandle = NULL;
			}
			break;
		default:
			StrCopy(string, "");
	}

	WinPushDrawState();
	
	RGBColorType foreColor, backColor;

	foreColor.index = 0;
	backColor.index = 0;
	if ((row == g_CurrentSelection) && (column != 0)) {
		foreColor.r = 255;
		foreColor.g = 255;
		foreColor.b = 255;
		
		backColor.r = 10;
		backColor.g = 36;
		backColor.b = 106;
	} else if (row % 2 == 0) {
		backColor.r = 255;
		backColor.g = 255;
		backColor.b = 255;
		
		foreColor.r = 0;
		foreColor.g = 0;
		foreColor.b = 0;
	} else {
		backColor.r = 220;
		backColor.g = 220;
		backColor.b = 220;
		
		foreColor.r = 0;
		foreColor.g = 0;
		foreColor.b = 0;
	}
	WinSetForeColorRGB(&foreColor, NULL);
	WinSetTextColorRGB(&foreColor, NULL);
	WinSetBackColorRGB(&backColor, NULL);
	
	WinSetUnderlineMode(noUnderline);
		
	FntSetFont(font);

	Int16 width = bounds->extent.x - 2;
	Int16 len = StrLen(string);
	Boolean noFit = false;
	FntCharsInWidth(string, &width, &len, &noFit);
	
	UInt16 x = bounds->topLeft.x;
	UInt16 y = bounds->topLeft.y;
	
	bounds->topLeft.x += - 1;
	bounds->topLeft.y += 0;
	bounds->extent.x += 2;
	bounds->extent.y += 0;
	
	WinEraseRectangle(bounds, 0);
	WinDrawGrayLine(
		bounds->topLeft.x + bounds->extent.x - 2, 
		bounds->topLeft.y,
		bounds->topLeft.x + bounds->extent.x - 2, 
		bounds->topLeft.y + bounds->extent.y);// - 2);
		
	WinDrawChars(string, len, x, y);
	
	WinPopDrawState();
}
Esempio n. 4
0
 ~PalmUnderlineSetter()
 {WinSetUnderlineMode(originalUnderline_);}
Esempio n. 5
0
 explicit PalmUnderlineSetter(UnderlineModeType newMode):
     originalUnderline_(WinSetUnderlineMode(newMode))
 {}