Views
Foundation Package API Reference Guide
Product Documentation:
Views Documentation Home
List of all members | Public Member Functions | Protected Member Functions
IlvView::RoundedCornerShape Class Reference

#include <ilviews/base/view.h>

Inheritance diagram for IlvView::RoundedCornerShape:
IlvView::Shape

Public Member Functions

 RoundedCornerShape (IlvDim hRadius, IlvDim vRadius, IlBoolean addTitle=IlFalse)
 Constructor. More...
 
virtual ~RoundedCornerShape ()
 Destructor.
 
void getRadiuses (IlvDim &hRadius, IlvDim &vRadius) const
 Returns the radiuses of rounded corners. More...
 
IlBoolean setRadiuses (IlvDim hRadius, IlvDim vRadius)
 Sets the radiuses of rounded corners. More...
 
- Public Member Functions inherited from IlvView::Shape
IlvViewgetView () const
 Returns the view associated with the shape.
 

Protected Member Functions

virtual IlBoolean apply ()
 Calls the primitive setting the shape on the view. More...
 
virtual void resize (const IlvRect &newRect)
 Called as a resize callback of the view. More...
 
virtual IlBoolean setView (IlvView *view)
 Sets the view on which the shape applies. More...
 
- Protected Member Functions inherited from IlvView::Shape
 Shape (IlBoolean addTitle=IlFalse)
 Constructor. More...
 
virtual ~Shape ()
 Destructor.
 

Detailed Description

Library: xviews or winviews or mviews (mutually exclusive)

This class implements a view shape defined as a rectangle with rounded corners. The rectangle has the width and height of the view. The corners are quarters of an ellipse defined by an horizontal and a vertical radius.

The rounded corners are the ones of the inner view area, not including window decorations and title bar.

When the view dimensions change, the method resize() recomputes the shape area an apply it to the window. The rounded corners keep the same size except when the view is too small to contain them; in this case, the class uses a radius value small enough to fit in the new size.

Constructor & Destructor Documentation

◆ RoundedCornerShape()

IlvView::RoundedCornerShape::RoundedCornerShape ( IlvDim  hRadius,
IlvDim  vRadius,
IlBoolean  addTitle = IlFalse 
)

Constructor.

If addTitle is set to IlTrue, a rectangular area defined by the window title bar is added to the shape. This is only valid for top-level views on Windows platforms.

Parameters
hRadiusThe horizontal radius of the rounded corners.
vRadiusThe vertical radius of the rounded corners.
addTitleSpecifies whether to add the window title area to the shape.

Member Function Documentation

◆ apply()

virtual IlBoolean IlvView::RoundedCornerShape::apply ( )
protectedvirtual

Calls the primitive setting the shape on the view.

This method is called by setView() and should also be called by resize(). Its job is to set the shape of the view by calling IlvAbstracView::setShapeMask(). The definition of the mask depends on the specification of the subclass.

Implements IlvView::Shape.

◆ getRadiuses()

void IlvView::RoundedCornerShape::getRadiuses ( IlvDim hRadius,
IlvDim vRadius 
) const

Returns the radiuses of rounded corners.

Parameters
hRadiusThe returned value of the horizontal radius.
vRadiusThe returned value of the vertical radius.

◆ resize()

virtual void IlvView::RoundedCornerShape::resize ( const IlvRect newRect)
protectedvirtual

Called as a resize callback of the view.

The method should recompute a shape, if necessary. If the shape must be changed, the method should call apply() to replace the previous shape that was fit for the previous size.

Parameters
newRectThe new size of the view.

Implements IlvView::Shape.

◆ setRadiuses()

IlBoolean IlvView::RoundedCornerShape::setRadiuses ( IlvDim  hRadius,
IlvDim  vRadius 
)

Sets the radiuses of rounded corners.

If the Shape is already set on a view, the method recomputes the shape area and sets it on the view by calling apply().

Parameters
hRadiusThe new value of the horizontal radius.
vRadiusThe new value of the vertical radius.
Returns
The value returned by apply(), or IlTrue if the Shape is not set on a view.

◆ setView()

virtual IlBoolean IlvView::RoundedCornerShape::setView ( IlvView view)
protectedvirtual

Sets the view on which the shape applies.

This method is called by IlvView::setShape(). It initializes internal fields and calls apply() so that the shape is actually set on the window.

setView() should not be called by applications except when defining a subclass.

Subclasses may override this method if they want additional setup when the shape is set on a view. In this case, the overriding method should also call setView() of the parent class to ensure proper initialization.

Reimplemented from IlvView::Shape.