Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:53

0001 // Created on: 1993-07-27
0002 // Created by: Christian CAILLET
0003 // Copyright (c) 1993-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_Activator_HeaderFile
0018 #define _IFSelect_Activator_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 
0022 #include <Standard_Transient.hxx>
0023 #include <Standard_Integer.hxx>
0024 #include <TColStd_HSequenceOfAsciiString.hxx>
0025 #include <IFSelect_ReturnStatus.hxx>
0026 class IFSelect_SessionPilot;
0027 
0028 
0029 class IFSelect_Activator;
0030 DEFINE_STANDARD_HANDLE(IFSelect_Activator, Standard_Transient)
0031 
0032 //! Defines the general frame for working with a SessionPilot.
0033 //! Each Activator treats a set of Commands. Commands are given as
0034 //! alphanumeric strings. They can be of two main forms :
0035 //! - classic, to list, evaluate, enrich the session (by itself) :
0036 //! no specific remark, its complete execution must be described
0037 //! - creation of a new item : instead of creatinf it plus adding
0038 //! it to the session (which is a classic way), it is possible
0039 //! to create it and make it recorded by the SessionPilot :
0040 //! then, the Pilot will add it to the session; this way allows
0041 //! the Pilot to manage itself named items
0042 //!
0043 //! In order to make easier the use of Activator, this class
0044 //! provides a simple way to Select an Actor for a Command :
0045 //! each sub-class of SectionActor defines the command titles it
0046 //! recognizes, plus attaches a Number, unique for this sub-class,
0047 //! to each distinct command title.
0048 //!
0049 //! Each time an action is required, the corresponding Number
0050 //! can then be given to help the selection of the action to do.
0051 //!
0052 //! The result of an Execution must indicate if it is worth to be
0053 //! recorded or not : see method Do
0054 class IFSelect_Activator : public Standard_Transient
0055 {
0056 
0057 public:
0058 
0059   
0060   //! Records, in a Dictionary available for all the Activators,
0061   //! the command title an Activator can process, attached with
0062   //! its number, proper for this Activator
0063   //! <mode> allows to distinguish various execution modes
0064   //! 0: default mode; 1 : for xset
0065   Standard_EXPORT static void Adding (const Handle(IFSelect_Activator)& actor, const Standard_Integer number, const Standard_CString command, const Standard_Integer mode);
0066   
0067   //! Allows a self-definition by an Activator of the Commands it
0068   //! processes, call the class method Adding (mode 0)
0069   Standard_EXPORT void Add (const Standard_Integer number, const Standard_CString command) const;
0070   
0071   //! Same as Add but specifies that this command is candidate for
0072   //! xset (creation of items, xset : named items; mode 1)
0073   Standard_EXPORT void AddSet (const Standard_Integer number, const Standard_CString command) const;
0074   
0075   //! Removes a Command, if it is recorded (else, does nothing)
0076   Standard_EXPORT static void Remove (const Standard_CString command);
0077   
0078   //! Selects, for a Command given by its title, an actor with its
0079   //! command number. Returns True if found, False else
0080   Standard_EXPORT static Standard_Boolean Select (const Standard_CString command, Standard_Integer& number, Handle(IFSelect_Activator)& actor);
0081   
0082   //! Returns mode recorded for a command. -1 if not found
0083   Standard_EXPORT static Standard_Integer Mode (const Standard_CString command);
0084   
0085   //! Returns, for a root of command title, the list of possible
0086   //! commands.
0087   //! <mode> : -1 (D) for all commands if <commands> is empty
0088   //! -1 + command : about a Group , >= 0 see Adding
0089   //! By default, it returns the whole list of known commands.
0090   Standard_EXPORT static Handle(TColStd_HSequenceOfAsciiString) Commands (const Standard_Integer mode = -1, const Standard_CString command = "");
0091   
0092   //! Tries to execute a Command Line. <number> is the number of the
0093   //! command for this Activator. It Must forecast to record the
0094   //! result of the execution, for need of Undo-Redo
0095   //! Must Returns : 0 for a void command (not to be recorded),
0096   //! 1 if execution OK, -1 if command incorrect, -2 if error
0097   //! on execution
0098   Standard_EXPORT virtual IFSelect_ReturnStatus Do (const Standard_Integer number, const Handle(IFSelect_SessionPilot)& pilot) = 0;
0099   
0100   //! Sends a short help message for a given command identified by
0101   //! it number for this Activator (must take one line max)
0102   Standard_EXPORT virtual Standard_CString Help (const Standard_Integer number) const = 0;
0103   
0104   Standard_EXPORT Standard_CString Group() const;
0105   
0106   Standard_EXPORT Standard_CString File() const;
0107   
0108   //! Group and SetGroup define a "Group of commands" which
0109   //! correspond to an Activator. Default is "XSTEP"
0110   //! Also a file may be attached
0111   Standard_EXPORT void SetForGroup (const Standard_CString group, const Standard_CString file = "");
0112 
0113 
0114 
0115 
0116   DEFINE_STANDARD_RTTIEXT(IFSelect_Activator,Standard_Transient)
0117 
0118 protected:
0119 
0120   
0121   //! Sets the default values
0122   Standard_EXPORT IFSelect_Activator();
0123 
0124 
0125 
0126 private:
0127 
0128 
0129   TCollection_AsciiString thegroup;
0130   TCollection_AsciiString thefile;
0131 
0132 
0133 };
0134 
0135 
0136 
0137 
0138 
0139 
0140 
0141 #endif // _IFSelect_Activator_HeaderFile