973c2be1 |
1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
2 | // |
973c2be1 |
3 | // This file is part of Open CASCADE Technology software library. |
b311480e |
4 | // |
973c2be1 |
5 | // This library is free software; you can redistribute it and / or modify it |
6 | // under the terms of the GNU Lesser General Public 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. |
b311480e |
10 | // |
973c2be1 |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
b311480e |
13 | |
7fd59977 |
14 | #include <IFSelect_Act.ixx> |
15 | #include <TCollection_AsciiString.hxx> |
16 | |
17 | static TCollection_AsciiString thedefgr, thedefil; |
18 | |
19 | |
20 | |
21 | IFSelect_Act::IFSelect_Act |
22 | (const Standard_CString name, const Standard_CString help, |
23 | const IFSelect_ActFunc func) |
24 | : thename (name) , thehelp (help) , thefunc (func) { } |
25 | |
26 | IFSelect_ReturnStatus IFSelect_Act::Do |
27 | (const Standard_Integer, const Handle(IFSelect_SessionPilot)& pilot) |
28 | { |
29 | if (!thefunc) return IFSelect_RetVoid; |
30 | return thefunc (pilot); |
31 | } |
32 | |
33 | Standard_CString IFSelect_Act::Help (const Standard_Integer) const |
34 | { return thehelp.ToCString(); } |
35 | |
36 | |
37 | void IFSelect_Act::SetGroup |
38 | (const Standard_CString group, const Standard_CString file) |
39 | { thedefgr.Clear(); if (group[0] != '\0') thedefgr.AssignCat(group); |
40 | thedefil.Clear(); if (file [0] != '\0') thedefil.AssignCat(file); } |
41 | |
42 | void IFSelect_Act::AddFunc |
43 | (const Standard_CString name, const Standard_CString help, |
44 | const IFSelect_ActFunc func) |
45 | { |
46 | Handle(IFSelect_Act) act = new IFSelect_Act (name,help,func); |
47 | if (thedefgr.Length() > 0) act->SetForGroup (thedefgr.ToCString()); |
48 | act->Add (1,name); |
49 | } |
50 | |
51 | void IFSelect_Act::AddFSet |
52 | (const Standard_CString name, const Standard_CString help, |
53 | const IFSelect_ActFunc func) |
54 | { |
55 | Handle(IFSelect_Act) act = new IFSelect_Act (name,help,func); |
56 | if (thedefgr.Length() > 0) |
57 | act->SetForGroup (thedefgr.ToCString(),thedefil.ToCString()); |
58 | act->AddSet (1,name); |
59 | } |