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