summaryrefslogtreecommitdiff
path: root/inc/IFSelect_Editor.hxx
blob: dc9b5018cb00c72912827f02f4ba3dc1427a250d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
// This file is generated by WOK (CPPExt).
// Please do not edit this file; modify original file instead.
// The copyright and license terms as defined for the original file apply to 
// this header file considered to be the "object code" form of the original source.

#ifndef _IFSelect_Editor_HeaderFile
#define _IFSelect_Editor_HeaderFile

#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_DefineHandle_HeaderFile
#include <Standard_DefineHandle.hxx>
#endif
#ifndef _Handle_IFSelect_Editor_HeaderFile
#include <Handle_IFSelect_Editor.hxx>
#endif

#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
#ifndef _Handle_Dico_DictionaryOfInteger_HeaderFile
#include <Handle_Dico_DictionaryOfInteger.hxx>
#endif
#ifndef _TColStd_Array1OfTransient_HeaderFile
#include <TColStd_Array1OfTransient.hxx>
#endif
#ifndef _TColStd_Array1OfAsciiString_HeaderFile
#include <TColStd_Array1OfAsciiString.hxx>
#endif
#ifndef _TColStd_Array1OfInteger_HeaderFile
#include <TColStd_Array1OfInteger.hxx>
#endif
#ifndef _MMgt_TShared_HeaderFile
#include <MMgt_TShared.hxx>
#endif
#ifndef _Handle_Interface_TypedValue_HeaderFile
#include <Handle_Interface_TypedValue.hxx>
#endif
#ifndef _Standard_CString_HeaderFile
#include <Standard_CString.hxx>
#endif
#ifndef _IFSelect_EditValue_HeaderFile
#include <IFSelect_EditValue.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _Handle_Message_Messenger_HeaderFile
#include <Handle_Message_Messenger.hxx>
#endif
#ifndef _Handle_IFSelect_EditForm_HeaderFile
#include <Handle_IFSelect_EditForm.hxx>
#endif
#ifndef _Handle_TCollection_HAsciiString_HeaderFile
#include <Handle_TCollection_HAsciiString.hxx>
#endif
#ifndef _Handle_IFSelect_ListEditor_HeaderFile
#include <Handle_IFSelect_ListEditor.hxx>
#endif
#ifndef _Handle_TColStd_HSequenceOfHAsciiString_HeaderFile
#include <Handle_TColStd_HSequenceOfHAsciiString.hxx>
#endif
#ifndef _Handle_Standard_Transient_HeaderFile
#include <Handle_Standard_Transient.hxx>
#endif
#ifndef _Handle_Interface_InterfaceModel_HeaderFile
#include <Handle_Interface_InterfaceModel.hxx>
#endif
class Dico_DictionaryOfInteger;
class Standard_OutOfRange;
class Interface_TypedValue;
class Message_Messenger;
class TCollection_AsciiString;
class IFSelect_EditForm;
class TCollection_HAsciiString;
class IFSelect_ListEditor;
class TColStd_HSequenceOfHAsciiString;
class Standard_Transient;
class Interface_InterfaceModel;


//! An Editor defines a set of values and a way to edit them, on <br>
//!           an entity or on the model (e.g. on its header) <br>
//! <br>
//!           Each Value is controlled by a TypedValue, with a number (it is <br>
//!           an Integer) and a name under two forms (complete and short) <br>
//!           and an edit mode <br>
class IFSelect_Editor : public MMgt_TShared {

public:

  //! Sets a Typed Value for a given ident and short name, with an <br>
//!           Edit Mode <br>
  Standard_EXPORT     void SetValue(const Standard_Integer num,const Handle(Interface_TypedValue)& typval,const Standard_CString shortname = "",const IFSelect_EditValue accessmode = IFSelect_Editable) ;
  //! Sets a parameter to be a List <br>
//!           max < 0 : not for a list (set when starting) <br>
//!           max = 0 : list with no length limit (default for SetList) <br>
//!           max > 0 : list limited to <max> items <br>
  Standard_EXPORT     void SetList(const Standard_Integer num,const Standard_Integer max = 0) ;
  //! Returns the count of Typed Values <br>
  Standard_EXPORT     Standard_Integer NbValues() const;
  //! Returns a Typed Value from its ident <br>
  Standard_EXPORT     Handle_Interface_TypedValue TypedValue(const Standard_Integer num) const;
  //! Tells if a parameter is a list <br>
  Standard_EXPORT     Standard_Boolean IsList(const Standard_Integer num) const;
  //! Returns max length allowed for a list <br>
//!           = 0 means : list with no limit <br>
//!           < 0 means : not a list <br>
  Standard_EXPORT     Standard_Integer MaxList(const Standard_Integer num) const;
  //! Returns the name of a Value (complete or short) from its ident <br>
//!           Short Name can be empty <br>
  Standard_EXPORT     Standard_CString Name(const Standard_Integer num,const Standard_Boolean isshort = Standard_False) const;
  //! Returns the edit mode of a Value <br>
  Standard_EXPORT     IFSelect_EditValue EditMode(const Standard_Integer num) const;
  //! Returns the number (ident) of a Value, from its name, short or <br>
//!           complete. If not found, returns 0 <br>
  Standard_EXPORT     Standard_Integer NameNumber(const Standard_CString name) const;
  
  Standard_EXPORT     void PrintNames(const Handle(Message_Messenger)& S) const;
  
  Standard_EXPORT     void PrintDefs(const Handle(Message_Messenger)& S,const Standard_Boolean labels = Standard_False) const;
  //! Returns the MaxLength of, according to what : <br>
//!           <what> = -1 : length of short names <br>
//!           <what> =  0 : length of complete names <br>
//!           <what> =  1 : length of values labels <br>
  Standard_EXPORT     Standard_Integer MaxNameLength(const Standard_Integer what) const;
  //! Returns the specific label <br>
  Standard_EXPORT   virtual  TCollection_AsciiString Label() const = 0;
  //! Builds and Returns an EditForm, empty (no data yet) <br>
//!           Can be redefined to return a specific type of EditForm <br>
  Standard_EXPORT   virtual  Handle_IFSelect_EditForm Form(const Standard_Boolean readonly,const Standard_Boolean undoable = Standard_True) const;
  //! Tells if this Editor can work on this EditForm and its content <br>
//!           (model, entity ?) <br>
  Standard_EXPORT   virtual  Standard_Boolean Recognize(const Handle(IFSelect_EditForm)& form) const = 0;
  //! Returns the value of an EditForm, for a given item <br>
//!           (if not a list. for a list, a Null String may be returned) <br>
  Standard_EXPORT   virtual  Handle_TCollection_HAsciiString StringValue(const Handle(IFSelect_EditForm)& form,const Standard_Integer num) const = 0;
  //! Returns a ListEditor for a parameter which is a List <br>
//!           Default returns a basic ListEditor for a List, a Null Handle <br>
//!           if <num> is not for a List. Can be redefined <br>
  Standard_EXPORT   virtual  Handle_IFSelect_ListEditor ListEditor(const Standard_Integer num) const;
  //! Returns the value of an EditForm as a List, for a given item <br>
//!           If not a list, a Null Handle should be returned <br>
//!           Default returns a Null Handle, because many Editors have <br>
//!           no list to edit. To be redefined as required <br>
  Standard_EXPORT   virtual  Handle_TColStd_HSequenceOfHAsciiString ListValue(const Handle(IFSelect_EditForm)& form,const Standard_Integer num) const;
  //! Loads original values from some data, to an EditForm <br>
//!           Remark: <ent> may be Null, this means all <model> is concerned <br>
//!           Also <model> may be Null, if no context applies for <ent> <br>
//!           And both <ent> and <model> may be Null, for a full static <br>
//!           editor <br>
  Standard_EXPORT   virtual  Standard_Boolean Load(const Handle(IFSelect_EditForm)& form,const Handle(Standard_Transient)& ent,const Handle(Interface_InterfaceModel)& model) const = 0;
  //! Updates the EditForm when a parameter is modified <br>
//!           I.E.  default does nothing, can be redefined, as follows : <br>
//!           Returns True when done (even if does nothing), False in case <br>
//!           of refuse (for instance, if the new value is not suitable) <br>
//!           <num> is the rank of the parameter for the EDITOR itself <br>
//!           <enforce> True means that protected parameters can be touched <br>
//! <br>
//!           If a parameter commands the value of other ones, when it is <br>
//!           modified, it is necessary to touch them by Touch from EditForm <br>
  Standard_EXPORT   virtual  Standard_Boolean Update(const Handle(IFSelect_EditForm)& form,const Standard_Integer num,const Handle(TCollection_HAsciiString)& newval,const Standard_Boolean enforce) const;
  //! Acts as Update, but when the value is a list <br>
  Standard_EXPORT   virtual  Standard_Boolean UpdateList(const Handle(IFSelect_EditForm)& form,const Standard_Integer num,const Handle(TColStd_HSequenceOfHAsciiString)& newlist,const Standard_Boolean enforce) const;
  //! Applies modified values of the EditForm with some data <br>
//!           Remark: <ent> may be Null, this means all <model> is concerned <br>
//!           Also <model> may be Null, if no context applies for <ent> <br>
//!           And both <ent> and <model> may be Null, for a full static <br>
//!           editor <br>
  Standard_EXPORT   virtual  Standard_Boolean Apply(const Handle(IFSelect_EditForm)& form,const Handle(Standard_Transient)& ent,const Handle(Interface_InterfaceModel)& model) const = 0;




  DEFINE_STANDARD_RTTI(IFSelect_Editor)

protected:

  //! Prepares the list of Typed Values (gives its count) <br>
//!           This count can be tuned later, to a LOWER value, this allows <br>
//!           to initialize with a "maximum reservation" then cut the extra <br>
  Standard_EXPORT   IFSelect_Editor(const Standard_Integer nbval);
  //! Adjusts the true count of values. It can be LOWER or equal to <br>
//!           the initial size (which then acts as a reservation), but never <br>
//!           greater <br>
  Standard_EXPORT     void SetNbValues(const Standard_Integer nbval) ;



private: 


Standard_Integer thenbval;
Standard_Integer themaxsh;
Standard_Integer themaxco;
Standard_Integer themaxla;
Handle_Dico_DictionaryOfInteger thenames;
TColStd_Array1OfTransient thevalues;
TColStd_Array1OfAsciiString theshorts;
TColStd_Array1OfInteger themodes;
TColStd_Array1OfInteger thelists;


};





// other Inline functions and methods (like "C++: function call" methods)


#endif