You may return to the Cvo Object Documenation Index from this document. This document contains the following sections describing the Cvo_ViewPort object:
Cvo_ViewPort
Cvo_Frame
#include
<Cvo/ViewPort.h++>
new
Cvo_ViewPort ( char *resource_name,
{ Cvo_Object *parent | Display *display } )
A Cvo_ViewPort object is a basic object which allows viewing of data with scroll bars in the vertical and/or horizontal directions. A Cvo_ViewPort, though it creates the scroll bars, does not actually register the scroll bars to do anything. In the same manner, the Cvo_ViewPort object does not actually create the "viewport" in which to view things.
The Cvo_ViewPort object permits a Cvo_Window to be registered as the
"main" window using the AddMain()
member function. The "main"
window should contain what will be viewed by the Cvo_ViewPort object,
and it will be reparented such that it is a child of the Cvo_Frame
object within the Cvo_ViewPort object. The Cvo_ScrollBar objects
will match the size of the "main" window.
There are several objects derived from the Cvo_ViewPort, such as Cvo_TextViewPort, Cvo_PaintViewPort, Cvo_TreeViewPort and Cvo_WindowViewPort which are generally the interfaces used instead of this lower level interface.
This object defines the following member functions in addition to those defined by its parent and ancestor objects.
AddVertical (
)
Causes a vertical scroll bar to be added.
AddHorizontal (
)
Causes a horizontal scroll bar to be added.
AddMain (
Cvo_Window *win )
Causes win to become the "main" window of the Cvo_ViewPort. This must be called *before* win has been mapped or created. Typically this done as follows:
Cvo_Window *win = new Cvo_Window("port", parent);
Cvo_ViewPort *tvp = new Cvo_ViewPort("viewport", parent);
tvp->AddMain(win);
Cvo_ScrollBar *Vertical (
)
Returns the vertical Cvo_ScrollBar of the Cvo_ViewPort.
Cvo_ScrollBar *Horizontal (
)
Returns the horizontal Cvo_ScrollBar of the Cvo_ViewPort.
Cvo_Window *Main (
)
Returns the "main" window of the Cvo_ViewPort.
The various Set*Size()
routines on a Cvo_ViewPort will actually
operate on the Cvo_Window object set with AddMain()
, rather than
the Cvo_ViewPort itself.
Your application should supply registration functions for the
CvoScrollBarEvent
on the vertical and horizontal scroll bars and
move the data in the "main" window in response to those events.
This object is composed of the following Cvo objects. Each object has the shown resource name. This link displays the composition of the parent object.
Cvo_Frame
:
*CvoViewPort.upper_part
Cvo_ScrollBar
:
*CvoViewPort.horizontal
Cvo_ScrollBar
:
*CvoViewPort.upper_part.vertical
See the example source code for an example of how to use this object.
See the legend for information about the conventions used in this documentation.