Commit 2c969f45 authored by Andrew Hodgkinson's avatar Andrew Hodgkinson
Browse files

Tidied up Hotlist source a bit

parent f2a7d4b0
This diff is collapsed.
/* 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
/* Dialogue definitions (event codes) */
#define HotlistShowEditURL 0x300b
#define HotlistShowRenameDirectory 0x300c
#define HotlistShowNewURL 0x300d
#define HotlistShowNewDirectory 0x300e
#define HotlistNewEditURLOk 0x300f
#define HotlistNewRenameDirectoryOk 0x3010
#define HotlistNewEditURLCancel 0x3011
#define HotlistNewRenameDirectoryCancel 0x3012
/* Menu definitions (event codes) */
#define ShowHotlist 0x3000
#define AddThisPage 0x3001
#define RemoveThisPage 0x3002
#define SaveHotlist 0x3003
#define HotlistMenuOpened 0x3004
#define HotlistMenuClosed 0x3005
#define HotlistSelectAll 0x3006
#define HotlistClearSelect 0x3007
#define HotlistOpenAll 0x3008
#define HotlistCloseAll 0x3009
#define HotlistDelete 0x300a
/* Enumerations */
typedef enum hotlist_type
{
hl_directory,
hl_url,
/* Special case to allow range checking - must be the last item */
hl_ALL
} hotlist_type;
typedef enum hl_opentype
{
not_open,
already_open
} hl_opentype;
/* 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)
#define HOTLIST_D_HAS_SUBDIRECTORY (1<<16)
#define HOTLIST_D_IS_OPEN (1<<17)
#define HOTLIST_D_IS_HIGHLIGHTED (1<<18)
#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 */
#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+"
#define URL_SPRITE "small_b28"
#define SELECTION_SPRITE "package"
#define HOTLIST_SCROLL_BOUNDARY_SIZE 32
#define HOTLIST_SCROLL_SPEED_MIN 8
#define HOTLIST_SCROLL_SPEED_INC 8
#define HOTLIST_SCROLL_SPEED_MAX 128
/* 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
#define HOTLIST_SAVE_SUBMENUITEM 0x00
#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 */
_kernel_oserror * hotlist_initialise (void);
_kernel_oserror * hotlist_open (int show_type, void * type, int show_urls);
_kernel_oserror * hotlist_close (void);
_kernel_oserror * hotlist_load (char * filename);
_kernel_oserror * hotlist_save (char * filename);
_kernel_oserror * hotlist_add (char * description, char * url, int at_bottom);
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment