0026936: Drawbacks of inlining in new type system in OCCT 7.0 -- automatic
[occt.git] / src / IFSelect / IFSelect_Act.hxx
1 // Created on: 1996-03-05
2 // Created by: Christian CAILLET
3 // Copyright (c) 1996-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _IFSelect_Act_HeaderFile
18 #define _IFSelect_Act_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <TCollection_AsciiString.hxx>
24 #include <IFSelect_ActFunc.hxx>
25 #include <IFSelect_Activator.hxx>
26 #include <Standard_CString.hxx>
27 #include <IFSelect_ReturnStatus.hxx>
28 #include <Standard_Integer.hxx>
29 class Standard_DomainError;
30 class IFSelect_SessionPilot;
31
32
33 class IFSelect_Act;
34 DEFINE_STANDARD_HANDLE(IFSelect_Act, IFSelect_Activator)
35
36 //! Act gives a simple way to define and add functions to be ran
37 //! from a SessionPilot, as follows :
38 //!
39 //! Define a function as
40 //! static IFSelect_RetStatus myfunc
41 //! (const Standard_CString name,
42 //! const Handle(IFSelect_SessionPilot)& pilot)
43 //! { ... }
44 //! When ran, it receives the exact name (string) of the called
45 //! function, and the SessionPilot which brings other infos
46 //!
47 //! Add it by
48 //! IFSelect_Act::AddFunc (name,help,myfunc);
49 //! for a normal function, or
50 //! IFSelect_Act::AddFSet (name,help,myfunc);
51 //! for a function which is intended to create a control item
52 //! name and help are given as CString
53 //!
54 //! Then, it is available for run
55 class IFSelect_Act : public IFSelect_Activator
56 {
57
58 public:
59
60   
61   //! Creates an Act with a name, help and a function
62   //! mode (Add or AddSet) is given when recording
63   Standard_EXPORT IFSelect_Act(const Standard_CString name, const Standard_CString help, const IFSelect_ActFunc func);
64   
65   //! Execution of Command Line. remark that <number> is senseless
66   //! because each Act brings one and only one function
67   Standard_EXPORT IFSelect_ReturnStatus Do (const Standard_Integer number, const Handle(IFSelect_SessionPilot)& pilot) Standard_OVERRIDE;
68   
69   //! Short Help for commands : returns the help given to create
70   Standard_EXPORT Standard_CString Help (const Standard_Integer number) const Standard_OVERRIDE;
71   
72   //! Changes the default group name for the following Acts
73   //! group empty means to come back to default from Activator
74   //! Also a file name can be precised (to query by getsource)
75   Standard_EXPORT static void SetGroup (const Standard_CString group, const Standard_CString file = "");
76   
77   //! Adds a function with its name and help : creates an Act then
78   //! records it as normal function
79   Standard_EXPORT static void AddFunc (const Standard_CString name, const Standard_CString help, const IFSelect_ActFunc func);
80   
81   //! Adds a function with its name and help : creates an Act then
82   //! records it as function for XSET (i.e. to create control item)
83   Standard_EXPORT static void AddFSet (const Standard_CString name, const Standard_CString help, const IFSelect_ActFunc func);
84
85
86
87
88   DEFINE_STANDARD_RTTIEXT(IFSelect_Act,IFSelect_Activator)
89
90 protected:
91
92
93
94
95 private:
96
97
98   TCollection_AsciiString thename;
99   TCollection_AsciiString thehelp;
100   IFSelect_ActFunc thefunc;
101
102
103 };
104
105
106
107
108
109
110
111 #endif // _IFSelect_Act_HeaderFile