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

CView

Methods Index

Heritage
Description
Usage
Protected Data Members
Private Data Members
Friends
Public Methods
Constructor and Destructor Methods
Visibility State Methods
Activate Events
Enable/Disable Events
Mouse Events
Draw Events
Other Events
Scrolling Methods
Coordinates and Locations
Environment Methods
Glue Methods
Dragging and Stretching Methods
Utility Methods
Printing Methods
CBoss Messages and Events
"Wide Interface" Methods
Event Handler Methods
TDI Enabling Method
Protected Methods
Utility Methods

CView


Heritage

Superclass: CBoss

Subclasses: CNativeTextEdit, CNativeView, CSubview, CText, CWireFrame


Description

A view is any object that can be displayed on the screen in a window or inside other views. Views can receive events, commands, and environment changes, and they can become visible/invisible or active/inactive. View objects are instantiated, initialized, and automatically registered with a window or another view. After that, these objects take care of updating, refreshing, handling mouse events, sizing, moving, clipping to enclosures, scrolling, and so on.

All objects in the CView hierarchy can be enabled or disabled, meaning that they can receive events or not receive events. However, even when a view is disabled, it can still receive moving and sizing events. Setting the moving and sizing to TRUE in effect disables a view because that view no longer acts as it usually does-as a button, for example. Instead, it simply acts as an object that is being moved and sized.

One special kind of CView, the subview, has the added ability to contain other views recursively nested within it. To manage the subviews, XVT-Power++ provides different types of methods. One type, the "Do" methods, are message passing functions that propagate events to recursively nested subviews. For example, DoShow propagates the Show message, notifying each nested subview to reveal itself and to propagate the message recursively on down to its nested subviews. This capability for propagation is very important for classes derived from CSubview because subviews often need to propagate a message to all of their nested views.

CView is a more general case because it does not nest subviews. XVT-Power++ is structured so that all viewable objects have the same basic functionality, whether they are a CView or a CSubview. That is, there is a "wide interface" to CView and its derived classes. You do not need to know whether a particular view has subviews. You simply call the "Do" method, and that method propagates through all the views. If the view cannot contain subviews, then it just propagates the message to itself. Every time there is a "Do" method at the CView level, this method has been provided for a "wide interface" so that CView objects can be handled just like CSubview objects, as is often noted in the following discussion of the methods on CView.


Usage

This is an abstract class from which you must derive further classes. For more information, see the derived class CSubview.


Protected Data Members

CStringRW itsTitle The view's title
CRect itsFrame; A view's rectangular border
CPoint itsOrigin; The view's origin for scrolling
CWindow* itsCWindow; The window in which it belongs
long itsCommand; Command to generate upon a mouse click
long itsDoubleCommand; Command to generate upon a double mouse click
CSubview* itsEnclosure; The enclosure to which the object belongs


Private Data Members

CEnvironment* itsEnvironment; Its local environment
BOOLEAN itIsVisible; Whether it is visible within the frame
BOOLEAN itIsEnabled; Whether it can receive events
BOOLEAN itIsActive; Whether it is in an active state
CGlue* itsGlue; The type of glue
CWireFrame* itsWireFrame; The wire frame used for sizing and dragging
static CView* itsClickedView; Used to generate click commands

Friends

friend class CResourceWindow
friend class CWireFrame


Public Methods

Constructor and Destructor Methods

All of the CView constructors are called by the constructors of the classes derived from CView.

CView(CSubview* theEnclosure, const CRect& theRegion,
const CStringRW& theTitle = NULLString);
CView(const CView& theView);
CView& operator=(const CView& theView);
virtual ~CView(void);
BOOLEAN IView(BOOLEAN isVisible = TRUE,
GLUETYPE theGlue = NULLSTICKY);

Visibility State Methods

virtual BOOLEAN IsVisible(void) const;
virtual void Show(void);
virtual void Hide(void);
virtual void DoShow(void);
virtual void DoHide(void);

Activate Events

virtual BOOLEAN IsActive(void) const;
virtual void Activate(void);
virtual void Deactivate(void);
virtual void DoActivate(void);
virtual void DoDeactivate(void);

Enable/Disable Events

virtual BOOLEAN IsEnabled(void) const;
virtual void Disable(void);
virtual void Enable(void);
virtual void DoEnable(void);
virtual void DoDisable(void);

Mouse Events

virtual void MouseDown(CPoint theLocation,
short theButton = 0,
BOOLEAN isShiftKey = FALSE,
BOOLEAN isControlKey = FALSE);
virtual void MouseMove(CPoint theLocation,
short theButton = 0,
BOOLEAN isShiftKey =FALSE,
BOOLEAN isControlKey =FALSE);
virtual void MouseUp(CPoint theLocation,
short theButton = 0,
BOOLEAN isShiftKey =FALSE,
BOOLEAN isControlKey =FALSE);
virtual void MouseDouble(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);
virtual void DoMouseDouble(CPoint theLocation,
short theButton = 0,
BOOLEAN isShiftKey = FALSE,
BOOLEAN isControlKey = FALSE);
virtual CView* FindHitView(
const CPoint& theLocation) const;

Draw Events

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

Other Events

virtual void Key(const CKey& theKey);
virtual void DoKey(const CKey&);
virtual void Size(const CRect& theNewSize);
virtual void DoSize(const CRect& theNewSize);
virtual void SetFont(const CFont &theNewFont, 
BOOLEAN isUpdate = FALSE);
virtual void DoSetFont(const CFont &theNewFont, BOOLEAN isUpdate = FALSE);
virtual BOOLEAN ClassCanGetKeyFocus() const;
virtual BOOLEAN CanGetKeyFocus() const;

Scrolling Methods

The following two methods are called when a scrollbar receives a scrolling event. The event propagates from the scrollbar to its enclosure. theEventType designates the kind of scroll: line up, line down, page up, or page down (the terms "up" and "down" are used for both horizontal and vertical scrolling, though the effects are different for horizontal scrolling). theThumbPosition is the numerical value for placement of the thumb when either thumb repositioning or dynamic thumb tracking is used. These methods are provided simply for "wide interface" purposes.

virtual void VScroll(SCROLL_CONTROL theType,
UNITS thePos);
virtual void HScroll(SCROLL_CONTROL theType,
UNITS thePos);

Coordinates and Locations

CView has several convenient utility methods to get different coordinates that a view might have. It is very important to know whether the coordinates returned by a given method are global, window-relative coordinates; local coordinates that are relative to the view's enclosure; or local coordinates that are relative to the view itself.

See Also: For a description of coordinate spaces for nested views, see "The Point of Origin" section in the "Views and Subviews" chapter of the Guide to XVT Development Solution for C++.

virtual CRect GetFrame(void) const;
virtual CRect GetVisibleFrame(void) const;
virtual CRect GetGlobalFrame(void) const;
virtual CRect GetClippedFrame(void) const;
virtual CRect GetLocalFrame(void) const;
virtual CPoint GetOrigin(void) const;
virtual CPoint GetGlobalOrigin(void) const;
virtual void SetOrigin(const CPoint& theDeltaPoint);
virtual void DoSetOrigin(const CPoint& theDeltaPoint);

Environment Methods

Every view has an environment, which sets such variables as its font type, background and foreground colors, and pen width and pattern. See CEnvironment.

virtual const CEnvironment* GetEnvironment(void) const;
virtual void SetEnvironment(const CEnvironment& theNewEnvironment, BOOLEAN isUpdate = FALSE);
virtual void DoSetEnvironment(const CEnvironment& theNewEnvironment, BOOLEAN isUpdate = FALSE);
virtual BOOLEAN IsEnvironmentShared(void);

Glue Methods

virtual void SetGlueObject(CGlue* theGlue, 
BOOLEAN isDeleteOld = TRUE);
virtual CGlue* GetGlueObject(void);
virtual GLUETYPE GetGlue(void) const;
virtual void SetGlue(GLUETYPE theGlue);
virtual void DoSetGlue(GLUETYPE theGlue);
virtual void Glue();

Dragging and Stretching Methods

"Dragging" and "stretching" take effect when the user clicks on a view to select it, and then drags it or stretches it with the mouse. The last two methods in this section, SetWireFrame and GetWireFrame, pertain to CWireFrame, a helper class used by views. Wire frames are the rubberband frames that appear when you select a view for dragging or stretching. Usually, when you set a view to be draggable or sizable, the view creates a wire frame that it uses for dragging and sizing purposes. You may want to derive a modified wire frame, which draws a little differently or has a different look-and-feel, from the CWireFrame class.

Views can generate these events: WFSelectCmd, WFDeselectCMd, and WFMoveCmd, depending on whether a view is selected, deselected, or moved/sized. DoCommands can pass along data in the form of a void pointer so that view events can send along a pointer to the view object that is selected, deselected, or moved. Thus, you can trap the selection, deselection, or moving of views as these events happen by putting a case in the DoCommands.

virtual BOOLEAN IsDraggable(void) const;
virtual void SetDragging(BOOLEAN isDraggable);
virtual void DoSetDragging(BOOLEAN isDraggable);
virtual BOOLEAN IsSizable(void) const;
virtual void SetSizing(BOOLEAN isSizable);
virtual void DoSetSizing(BOOLEAN isSizable);
virtual void SetWireFrame(CWireFrame* theNewWireFrame);
virtual CWireFrame* GetWireFrame(void) const;

Utility Methods

virtual CWindow* GetCWindow(void) const;
virtual void SetCommand(long theCommand);
virtual long GetCommand(void) const;
virtual void SetDoubleCommand(long theCommand);
virtual long GetDoubleCommand(void) const;
virtual void SetTitle(const CStringRW& theNewTitle);
virtual const CStringRW GetTitle(void) const;
virtual CSubview* GetEnclosure(void) const;
virtual void SetEnclosure(CSubview* theEnclosure);
virtual WINDOW GetXVTWindow(void) const;
WIN_TYPE GetXVTType(void) const;

Printing Methods

virtual BOOLEAN DoPrint(const CRect& theRegion) const;
virtual void DoPrintDraw(const CRect& theRegion);
virtual void PrintDraw(const CRect& theRegion);

CBoss Messages and Events

virtual const RWOrdered* GetSubObjects(void) const;
virtual void DoCommand(long theCommand, 
void* theData=NULL);

"Wide Interface" Methods

The following methods have been provided for a "wide interface" so that CView objects can be handled just like CSubview objects.

virtual CView* FindDeepSubview(const CPoint& theLocation) const;
virtual CView* FindSubview(const CPoint& theLocation) const;
virtual CView* FindSubview(long theViewId) const;
virtual CView* GetSelectedView(void) const;
virtual CView* FindEventTarget(const CPoint& theLocation) const;
virtual const RWOrdered* GetSubviews(void) const;
virtual CView* FindResourceView(long theContainerId, 
long theId) const;
virtual BOOLEAN HitTest(const CPoint &theLoc) const;

Event Handler Methods

virtual void DoTimer(long theTimerId);
virtual void DoUser(long theUserId, void* theData);

TDI Enabling Method

virtual void DoUpdateModel(
long theControllerId,
long theCommand,
const CModel* theModel);

Protected Methods

Utility Methods

virtual BOOLEAN Prepare(const CRect& theClippingRegion);
void BuildView(CSubview* theEnclosure, 
const CRect& theRegion);
void CopyView(const CView& theView);


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

support@xvt.com


Visit our online help desk for tech support

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