42cf5bc1 |
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> |
42cf5bc1 |
21 | |
42cf5bc1 |
22 | #include <IFSelect_ActFunc.hxx> |
23 | #include <IFSelect_Activator.hxx> |
42cf5bc1 |
24 | #include <IFSelect_ReturnStatus.hxx> |
25 | #include <Standard_Integer.hxx> |
42cf5bc1 |
26 | class IFSelect_SessionPilot; |
27 | |
28 | |
29 | class IFSelect_Act; |
30 | DEFINE_STANDARD_HANDLE(IFSelect_Act, IFSelect_Activator) |
31 | |
32 | //! Act gives a simple way to define and add functions to be ran |
33 | //! from a SessionPilot, as follows : |
34 | //! |
35 | //! Define a function as |
36 | //! static IFSelect_RetStatus myfunc |
37 | //! (const Standard_CString name, |
38 | //! const Handle(IFSelect_SessionPilot)& pilot) |
39 | //! { ... } |
40 | //! When ran, it receives the exact name (string) of the called |
41 | //! function, and the SessionPilot which brings other infos |
42 | //! |
43 | //! Add it by |
44 | //! IFSelect_Act::AddFunc (name,help,myfunc); |
45 | //! for a normal function, or |
46 | //! IFSelect_Act::AddFSet (name,help,myfunc); |
47 | //! for a function which is intended to create a control item |
48 | //! name and help are given as CString |
49 | //! |
50 | //! Then, it is available for run |
51 | class IFSelect_Act : public IFSelect_Activator |
52 | { |
53 | |
54 | public: |
55 | |
56 | |
57 | //! Creates an Act with a name, help and a function |
58 | //! mode (Add or AddSet) is given when recording |
59 | Standard_EXPORT IFSelect_Act(const Standard_CString name, const Standard_CString help, const IFSelect_ActFunc func); |
60 | |
61 | //! Execution of Command Line. remark that <number> is senseless |
62 | //! because each Act brings one and only one function |
79104795 |
63 | Standard_EXPORT IFSelect_ReturnStatus Do (const Standard_Integer number, const Handle(IFSelect_SessionPilot)& pilot) Standard_OVERRIDE; |
42cf5bc1 |
64 | |
65 | //! Short Help for commands : returns the help given to create |
79104795 |
66 | Standard_EXPORT Standard_CString Help (const Standard_Integer number) const Standard_OVERRIDE; |
42cf5bc1 |
67 | |
68 | //! Changes the default group name for the following Acts |
69 | //! group empty means to come back to default from Activator |
70 | //! Also a file name can be precised (to query by getsource) |
71 | Standard_EXPORT static void SetGroup (const Standard_CString group, const Standard_CString file = ""); |
72 | |
73 | //! Adds a function with its name and help : creates an Act then |
74 | //! records it as normal function |
75 | Standard_EXPORT static void AddFunc (const Standard_CString name, const Standard_CString help, const IFSelect_ActFunc func); |
76 | |
77 | //! 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 | Standard_EXPORT static void AddFSet (const Standard_CString name, const Standard_CString help, const IFSelect_ActFunc func); |
80 | |
81 | |
82 | |
83 | |
92efcf78 |
84 | DEFINE_STANDARD_RTTIEXT(IFSelect_Act,IFSelect_Activator) |
42cf5bc1 |
85 | |
86 | protected: |
87 | |
88 | |
89 | |
90 | |
91 | private: |
92 | |
93 | |
94 | TCollection_AsciiString thename; |
95 | TCollection_AsciiString thehelp; |
96 | IFSelect_ActFunc thefunc; |
97 | |
98 | |
99 | }; |
100 | |
101 | |
102 | |
103 | |
104 | |
105 | |
106 | |
107 | #endif // _IFSelect_Act_HeaderFile |