home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
linuxmafia.com 2016
/
linuxmafia.com.tar
/
linuxmafia.com
/
pub
/
palmos
/
wapuniverse-src-0.3.5.build9.tar.gz
/
wapuniverse-src-0.3.5.build9.tar
/
wapuniverse-0.3.5.build9
/
MenuHnd.c
< prev
next >
Wrap
C/C++ Source or Header
|
2000-11-12
|
6KB
|
239 lines
// ---------------------------------------------------------------------------
// MenuHnd.c
// Contains PalmOS specific code, for MenuHandlers
//
// Project: WAPUniverse for PalmOS
// Copyright ⌐ 1999-2000 Filip Onkelinx
//
// http://www.wapuniverse.com/
// filip@onkelinx.com
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
//
// $Workfile: MenuHnd.c $
// $Author: wapuniverse $
// $Date: 2000/11/11 20:51:09 $
// $Revision: 1.6 $
//
// $Header: /cvsroot/wapuniverse/wapuniverse/src/MenuHnd.c,v 1.6 2000/11/11 20:51:09 wapuniverse Exp $
//
// -------------------------------------------------------------------------------
#include <PalmOS.h>
#include "WAPUniverse.h"
#include "dbConn.h"
#include "../res/WAPUniverse_res.h"
#include "formBrowser.h"
#include "PalmUtils.h"
/**************************************/
/** Menu Handler Functions **/
/**************************************/
static void LoadNetworkPanel()
{
// from http://oasis.palm.com/devzone/knowledgebasearticle.cfm?article_id=1204
/*
static UInt32 gPanelCreators[8] = {
sysFileCButtons,
sysFileCDigitizer,
sysFileCFormats,
sysFileCGeneral,
sysFileCModemPanel,
sysFileCNetworkPanel,
sysFileCOwner,
sysFileCShortCuts,
};
*/
LocalID theDBID;
UInt16 theCardNo;
DmSearchStateType theSearchState;
// Grab the id of the panel we want to launch
DmGetNextDatabaseByTypeCreator(true, &theSearchState, sysFileTPanel, sysFileCNetworkPanel,
true, &theCardNo, &theDBID);
// Launch the panel
SysUIAppSwitch(theCardNo, theDBID, sysAppLaunchCmdPanelCalledFromApp, NULL );
}
/****************************************************/
/*
Function: Int16 MenuOptions_MH(UInt16 menuID);
Description: Menu Handler for MenuOptions
*/
/****************************************************/
Int16 mhMenuOptions(UInt16 menuID, GlobalsType *g)
{
switch (menuID) {
case OptionsGetInfo:
DisplayAbout();
break;
case OptionLicense:
DisplayLicense();
break;
case OptionConnectionSettings:
SwitchForm(frmConnectionList,g);
break;
case OptionBookmarks:
if(dbConnNumRecords(g)>0){
SwitchForm(frmUrlList,g);
}
else{
FrmCustomAlert (alError, "You need to define at least one connection\n", "", NULL);
}
break;
case OptionMTSyncPrefs:
SwitchForm(frmMTSyncPrefs,g);
break;
case OptionNetwork:
LoadNetworkPanel();
break;
default:
break;
}
return(0);
}
/****************************************************/
/*
Function: Int16 MenuView_MH(UInt16 menuID);
Description: Menu Handler for MenuView
*/
/****************************************************/
Boolean mhMenuView(UInt16 menuID, GlobalsType *g)
{
Boolean status=false;
switch (menuID) {
case miViewSource:
status = browserSrcEvt(g);
break;
case miReload:
status = browserReloadEvt(g);
break;
case miBack:
status = browserBackEvt(g);
break;
case miStop:
status = browserStopEvt(g);
break;
case miConnectionSettings:
SwitchForm(frmConnectionList,g);
break;
case miBookmarks:
status = browserURLsEvt(g);
break;
case miMTSyncPrefs:
SwitchForm(frmMTSyncPrefs,g);
break;
case miNetwork:
LoadNetworkPanel();
break;
case miGetInfo:
DisplayAbout();
status = true;
break;
case miLicense:
DisplayLicense();
status = true;
break;
default:
break;
}
return(status);
}
/****************************************************/
/*
Function: Int16 MenuEdit_MH(UInt16 menuID);
Description: Menu Handler for MenuEdit
*/
/****************************************************/
Int16 mhMenuEdit(UInt16 menuID)
{
FieldPtr fld;
switch (menuID) {
case EditEditCut: // Do a cut to the clipboard if text is
// highlighted.
fld = GetFocusObjectPtr ();
if (fld)
FldCut (fld);
break;
case EditEditCopy: // Copy the highlighted text to the
// clipboard.
fld = GetFocusObjectPtr ();
if (fld)
FldCopy (fld);
break;
case EditEditPaste: // Do a paste from the clipboard.
fld = GetFocusObjectPtr ();
if (fld)
FldPaste (fld);
break;
case EditEditUndo: // undo the last text change.
fld = GetFocusObjectPtr ();
if (fld)
FldUndo (fld);
break;
case EditEditKeyboard: // display the on screen keyboard
SysKeyboardDialog (kbdAlpha);
break;
case EditEditGraffiti: // Display the graffiti reference screen
SysGraffitiReferenceDialog (referenceDefault);
break;
default:
break;
}
return(0);
}