Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-05 09:22:34

0001 // Created on: 1996-03-05
0002 // Created by: Christian CAILLET
0003 // Copyright (c) 1996-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _IFSelect_Act_HeaderFile
0018 #define _IFSelect_Act_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 
0022 #include <IFSelect_ActFunc.hxx>
0023 #include <IFSelect_Activator.hxx>
0024 #include <IFSelect_ReturnStatus.hxx>
0025 #include <Standard_Integer.hxx>
0026 class IFSelect_SessionPilot;
0027 
0028 //! Act gives a simple way to define and add functions to be ran
0029 //! from a SessionPilot, as follows :
0030 //!
0031 //! Define a function as
0032 //! static IFSelect_RetStatus myfunc
0033 //! (const char* const name,
0034 //! const occ::handle<IFSelect_SessionPilot>& pilot)
0035 //! { ... }
0036 //! When ran, it receives the exact name (string) of the called
0037 //! function, and the SessionPilot which brings other infos
0038 //!
0039 //! Add it by
0040 //! IFSelect_Act::AddFunc (name,help,myfunc);
0041 //! for a normal function, or
0042 //! IFSelect_Act::AddFSet (name,help,myfunc);
0043 //! for a function which is intended to create a control item
0044 //! name and help are given as CString
0045 //!
0046 //! Then, it is available for run
0047 class IFSelect_Act : public IFSelect_Activator
0048 {
0049 
0050 public:
0051   //! Creates an Act with a name, help and a function
0052   //! mode (Add or AddSet) is given when recording
0053   Standard_EXPORT IFSelect_Act(const char* const      name,
0054                                const char* const      help,
0055                                const IFSelect_ActFunc func);
0056 
0057   //! Execution of Command Line. remark that <number> is senseless
0058   //! because each Act brings one and only one function
0059   Standard_EXPORT IFSelect_ReturnStatus
0060     Do(const int number, const occ::handle<IFSelect_SessionPilot>& pilot) override;
0061 
0062   //! Short Help for commands : returns the help given to create
0063   Standard_EXPORT const char* Help(const int number) const override;
0064 
0065   //! Changes the default group name for the following Acts
0066   //! group empty means to come back to default from Activator
0067   //! Also a file name can be precised (to query by getsource)
0068   Standard_EXPORT static void SetGroup(const char* const group, const char* const file = "");
0069 
0070   //! Adds a function with its name and help : creates an Act then
0071   //! records it as normal function
0072   Standard_EXPORT static void AddFunc(const char* const      name,
0073                                       const char* const      help,
0074                                       const IFSelect_ActFunc func);
0075 
0076   //! Adds a function with its name and help : creates an Act then
0077   //! records it as function for XSET (i.e. to create control item)
0078   Standard_EXPORT static void AddFSet(const char* const      name,
0079                                       const char* const      help,
0080                                       const IFSelect_ActFunc func);
0081 
0082   DEFINE_STANDARD_RTTIEXT(IFSelect_Act, IFSelect_Activator)
0083 
0084 private:
0085   TCollection_AsciiString thename;
0086   TCollection_AsciiString thehelp;
0087   IFSelect_ActFunc        thefunc;
0088 };
0089 
0090 #endif // _IFSelect_Act_HeaderFile