[Classes] [Prev] [Next] [Methods]

CSubview

Methods Index

Heritage
Description
Usage
Protected Data Members
Public Methods
Constructor and Destructor Methods
Visibility State Methods
Activate Events
Enable/Disable Events
Mouse Events
Draw Methods
Printing Methods
Coordinates and Locations
Environment Methods
Glue Methods
Sizing and Dragging Methods
Selection Methods
Utility Methods
Command and Key Methods
Methods for Adding and Removing Subviews
Other Methods
Protected Methods

CSubview


Heritage

Superclass: CView

Subclasses: CGrid, CRadioGroup, CView, CSketchPad, CVirtualFrame, CWindow


Description

CSubview objects are special types of CView objects that have the added ability to contain other nested CSubview objects.

A CSubview object can contain other views within it. Most actions, events, and changes it receives are recursively filtered down to all of the subview's child views. CSubview manages the propagation of some events, such as update (draw) events. If a subview cannot handle an event that has been passed to it, the subview passes the event back up to its enclosing view.

The concept of nested views and enclosures is crucial in XVT-Power++. All CSubview objects except for windows have an object that acts as the enclosure. CSubview objects can nest inside windows-which are themselves a type of subview-as well as inside other views. Each enclosing view establishes its own local coordinate system and clipping properties. Nesting views inside a subview has a stacking effect. When subviews are added to a view, the last one added is the top-most view on the stack.

A common error made by novices to XVT-Power++ is to distinguish between CSubview and its parent class CView. The only difference between the classes is that subviews can contain other nested views. This means that any CView object can itself be nested inside of a CSubview object. In the class hierarchy, the CSubview class is the child of the CView class, whereas in the object hierarchy a CSubview object is the enclosure of a CView object.


Usage

The most important functionality implemented at this level of the XVT-Power++ class hierarchy is event filtering. CSubview contains two different types of event handling methods: the Event and DoEvent methods. To understand the difference, consider the following two event methods:

Event methods are handled by the CSubview object itself, while DoEvent methods are both handled and passed down to the rest of the subviews, which, in turn, pass them on down to any subviews they may contain.


Protected Data Members

RWOrdered* itsSubviews; List of the views it contains
CView* itsSelectedView; The view that should receive events first
CView* itsKeyFocus; The view that receives the keyboard event
RWOrdered itsSelectedViews; List of selected views


Public Methods

Constructor and Destructor Methods

CSubview(CSubview* theEnclosure, 
const CRect& theRegion);
CSubview(const CSubview& theSubview);
CSubview& operator=(const CSubview& theSubview);
virtual ~CSubview(void);

Visibility State Methods

The following two methods are present at the CView level, in addition to Hide and Show, which actually take care of hiding and showing the view. For CView, DoShow and DoHide are present so that XVT-Power++ can achieve a "wide interface" that treats CView and CSubview objects in the same way. At the CSubview level, DoShow and DoHide ensure that the Hide and Show operations are passed on to all of the recursively nested subviews. You must still generate a DoDraw message to see the results.

virtual void DoShow(void);
virtual void DoHide(void);

Activate Events

The following two methods are present at the CView level in addition to Activate and Deactivate, which actually take care of activating and deactivating the view. For CView, DoActivate and DoDeactivate are present so that XVT-Power++ can achieve a "wide interface" that treats CView and CSubview objects in the same way. At the CSubview level, DoActivate and DoDeactivate ensure that the Activate and Deactivate operations are passed on to all of the recursively nested subviews. The events passed are downward-chaining.

virtual void DoActivate(void);
virtual void DoDeactivate(void);

Enable/Disable Events

virtual void DoEnable(void);
virtual void DoDisable(void);

Mouse Events

Mouse events are passed directly to the view at the location where the event occurs. Each of the following methods has a theButton argument that specifies which mouse button is used and can have the values 0 (left), 1 (middle), or 2 (right). By default, neither the Shift key nor the Control key is used in conjunction with the mouse button.

The base mouse methods, which reside at the CView level, have
an argument called theLocation, which marks the location of the cursor when the mouse button was clicked. This point, theLocation, is in local coordinates, that is, coordinates relative
to the view's top-left corner. Like the base mouse methods, the "Do" mouse methods take a parameter named theLocation. However,
for the "Do" methods theLocation is in global, window-relative coordinates. The "Do" methods take the global coordinate, translate it into a local coordinate, and call the corresponding base mouse method. However, at the CSubview level, more computation is required to verify whether the global coordinate is contained in
one of the views.

virtual void DoMouseDouble(CPoint theLocation,
short theButton = 0,
BOOLEAN isShiftKey = FALSE,
BOOLEAN isControlKey = FALSE);
virtual void DoMouseDown(CPoint theLocation,
short theButton = 0,
BOOLEAN isShiftKey = FALSE,
BOOLEAN isControlKey = FALSE);
virtual void DoMouseMove(CPoint theLocation,
short theButton = 0,
BOOLEAN isShiftKey = FALSE,
BOOLEAN isControlKey = FALSE);
virtual void DoMouseUp(CPoint theLocation,
short theButton = 0,
BOOLEAN isShiftKey = FALSE,
BOOLEAN isControlKey = FALSE);

Draw Methods

virtual void DoDraw(
const CRect& theClippingRegion = MAXRect);

Printing Methods

virtual void DoPrintDraw(
const CRect& theClippingRegion);

Coordinates and Locations

virtual void DoSetOrigin(
const CPoint& theDeltaPoint);

Environment Methods

virtual void SetEnvironment(
const CEnvironment& theNewEnvironment,
BOOLEAN isUpdate = FALSE);
virtual void DoSetEnvironment(
const CEnvironment& theNewEnvironment,
BOOLEAN isUpdate = FALSE);
virtual void SetFont(const CFont &theNewFont, 
BOOLEAN isUpdate = FALSE);
virtual void DoSetFont(const CFont &theNewFont, 
BOOLEAN isUpdate = FALSE);

Glue Methods

virtual void DoSetGlue(GLUETYPE theGlue);

Sizing and Dragging Methods

virtual void DoSetDragging(BOOLEAN isDraggable);
virtual void DoSetSizing(BOOLEAN isSizable);

Selection Methods

virtual void SetSelectedView(CView* theSelectedView);
virtual CView* GetSelectedView(void) const;
virtual void AddSelectedView(CView* theView);
virtual void RemoveSelectedView(CView* theView);
virtual const RWOrdered* GetSelectedViews(void);

Utility Methods

virtual void PlaceTopSubview(const CView* theView);
virtual void PlaceBottomSubview(const CView* theView);
virtual CView* FindSubview(const CPoint& theLocation) const;
virtual CView* FindSubview(int theViewId) const;
virtual CView* FindDeepSubview(const CPoint& theLocation) const;
virtual void FindSubviews(
const CPoint& theLocation,
RWOrdered* theList) const;
virtual const RWOrdered* GetSubviews(void) const;
int GetNumViews(void) const;
virtual const RWOrdered* GetSubObjects(void) const;
virtual CView* FindResourceView(
long theContainerId,
long theId) const;

Command and Key Methods

virtual void SetKeyFocus(CView *theFocusedView);
CView* GetKeyFocus(void) const;

Methods for Adding and Removing Subviews

The following methods are called internally by XVT-Power++ classes.

virtual void AddSubview(const CView* theSubview);
virtual void RemoveSubview(const CView* thesubview);

Other Methods

virtual void DoKey(const CKey&);
virtual void DoSize(const CRect& theNewSize);
virtual CPoint AutoScroll(
UNITS theHorizontalChange,
UNITS theVerticalChange);
CView* FindEventTarget(const CPoint& theLocation) const;
virtual void SetEnclosure(CSubview* theEnclosure);

Protected Methods

BOOLEAN ISubview(BOOLEAN isVisible, GLUETYPE theGlue); 


[Classes] [Prev] [Next] [Methods]

support@xvt.com


Visit our online help desk for tech support

Copyright © 2009, Providence Software Solutions Inc. All rights reserved.