7fd59977 |
1 | -- File: IFSelect_Act.cdl |
2 | -- Created: Tue Mar 5 09:44:33 1996 |
3 | -- Author: Christian CAILLET |
4 | -- <cky@fidox> |
5 | ---Copyright: Matra Datavision 1996 |
6 | |
7 | |
8 | class Act from IFSelect inherits Activator |
9 | |
10 | ---Purpose : Act gives a simple way to define and add functions to be ran |
11 | -- from a SessionPilot, as follows : |
12 | -- |
13 | -- Define a function as |
14 | -- static IFSelect_RetStatus myfunc |
15 | -- (const Standard_CString name, |
16 | -- const Handle(IFSelect_SessionPilot)& pilot) |
17 | -- { ... } |
18 | -- When ran, it receives the exact name (string) of the called |
19 | -- function, and the SessionPilot which brings other infos |
20 | -- |
21 | -- Add it by |
22 | -- IFSelect_Act::AddFunc (name,help,myfunc); |
23 | -- for a normal function, or |
24 | -- IFSelect_Act::AddFSet (name,help,myfunc); |
25 | -- for a function which is intended to create a control item |
26 | -- name and help are given as CString |
27 | -- |
28 | -- Then, it is available for run |
29 | |
30 | uses CString, AsciiString, SessionPilot, ActFunc, ReturnStatus |
31 | |
32 | raises DomainError |
33 | |
34 | is |
35 | |
36 | Create (name, help : CString; func : ActFunc) returns mutable Act; |
37 | ---Purpose : Creates an Act with a name, help and a function |
38 | -- mode (Add or AddSet) is given when recording |
39 | |
40 | Do (me : mutable; number : Integer; pilot : mutable SessionPilot) |
41 | returns ReturnStatus; |
42 | ---Purpose : Execution of Command Line. remark that <number> is senseless |
43 | -- because each Act brings one and only one function |
44 | |
45 | Help (me; number : Integer) returns CString; |
46 | ---Purpose : Short Help for commands : returns the help given to create |
47 | |
48 | -- to record functions |
49 | |
50 | SetGroup (myclass; group : CString; file : CString = ""); |
51 | ---Purpose : Changes the default group name for the following Acts |
52 | -- group empty means to come back to default from Activator |
53 | -- Also a file name can be precised (to query by getsource) |
54 | |
55 | AddFunc (myclass; name, help : CString; func : ActFunc) |
56 | ---Purpose : Adds a function with its name and help : creates an Act then |
57 | -- records it as normal function |
58 | raises DomainError; |
59 | -- Error if <name> already recorded (see Activator) |
60 | |
61 | AddFSet (myclass; name, help : CString; func : ActFunc) |
62 | ---Purpose : Adds a function with its name and help : creates an Act then |
63 | -- records it as function for XSET (i.e. to create control item) |
64 | raises DomainError; |
65 | -- Error if <name> already recorded (see Activator) |
66 | |
67 | fields |
68 | |
69 | thename : AsciiString; |
70 | thehelp : AsciiString; |
71 | thefunc : ActFunc; |
72 | |
73 | end Act; |