NetSurf
help.c
Go to the documentation of this file.
1/*
2 * Copyright 2013-4 Chris Young <chris@unsatisfactorysoftware.co.uk>
3 *
4 * This file is part of NetSurf, http://www.netsurf-browser.org/
5 *
6 * NetSurf is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * NetSurf is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include "amiga/os3support.h"
20
21#include "amiga/help.h"
22
23/* AmigaGuide class */
24#include "amiga/agclass/amigaguide_class.h"
25
26static Class *AmigaGuideClass = NULL;
27static Object *AmigaGuideObject = NULL;
28
29/* This array needs to match the enum in help.h */
30CONST_STRPTR context_nodes[] = {
31 "Main",
32 "GUI",
33 "Prefs",
34 NULL
35};
36
37static void ami_help_init(struct Screen *screen)
38{
39 AmigaGuideClass = initAGClass();
40
42 AMIGAGUIDE_Name, "PROGDIR:NetSurf.guide",
43 AMIGAGUIDE_BaseName, "NetSurf",
44 AMIGAGUIDE_Screen, screen,
45 AMIGAGUIDE_ContextArray, context_nodes,
46 AMIGAGUIDE_ContextID, AMI_HELP_MAIN,
47 TAG_DONE);
48}
49
50void ami_help_open(ULONG node, struct Screen *screen)
51{
52 if(AmigaGuideObject == NULL) ami_help_init(screen);
53 SetAttrs(AmigaGuideObject, AMIGAGUIDE_ContextID, node, TAG_DONE);
54 IDoMethod(AmigaGuideObject, AGM_OPEN, NULL);
55}
56
57void ami_help_free(void)
58{
59 if (AmigaGuideObject) DisposeObject(AmigaGuideObject);
60 if (AmigaGuideClass) freeAGClass(AmigaGuideClass);
61
62 AmigaGuideObject = NULL;
63 AmigaGuideClass = NULL;
64}
65
66void ami_help_new_screen(struct Screen *screen)
67{
68 if(AmigaGuideObject == NULL) return;
69 SetAttrs(AmigaGuideObject, AMIGAGUIDE_Screen, screen, TAG_DONE);
70}
71
72ULONG ami_help_signal(void)
73{
74 ULONG ag_sig = 0;
76 GetAttr(AMIGAGUIDE_Signal, AmigaGuideObject, &ag_sig);
77 return ag_sig;
78}
79
81{
82 ULONG ret = IDoMethod(AmigaGuideObject, AGM_PROCESS, NULL);
83 if(ret) ami_help_free();
84}
85
CONST_STRPTR context_nodes[]
Definition: help.c:30
void ami_help_new_screen(struct Screen *screen)
Definition: help.c:66
ULONG ami_help_signal(void)
Definition: help.c:72
void ami_help_process(void)
Definition: help.c:80
static void ami_help_init(struct Screen *screen)
Definition: help.c:37
void ami_help_open(ULONG node, struct Screen *screen)
Definition: help.c:50
void ami_help_free(void)
Definition: help.c:57
static Class * AmigaGuideClass
Definition: help.c:26
static Object * AmigaGuideObject
Definition: help.c:27
@ AMI_HELP_MAIN
Definition: help.h:25
APTR NewObject(struct IClass *classPtr, CONST_STRPTR classID, ULONG tagList,...)
Definition: os3support.c:434
Minimal compatibility header for AmigaOS 3.
#define IDoMethod
Definition: os3support.h:169