Hotlist 8.57 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
/* 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   : Hotlist.h                              */
/*                                                 */
/* Purpose: Managing a hotlist in the browser.     */
/*                                                 */
/* Author : D.T.A.Brown                            */
/*                                                 */
/* History: 06-Aug-97: Created.                    */
/*          22-Aug-97: (ADH/DTAB) Integrated into  */
/*                     main browser code.          */
/*          25-Aug-97: (ADH) Definitions imported  */
/*                     from TBEvents.h.            */
/***************************************************/

#ifndef REMOTE_HOTLIST

31 32 33
  /* Hotlist dialogue event codes. Reuse of the same dialogue for  */
  /* different actions (e.g. New and Edit URL) make these a little */
  /* unusual.                                                      */
34

35 36 37 38
  #define EHotlistShowNewURL               0x025ff
  #define EHotlistShowEditURL              0x025fe
  #define EHotlistShowNewDirectory         0x025fd
  #define EHotlistShowRenameDirectory      0x025fc
39

40 41 42 43
  #define EHotlistNewEditURLOK             0x025fb
  #define EHotlistNewEditURLCancel         0x025fa
  #define EHotlistNewRenameDirectoryOK     0x025f9
  #define EHotlistNewRenameDirectoryCancel 0x025f8
David Brown's avatar
David Brown committed
44

45 46 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 72 73 74 75 76 77 78 79 80 81 82 83 84 85
  /* Enumerations */

  typedef enum hotlist_type
  {
    hl_directory,
    hl_url,

    /* Special case to allow range checking - must be the last item */

    hl_ALL

  } hotlist_type;

  /* Structures */

  typedef struct hotlist_item
  {
    hotlist_type             type;              /* Item type */
    unsigned int             flags;
    char                   * name;              /* Leaf name (NULL terminated string) */

    union
    {
      char                 * url;               /* Pointer to url (NULL terminated string) */
      struct hotlist_item  * directory_content; /* Pointer to directory contents */
      void                 * generic_data;      /* generic type */

    } data;

    struct hotlist_item    * parent;            /* Points to parent directory or NULL if none      */
    struct hotlist_item    * previous;          /* Points to previous hotlist_item or NULL if none */
    struct hotlist_item    * next;              /* Points to next hotlist_item or NULL if no more  */

  } hotlist_item;

  /* Miscellaneous definitions */

  #define HOTLIST_MAX_TYPE                    hl_url

  #define HOTLIST_G_IS_SELECTED               (1<<0)
  #define HOTLIST_G_REDRAW_NOW                (1<<1)
86
  #define HOTLIST_G_DRAG_SELECTED             (1<<2)
87

88 89
  #define HOTLIST_D_IS_OPEN                   (1<<16)
  #define HOTLIST_D_IS_HIGHLIGHTED            (1<<17)
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126

  #define DIRECTORY_FLAGS                     HOTLIST_G_REDRAW_NOW

  #define URL_FLAGS                           HOTLIST_G_REDRAW_NOW

  #define HOTLIST_SPRITE_ICON_FLAGS           (WimpIcon_Sprite       |   \
                                               WimpIcon_HCentred     |   \
                                               WimpIcon_VCentred     |   \
                                               WimpIcon_Indirected   |   \
                                               WimpIcon_FGColour * 7 |   \
                                               WimpIcon_BGColour * 0)

  #define HOTLIST_TEXT_ICON_FLAGS_SELECTED    (WimpIcon_Text         |   \
                                               WimpIcon_Filled       |   \
                                               WimpIcon_VCentred     |   \
                                               WimpIcon_Indirected   |   \
                                               WimpIcon_FGColour * 1 |   \
                                               WimpIcon_BGColour * 7)

  #define HOTLIST_TEXT_ICON_FLAGS_UNSELECTED  (WimpIcon_Text         |   \
                                               WimpIcon_VCentred     |   \
                                               WimpIcon_Indirected   |   \
                                               WimpIcon_FGColour * 7 |   \
                                               WimpIcon_BGColour * 0)

  #define HOTLIST_TEXT_ICON_FLAGS_DRAG        (WimpIcon_Text         |   \
                                               WimpIcon_Filled       |   \
                                               WimpIcon_VCentred     |   \
                                               WimpIcon_Indirected   |   \
                                               WimpIcon_FGColour * 7 |   \
                                               WimpIcon_BGColour * 1)

  #define HOTLIST_POSITION_BEFORE             0 /* before item */
  #define HOTLIST_POSITION_AFTER              1 /* after item  */
  #define HOTLIST_POSITION_BEGINNING          2 /* beginning of directory */
  #define HOTLIST_POSITION_END                3 /* end of directory */

127
  #define HOTLIST_NOT_DRAGGING                0
128 129 130 131 132 133 134 135 136 137 138 139 140 141
  #define HOTLIST_BOX_DRAG                    1
  #define HOTLIST_SOLID_DRAG_OBJECT           2
  #define HOTLIST_SOLID_DRAG_SPRITE           3
  #define HOTLIST_BOX_DRAG_SELECTION          4

  #define HOTLIST_WINDOW_MIN_WIDTH            480
  #define HOTLIST_WINDOW_MIN_HEIGHT           3       /* In items */

  #define HOTLIST_MENUSECTION_NEW             1
  #define HOTLIST_MENUSECTION_ALTER           2

  #define OPEN_DIRECTORY_SPRITE               "small_diro"
  #define CLOSED_DIRECTORY_SPRITE             "small_dir"
  #define INSERT_DIRECTORY_SPRITE             "small_dir+"
142
  #define URL_SPRITE                          "small_f91"
143 144
  #define SELECTION_SPRITE                    "package"

145 146 147 148 149 150 151
  #define HL_MODIFIED_ADD                     0
  #define HL_MODIFIED_DELETE                  1
  #define HL_MODIFIED_MOVE                    2
  #define HL_MODIFIED_COPY                    3
  #define HL_MODIFIED_LOAD                    4
  #define HL_MODIFIED_ALTER                   5

152 153
  #define HL_SAVE_NONE                        0
  #define HL_SAVE_URI                         1
154
  #define HL_SAVE_HTML                        2
155

156 157 158 159 160 161 162 163 164
  /* Various component IDs */

  #define HOTLIST_URL_MENUITEM                0x05
  #define HOTLIST_SELECTALL_MENUITEM          0x00
  #define HOTLIST_CLEARSELECTION_MENUITEM     0x01
  #define HOTLIST_NEWDIRECTORY_MENUITEM       0x02
  #define HOTLIST_NEWURL_MENUITEM             0x06
  #define HOTLIST_OPENALL_MENUITEM            0x03
  #define HOTLIST_CLOSEALL_MENUITEM           0x04
165 166 167 168
  #define HOTLIST_DISPLAY_MENUITEM            0x07

  #define HOTLIST_MENU_SHOWDESCRIPTIONS       0x00
  #define HOTLIST_MENU_SHOWURLS               0x01
169

170 171
  /* (Use MiscHotlistSaveObject for all of the submenu 'save' items) */

172 173 174 175 176 177 178 179 180 181 182 183 184 185
  #define HOTLIST_RENAME_SUBMENUITEM          0x01
  #define HOTLIST_DELETE_SUBMENUITEM          0x02

  #define HOTLIST_NEWDIRECTORY_NAME           0x01
  #define HOTLIST_NEWDIRECTORY_CANCEL         0x03
  #define HOTLIST_NEWDIRECTORY_NEW            0x02

  #define HOTLIST_NEWURL_NAME                 0x01
  #define HOTLIST_NEWURL_URL                  0x05
  #define HOTLIST_NEWURL_CANCEL               0x03
  #define HOTLIST_NEWURL_NEW                  0x02

  /* Function prototypes */

186 187 188 189 190
  _kernel_oserror * hotlist_initialise           (void);

  _kernel_oserror * hotlist_open                 (int show_type, void * type, int show_urls);
  _kernel_oserror * hotlist_close                (void);
  ObjectId          hotlist_return_window_id     (void);
191

192
  _kernel_oserror * hotlist_load                 (char * filename);
193
  _kernel_oserror * hotlist_add_html_file        (int x, int y, char * path);
194 195
  _kernel_oserror * hotlist_save_hotlist         (char * filename, int type);
  _kernel_oserror * hotlist_save                 (char * filename);
196

197 198
  hotlist_item    * hotlist_find_selected_item   (void);
  unsigned int      hotlist_count_selected_items (void);
199

200 201
  _kernel_oserror * hotlist_add                  (char * description, char * url, int at_bottom);
  _kernel_oserror * hotlist_add_position         (int x, int y, char * description, char * url);
202

203
  _kernel_oserror * hotlist_clear_selection      (void);
204

205 206
  int               hotlist_find_match           (char * buffer, int buffer_size);

207
#endif