| // Copyright (c) 1999-2014 OPEN CASCADE SAS | |
| // | |
| // This file is part of Open CASCADE Technology software library. | |
| // | |
| // This library is free software; you can redistribute it and/or modify it under | |
| // the terms of the GNU Lesser General Public License version 2.1 as published | |
| // by the Free Software Foundation, with special exception defined in the file | |
| // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT | |
| // distribution for complete text of the license and disclaimer of any warranty. | |
| // | |
| // Alternatively, this file may be used under the terms of Open CASCADE | |
| // commercial license or contractual agreement. | |
| #include <IFSelect_Act.hxx> | |
| #include <IFSelect_SessionPilot.hxx> | |
| #include <Standard_Type.hxx> | |
| #include <TCollection_AsciiString.hxx> | |
| IMPLEMENT_STANDARD_RTTIEXT(IFSelect_Act, IFSelect_Activator) | |
| static TCollection_AsciiString thedefgr, thedefil; | |
| IFSelect_Act::IFSelect_Act(const char* const name, | |
| const char* const help, | |
| const IFSelect_ActFunc func) | |
| : thename(name), | |
| thehelp(help), | |
| thefunc(func) | |
| { | |
| } | |
| IFSelect_ReturnStatus IFSelect_Act::Do(const int, const occ::handle<IFSelect_SessionPilot>& pilot) | |
| { | |
| if (!thefunc) | |
| { | |
| return IFSelect_RetVoid; | |
| } | |
| return thefunc(pilot); | |
| } | |
| const char* IFSelect_Act::Help(const int) const | |
| { | |
| return thehelp.ToCString(); | |
| } | |
| void IFSelect_Act::SetGroup(const char* const group, const char* const file) | |
| { | |
| thedefgr.Clear(); | |
| if (group[0] != '\0') | |
| { | |
| thedefgr.AssignCat(group); | |
| } | |
| thedefil.Clear(); | |
| if (file[0] != '\0') | |
| { | |
| thedefil.AssignCat(file); | |
| } | |
| } | |
| void IFSelect_Act::AddFunc(const char* const name, | |
| const char* const help, | |
| const IFSelect_ActFunc func) | |
| { | |
| occ::handle<IFSelect_Act> act = new IFSelect_Act(name, help, func); | |
| if (thedefgr.Length() > 0) | |
| { | |
| act->SetForGroup(thedefgr.ToCString()); | |
| } | |
| act->Add(1, name); | |
| } | |
| void IFSelect_Act::AddFSet(const char* const name, | |
| const char* const help, | |
| const IFSelect_ActFunc func) | |
| { | |
| occ::handle<IFSelect_Act> act = new IFSelect_Act(name, help, func); | |
| if (thedefgr.Length() > 0) | |
| { | |
| act->SetForGroup(thedefgr.ToCString(), thedefil.ToCString()); | |
| } | |
| act->AddSet(1, name); | |
| } |