|
GLG Toolkit, C / C++ API Library
Version 4.5
|
This group contains functions that may be used to edit and configure objects in the drawing at run time. More...
This group contains functions that may be used to edit and configure objects in the drawing at run time.
Functions | |
| GlgBoolean | GlgConstrainObject (GlgObject from_attribute, GlgObject to_attribute) |
| Constrains an attribute or a point of an object to an attribute or a point of another object. More... | |
| GlgBoolean | GlgDeleteTags (GlgObject object, GlgTagType tag_type_mask) |
| Deletes all object's data tags or all object's public properties. More... | |
| void | GlgReleaseObject (GlgObject object, GlgObject suspend_info) |
| Releases an object that was suspended for editing. More... | |
| void | GlgSetCustomSetupHandler (GlgCustomSetupHandler handler) |
| Installs a custom setup handler that will be invoked to perform custom processing of objects tagged using the CustomSetup flag in the GLG drawing. More... | |
| GlgObject | GlgSuspendObject (GlgObject object) |
| Suspends a drawn object for editing. More... | |
| GlgBoolean | GlgUnconstrainObject (GlgObject attribute) |
| Unconstrains a object's attribute or an object's point. More... | |
| GlgBoolean GlgConstrainObject | ( | GlgObject | from_attribute, |
| GlgObject | to_attribute | ||
| ) |
Constrains an attribute or a point of an object to an attribute or a point of another object.
| from_attribute | The attribute or point object to be constrained. To obtain the object ID of the from_attribute, the GlgGetResourceObject function must be used with a default resource name rather than a user-defined resource name as the last part of resource path. For example, "object1/FillColor" must be used to get the object ID of the FillColor attribute of my_object, and not "my_object/my_color". |
For objects that have a fixed number of control points (Arc, Text, etc.), use the default attribute name ("PointN") to access an object's Nth control point. For objects with a variable number of points (e.g. polygons), use the GlgGetElement or GlgIterate function to get their points and use them as the from_attribute.
| to_attribute | The attribute or the point to constrain to. This object may be queried by using either the default or a user-defined resource name. |
This function constrains the attribute or the point specified by from_attribute to the attribute or the point specified by to_attribute. If two attributes are constrained, changing the value of either attribute changes the values of both. For more information about constraining, see the Constraints section in the Structure of a GLG Drawing chapter of the GLG User's Guide and Builder Reference Manual.
If the object whose from_attribute attribute is being constrained has already been drawn, an error message will be generated. You should either constrain object attributes before drawing the object or use the GlgSuspendObject and GlgReleaseObject functions to temporarily suspend a drawn object for editing.
You cannot constrain any objects beside the attribute objects (a control point is an attribute object as well). The from_attribute and to_attribute attribute objects should be of the same data subtype. That is, you cannot constrain a color attribute object (G type) to the line width attribute object (D type) because they have different data types.
If any of the conditions above are not satisfied, the function fails and returns False. If constraining is successful, the function returns True.
Note that constraining an attribute object causes all the attributes of the attribute object to be identical to the attributes of the object to which it is constrained, including its name, transformation and value. If a transformation is added to an attribute object, it is automatically added to all the attribute objects that are constrained to this attribute object in order to maintain the constraints.
Similarly, if the object name is changed, it is automatically changed for all the objects that are constrained to the object. These changes are permanent and remain in effect even after the constraints are removed.
| GlgBoolean GlgDeleteTags | ( | GlgObject | object, |
| GlgTagType | tag_type_mask | ||
| ) |
Deletes all object's data tags or all object's public properties.
| object | The object to delete the tags from. |
| tag_type_mask | A bitwise mask that defines the type of tags to delete:
|
This function fails if the object has been set up and drawn. The GlgSuspendObject and GlgReleaseObject functions may be used to temporarily suspend an object that has been drawn to perform any modifications that require a hierarchy reset.
Releases an object that was suspended for editing.
| object | The suspended object to be released. |
| suspend_info | Suspension information returned by the previous call to GlgSuspendObject. |
This function releases previously suspended object and is intended to be used only in conjunction with the GlgSuspendObject function.
| void GlgSetCustomSetupHandler | ( | GlgCustomSetupHandler | handler | ) |
Installs a custom setup handler that will be invoked to perform custom processing of objects tagged using the CustomSetup flag in the GLG drawing.
| handler | The custom setup handler function to be invoked. |
A custom setup handler is a function which is invoked at different times during the lifetime of objects tagged using the CustomSetup flag. The handler is invoked for each tagged object with the object passed as a parameter. The handler can perform custom processing based on the information stored in the object.
Custom setup may be used to automate object data tags assignment based on the object ID, or to attach Input and Trace callbacks to objects representing custom widgets that handle user interaction.
The GlgViewer.c and HMIPage.c files in the DEMOS/SCADAViewer directory of GLG installation provide an elaborate example of an application framework that uses a custom setup handler to process special custom widgets.
See GlgCustomSetupHandler for more information.
Suspends a drawn object for editing.
| object | An object to be suspended. |
Some operations, such as attaching a transformation to an object, constraining an object's attribute and some others, may be carried out only before the object has been drawn. If the object has been drawn and you still need to perform these operations, the GlgSuspendObject function must be used to suspend the object for editing. If GlgSuspendObject is not used, any attempt to perform these modifications will fail, producing an error message.
GlgSuspendObject may be called only for the graphical objects, such as a viewport, group, polygon, text, etc.
The GlgReleaseObject function must be called after the editing operations have been completed. If an object is suspended, it is not allowed to call GlgUpdate until the object has been released.
| GlgBoolean GlgUnconstrainObject | ( | GlgObject | attribute | ) |
Unconstrains a object's attribute or an object's point.
| attribute | The attribute or point object to be unconstrained. |
This function removes any constraints applied to an attribute object. Any changes made to the object while it was constrained to another object are permanent and will be in effect even after the constraints are removed. The removal of the constraints only means that changes to this object are no longer copied to the other objects to which it was once constrained.
If any of the objects which are using this attribute object (or any objects with attributes constrained to it) have already been drawn, an error message will be generated. You should either unconstrain object attributes before drawing the object or use the GlgSuspendObject and GlgReleaseObject functions to temporarily suspend a drawn object for editing.