1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
15 #include <IFSelect_Act.hxx>
16 #include <IFSelect_SessionPilot.hxx>
17 #include <Standard_DomainError.hxx>
18 #include <Standard_Type.hxx>
19 #include <TCollection_AsciiString.hxx>
21 IMPLEMENT_STANDARD_RTTIEXT(IFSelect_Act,IFSelect_Activator)
23 static TCollection_AsciiString thedefgr, thedefil;
27 IFSelect_Act::IFSelect_Act
28 (const Standard_CString name, const Standard_CString help,
29 const IFSelect_ActFunc func)
30 : thename (name) , thehelp (help) , thefunc (func) { }
32 IFSelect_ReturnStatus IFSelect_Act::Do
33 (const Standard_Integer, const Handle(IFSelect_SessionPilot)& pilot)
35 if (!thefunc) return IFSelect_RetVoid;
36 return thefunc (pilot);
39 Standard_CString IFSelect_Act::Help (const Standard_Integer) const
40 { return thehelp.ToCString(); }
43 void IFSelect_Act::SetGroup
44 (const Standard_CString group, const Standard_CString file)
45 { thedefgr.Clear(); if (group[0] != '\0') thedefgr.AssignCat(group);
46 thedefil.Clear(); if (file [0] != '\0') thedefil.AssignCat(file); }
48 void IFSelect_Act::AddFunc
49 (const Standard_CString name, const Standard_CString help,
50 const IFSelect_ActFunc func)
52 Handle(IFSelect_Act) act = new IFSelect_Act (name,help,func);
53 if (thedefgr.Length() > 0) act->SetForGroup (thedefgr.ToCString());
57 void IFSelect_Act::AddFSet
58 (const Standard_CString name, const Standard_CString help,
59 const IFSelect_ActFunc func)
61 Handle(IFSelect_Act) act = new IFSelect_Act (name,help,func);
62 if (thedefgr.Length() > 0)
63 act->SetForGroup (thedefgr.ToCString(),thedefil.ToCString());