Rogue Wave Views 5.6 |
Rogue Wave Views |
Rogue Wave Views Documentation Home |
Graphic class. More...
#include <ilviews/graphics/icon.h>
Public Member Functions | |
IlvTransparentIcon (IlvDisplay *display, const IlvPoint &position, IlvBitmap *bitmap, IlvBitmap *mask, IlvPalette *palette=0) | |
Second constructor. | |
IlvTransparentIcon (IlvDisplay *display, const IlvPoint &position, IlvBitmap *bitmap, IlvPalette *palette=0) | |
First constructor. | |
const char * | className () const |
Returns the class name of an object. | |
virtual IlvGraphic * | copy () const |
Copies this object. | |
virtual IlvClassInfo * | getClassInfo () const |
Gets class information. | |
IlvBitmap * | getMask () const |
Gets the mask used by this transparent icon. | |
IlBoolean | isSubtypeOf (const IlvClassInfo *c) const |
Checks whether this object's class is a subclass. | |
IlBoolean | isSubtypeOf (const char *t) const |
Checks whether this object's class is a subclass of a given parent class. | |
virtual void | setBitmap (IlvBitmap *bitmap) |
Sets the bitmap of this icon. | |
void | setMask (IlvBitmap *bitmap) |
Sets the mask used by this transparent icon. | |
virtual void | write (IlvOutputFile &) const |
Writes an object description to a file. | |
Static Public Member Functions | |
static void | AddProperty (const IlSymbol *k, IlAny v) |
Adds a property to this object's class. | |
static IlAny | GetProperty (const IlSymbol *key, IlBoolean p=((IlBoolean) 0)) |
Retrieves the property value associated with the key in this object's class. | |
static const IlvClassInfo * | HasProperty (const IlSymbol *key, IlBoolean p=((IlBoolean) 0)) |
Checks for the existence of a property for this object's class hierarchy. | |
static IlvGraphic * | read (IlvInputFile &, IlvPalette *pal) |
Reads an object description from a file. | |
static IlBoolean | RemoveProperty (const IlSymbol *key) |
Removes a property from this object's class. | |
static IlBoolean | ReplaceProperty (const IlSymbol *k, IlAny v) |
Replaces a property in this object's class. |
Graphic class.
Library: views
An IlvTransparentIcon
object appears as an image that may have a transparent background. An IlvTransparentIcon
may have transparent areas if its bitmap is monochrome, or has a mask (see IlvBitmap::getMask
). Pixels in the monochrome source bitmap, or in the bitmap mask, that have a zero value do not affect the destination port when the drawing is performed. The other pixels indicate an opaque drawing of the source bitmap.
In the figure below, the transparent regions of the bitmap let the background pattern show through. This process works only for monochrome bitmaps or colored bitmaps that have either a transparency mask or a transparent color index.
IlvBitmap
. IlvTransparentIcon::IlvTransparentIcon | ( | IlvDisplay * | display, | |
const IlvPoint & | position, | |||
IlvBitmap * | bitmap, | |||
IlvPalette * | palette = 0 | |||
) |
First constructor.
This constructor initializes a new IlvTransparentIcon
at an indicated location. This icon is initialized with the provided bitmap. If this bitmap is not monochrome and if it has no mask, Rogue Wave Views will call the method IlvBitmap::computeMask
on that bitmap so that it can be displayed with transparent areas.
display | A pointer to the display object that will display this icon. | |
position | The top-left position of this icon. | |
bitmap | The bitmap used by this icon. This bitmap is referenced by the IlvIcon object; therefore, if you modify the bitmap object, the visible aspect of the IlvIcon takes these changes into account. This bitmap is locked in the constructor and unlocked in the destructor. | |
palette | A pointer to the palette that will be used by this object. If left unspecified or set to 0, the default palette of the display (see IlvDisplay::defaultPalette ) will be used. |
IlvTransparentIcon::IlvTransparentIcon | ( | IlvDisplay * | display, | |
const IlvPoint & | position, | |||
IlvBitmap * | bitmap, | |||
IlvBitmap * | mask, | |||
IlvPalette * | palette = 0 | |||
) |
Second constructor.
This constructor initializes a new IlvTransparentIcon
at an indicated location. This icon is initialized with the provided bitmap and the provided mask. This mask is set to the bitmap (by calling IlvBitmap::setMask
) in the constructor.
display | A pointer to the display object that will display this icon. | |
position | The top-left position of this icon. | |
bitmap | The bitmap used by this icon. This bitmap is referenced by the IlvIcon object; therefore, if you modify the bitmap object, the visible aspect of the IlvIcon takes these changes into account. This bitmap is locked in the constructor and unlocked in the destructor. | |
mask | The mask used by this transparent icon. It must have the same dimensions as bitmap and must be monochrome. | |
palette | A pointer to the palette that will be used by this object. If left unspecified or set to 0, the default palette of the display (see IlvDisplay::defaultPalette ) will be used. |
Adds a property to this object's class.
This static function associates the given value with the given key for the class of this object only.
key | The key to be associated. | |
value | The value to be associated. |
Reimplemented from IlvIcon.
const char* IlvTransparentIcon::className | ( | ) | const |
Returns the class name of an object.
This method is equivalent to getClassInfo()->getClassName()
.
IlvRectangle
object, the className function returns "IlvRectangle"
. Reimplemented from IlvIcon.
virtual IlvGraphic* IlvTransparentIcon::copy | ( | ) | const [virtual] |
Copies this object.
Allocates and returns a copy of this object. If the object is composite, the implementation of this member function makes a copy of the object's components.
IlvPredefinedIOMembers
. Reimplemented from IlvIcon.
virtual IlvClassInfo* IlvTransparentIcon::getClassInfo | ( | ) | const [virtual] |
Gets class information.
Returns a pointer to the IlvClassInfo
object associated with this object's class.
Reimplemented from IlvIcon.
IlvBitmap* IlvTransparentIcon::getMask | ( | ) | const |
Gets the mask used by this transparent icon.
static IlAny IlvTransparentIcon::GetProperty | ( | const IlSymbol * | key, | |
IlBoolean | checkSuperClass = ((IlBoolean) 0) | |||
) | [static] |
Retrieves the property value associated with the key in this object's class.
Retrieves the property value associated with the property name key. If the property cannot be found in the class of this object, and if checkSuperClass is set to IlTrue
, then the function operates iteratively on each superclass until the property is found. If the property cannot be found, then 0
is returned.
key | The key with which the property value is associated. | |
checkSuperClass | IlTrue specifies iterative search on superclasses. |
0
. Reimplemented from IlvIcon.
static const IlvClassInfo* IlvTransparentIcon::HasProperty | ( | const IlSymbol * | key, | |
IlBoolean | checkSuperClass = ((IlBoolean) 0) | |||
) | [static] |
Checks for the existence of a property for this object's class hierarchy.
Retrieves a pointer to the IlvClassInfo
that indicates a class where the key property exists. If the returned value is non-0
, then this property actually exists for this class. If this is not the case and if checkSuperClass is set to IlTrue
, then the function operates iteratively on each superclass until a match is found. If the property cannot be found, then 0
is returned.
key | The key with which the property value is associated. | |
checkSuperClass | IlTrue specifies iterative search on superclasses. |
0
. Reimplemented from IlvIcon.
IlBoolean IlvTransparentIcon::isSubtypeOf | ( | const IlvClassInfo * | classInfo | ) | const |
Checks whether this object's class is a subclass.
This method is equivalent to getClassInfo()->isSubtypeOf(classInfo)
.
classInfo | The name of a class on which the object's class is tested. |
IlTrue
or IlFalse
, depending on whether or not this object's class is a subclass of the class indicated by classInfo. Reimplemented from IlvIcon.
IlBoolean IlvTransparentIcon::isSubtypeOf | ( | const char * | parentClass | ) | const |
Checks whether this object's class is a subclass of a given parent class.
This method is equivalent to getClassInfo()->isSubtypeOf(parentClass)
.
parentClass | A string representing the parent class. |
IlTrue
or IlFalse
, depending on whether or not this object's class inherits parentClass attributes. The parentClass parameter should be a string representing the class name of an IlvGraphic
subclass. A call to this member function for a given class instance returns IlTrue
if given the name of its class. Reimplemented from IlvIcon.
static IlvGraphic* IlvTransparentIcon::read | ( | IlvInputFile & | file, | |
IlvPalette * | palette | |||
) | [static] |
Reads an object description from a file.
Reads an object description from the file input, given the palette graphic attributes. It reads the information that was saved by the member function write
to be able to create a new instance of this object. Usually, because of the availability of the constructor that expects an IlvInputFile
, read should be equivalent to:
IlvGraphic* MyClass::read(IlvInputFile& file, IlvPalette* palette) { return new MyClass(file, palette); }
In the following example, the static member function read
of the IlvLabel
class could have the following form:
IlvGraphic* IlvLabel::read(IlvInputFile& file, IlvPalette* pal) { IlvPoint pos; file.getStream() >> pos; // Read the position field return new IlvLabel(pal->getDisplay(), pos, IlvReadString(file.getStream()), pal); }
file | The name of the file to be read from. | |
palette | The name of the palette for the object. |
DeclareTypeInfoRO
, DeclareTypeInfo
, IlvPredefinedIOMembers
. read
method is not capitalized like other static methods so that it is consistent with the write
method. Reimplemented from IlvIcon.
Removes a property from this object's class.
This static function removes the indicated property to the class of this object.
key | The key property to be removed. |
IlTrue
if the key property was actually found, or IlFalse
otherwise. Reimplemented from IlvIcon.
Replaces a property in this object's class.
This static function replaces the indicated property value to the class of this object.
key | The key to be replaced. | |
value | The value to be replaced. |
IlTrue
if the key property was actually found, or IlFalse
otherwise. Reimplemented from IlvIcon.
virtual void IlvTransparentIcon::setBitmap | ( | IlvBitmap * | bitmap | ) | [virtual] |
Sets the bitmap of this icon.
Associates the IlvIcon
object with a new bitmap. The previous bitmap is unlocked and the new associated bitmap is locked. Note that if you change the bitmap of the icon with one that doesn't have the same dimensions as the previous bitmap, the bounding box of this icon will change.
bitmap | The new bitmap that this icon will display. |
Reimplemented from IlvIcon.
void IlvTransparentIcon::setMask | ( | IlvBitmap * | bitmap | ) |
Sets the mask used by this transparent icon.
bitmap | A pointer to the new bitmap that this object should use. If this bitmap is not monochrome and if it doesn't have a mask, Rogue Wave Views calls IlvBitmap::computeMask on this bitmap so that the transparency effect can take place. |
virtual void IlvTransparentIcon::write | ( | IlvOutputFile & | output | ) | const [virtual] |
Writes an object description to a file.
Writes out, in a file, the object description. This description contains all the information necessary to create an exact copy of this object by means of the member function read
. Information concerning any IlvPalette
object attached to this object is written out by the object containers. All other information, such as the position and size of the object, is written out by this virtual member function.
For example, suppose we have an IlvLabel
class that implements a graphic object drawn as a text string at a given position. It maintains its position in an internal IlvPoint
field called _position
and its textual content in an internal character array field called _text
. The only information we need to save is the contents of those fields. So, the member function write
of such an object should have the following form:
void IlvLabel::write(IlvOutputFile& file) const { // Save the position field file.getStream() << IlvSpc() << _position; // Save the text field IlvWriteString(file.getStream(), _text); }
output | The the output file to be written to. |
DeclareTypeInfo
. Reimplemented from IlvIcon.
© Copyright 2012, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.