IlvContainer: The Graphic Placeholder Class
IlvContainer is the graphic placeholder class. Its member functions for handling objects within containers are described in:
General-Purpose Member Functions
Some member functions of the IlvContainer class, for example addObject and removeObject, enable you to store and remove objects within containers. (See the Views Reference Manual for more details.) The IlvContainer object stores graphic objects in a list.
Applying Functions to Objects
Additional member functions are used to apply user-defined functions to the container objects. These are:
-
applyToObjects Apply a user-defined function to each object in a IlvContainer.
-
applyToObject Apply a user-defined function to the specified graphic object only.
Tagged Objects
The IlvContainer class provides member functions to manage graphic objects that have been tagged by the user. A tag is a kind of marker represented by an object of the IlSymbol class and which can be associated with several graphic objects:
-
applyToTaggedObjects is similar to the method applyToObjects but is used with tagged objects.
-
getTaggedObjects returns an array of pointers to objects stored in the container which are tagged with the specified tag.
-
removeTaggedObjects removes from the container all the objects tagged with the specified tag.
IlSymbol Class
Views sometimes needs string constants to manipulate specific entities, such as tags. To do this, there is a generic manner of handling unique strings within a given application. The strings are called symbols, and are managed by the IlSymbol class.
The IlGetSymbol global function lets you create new symbols or access symbols already created.
Object Properties
Several member functions of the IlvContainer class let you manage container object properties, such as the functions getObject, setObjectName, and setVisible. For example, it is possible to:
-
Access a graphic object according to different criteria: its name or its index identifier, since the container stores objects in a list.
-
Interchange two objects with respect to their order in the container list (swap method).
-
Request an object’s state of visibility or to change the state. (Visibility refers to whether the object is visible on the screen or not.)
-
Ask by means of the static method GetContainer where a graphic object is stored, that is, in which container. You cannot store an object in more than one container.
Note
Since the member function GetContainer is static, it is not necessary to apply it to an existing instance of IlvContainer. You can use this method from anywhere, with the notation: GetContainer(myobject); |