b311480e |
1 | -- Created on: 1996-03-05 |
2 | -- Created by: Christian CAILLET |
3 | -- Copyright (c) 1996-1999 Matra Datavision |
4 | -- Copyright (c) 1999-2012 OPEN CASCADE SAS |
5 | -- |
6 | -- The content of this file is subject to the Open CASCADE Technology Public |
7 | -- License Version 6.5 (the "License"). You may not use the content of this file |
8 | -- except in compliance with the License. Please obtain a copy of the License |
9 | -- at http://www.opencascade.org and read it completely before using this file. |
10 | -- |
11 | -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
12 | -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
13 | -- |
14 | -- The Original Code and all software distributed under the License is |
15 | -- distributed on an "AS IS" basis, without warranty of any kind, and the |
16 | -- Initial Developer hereby disclaims all such warranties, including without |
17 | -- limitation, any warranties of merchantability, fitness for a particular |
18 | -- purpose or non-infringement. Please see the License for the specific terms |
19 | -- and conditions governing the rights and limitations under the License. |
20 | |
7fd59977 |
21 | |
22 | |
23 | class Act from IFSelect inherits Activator |
24 | |
25 | ---Purpose : Act gives a simple way to define and add functions to be ran |
26 | -- from a SessionPilot, as follows : |
27 | -- |
28 | -- Define a function as |
29 | -- static IFSelect_RetStatus myfunc |
30 | -- (const Standard_CString name, |
31 | -- const Handle(IFSelect_SessionPilot)& pilot) |
32 | -- { ... } |
33 | -- When ran, it receives the exact name (string) of the called |
34 | -- function, and the SessionPilot which brings other infos |
35 | -- |
36 | -- Add it by |
37 | -- IFSelect_Act::AddFunc (name,help,myfunc); |
38 | -- for a normal function, or |
39 | -- IFSelect_Act::AddFSet (name,help,myfunc); |
40 | -- for a function which is intended to create a control item |
41 | -- name and help are given as CString |
42 | -- |
43 | -- Then, it is available for run |
44 | |
45 | uses CString, AsciiString, SessionPilot, ActFunc, ReturnStatus |
46 | |
47 | raises DomainError |
48 | |
49 | is |
50 | |
51 | Create (name, help : CString; func : ActFunc) returns mutable Act; |
52 | ---Purpose : Creates an Act with a name, help and a function |
53 | -- mode (Add or AddSet) is given when recording |
54 | |
55 | Do (me : mutable; number : Integer; pilot : mutable SessionPilot) |
56 | returns ReturnStatus; |
57 | ---Purpose : Execution of Command Line. remark that <number> is senseless |
58 | -- because each Act brings one and only one function |
59 | |
60 | Help (me; number : Integer) returns CString; |
61 | ---Purpose : Short Help for commands : returns the help given to create |
62 | |
63 | -- to record functions |
64 | |
65 | SetGroup (myclass; group : CString; file : CString = ""); |
66 | ---Purpose : Changes the default group name for the following Acts |
67 | -- group empty means to come back to default from Activator |
68 | -- Also a file name can be precised (to query by getsource) |
69 | |
70 | AddFunc (myclass; name, help : CString; func : ActFunc) |
71 | ---Purpose : Adds a function with its name and help : creates an Act then |
72 | -- records it as normal function |
73 | raises DomainError; |
74 | -- Error if <name> already recorded (see Activator) |
75 | |
76 | AddFSet (myclass; name, help : CString; func : ActFunc) |
77 | ---Purpose : Adds a function with its name and help : creates an Act then |
78 | -- records it as function for XSET (i.e. to create control item) |
79 | raises DomainError; |
80 | -- Error if <name> already recorded (see Activator) |
81 | |
82 | fields |
83 | |
84 | thename : AsciiString; |
85 | thehelp : AsciiString; |
86 | thefunc : ActFunc; |
87 | |
88 | end Act; |