⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dateagenda.c

📁 我的Palm OS 5 SDK zhCN_PIMApps代码。 使用codewarrior 开发环境
💻 C
📖 第 1 页 / 共 5 页
字号:
		TblSetItemStyle (table, row, priorityColumn, numericTableItem);
		TblSetItemStyle (table, row, descColumn, customTableItem);
		TblSetItemStyle (table, row, dueDateColumn, customTableItem);
		TblSetItemStyle (table, row, categoryColumn, customTableItem);


		// Set the font used to draw the text of the row.
		if (ListFont == stdFont)
			fontID = boldFont;
		else
			fontID = ListFont;
		TblSetItemFont (table, row, priorityColumn, fontID);
		TblSetItemFont (table, row, descColumn, ListFont);
		TblSetItemFont (table, row, dueDateColumn, ListFont);
		TblSetItemFont (table, row, categoryColumn, ListFont);

//		TblSetRowUsable (table, row, false);
		}


	TblSetColumnUsable (table, completedColumn, true);
	TblSetColumnUsable (table, priorityColumn, ShowPriorities);
	TblSetColumnUsable (table, descColumn, true);
	TblSetColumnUsable (table, dueDateColumn, ShowDueDates);
	TblSetColumnUsable (table, categoryColumn, showCategories);

	TblSetColumnMasked (table, completedColumn, true);
	TblSetColumnMasked (table, priorityColumn, true);
	TblSetColumnMasked (table, descColumn, true);
	TblSetColumnMasked (table, dueDateColumn, true);
	TblSetColumnMasked (table, categoryColumn, true);


	// Set the spacing after the complete column.
	if (ShowPriorities)
		{
		TblSetColumnSpacing (table, completedColumn, 0);
		TblSetColumnSpacing (table, priorityColumn, spaceBeforeDesc);
		}
	else
		{
		TblSetColumnSpacing (table, completedColumn, spaceBeforeDesc);
		}

	if (ShowDueDates && showCategories)
		{
		TblSetColumnSpacing (table, dueDateColumn, spaceBeforeCategory);
		}


	// Set the width of the priorities column.
	if (ShowPriorities)
		{
		width = ListViewGetColumnWidth (priorityColumn);
		TblSetColumnWidth (table, priorityColumn, width);
		}


	// Set the width of the due date column.
	if (ShowDueDates)
		{
		width = ListViewGetColumnWidth (dueDateColumn);
		TblSetColumnWidth (table, dueDateColumn, width);
		}


	// Set the width of the category column.
	if (showCategories)
		{
		width = ListViewGetColumnWidth (categoryColumn);
		TblSetColumnWidth (table, categoryColumn, width);
		}


	// Set the width of the description column.
	TblGetBounds (table, &r);
	width = r.extent.x;
	width -= TblGetColumnWidth (table, completedColumn) +
				TblGetColumnSpacing (table, completedColumn);
	if (ShowPriorities)
		width -= TblGetColumnWidth (table, priorityColumn) +
				   TblGetColumnSpacing (table, priorityColumn);
	if (ShowDueDates)
		width -= TblGetColumnWidth (table, dueDateColumn) +
				   TblGetColumnSpacing (table, dueDateColumn);
	if (showCategories)
		width -= TblGetColumnWidth (table, categoryColumn) +
				   TblGetColumnSpacing (table, categoryColumn);


	TblSetColumnWidth (table, descColumn, width);


	// Set the callback routines that will load and save the
	// description field.
//	TblSetLoadDataProcedure (table, descColumn, (TableLoadDataFuncPtr)ListViewGetDescription);
//	TblSetSaveDataProcedure (table, descColumn, (TableSaveDataFuncPtr)ListViewSaveDescription);

	// Set the callback routines that draws the various fields
	TblSetCustomDrawProcedure (table, dueDateColumn, ListViewDrawDueDate);
	TblSetCustomDrawProcedure (table, categoryColumn, ListViewDrawCategory);
	TblSetCustomDrawProcedure (table, descColumn, ListViewDrawDesc);


	// Set the label of the category trigger.
	ctl = GetObjectPtr (AgendaToDoCategoryTrigger);
	CategoryGetName (Agenda.todoDB, CurrentCategory, CategoryName);
	CategorySetTriggerLabel (ctl, CategoryName);
}


/***********************************************************************
 *
 * FUNCTION:    AgendaViewFillTitle
 *
 * DESCRIPTION:
 *
 * PARAMETERS:  nothing
 *
 * RETURNED:    nothing
 *
 * REVISION HISTORY:
 *			Name	Date		Description
 *			----	----		-----------
 *			rbb	5/28/99	Initial Revision
 *
 ***********************************************************************/
static void
AgendaViewFillTitle (
	FormPtr							frm )
{
#pragma unused (frm)

}


/***********************************************************************
 *
 * FUNCTION:    AgendaViewFillAppointmentsTitle
 *
 * DESCRIPTION:
 *
 * PARAMETERS:  nothing
 *
 * RETURNED:    nothing
 *
 * REVISION HISTORY:
 *			Name	Date		Description
 *			----	----		-----------
 *			rbb	5/28/99	Initial Revision
 *
 ***********************************************************************/
static void
AgendaViewFillAppointmentsTitle (
	FormPtr							frm )
{
#pragma unused (frm)

}


/***********************************************************************
 *
 * FUNCTION:    AgendaViewFillAppointments
 *
 * DESCRIPTION:
 *
 * PARAMETERS:  nothing
 *
 * RETURNED:    nothing
 *
 * REVISION HISTORY:
 *			Name	Date		Description
 *			----	----		-----------
 *			rbb	5/28/99	Initial Revision
 *
 ***********************************************************************/
static void
AgendaViewFillAppointments (
	FormType*						inFormP )
{
#pragma unused (inFormP)

	TableType*						tableP;
	RectangleType					tableBounds;
	UInt16							row;
	UInt16							lastRow;
	FontID							oldFont;
	UInt16							apptIndex;
	UInt16							apptCount;
	UInt16							rowHeight = 0;
	UInt16							displayableHeight = 0;
	UInt16							virtualHeight = 0;
	UInt16 							attr;
	Boolean 							masked;
	UInt16							maxIndex;

	// Get the height of the table and the width of the description column.
	tableP = GetObjectPtr (AgendaDatebookTable);
	TblGetBounds (tableP, &tableBounds);

	row = 0;
	lastRow = TblGetLastUsableRow (tableP);

	oldFont = FntSetFont (Agenda.apptFont);
	rowHeight = FntLineHeight ();
	FntSetFont (oldFont);

	apptCount = AgendaGetAppointmentCount();
	maxIndex = max (0, (Int16) apptCount - (Int16) lastRow - 1);
	apptIndex = min (Agenda.apptTopVisibleIndex, maxIndex);
	Agenda.apptTopVisibleIndex = apptIndex;

	// Associate each row with the appropriate appointment
	while ( (apptIndex < apptCount) && (row <= lastRow) )
		{
		// Also ensure that we're within our drawing area
		if ( displayableHeight + rowHeight <= tableBounds.extent.y )
			{
			MemHandle				apptsH;
			ApptInfoType*			apptsP;

			TblSetRowID (tableP, row, apptIndex);
			TblMarkRowInvalid (tableP, row);

			//Mask if appropriate
			apptsH = AgendaGetAppointments ();
			if (apptsH)
				{
				apptsP = MemHandleLock (apptsH);
				DmRecordInfo (ApptDB, apptsP[apptIndex].recordNum, &attr, NULL, NULL);
			   	masked = (((attr & dmRecAttrSecret) && PrivateRecordVisualStatus == maskPrivateRecords));
				TblSetRowMasked(tableP,row,masked);

				MemPtrUnlock (apptsP);
				}

			apptIndex++;
			row++;
			displayableHeight += rowHeight;
			}
		else
			{
			break;
			}
		}

	if (apptCount == 0)
		{
		// Set the ID to a special value to trigger the display of the "no appointments" text
		TblSetRowID (tableP, 0, 0xffff);
		TblSetRowMasked (tableP, row, false);
		TblMarkRowInvalid (tableP, row);
		}
}


#pragma mark -
/***********************************************************************
 *
 * FUNCTION:    AgendaLoadAppointments
 *
 * DESCRIPTION:
 *
 * PARAMETERS:  nothing
 *
 * RETURNED:    nothing
 *
 * REVISION HISTORY:
 *			Name	Date		Description
 *			----	----		-----------
 *			rbb	5/28/99	Initial Revision
 *
 ***********************************************************************/
static MemHandle
AgendaLoadAppointments (
	DateType							inDate )
{
	MemHandle						appointmentsH;
	UInt16							count;

	// Load the day's appointments from the database
	ApptGetAppointments (Agenda.apptDB, inDate, 1, &appointmentsH, &count);

	// Replace the current appointments with our new data (frees any old data)
	AgendaSetAppointments (appointmentsH, count);

	return appointmentsH;
}


/***********************************************************************
 *
 * FUNCTION:    AgendaFreeAppointments
 *
 * DESCRIPTION:
 *
 * PARAMETERS:  nothing
 *
 * RETURNED:    nothing
 *
 * REVISION HISTORY:
 *			Name	Date		Description
 *			----	----		-----------
 *			rbb	5/28/99	Initial Revision
 *
 ***********************************************************************/
static void
AgendaFreeAppointments ( )
{
	if ( Agenda.apptsH != NULL )
		{
		MemHandleFree (Agenda.apptsH);
		}

	Agenda.apptsH = NULL;
	Agenda.apptCount = 0;
}


/***********************************************************************
 *
 * FUNCTION:    AgendaGetAppointments
 *
 * DESCRIPTION:
 *
 * PARAMETERS:  nothing
 *
 * RETURNED:    nothing
 *
 * REVISION HISTORY:
 *			Name	Date		Description
 *			----	----		-----------
 *			rbb	5/28/99	Initial Revision
 *
 ***********************************************************************/
static MemHandle
AgendaGetAppointments ( )
{
	return Agenda.apptsH;
}


/***********************************************************************
 *
 * FUNCTION:    AgendaSetAppointments
 *
 * DESCRIPTION:
 *
 * PARAMETERS:  nothing
 *
 * RETURNED:    nothing
 *
 * REVISION HISTORY:
 *			Name	Date		Description
 *			----	----		-----------
 *			rbb	5/28/99	Initial Revision
 *
 ***********************************************************************/
static void
AgendaSetAppointments (
	const MemHandle				inAppointmentsH,
	UInt16							inAppointmentCount )
{
	AgendaFreeAppointments ();

	Agenda.apptsH = inAppointmentsH;
	Agenda.apptCount = inAppointmentCount;
}


/***********************************************************************
 *
 * FUNCTION:    AgendaGetAppointmentCount
 *
 * DESCRIPTION:
 *
 * PARAMETERS:  nothing
 *
 * RETURNED:    nothing
 *
 * REVISION HISTORY:
 *			Name	Date		Description
 *			----	----		-----------
 *			rbb	5/28/99	Initial Revision
 *
 ***********************************************************************/
static UInt16
AgendaGetAppointmentCount ( )
{
	return Agenda.apptCount;
}


#pragma mark -
/***********************************************************************
 *
 * FUNCTION:    AgendaViewGetScrollableRect
 *
 * DESCRIPTION: Returns the area into which the agenda can be drawn.
 *					 This is the whole screen, except for the title and
 *					 control areas.
 *
 * PARAMETERS:  nothing
 *
 * RETURNED:    outBoundsP	- Screen area for agenda contents
 *
 * REVISION HISTORY:
 *			Name	Date		Description
 *			----	----		-----------
 *			rbb	6/14/99	Initial Revision
 *
 ***********************************************************************/
static void
AgendaViewGetScrollableRect (
	FormType*						inFormP,
	RectangleType*					outBoundsP )
{
	FrmGetObjectBounds (inFormP, FrmGetObjectIndex(inFormP, AgendaScrollableArea), outBoundsP);
}


/***********************************************************************
 *
 * FUNCTION:    AgendaViewGetSeparatorHeight
 *
 * DESCRIPTION: Returns the height of the area between the datebook and
 *					 to do sections of the agenda view, into which the category
 *					 popup is drawn
 *
 * PARAMETERS:  nothing
 *
 * RETURNED:    outBoundsP	- Screen area for agenda contents
 *
 * REVISION HISTORY:
 *			Name	Date		Description
 *			----	--

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -