Don't call ReadArgs() if started from WB.
[tangerine.git] / compiler / alib / hotkey.c
blob7b157fd5fda2e0c0de995ba310103cb3302f8bcf
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 /*****************************************************************************
8 NAME */
10 #include <proto/exec.h>
11 #include <proto/commodities.h>
12 #include <libraries/commodities.h>
14 extern struct Library *CxBase;
16 CxObj *HotKey(
18 /* SYNOPSIS */
19 STRPTR description,
20 struct MsgPort *port,
21 LONG id
24 /* FUNCTION
25 A simple way to get a hotkey for your program. The program is
26 posted a message when the user does the specified input action in
27 'description' regardless of whether the program has input focus or
28 not. The key combination event is swallowed, that is not sent any
29 farther in the input system.
31 It's recommended that the user should be able to specify a
32 program's hotkey with tooltypes, for instance
33 HOTKEY="alt shift f5".
35 INPUTS
36 description -- commodities filter description (see
37 commodities.library/SetFilter())
38 port -- message port the hotkey messages will be sent to
39 id -- identifier (see CxSender())
41 RESULT
42 A pointer to a filter object which represents the HotKey.
44 NOTES
45 Commodities.library must be open at the time of the call.
47 EXAMPLE
49 BUGS
51 SEE ALSO
52 CxFilter(), CxTranslate(), CxSender(), commodities.library/SetFilter(),
53 commodities.library/CxObjError()
55 INTERNALS
57 HISTORY
59 26.04.98 SDuvan implemented
61 *****************************************************************************/
63 CxObj *filter; /* The objects making up the hotkey */
64 CxObj *sender; /* functionality... */
65 CxObj *translator;
67 if((filter = CxFilter(description)) == NULL)
68 return NULL;
70 if((sender = CxSender(port, id)) == NULL)
72 DeleteCxObj(filter);
73 return NULL;
76 AttachCxObj(filter, sender);
78 /* Create the commodities equivalent of NIL: */
79 if((translator = CxTranslate(NULL)) == NULL)
81 DeleteCxObjAll(filter);
82 return NULL;
85 AttachCxObj(filter, translator);
87 return filter;
89 } /* HotKey */