rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Foundation Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IlvGraphicAdapter< ADAPTEE > Class Template Reference

Frame class to adapt any object as an IlvGraphic. More...

#include <ilviews/graphics/adapter.h>

Inheritance diagram for IlvGraphicAdapter< ADAPTEE >:
IlvGraphic

List of all members.

Public Member Functions

 IlvGraphicAdapter (ADAPTEE *obj, IlBoolean owner=((IlBoolean) 0))
 Constructor.
virtual ~IlvGraphicAdapter ()=0
 Destructor.
ADAPTEE *const getAdaptee () const
 Returns a const pointer to the adaptee.
virtual IlBoolean handleEvent (IlvEvent &event, const IlvTransformer *t=0) const =0
 Handles mouse and keyboard events.
IlBoolean isOwner () const
 Returns the ownership property.
void setAdaptee (ADAPTEE *adaptee, IlBoolean owner)
 Sets the adpatee.
virtual void write (IlvOutputFile &os) const =0
 Writes out the object description.

Protected Member Functions

 IlvGraphicAdapter ()
 Constructor.
virtual void afterSetAdaptee ()
 This virtual member function is called after the adaptee is set.
virtual void beforeSetAdaptee ()
 Is called before the adaptee is set.
virtual IlvReferenceStreamer * factory () const =0
 Creates an IlvReferenceStreamer.
virtual void writeAdaptee (IlvOutputFile &os) const =0
 Saves the data specific to the adaptee.

Detailed Description

template<class ADAPTEE>
class IlvGraphicAdapter< ADAPTEE >

Frame class to adapt any object as an IlvGraphic.

Library: views

This template class is intended to be used as a base class (it is a pure abstract class). The parameter of the template ADAPTEE specifies the type of the adpatee object.

Among the member functions inherited from IlvGraphic, the following ones have to be defined:

 virtual void boundingBox(IlvRect&          rect,
                          const IlvTransformer* t = 0) const
 virtual IlBoolean contains(const IlvPoint&   p,
                             const IlvPoint&   tp,
                             const IlvTransformer* t = 0) const;
 virtual void draw(IlvPort*           dst,
                   const IlvTransformer*      t = 0,
                   const IlvRegion*   clip = 0) const;
 virtual void applyTransform(const IlvTransformer* t);

The following member functions are likely to be redefined:

 virtual void drawPalette(const IlvPalette*   pal,
                          IlvPort*            dst,
                          const IlvTransformer*       t = 0,
                          const IlvRegion*    clip = 0) const;
 virtual void setBackground(IlvColor* c);
 virtual void setForeground(IlvColor* c);
 virtual void setFont(IlvFont* f);
 virtual void setColorPattern(IlvColorPattern* b);
 virtual void setGradientPattern(IlvGradientPattern* g);
 virtual void setPattern(IlvPattern* p);
 virtual void setMode(IlvDrawMode m);
 virtual void setArcMode(IlvArcMode m);
 virtual void setFillRule(IlvFillRule m);
 virtual void setFillStyle(IlvFillStyle f);
 virtual void setLineStyle(IlvLineStyle* style);
 virtual void setLineWidth(IlUShort width);
 virtual void setOverwrite(IlBoolean overwrite);
 virtual void setAlpha(IlvIntensity alpha);
 virtual void setAntialiasingMode(IlvAntialiasingMode mode);
 virtual IlBoolean zoomable() const;
 virtual void setPalette(IlvPalette* pal);
 virtual void print(ILVSTDPREF ostream&, int level = 0) const;

Constructor & Destructor Documentation

template<class ADAPTEE>
IlvGraphicAdapter< ADAPTEE >::IlvGraphicAdapter ( ADAPTEE *  obj,
IlBoolean  owner = ((IlBoolean)0) 
)

Constructor.

Initializes the data members specific to the class.

Parameters:
obj A pointer to an ADAPTEE (type given as parameter of the template) IlvGraphic. The type of the object is given as parameter to the template.
owner An IlBoolean. The default value is IlFalse, that means that the adaptee is not owned.
See also:
IlvGraphicAdapter::~IlvGraphicAdapter
IlvGraphicAdapter::isOwner
IlvGraphicAdapter::getAdaptee
IlvGraphicAdapter::setAdaptee
template<class ADAPTEE >
IlvGraphicAdapter< ADAPTEE >::~IlvGraphicAdapter (  )  [pure virtual]

Destructor.

The adaptee is unlocked. If the reference counter is null and has the property owner set to true - that means at least one of the adapters that share this adaptee is owner - then the adaptee is deleted.

See also:
IlvGraphicAdapter::IlvGraphicAdapter
template<class ADAPTEE>
IlvGraphicAdapter< ADAPTEE >::IlvGraphicAdapter (  )  [protected]

Constructor.

This protected constructor may only be used by a derived class.


Member Function Documentation

template<class ADAPTEE>
virtual IlvReferenceStreamer* IlvGraphicAdapter< ADAPTEE >::factory (  )  const [protected, pure virtual]

Creates an IlvReferenceStreamer.

The object returned by this function must be deleted.

Returns:
The reference streamer for the adaptee.

Implemented in IlvGraphicCOMAdapter.

template<class ADAPTEE>
ADAPTEE* const IlvGraphicAdapter< ADAPTEE >::getAdaptee (  )  const

Returns a const pointer to the adaptee.

The type is given by the parameter of the template.

Returns:
A const pointer to an ADAPTEE (type given as parameter of the template).
See also:
IlvGraphicAdapter::setAdapter
template<class ADAPTEE>
virtual IlBoolean IlvGraphicAdapter< ADAPTEE >::handleEvent ( IlvEvent event,
const IlvTransformer t = 0 
) const [pure virtual]

Handles mouse and keyboard events.

The function returns IlFalse if the event has not been dealt with.

Parameters:
event The event to be handled.
Returns:
IlTrue if the event is handled, IlFalse otherwise.

Implemented in IlvGraphicCOMAdapter.

template<class ADAPTEE>
IlBoolean IlvGraphicAdapter< ADAPTEE >::isOwner (  )  const

Returns the ownership property.

Returns:
IlTrue when the object has the ownership of the adaptee, IlFalse otherwise.
See also:
IlvGraphicAdapter::setAdaptee
template<class ADAPTEE>
void IlvGraphicAdapter< ADAPTEE >::setAdaptee ( ADAPTEE *  adaptee,
IlBoolean  owner 
)

Sets the adpatee.

First, this function calls the virtual member function beforeSetAdaptee.

Second it calls the factory of IlvOwnership in order to get an owner object. The previous object, if any, is automatically unlocked through a reference counter mechanism.

Third, it calls the virtual member function afterSetAdaptee.

Parameters:
adaptee A pointer to an ADAPTEE (type given as parameter of the template).
owner An IlBoolean that specifies the ownership of the adaptee.
See also:
IlvGraphicAdapter::getAdaptee
template<class ADAPTEE >
void IlvGraphicAdapter< ADAPTEE >::write ( IlvOutputFile os  )  const [pure virtual]

Writes out the object description.

This member function uses a IlvReferenceStreamer to save the adaptee through a call to template<class OBJECT> void IlvWrite(IlvOwnership<OBJECT>&, IlvOutputFile&, IlvReferenceStreamer&).

The derived classes must save their data after having called this function.

Parameters:
os The IlvOutputFile that is written to.
See also:
IlvGraphicAdapter::writeAdaptee
IlvWrite

Implements IlvGraphic.

Implemented in IlvGraphicCOMAdapter.

template<class ADAPTEE>
virtual void IlvGraphicAdapter< ADAPTEE >::writeAdaptee ( IlvOutputFile os  )  const [protected, pure virtual]

Saves the data specific to the adaptee.

Parameters:
os The IlvOutputFile that is written to.

Implemented in IlvGraphicCOMAdapter.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

© 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.