Toolbars 10.4 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/* 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   : Toolbars.h                             */
17
/*                                                 */
18
/* Purpose: Toolbar-related functions for the      */
19 20
/*          browser.                               */
/*                                                 */
21
/* Author : A.D.Hodgkinson                         */
22 23
/*                                                 */
/* History: 21-Nov-96: Created.                    */
24 25
/*          25-Aug-97: Definitions imported from   */
/*                     TBEvents.h.                 */
26 27
/***************************************************/

28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
/* Button bar component IDs */

#define ButtonBarHome                   0x00001 /* Go to home page                                     */
#define ButtonBarBack                   0x00002 /* Return to previous page in history (if available)   */
#define ButtonBarReload                 0x00003 /* Reload page                                         */
#define ButtonBarStop                   0x00004 /* Stop any current fetch                              */
#define ButtonBarForward                0x00005 /* Go to next page in history list (if available)      */
#define ButtonBarAddToHotlist           0x00006 /* Add the URL to the Hotlist                          */
#define ButtonBarViewHotlist            0x00007 /* View the hotlist                                    */
#define ButtonBarViewResources          0x00008 /* View the resource list                              */
#define ButtonBarLoadImages             0x00009 /* Load images (if they weren't loaded automatically)  */
#define ButtonBarViewSource             0x0000a /* View the page source                                */
#define ButtonBarSaveSource             0x0000b /* Save ancestor document source                       */
#define ButtonBarPrint                  0x0000c /* Print the selected frame contents                   */
#define ButtonBarGoTo                   0x0000d /* Go To button (allows entry of a URL)                */
#define ButtonBarGo                     0x0000e /* Go (companion to above, jumps to URL)               */
#define ButtonBarCancel                 0x0000f /* Cancel a current action                             */
45 46
#define ButtonBarSaveAsText             0x00012 /* Save page as plain text                             */
#define ButtonBarSaveAsDraw             0x00013 /* Save page as a Draw file                            */
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71

#define ButtonBarBistate                0x00010 /* The working gadget of a bistate group of 3 gadgets  */
#define ButtonBarTristate               0x00011 /* The working gadget of a tristate group of 4 gadgets */

#define ButtonBarSpacer                 0x00100 /* Invisible gadget to mark height of bar              */
#define ButtonBarBackground             0x00101 /* Background sprite gadget behind button bar          */

/* Button bar event codes (keep in sync with any associated */
/* component IDs - that way things are easier to remember). */

#define EButtonBarHome                  0x00001
#define EButtonBarBack                  0x00002
#define EButtonBarReload                0x00003
#define EButtonBarStop                  0x00004
#define EButtonBarForward               0x00005
#define EButtonBarAddToHotlist          0x00006
#define EButtonBarViewHotlist           0x00007
#define EButtonBarViewResources         0x00008
#define EButtonBarLoadImages            0x00009
#define EButtonBarViewSource            0x0000a
#define EButtonBarSaveSource            0x0000b
#define EButtonBarPrint                 0x0000c
#define EButtonBarGoTo                  0x0000d
#define EButtonBarGo                    0x0000e
#define EButtonBarCancel                0x0000f
72 73
#define EButtonBarSaveAsText            0x00012
#define EButtonBarSaveAsDraw            0x00013
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108

#define EButtonBarBistate               0x00010
#define EButtonBarTristate              0x00011

/* URL bar component IDs */

#define URLBarWrit                      0x00200 /* Writable gadget in the URL bar             */
#define URLBarLabel                     0x00201 /* Label on writable gadget in URL bar        */
#define URLBarHistoryMenuR              0x00202 /* History menu button (open to the right)    */
#define URLBarHistoryMenuL              0x00203 /* History menu button (open to the left)     */
#define URLBarDiallerStatus             0x00204 /* Dialler status display                     */
#define URLBarDiallerStatusLabel        0x00205 /* Dialler status label button                */
#define URLBarDiallerStatusCover        0x00206 /* Gadget covering the dialler status display */

#define URLBarSpacer                    0x00300 /* Invisible gadget to mark height of bar     */
#define URLBarBackground                0x00301 /* Background sprite gadget behind URL bar    */

/* URL bar event codes */

#define EURLBarToggleHistory            0x00201 /* Acts as if the history menu popup was clicked on; checks to see if */
                                                /* the MenuR gadget is there, then the MenuL, defaults to MenuR. Will */
                                                /* close the menu if it is already open.                              */
#define EURLBarClearURL                 0x003ff /* Clear the URL writable - as with Ctrl+U (must have input focus).   */

/* Status bar component IDs (there are no event codes) */

#define StatusBarAnimBase               0x00400 /* Static component of status bar animation   */
#define StatusBarAnimAnim               0x00401 /* Animated component of status bar animation */
#define StatusBarStatus                 0x00402 /* Main status line                           */
#define StatusBarStatusCover            0x00403 /* Gadget covering the status line            */
#define StatusBarStatusLabel            0x00404 /* Main status line label                     */
#define StatusBarProgress               0x00405 /* Fetch progress display                     */
#define StatusBarProgressCover          0x00406 /* Gadget covering the progress display       */

#define StatusBarSpacer                 0x00500 /* Invisible gadget to mark height of bar     */
109

110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
/* Magic number definitions */

#define InternalBottomLeft 1
#define InternalTopLeft    2
#define ExternalBottomLeft 4
#define ExternalTopLeft    8

/* The range of messages that can be in the status bar. */
/* These are defined in order of priority, the first    */
/* having the lowest. Items which decay are not worked  */
/* out by toolbars_update_status, and must be set       */
/* explicitly with toolbars_update_specific_status.     */

typedef enum status_type
{
  Toolbars_Status_NoType = -1, /* To indicate no current status at all */
  Toolbars_Status_Ready,       /* Just 'ready', no other info          */
  Toolbars_Status_Viewing,     /* Viewing '(URL / title)'              */
  Toolbars_Status_Formatting,  /* Formatting '(URL)'                   */
  Toolbars_Status_Processing,  /* Processing '(URL)'                   */
  Toolbars_Status_GetPics,     /* Number of images being fetched       */
  Toolbars_Status_Fetching,    /* Fetching '(URL)'                     */
132 133 134 135 136
  Toolbars_Status_Connected,   /* Have just connected to server        */
  Toolbars_Status_SentReq,     /* Have sent request to server          */
  Toolbars_Status_Responded,   /* Server's initial response received   */
  Toolbars_Status_Redirected,  /* Browser redirected to new location   */
  Toolbars_Status_Connecting,  /* Trying to connect to a server        */
137
  Toolbars_Status_PlugIn,      /* Showing a Plug-In message            */
138 139 140 141 142 143 144 145 146 147
  Toolbars_Status_LinkTo,      /* Showing a link to something (decays) */
  Toolbars_Status_Help         /* Showing interactive help (decays)    */
}
status_type;

/* Function prototypes */

ObjectId          toolbars_get_upper              (browser_data * b);
ObjectId          toolbars_get_lower              (browser_data * b);

148
void              toolbars_set_presence           (browser_data * b, unsigned int flags);
149 150 151 152 153 154 155 156 157 158 159
void              toolbars_move_gadgets           (browser_data * p);

int               toolbars_animation              (int eventcode, WimpPollBlock * b, IdBlock * idb, browser_data * handle);
int               toolbars_animation_drift        (int eventcode, WimpPollBlock * b, IdBlock * idb, browser_data * handle);
int               toolbars_animate_slow           (int eventcode, WimpPollBlock * b, IdBlock * idb, void * handle);

void              toolbars_hide_cgi               (char * url);
void              toolbars_hide_internal          (char * iurl);

_kernel_oserror * toolbars_update_status          (browser_data * b, status_type type);
_kernel_oserror * toolbars_cancel_status          (browser_data * b, status_type type);
160
_kernel_oserror * toolbars_cancel_all             (browser_data * b);
161 162 163 164 165
int               toolbars_timeout_status         (int eventcode, WimpPollBlock * b, IdBlock * idb, browser_data * handle);
_kernel_oserror * toolbars_remove_status_item     (browser_data * b, browser_data * ancestor);

void              toolbars_update_progress        (browser_data * b);
void              toolbars_update_url             (browser_data * b);
166 167
_kernel_oserror * toolbars_update_dialler_time    (browser_data * b);
_kernel_oserror * toolbars_update_dialler_status  (browser_data * b);
168 169 170 171 172 173 174 175 176 177 178 179

int               toolbars_button_height          (browser_data * b);
int               toolbars_url_height             (browser_data * b);
int               toolbars_status_height          (browser_data * b);

_kernel_oserror * toolbars_set_button_states      (browser_data * b);
_kernel_oserror * toolbars_set_all_button_states  (void);

void              toolbars_merged_to_status       (browser_data * b, ObjectId t);
void              toolbars_merged_to_url          (browser_data * b, ObjectId t);
void              toolbars_set_bistate_state      (browser_data * b, ObjectId t, int state);
void              toolbars_set_tristate_state     (browser_data * b, ObjectId t, int state);