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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _IFSelect_Act_HeaderFile
18 #define _IFSelect_Act_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
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;
34 DEFINE_STANDARD_HANDLE(IFSelect_Act, IFSelect_Activator)
36 //! Act gives a simple way to define and add functions to be ran
37 //! from a SessionPilot, as follows :
39 //! Define a function as
40 //! static IFSelect_RetStatus myfunc
41 //! (const Standard_CString name,
42 //! const Handle(IFSelect_SessionPilot)& pilot)
44 //! When ran, it receives the exact name (string) of the called
45 //! function, and the SessionPilot which brings other infos
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
54 //! Then, it is available for run
55 class IFSelect_Act : public IFSelect_Activator
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);
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;
69 //! Short Help for commands : returns the help given to create
70 Standard_EXPORT Standard_CString Help (const Standard_Integer number) const Standard_OVERRIDE;
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 = "");
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);
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);
88 DEFINE_STANDARD_RTTIEXT(IFSelect_Act,IFSelect_Activator)
98 TCollection_AsciiString thename;
99 TCollection_AsciiString thehelp;
100 IFSelect_ActFunc thefunc;
111 #endif // _IFSelect_Act_HeaderFile