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

📄 quiklist.c

📁 CD_高级PALM编程
💻 C
📖 第 1 页 / 共 2 页
字号:
// If a previous list is being drawn, stop it. If not, enable drawing// in case a multi-char match previously disabled drawing.				gStopDrawing = drawing;			}		}	}	return handled;}#pragma mark ----------------/*********************************************************************** * FUNCTION:    	MainFormInit * * DESCRIPTION: 	This routine initializes the main form. It should be used to *							execute code that must be done _before_ the form is *							drawn using FrmDrawForm. * * RETURNED:    	nothing ***********************************************************************/static void MainFormInit(	FormPtr	frmP		// ( in )  Pointer to the main form){	if ( frmP != NULL )	{		RctSetRectangle ( &gListBounds, TOP_LEFT_X, TOP_LEFT_Y, EXTENT_X, EXTENT_Y );	}}/*********************************************************************** * FUNCTION:    	MainFormDraw * * DESCRIPTION: 	This routine draws the non-form contents of the main form. * * RETURNED:    	nothing ***********************************************************************/static void MainFormDraw(	FormPtr	frmP		// ( in )  Pointer to the main form.){	if ( frmP != NULL )	{		WinDrawRectangleFrame ( simpleFrame, &gListBounds );		MainFormDrawList ();	}}/*********************************************************************** * FUNCTION:    	MainFormDone * * DESCRIPTION: 	This routine cleans up after the main form. * * RETURNED:    	nothing ***********************************************************************/static void MainFormDone(	FormPtr	frmP		// ( in )  Pointer to the main form){	if ( frmP != NULL )	{		FrmEraseForm ( frmP );		FrmDeleteForm ( frmP );	}}/*********************************************************************** * FUNCTION:    	MainFormDoMenuCommand * * DESCRIPTION: 	This routine handles menu commands. * * RETURNED:    	True if the evenet is handled ***********************************************************************/ static Boolean MainFormDoMenuCommand	// ( out ) event handled?(	UInt16 	command		// ( in )  The ID of menu command to do){	Boolean	handled = false;	FormPtr	frmP;	switch ( command )	{		case MainOptionsAboutQuikList:					MenuEraseStatus ( 0 );			frmP = FrmInitForm ( AboutForm );			FrmDoDialog ( frmP );			FrmDeleteForm ( frmP );			handled = true;			break;	}	return handled;}/*********************************************************************** * FUNCTION:    	MainFormHandleEvent * * DESCRIPTION: 	This routine is the event handler for the main form. * * RETURNED:    	true if the event is handled. ***********************************************************************/ static Boolean MainFormHandleEvent	// ( out ) event handled?(	EventPtr eventP	// ( in ) Pointer to the event to handle){	Boolean 	handled	= false;	FormPtr	frmP		= FrmGetActiveForm ();	ListPtr		listP			= GetObjectPtr ( MainNamesList );		if ( frmP != NULL )	{		switch ( eventP->eType ) 		{		// Form events			case frmOpenEvent:					MainFormInit ( frmP );	// ***** WARNING  - falls thru to next case *****						case frmUpdateEvent:				FrmDrawForm ( frmP );				MainFormDraw( frmP );				handled = true;				break; 						case frmCloseEvent:				MainFormDone ( frmP );				handled = true;				break;			// Menu events			case menuEvent:				handled = MainFormDoMenuCommand ( eventP->data.menu.itemID );				break;// Key events			case keyDownEvent:				handled = MainFormProcessKeystroke (					( UInt8 ) eventP->data.keyDown.chr, false );				break;		}	}	return handled;}#pragma mark ----------------/*********************************************************************** * FUNCTION:    	AppHandleEvent * * DESCRIPTION: 	Loads a form's resources and set its event handler. * * RETURNED:    	true if the event is handled. ***********************************************************************/ static Boolean AppHandleEvent	// ( out ) event handled?(	EventPtr eventP	// ( in ) Pointer to the event to handle){	    Boolean 	handled = false;	if ( eventP->eType == frmLoadEvent )	{	// Form load event--initialize the form and make it the active form.		UInt16 	formId = eventP->data.frmLoad.formID;		FormPtr	frmP = FrmInitForm ( formId );		FrmSetActiveForm ( frmP );// Set the event handler for the form.		switch ( formId )		{			case MainForm:							FrmSetEventHandler ( frmP, MainFormHandleEvent );				handled = true;				break;//	Insert other cases as needed for other forms.		}		handled = true;	}	return handled;}/*********************************************************************** * FUNCTION:    	AppEventLoop * * DESCRIPTION: 	The main event loop for the application.   * * RETURNED:    	nothing ***********************************************************************/ static void AppEventLoop(	void){	UInt16 		error;	EventType 	event;	do {	// Get the next event		EvtGetEvent ( &event, gEventTimeout );// Check the starndard default handlers		if (! SysHandleEvent ( &event))			if (! MenuHandleEvent ( 0, &event, &error ))				if (! AppHandleEvent ( &event ))				// Nobody wanted the event. Check for a nil event to turn off Graffiti lookup timing					if ( event.eType == nilEvent &&						gNilEventCnt > 0  &&						FrmGetActiveFormID () == MainForm)					{						StopGrafftiLookup ( );					}// None of the above, take the default handler					FrmDispatchEvent ( &event );	} while ( event.eType != appStopEvent );}/*********************************************************************** * FUNCTION:     	AppStart * * DESCRIPTION:  	Do whatever is necessary to get started. * * RETURNED:     	Err value or 0 if nothing went wrong ***********************************************************************/ static Err AppStart	// ( out ) zero or an error code(	void){	Err		error;	error = OpenDatabase ( APP_FILE_TYPE, APP_FILE_CREATOR, dmModeReadOnly+dmModeShowSecret, &gDBRef );	if ( ! error )		gListSize = ( Int16 ) DmNumRecords ( gDBRef );	return ( error );}/*********************************************************************** * FUNCTION:    	AppStop * * DESCRIPTION: 	Do whatever you need to do, like save the preferences. * * RETURNED:    	nothing ***********************************************************************/static void AppStop(	void){	DmCloseDatabase ( gDBRef );	FrmCloseAllForms ();}/*********************************************************************** * FUNCTION:    	PilotMain * * DESCRIPTION: 	The application main entry point. * * RETURNED:    	0 if launch & execution are successful, non-zero otherwise. ***********************************************************************/ UInt32 PilotMain		// ( out ) error code or zero(	UInt16		cmd,					// ( in )  The launch code	MemPtr	/* cmdPBP*/,		// ( in )  Pointer to the launch code structure	UInt16		launchFlags		// ( in )  Extra launch info){	Err error = 0;// Check the ROM version for compatibility.	error = RomVersionCompatible ( MIN_ROM_VERSION, launchFlags);	if ( error == 0 ){// ROM OK, check for the various launch codes as needed.			switch (cmd)		{			case sysAppLaunchCmdNormalLaunch:							error = AppStart ();				if ( error == 0 )				{					FrmGotoForm ( MainForm );					AppEventLoop ();					AppStop ();				}				break;		}	}	return ( UInt32 ) error;}

⌨️ 快捷键说明

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