/* Copyright 1997 Acorn Computers Ltd
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/***************************************************/
/* File   : Menus.h                                */
/*                                                 */
/* Purpose: Handle browser menus.                  */
/*                                                 */
/* Author : A.D.Hodgkinson                         */
/*                                                 */
/* History: 20-Nov-96: Created.                    */
/***************************************************/

/* Main menu (menu from the icon bar icon) component IDs */

#define MainInfo                        0x10000 /* Item leading to the Info window            */
#define MainChoices                     0x10001 /* Item leading to Choices window             */
#define MainOpenURL                     0x10002 /* Item leading to the Open URL dialogue      */
#define MainShowHotlist                 0x10003 /* Item leading to the Hotlist                */
#define MainQuit                        0x10004
#define MainCache                       0x10005 /* Broadcast appropriate AppControl message   */

/* Main menu event codes */

#define EMainCache                      0x10005
#define EMainToBeShown                  0x101ff

/* Choices menu component IDs - these control what defaults any new */
/* browser windows will take.                                       */

#define ChoicesURLBar                   0x10200
#define ChoicesButtonBar                0x10201
#define ChoicesStatusBar                0x10202
#define ChoicesUnderlineLinks           0x10203
#define ChoicesUseDocumentColours       0x10204
#define ChoicesShowForegroundImages     0x10205
#define ChoicesShowBackgroundImages     0x10206
#define ChoicesFullScreen               0x10207

#define ChoicesSave                     0x10208 /* Save the choices (with no save dialogue) */

/* Choices menu event codes */

#define EChoicesToBeShown               0x103ff

/* Document menu (main menu from a browser window) component IDs */
/* - all lead to other submenus.                                 */

#define DocumentFile                    0x10400
#define DocumentNavigate                0x10401
#define DocumentHotlist                 0x10402
#define DocumentResources               0x10403
#define DocumentUtilities               0x10404
#define DocumentDisplay                 0x10405
#define DocumentHistory                 0x10406
#define DocumentHelp                    0x10407

/* Document menu event codes */

#define EDocumentToBeShown              0x105ff
#define EDocumentHidden                 0x105fe

/* File menu component IDs */

#define FileSaveFrame                   0x10600 /* Leading to Save dialogue for saving frame source      */
#define FileSaveParent                  0x10601 /* Leading to Save dialogue for saving parent source     */
#define FileSaveAncestor                0x10607 /* Leading to Save dialogue for saving ancestor source   */
#define FilePrint                       0x10602 /* Item leading to the Print dialogue                    */
#define FileExport                      0x10603 /* Item leading to the Export submenu                    */
#define FileSaveFrameLocation           0x10604 /* Leading to Save dialogue for saving current location  */
#define FileSaveParentLocation          0x10605 /* Leading to Save dialogue for saving parent location   */
#define FileSaveAncestorLocation        0x10606 /* Leading to Save dialogue for saving ancestor location */

/* File menu event codes */

#define EFileToBeShown                  0x107ff

/* Export menu component IDs */

#define ExportAsDraw                    0x10800 /* Leading to Save dialogue for saving page as Draw     */
#define ExportAsText                    0x10801 /* Leading to Save dialogue for saving page as Text     */
#define ExportLink                      0x10802 /* Leading to Save dialogue for saving link             */
#define ExportPicture                   0x10803 /* Leading to Save dialogue for saving foreground image */
#define ExportBackground                0x10804 /* Leading to Save dialogue for saving background image */

/* Export menu event codes */

#define EExportToBeShown                0x109ff

/* Oops, thinking in base 10. Where's 0x10a00, 0x10c00 and 0x10e00? */
/* Reserved for future expansion, of course ;-)                     */
/*                                                                  */
/* Encoding (internationalisation) menu event codes                 */

#define EEncodingSelect                 0x11000 /* Raised when any item in the Encoding menu and its submenus is selected */
#define EEncodingFromDocument           0x11001 /* The user selected "From document" at the top of the Encoding menu      */

#define EEncodingToBeShown              0x111ff

/* Navigate menu component IDs */

#define NavigateOpenURL                 0x11200 /* Item leading to the Open URL dialogue */
#define NavigateHome                    0x11201 /* Go to Home page                       */
#define NavigateBack                    0x11202 /* Go back in local history              */
#define NavigateForward                 0x11203 /* Go forward in local history           */
#define NavigateReload                  0x11204 /* Reload this page                      */
#define NavigateLoadAllImages           0x11205 /* Load all images                       */
#define NavigateStopAllFetches          0x11206 /* Stop all fetches                      */

/* Navigate menu event codes */

#define ENavigateToBeShown              0x113ff

/* Hotlist menu (from document menu) component IDs */

#define HotlistShowHotlist              0x11400
#define HotlistAddThisPage              0x11401
#define HotlistRemoveThisPage           0x11402
#define HotlistSaveHotlist              0x11403

/* Hotlist menu event codes (NB for showing the hotlist, */
/* use EButtonBarViewHotlist, and for adding items use   */
/* EButtonBarAddToHotlist).                              */

#define EHotlistRemoveThisPage          0x11402
#define EHotlistSaveHotlist             0x11403

#define EHotlistToBeShown               0x115ff
#define EHotlistHidden                  0x115fe
#define EHotlistCancelDrag              0x115fd

#define EHotlistSelectAll               0x115fc
#define EHotlistClearSelect             0x115fb
#define EHotlistOpenAll                 0x115fa
#define EHotlistCloseAll                0x115f9
#define EHotlistDelete                  0x115f8
#define EHotlistShowDescriptions        0x115f7
#define EHotlistShowURLs                0x115f6

/* Utilities menu component IDs */

#define UtilsFindText                   0x11600
#define UtilsURLBar                     0x11601
#define UtilsButtonBar                  0x11602
#define UtilsStatusBar                  0x11603
#define UtilsUnderlineLinks             0x11604
#define UtilsUseDocumentColours         0x11605
#define UtilsShowForegroundImages       0x11606
#define UtilsShowBackgroundImages       0x11607
#define UtilsFullScreen                 0x11608

/* Utilities menu event codes */

#define EUtilsToBeShown                 0x117ff

/* Main hotlist window - miscellaneous menu component IDs. These */
/* are largely independent of other browser operation and so     */
/* only those that absolutely must to be here are included.      */

#define MiscHotlistSaveObject           0x11800

/* History menu component IDs */

#define HistorySaveLocal                0x11a00
#define HistorySaveGlobal               0x11a01
#define HistoryEmptyLocal               0x11a02
#define HistoryEmptyGlobal              0x11a03
#define HistoryEmptyImage               0x11a04

/* History menu event codes */

#define EHistoryToBeShown               0x11bff

/* Help menu event codes */

#define EHelpFromHelpString             0x11dff
#define EHelpReleaseNotes               0x11dfe
#define EHelpAboutPage                  0x11dfd

/* (The range 0x11d00 to 0x11d7f map to Controls file entries */
/* JumpTo00 to JumpTo7f which hold URLs to go to - this event */
/* may thus be used to command a jump to a specific URL from  */
/* any source, not just a menu item. This event is trapped    */
/* through the handle_miscellaneous_event function.           */

#define EHelpGenericBase                0x11d00
#define EHelpGenericTop                 0x11d7f

/* Function prototypes */

int            menus_item_selected          (int eventcode,ToolboxEvent * event,IdBlock * idb,void * handle);
int            menus_toggle_tick            (ObjectId o, ComponentId c);

int            menus_show_main              (int eventcode,ToolboxEvent * event,IdBlock * idb,void * handle);
int            menus_show_utils             (int eventcode,ToolboxEvent * event,IdBlock * idb,void * handle);
int            menus_show_file              (int eventcode,ToolboxEvent * event,IdBlock * idb,void * handle);
int            menus_show_navigate          (int eventcode,ToolboxEvent * event,IdBlock * idb,void * handle);
int            menus_show_choices           (int eventcode,ToolboxEvent * event,IdBlock * idb,void * handle);
int            menus_show_export            (int eventcode,ToolboxEvent * event,IdBlock * idb,void * handle);
int            menus_show_document          (int eventcode,ToolboxEvent * event,IdBlock * idb,void * handle);
int            menus_show_history           (int eventcode,ToolboxEvent * event,IdBlock * idb,void * handle);

int            menus_hide_document          (int eventcode,ToolboxEvent * event,IdBlock * idb,void * handle);
int            menus_close_document_if_mine (browser_data * b);

HStream      * menus_document_opened_over   (void);
browser_data * menus_document_over_browser  (void);


int            menus_help_from_help_string  (int eventcode, ToolboxEvent * event, IdBlock * idb, void * handle);
int            menus_help_release_notes     (int eventcode, ToolboxEvent * event, IdBlock * idb, void * handle);
int            menus_help_about_page        (int eventcode, ToolboxEvent * event, IdBlock * idb, void * handle);
void           menus_help_miscellaneous     (browser_data * b, int which);