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 >
C/C++ Source or Header  |  2000-11-12  |  6KB  |  239 lines

  1. // ---------------------------------------------------------------------------
  2. // MenuHnd.c
  3. // Contains PalmOS specific code, for MenuHandlers
  4. // 
  5. // Project: WAPUniverse for PalmOS
  6. // Copyright ⌐ 1999-2000 Filip Onkelinx
  7. //
  8. // http://www.wapuniverse.com/
  9. // filip@onkelinx.com
  10. //
  11. // This program is free software; you can redistribute it and/or
  12. // modify it under the terms of the GNU General Public License
  13. // as published by the Free Software Foundation; either version 2
  14. // of the License, or (at your option) any later version.
  15. //
  16. // This program is distributed in the hope that it will be useful,
  17. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. // GNU General Public License for more details.
  20. //
  21. // You should have received a copy of the GNU General Public License
  22. // along with this program; if not, write to the Free Software 
  23. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 
  24. //
  25. // 
  26. // $Workfile: MenuHnd.c $  
  27. // $Author: wapuniverse $  
  28. // $Date: 2000/11/11 20:51:09 $     
  29. // $Revision: 1.6 $
  30. // 
  31. // $Header: /cvsroot/wapuniverse/wapuniverse/src/MenuHnd.c,v 1.6 2000/11/11 20:51:09 wapuniverse Exp $
  32. // 
  33. // -------------------------------------------------------------------------------
  34. #include <PalmOS.h>
  35. #include     "WAPUniverse.h"
  36. #include    "dbConn.h"
  37. #include     "../res/WAPUniverse_res.h"
  38. #include    "formBrowser.h"
  39. #include    "PalmUtils.h"
  40.  
  41. /**************************************/
  42. /** Menu Handler Functions           **/
  43. /**************************************/
  44.  
  45. static void LoadNetworkPanel()
  46. {
  47.     // from    http://oasis.palm.com/devzone/knowledgebasearticle.cfm?article_id=1204
  48.  
  49.     /*
  50.     static UInt32 gPanelCreators[8] = {
  51.     sysFileCButtons,
  52.     sysFileCDigitizer,
  53.     sysFileCFormats,
  54.     sysFileCGeneral,
  55.     sysFileCModemPanel,
  56.     sysFileCNetworkPanel,
  57.     sysFileCOwner,
  58.     sysFileCShortCuts,
  59.     };
  60.     */
  61.     
  62.     LocalID theDBID;
  63.     UInt16 theCardNo;
  64.     DmSearchStateType theSearchState;
  65.  
  66.     // Grab the id of the panel we want to launch
  67.     DmGetNextDatabaseByTypeCreator(true, &theSearchState, sysFileTPanel, sysFileCNetworkPanel,
  68.             true, &theCardNo, &theDBID);
  69.  
  70.     // Launch the panel
  71.     SysUIAppSwitch(theCardNo, theDBID, sysAppLaunchCmdPanelCalledFromApp, NULL );
  72.  
  73. }
  74.  
  75.  
  76. /****************************************************/
  77. /* 
  78.    Function: Int16 MenuOptions_MH(UInt16 menuID);
  79.    Description: Menu Handler for MenuOptions 
  80.  */
  81. /****************************************************/
  82.  
  83. Int16 mhMenuOptions(UInt16 menuID, GlobalsType *g)
  84. {
  85.     switch (menuID) {
  86.  
  87.       case OptionsGetInfo:
  88.           DisplayAbout();
  89.           break;
  90.  
  91.       case OptionLicense:
  92.           DisplayLicense();
  93.           break;
  94.  
  95.       case OptionConnectionSettings:
  96.           SwitchForm(frmConnectionList,g);
  97.           break;
  98.  
  99.       case OptionBookmarks:
  100.             if(dbConnNumRecords(g)>0){
  101.                  SwitchForm(frmUrlList,g);                     
  102.             }
  103.             else{
  104.                 FrmCustomAlert (alError, "You need to define at least one connection\n", "", NULL);
  105.             }
  106.           break;
  107.  
  108.       case OptionMTSyncPrefs:
  109.             SwitchForm(frmMTSyncPrefs,g);
  110.           break;
  111.           
  112.     case OptionNetwork:
  113.         LoadNetworkPanel();
  114.         break;
  115.  
  116.       default:
  117.       break;
  118.      }
  119.      return(0);
  120. }
  121.  
  122.  
  123. /****************************************************/
  124. /* 
  125.    Function: Int16 MenuView_MH(UInt16 menuID);
  126.    Description: Menu Handler for MenuView 
  127.  */
  128. /****************************************************/
  129.  
  130. Boolean mhMenuView(UInt16 menuID, GlobalsType *g)
  131. {
  132. Boolean status=false;
  133.  
  134.     switch (menuID) {
  135.  
  136.       case miViewSource:
  137.           status = browserSrcEvt(g);
  138.           break;
  139.  
  140.       case miReload:
  141.             status = browserReloadEvt(g);
  142.           break;
  143.  
  144.       case miBack:
  145.           status = browserBackEvt(g);
  146.           break;
  147.  
  148.       case miStop:
  149.           status = browserStopEvt(g);
  150.             break;
  151.           
  152.       case miConnectionSettings:
  153.           SwitchForm(frmConnectionList,g);
  154.           break;
  155.  
  156.       case miBookmarks:
  157.           status = browserURLsEvt(g);
  158.           break;
  159.  
  160.       case miMTSyncPrefs:
  161.             SwitchForm(frmMTSyncPrefs,g);
  162.           break;
  163.           
  164.       case miNetwork:
  165.         LoadNetworkPanel();
  166.         break;
  167.  
  168.       case miGetInfo:
  169.           DisplayAbout();
  170.           status = true;
  171.           break;
  172.  
  173.       case miLicense:
  174.           DisplayLicense();
  175.           status = true;
  176.           break;
  177.  
  178.       default:
  179.       break;
  180.      }
  181.      return(status);
  182. }
  183.  
  184.  
  185. /****************************************************/
  186. /* 
  187.    Function: Int16 MenuEdit_MH(UInt16 menuID);
  188.    Description: Menu Handler for MenuEdit 
  189.  */
  190. /****************************************************/
  191.  
  192. Int16 mhMenuEdit(UInt16 menuID)
  193. {
  194.   FieldPtr        fld;
  195.  
  196.     switch (menuID) {
  197.  
  198.     case EditEditCut:       // Do a cut to the clipboard if text is
  199.                                 // highlighted.
  200.       fld = GetFocusObjectPtr ();
  201.       if (fld)
  202.         FldCut (fld);
  203.       break;
  204.  
  205.     case EditEditCopy:          // Copy the highlighted text to the
  206.                                 // clipboard.
  207.       fld = GetFocusObjectPtr ();
  208.       if (fld)
  209.         FldCopy (fld);
  210.       break;
  211.  
  212.     case EditEditPaste:     // Do a paste from the clipboard.
  213.       fld = GetFocusObjectPtr ();
  214.       if (fld)
  215.         FldPaste (fld);
  216.       break;
  217.  
  218.     case EditEditUndo:          // undo the last text change.
  219.       fld = GetFocusObjectPtr ();
  220.       if (fld)
  221.         FldUndo (fld);
  222.       break;
  223.  
  224.     case EditEditKeyboard:      // display the on screen keyboard
  225.       SysKeyboardDialog (kbdAlpha);
  226.       break;
  227.  
  228.     case EditEditGraffiti:      // Display the graffiti reference screen
  229.       SysGraffitiReferenceDialog (referenceDefault);
  230.       break;
  231.  
  232.     default:
  233.       break;
  234.    }
  235.      return(0);
  236. }
  237.  
  238.  
  239.