0024157: Parallelization of assembly part of BO
[occt.git] / src / IFSelect / IFSelect_EditForm.cdl
CommitLineData
b311480e 1-- Created on: 1998-02-23
2-- Created by: Christian CAILLET
3-- Copyright (c) 1998-1999 Matra Datavision
4-- Copyright (c) 1999-2012 OPEN CASCADE SAS
5--
6-- The content of this file is subject to the Open CASCADE Technology Public
7-- License Version 6.5 (the "License"). You may not use the content of this file
8-- except in compliance with the License. Please obtain a copy of the License
9-- at http://www.opencascade.org and read it completely before using this file.
10--
11-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13--
14-- The Original Code and all software distributed under the License is
15-- distributed on an "AS IS" basis, without warranty of any kind, and the
16-- Initial Developer hereby disclaims all such warranties, including without
17-- limitation, any warranties of merchantability, fitness for a particular
18-- purpose or non-infringement. Please see the License for the specific terms
19-- and conditions governing the rights and limitations under the License.
20
7fd59977 21
22
23class EditForm from IFSelect inherits TShared
24
25 ---Purpose : An EditForm is the way to apply an Editor on an Entity or on
26 -- the Model
27 -- It gives read-only or read-write access, with or without undo
28 --
29 -- It can be complete (all the values of the Editor are present)
30 -- or partial (a sub-list of these value are present)
31 -- Anyway, all references to Number (argument <num>) refer to
32 -- Number of Value for the Editor
33 -- While references to Rank are for rank in the EditForm, which
34 -- may differ if it is not Complete
35 -- Two methods give the correspondance between this Number and
36 -- the Rank in the EditForm : RankFromNumber and NumberFromRank
37 --
38
39uses CString, Transient,
40 AsciiString from TCollection,
41 HAsciiString from TCollection,
42 Array1OfInteger from TColStd,
43 SequenceOfInteger from TColStd,
44 Array1OfTransient from TColStd,
45 HSequenceOfHAsciiString from TColStd,
46 Messenger from Message,
47 InterfaceModel from Interface,
48 Editor from IFSelect, ListEditor from IFSelect
49
50is
51
52 Create (editor : Editor; readonly : Boolean; undoable : Boolean;
53 label : CString = "") returns EditForm;
54 ---Purpose : Creates a complete EditForm from an Editor
55 -- A specific Label can be given
56
57 Create (editor : Editor; nums : SequenceOfInteger;
58 readonly : Boolean; undoable : Boolean;
59 label : CString = "") returns EditForm;
60 ---Purpose : Creates an extracted EditForm from an Editor, limited to
61 -- the values identified in <nums>
62 -- A specific Label can be given
63
64 EditKeepStatus (me : mutable) returns Boolean;
65 ---Purpose : Returns and may change the keep status on modif
66 -- It starts as False
67 -- If it is True, Apply does not clear modification status
68 -- and the EditForm can be loaded again, modified value remain
69 -- and may be applied again
70 -- Remark that ApplyData does not clear the modification status,
71 -- a call to ClearEdit does
72 ---C++ : return &
73
74 Label (me) returns CString;
75
76 IsLoaded (me) returns Boolean;
77 ---Purpose : Tells if the EditForm is loaded now
78
79 ClearData (me : mutable);
80
81 SetData (me : mutable; ent : Transient; model : InterfaceModel);
82
83 SetEntity (me : mutable; ent : Transient);
84
85 SetModel (me : mutable; model : InterfaceModel);
86
87 Entity (me) returns Transient;
88
89 Model (me) returns InterfaceModel;
90
91 Editor (me) returns Editor;
92
93 IsComplete (me) returns Boolean;
94 ---Purpose : Tells if an EditForm is complete or is an extract from Editor
95
96 NbValues (me; editable : Boolean) returns Integer;
97 ---Purpose : Returns the count of values
98 -- <editable> True : count of editable values, i.e.
99 -- For a complete EditForm, it is given by the Editor
100 -- Else, it is the length of the extraction map
101 -- <editable> False : all the values from the Editor
102
103 NumberFromRank (me; rank : Integer) returns Integer;
104 ---Purpose : Returns the Value Number in the Editor from a given Rank in
105 -- the EditForm
106 -- For a complete EditForm, both are equal
107 -- Else, it is given by the extraction map
108 -- Returns 0 if <rank> exceeds the count of editable values,
109
110 RankFromNumber (me; number : Integer) returns Integer;
111 ---Purpose : Returns the Rank in the EditForm from a given Number of Value
112 -- for the Editor
113 -- For a complete EditForm, both are equal
114 -- Else, it is given by the extraction map
115 -- Returns 0 if <number> is not forecast to be edited, or is
116 -- out of range
117
118 NameNumber (me; name : CString) returns Integer;
119 ---Purpose : Returns the Value Number in the Editor for a given Name
120 -- i.e. the true ValueNumber which can be used in various methods
121 -- of EditForm
122 -- If it is not complete, for a recorded (in the Editor) but
123 -- non-loaded name, returns negative value (- number)
124
125 NameRank (me; name : CString) returns Integer;
126 ---Purpose : Returns the Rank of Value in the EditForm for a given Name
127 -- i.e. if it is not complete, for a recorded (in the Editor) but
128 -- non-loaded name, returns 0
129
130
131 LoadDefault (me : mutable);
132 ---Purpose : For a read-write undoable EditForm, loads original values
133 -- from defaults stored in the Editor
134
135 LoadData (me : mutable; ent : Transient; model : InterfaceModel)
136 returns Boolean is virtual;
137 ---Purpose : Loads modifications to data
138 -- Default uses Editor. Can be redefined
139 -- Remark that <ent> and/or <model> may be null, according to the
140 -- kind of Editor. Shortcuts are available for these cases, but
141 -- they finally call LoadData (hence, just ignore non-used args)
142
143 LoadEntity (me : mutable; ent : Transient) returns Boolean;
144 ---Purpose : Shortcut for LoadData when <model> is not used
145
146 LoadModel (me : mutable; model : InterfaceModel) returns Boolean;
147 ---Purpose : Shortcut for LoadData when only the model is concerned
148
149 LoadData (me : mutable) returns Boolean;
150 ---Purpose : Shortcut when both <ent> and <model> are not used
151 -- (when the Editor works on fully static or global data)
152
153
154
155 ListEditor (me; num : Integer) returns ListEditor;
156 ---Purpose : Returns a ListEditor to edit the parameter <num> of the
157 -- EditForm, if it is a List
158 -- The Editor created it (by ListEditor) then loads it (by
159 -- ListValue)
160 -- For a single parameter, returns a Null Handle ...
161
162 LoadValue (me : mutable; num : Integer; val : HAsciiString);
163 ---Purpose : Loads an original value (single). Called by the Editor only
164
165 LoadList (me : mutable; num : Integer; list : HSequenceOfHAsciiString);
166 ---Purpose : Loads an original value as a list. Called by the Editor only
167
168 OriginalValue (me; num : Integer) returns HAsciiString;
169 ---Purpose : From an edited value, returns its ... value (original one)
170 -- Null means that this value is not defined
171 -- <num> is for the EditForm, not the Editor
172 -- It is for a single parameter. For a list, gives a Null Handle
173
174 OriginalList (me; num : Integer) returns HSequenceOfHAsciiString;
175 ---Purpose : Returns an original value, as a list
176 -- <num> is for the EditForm, not the Editor
177 -- For a single parameter, gives a Null Handle
178
179
180 EditedValue (me; num : Integer) returns HAsciiString;
181 ---Purpose : Returns the Edited (i.e. Modified) Value (string for single)
182 -- <num> reports to the EditForm
183 -- If IsModified is False, returns OriginalValue
184 -- Null with IsModified True : means that this value is not
185 -- defined or has been removed
186 -- It is for a single parameter. For a list, gives a Null Handle
187
188 EditedList (me; num : Integer) returns HSequenceOfHAsciiString;
189 ---Purpose : Returns the Edited Value as a list
190 -- If IsModified is False, returns OriginalValue
191 -- Null with IsModified True : means that this value is not
192 -- defined or has been removed
193 -- For a single parameter, gives a Null Handle
194
195 IsModified (me; num : Integer) returns Boolean;
196 ---Purpose : Tells if a Value (of the EditForm) is modified (directly or
197 -- through touching by Update)
198
199 IsTouched (me; num : Integer) returns Boolean;
200 ---Purpose : Tells if a Value (of the EditForm) has been touched, i.e.
201 -- not modified directly but by the modification of another one
202 -- (by method Update from the Editor)
203
204 Modify (me : mutable; num : Integer; newval : HAsciiString;
205 enforce : Boolean = Standard_False) returns Boolean;
206 ---Purpose : Gives a new value for the item <num> of the EditForm, if
207 -- it is a single parameter (for a list, just returns False)
208 -- Null means to Remove it
209 -- <enforce> True to overpass Protected or Computed Access Mode
210 -- Calls the method Update from the Editor, which can touch other
211 -- parameters (see NbTouched)
212 -- Returns True if well recorded, False if this value is not
213 -- allowed
214 -- Warning : Does not apply immediately : will be applied by the method
215 -- Apply
216
217 ModifyList (me : mutable; num : Integer; edited : ListEditor;
218 enforce : Boolean = Standard_False) returns Boolean;
219 ---Purpose : Changes the value of an item of the EditForm, if it is a List
220 -- (else, just returns False)
221 -- The ListEditor contains the edited values of the list
222 -- If no edition was recorded, just returns False
223 -- Calls the method Update from the Editor, which can touch other
224 -- parameters (see NbTouched)
225 -- Returns True if well recorded, False if this value is not
226 -- allowed
227 -- Warning : Does not apply immediately : will be applied by the method
228 -- Apply
229
230 ModifyListValue (me : mutable; num : Integer; list : HSequenceOfHAsciiString;
231 enforce : Boolean = Standard_False) returns Boolean;
232 ---Purpose : As ModifyList but the new value is given as such
233 -- Creates a ListEditor, Loads it, then calls ModifyList
234
235 Touch (me : mutable; num : Integer; newval : HAsciiString) returns Boolean;
236 ---Purpose : Gives a new value computed by the Editor, if another parameter
237 -- commands the value of <num>
238 -- It is generally the case for a Computed Parameter for instance
239 -- Increments the counter of touched parameters
240 -- Warning : it gives no protection for ReadOnly etc... while it is the
241 -- internal way of touching parameters
242 -- Does not work (returns False) if <num> is for a list
243
244 TouchList (me : mutable; num : Integer; newlist : HSequenceOfHAsciiString)
245 returns Boolean;
246 ---Purpose : Acts as Touch but for a list
247 -- Does not work (returns False) if <num> is for a single param
248
249 NbTouched (me) returns Integer;
250 ---Purpose : Returns the count of parameters touched by the last Modify
251 -- (apart from the modified parameter itself)
252 -- Normally it is zero
253
254 ClearEdit (me : mutable; num : Integer = 0);
255 ---Purpose : Clears modification status : by default all, or one by its
256 -- numbers (in the Editor)
257
258
259 PrintDefs (me; S : Messenger from Message);
260 ---Purpose : Prints Definitions, relative to the Editor
261
262 PrintValues (me; S : Messenger from Message; what : Integer;
263 names : Boolean; alsolist : Boolean = Standard_False);
264 ---Purpose : Prints Values, according to what and alsolist
265 -- <names> True : prints Long Names; False : prints Short Names
266 -- <what> < 0 : prints Original Values (+ flag Modified)
267 -- <what> > 0 : prints Final Values (+flag Modified)
268 -- <what> = 0 : prints Modified Values (Original + Edited)
269 -- <alsolist> False (D) : lists are printed only as their count
270 -- <alsolist> True : lists are printed for all their items
271
272
273 Apply (me : mutable) returns Boolean;
274 ---Purpose : Applies modifications to own data
275 -- Calls ApplyData then Clears Status according EditKeepStatus
276
277 -- Specific methods : they work with the Editor (which provides the
278 -- specific behavior) but they can be redefined
279
280 Recognize (me) returns Boolean is virtual;
281 ---Purpose : Tells if this EditForm can work with its Editor and its actual
282 -- Data (Entity and Model)
283 -- Default uses Editor. Can be redefined
284
285 ApplyData (me : mutable; ent : Transient; model : InterfaceModel)
286 returns Boolean is virtual;
287 ---Purpose : Applies modifications to data
288 -- Default uses Editor. Can be redefined
289
290 Undo (me : mutable) returns Boolean;
291 ---Purpose : For an undoable EditForm, Applies ... origibal values !
292 -- and clears modified ones
293 -- Can be run only once
294
295fields
296
297 thecomplete : Boolean; -- complete ? else see thenums for mapping
298 theloaded : Boolean; -- loaded ?
299 thekeepst : Boolean; -- to keep edits
300 thelabel : AsciiString;
301 thenums : Array1OfInteger;
302 theorigs : Array1OfTransient;
303 themodifs : Array1OfTransient;
304 thestatus : Array1OfInteger;
305 theeditor : Editor;
306 theent : Transient;
307 themodel : InterfaceModel;
308 thetouched : Integer;
309
310end EditForm;