C++ API Library Reference
Public Functions | List of all members
IRenderedView Class Referenceabstract

The IRenderedView interface is used for streaming images from a service application to a view container on a remote client. The interface includes methods for keeping the size of the view in sync between the service and the client, and for handling user input events within the client view.

About View Size
When the client application first launches, PureWeb automatically captures and stores the size of the client-side view's container. From there, in the background it will take care of keeping the service-side and client-side views in sync and responding appropriately to resizing events. As a developer, you only need to choose whether the size of the view on the service should reflect the size of the view on the client, or the other way around. If you want the view size to be based on the client (this is by far the most common approach), use SetClientSize. To match the client-side view to the size of the view on the service, use GetActualSize.
About User Input Events
Whenever the end user interacts with a view using either mouse or keyboard, the client API automatically sends a command to the service with the relevant details. On the service, a built-in handler for this command then calls either postMouseEvent or postKeyEvent. The purpose of these methods is to map the PureWeb client event to its equivalent event on the framework used by the service (Windows Forms, Qt, MFC, and so on).

Because image rendering varies greatly between applications, and because handling of user input events vary between frameworks, it is difficult to provide a one-size fits all description of the methods in this interface. Refer to the sample applications for actual implementation examples.

Public Functions

virtual Size GetActualSize ()=0
virtual void PostKeyEvent (const Ui::PureWebKeyboardEventArgs &keyEvent)=0
virtual void PostMouseEvent (const Ui::PureWebMouseEventArgs &mouseEvent)=0
virtual void RenderView (RenderTarget target)=0
virtual bool RequiresRender ()
virtual void SetClientSize (Size clientSize)=0
Constructors and Destructors
virtual ~IRenderedView ()

Usage Description

virtual Size GetActualSize ( )
pure virtual

Returns the size of this view as it is currently displayed in the service application.

If this size and the client size are different, PureWeb will calculate the size of the buffer provided by RenderView and automatically scale the client-side view appropriately, minimizing bandwidth where possible.

If you prefer to have the service-side view change based on the size of the view on the client, stub out this method and implement SetClientSize instead.

virtual void PostKeyEvent ( const Ui::PureWebKeyboardEventArgs keyEvent)
pure virtualinherited

Posts the specified keyboard event to the receiver.

virtual void PostMouseEvent ( const Ui::PureWebMouseEventArgs mouseEvent)
pure virtualinherited

Posts the specified mouse event to the receiver. Coordinates will be relative to the remote client area, not the local service view area.

virtual void RenderView ( RenderTarget  target)
pure virtual

Streams the specified image to the client-side view container.

Although PureWeb does the actual work of streaming the image, you must tell it where to get that image, and this is the purpose of implementing RenderView. This involves populating the RenderTargetImage parameter of the RenderTarget with the actual image data. See RenderTarget.

virtual bool RequiresRender ( )

Returns true if the view needs to be rendered. This function is only called by PureWeb when the view is registered with the PolledRenders view registration option set to true. The default implementation returns false.

virtual void SetClientSize ( Size  clientSize)
pure virtual

Sets the desired size of the client rendering area, in pixels.

When you use this method, you are telling PureWeb to automatically resize the service-side view whenever a resizing event occurs on the client, for example if the end user resizes the browser window or rotates the device. If you prefer that the client-side view always match the size of the view on the service, stub out this method and implement GetActualSize instead.

clientSizeThe size of the view on the client, which will be used to set the size of the view on the service.