| Methods Index |
CBossSubclasses:
CNativeTextEdit, CNativeView, CSubview, CText, CWireFrame
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.
CSubview.
|
| |
friend class
|
CResourceWindow
|
friend class
|
CWireFrame
|
CView constructors are called by the constructors of the classes derived from CView.
CView(CSubview* theEnclosure, const CRect& theRegion,
const CStringRW& theTitle = NULLString);
theEnclosure is a pointer to the subview that will contain the view. theRegion is a coordinate location, local to the enclosure, that is used to place the view. If a title is not passed in, then theTitle will be set to NULLString.
CView(const CView& theView);
CView& operator=(const CView& theView);
virtual ~CView(void);
BOOLEANIView(BOOLEAN isVisible = TRUE,
GLUETYPE theGlue = NULLSTICKY);
virtual BOOLEAN IsVisible(void) const;
BOOLEAN value, which is TRUE if the view is visible and FALSE if the view is invisible.
virtual void Show(void);
virtual void Hide(void);
virtual void DoShow(void);
DoShow is the "wide interface" counterpart of Show. At the CView level, DoShow translates to a simple Show. However, it is overridden by CSubview to implement message passing to all of the subviews.
virtual void DoHide(void);
Hide.
virtual BOOLEAN IsActive(void) const;
BOOLEAN value of TRUE or FALSE.
virtual void Activate(void);
virtual void Deactivate(void);
virtual void DoActivate(void);
Activate message.
virtual void DoDeactivate(void);
Deactivate message.
virtual BOOLEAN IsEnabled(void) const;
TRUE) or disabled (FALSE) so that it cannot receive events.
virtual void Disable(void);
virtual void Enable(void);
virtual void DoEnable(void);
virtual void DoDisable(void);
theLocation, which is 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. Each method also has a theButton argument that specifies which mouse button is used and can have the values 0 (left), 1 (middle), or 2 (right). Typically, if you want to override the default parameters of a method for mouse events, you override the base method, not the "Do" method. For example, you would override the parameters of MouseDown rather than those of DoMouseDown. 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 subviews.
virtual void MouseDown(CPoint theLocation,
short theButton = 0,
BOOLEAN isShiftKey = FALSE,
BOOLEAN isControlKey = FALSE);
theLocation, the view receives and handles this event.
virtual void MouseMove(CPoint theLocation,
short theButton = 0,
BOOLEAN isShiftKey =FALSE,
BOOLEAN isControlKey =FALSE);
theLocation, the view receives and handles this event, whether the mouse button is down or not.
virtual void MouseUp(CPoint theLocation,
short theButton = 0,
BOOLEAN isShiftKey =FALSE,
BOOLEAN isControlKey =FALSE);
theLocation, the view receives and handles this event. This event is not necessarily preceded by a MouseDown or MouseMove event because those button actions may have taken place outside the view.
virtual void MouseDouble(CPoint theLocation,
short theButton = 0,
BOOLEAN isShiftKey = FALSE,
BOOLEAN isControlKey = FALSE);
theLocation, the view receives and handles this event.
virtual void DoMouseDown(CPoint theLocation,
short theButton = 0,
BOOLEAN isShiftKey = FALSE,
BOOLEAN isControlKey = FALSE);
theLocation, the view translates this coordinate into a local coordinate and calls MouseDown.
virtual void DoMouseMove(CPoint theLocation,
short theButton = 0,
BOOLEAN isShiftKey = FALSE,
BOOLEAN isControlKey = FALSE);
theLocation, the view translates this coordinate into a local coordinate and calls MouseMove.
virtual void DoMouseUp(CPoint theLocation,
short theButton = 0,
BOOLEAN isShiftKey = FALSE,
BOOLEAN isControlKey = FALSE);
theLocation, the view translates this coordinate into a local coordinate and calls MouseUp.
virtual void DoMouseDouble(CPoint theLocation,
short theButton = 0,
BOOLEAN isShiftKey = FALSE,
BOOLEAN isControlKey = FALSE);
theLocation, the view translates this coordinate into a local coordinate and calls MouseDouble.
virtual CView* FindHitView(
const CPoint& theLocation) const;
CWireFrame). Whenever a view is about to receive a mouse event, FindHitView is called to find out whether the event should go to the view or to its wire frame.
virtualvoid Invalidate(
const CRect& theFrame = MAXRect);
DoDraw().
virtual void Draw(const CRect& theClippingRegion);
theClippingRegion is the part of the view that needs to be drawn. theClippingRegion is in global, window-relative coordinates. If a CRect is passed in, the clipping region is set to the entire region that the view occupies.
virtual void DoDraw(
const CRect& theClippingRegion = MAXRect);
theClippingRegion is the part of the view that needs to be refreshed, and it is represented in global, window-relative coordinates; if it is set to MAXRect, the entire view is drawn. This method is automatically called after an E_UPDATE event. If a CRect is passed in, the clipping region is set to the entire region that the view occupies.
virtual void Key(const CKey& theKey);
theKey represents the character key that was pressed, including whether the Shift or Control key was pressed at the same time.
virtual void DoKey(const CKey&);
Key() method, where the actual event-handling code should be placed. DoKey() is provided with a CKey object that describes the keyboard event, including information regarding the actual key pressed as well as whether other keys pressed simultaneously (e.g., Shift, Ctl, Alt).
virtual void Size(const CRect& theNewSize);
new width or a new height. The coordinates of the region,
theNewSize, are relative to the enclosure-like the coordinates of the region that is passed in when a view is instantiated.
virtual void DoSize(const CRect& theNewSize);
Size.
virtual void SetFont(const CFont &theNewFont,
BOOLEAN isUpdate = FALSE);
SetFont message with the isUpdate parameter set to TRUE. The isUpdate parameter indicates whether this SetFont message is simply an update message or whether it is a "real" SetFont message meaning that this particular view should set its own font to the new font.
virtual void DoSetFont(const CFont &theNewFont, BOOLEAN isUpdate = FALSE);
SetFont.
virtual BOOLEAN ClassCanGetKeyFocus() const;
ClassCanGetKeyFocus() returns TRUE if the class can accept key focus: that is, a class that does something meaningful with keystrokes. For example, CText, a static text class, does not accept key focus, while NLineText, an editable text class, does accept focus.
virtual BOOLEAN CanGetKeyFocus() const;
CanGetKeyFocus() returns TRUE if an individual object can accept key focus. By default, an object can accept key focus if its class accepts key focus and if the object is visible and enabled. Thus, a disabled NLineText returns TRUE for ClassCanGetKeyFocus()(see above) but FALSE for CanGetKeyFocus().
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);
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;
NListButton and NListEdit, this method is the same as the GetFrame method.
virtual CRect GetGlobalFrame(void) const;
GetFrame()+GetOrigin().
virtual CRect GetClippedFrame(void) const;
CRect) with the coordinates of the visible portion of a clipped view. These coordinates are global, or window-relative. Usually, you will call GetClippedFrame before you call DoDraw in order to pass the smallest region possible to DoDraw. Because Draw and DoDraw take window-relative coordinates, GetClippedFrame returns a window-relative CRect.
virtual CRect GetLocalFrame(void) const;
virtual CPoint GetOrigin(void) const;
virtual CPoint GetGlobalOrigin(void) const;
virtual void SetOrigin(const CPoint& theDeltaPoint);
theDeltaPoint to it. This method should not be used to move a view; to move a view, use the Size method.
virtual void DoSetOrigin(const CPoint& theDeltaPoint);
SetOrigin. This method takes the current origin of the view and adds theDeltaPoint to it, and, then, it does the same thing recursively to the view's subviews.
CEnvironment.
virtual const CEnvironment* GetEnvironment(void) const;
GetEnvironment recurses upward until it finds some environment that is being used and returns it. At the top level, the default environment of the CApplication object is always available.
virtual void SetEnvironment(const CEnvironment& theNewEnvironment, BOOLEAN isUpdate = FALSE);
theNewEnvironment that is passed to it. By default, views share their enclosure's environment. However, as soon as you use SetEnvironment to give a view an environment of its own, the view uses that environment instead of the shared environment. When the global environment is changed, all views sharing that environment get a
SetEnvironment message with the isUpdate parameter set to TRUE. The isUpdate parameter indicates whether this SetEnvironment message is simply an update message or whether it is a "real" SetEnvironment message meaning that this particular view should set its own environment to the new environment.
virtual void DoSetEnvironment(const CEnvironment& theNewEnvironment, BOOLEAN isUpdate = FALSE);
theNewEnvironment. This method is the "wide interface" counterpart of SetEnvironment.When a view's environment is changed with
DoSetEnvironment, all of its nested views get a DoSetEnvironment message with the isUpdate parameter set to TRUE. The isUpdate parameter indicates whether this DoSetEnvironment message is simply an update message or whether it is a "real" DoSetEnvironment message meaning that this particular view should set its own environment to the new environment and pass this change down to all of its child views that are sharing its environment.
virtual BOOLEAN IsEnvironmentShared(void);
FALSE if the view is using an environment of its own.
virtual void SetGlueObject(CGlue* theGlue,
BOOLEAN isDeleteOld = TRUE);
TRUE is passed to isDeleteOld, then the old glue object is deleted. Otherwise, the user must do a GetGlueObject before calling this method and is responsible for deleting the previous glue object.
virtual CGlue* GetGlueObject(void);
virtual GLUETYPE GetGlue(void) const;
virtual void SetGlue(GLUETYPE theGlue);
virtual void DoSetGlue(GLUETYPE theGlue);
SetGlue. It sets the glue type of the view and then recursively sets the glue of the view's subviews to that type.
virtual void Glue();
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;
TRUE if the view can be dragged.
virtual void SetDragging(BOOLEAN isDraggable);
TRUE so that the view can be dragged or to FALSE so that the view cannot be dragged.
virtual void DoSetDragging(BOOLEAN isDraggable);
SetDragging. It sets the dragging for the view and then recursively sets it for the view's subviews.
virtual BOOLEAN IsSizable(void) const;
BOOLEAN value of TRUE if the view can be sized.
virtual void SetSizing(BOOLEAN isSizable);
BOOLEAN value that sets the sizing of a view to TRUE so that the view can be sized or to FALSE so that the view cannot be sized.
virtual void DoSetSizing(BOOLEAN isSizable);
SetSizing. It sets the sizing for the view and then recursively sets it for the view's subviews.
virtual void SetWireFrame(CWireFrame* theNewWireFrame);
virtual CWireFrame* GetWireFrame(void) const;
virtual CWindow* GetCWindow(void) const;
CWindow of the view. Every view must belong to some window, and this method returns a pointer to the window enclosure of the view.
virtual void SetCommand(long theCommand);
SetCommand allows you to set the command for the view.
virtual long GetCommand(void) const;
virtual void SetDoubleCommand(long theCommand);
SetDoubleCommand allows you to set the double command for the view.
virtual long GetDoubleCommand(void) const;
virtual void SetTitle(const CStringRW& theNewTitle);
theNewTitle.
virtual const CStringRW GetTitle(void) const;
NULL.
virtual CSubview* GetEnclosure(void) const;
CSubview object because only CSubview objects can act as enclosures for other views.
virtual void SetEnclosure(CSubview* theEnclosure);
theEnclosure is a CSubview object because only CSubview objects can act as enclosures for other views
virtual WINDOW GetXVTWindow(void) const;
WIN_TYPE GetXVTType(void) const;
virtual BOOLEAN DoPrint(const CRect& theRegion) const;
theRegion specifies the part of the view that is to be drawn in coordinates relative to the enclosure. The part of the view that clips to this region is the part that is actually printed.
virtual void DoPrintDraw(const CRect& theRegion);
DoDraw. It goes through the view's list of subviews, notifying them to print. At the CView level, this is a "wide interface" method. At the CSubview level, there is a DoPrintDraw method that does actually go through the list of subviews and notifies them to print.
virtual void PrintDraw(const CRect& theRegion);
xvt_dwin_draw_* functions. If you were to write your own printer Draw method, it would look just as if you were printing from the screen. You would still print using the view's XVT Portability Toolkit window, which can be obtained through the GetXVTWindow method. GetXVTWindow can return either a regular screen window or a printed window, depending on whether printing is being done. PrintDraw just calls the regular Draw method, and in most cases this is adequate. For some views, however, you may want to modify the way that drawing is done for the printer and not for the screen. In this case, you can override PrintDraw, putting in your own drawing specifications.
virtual const RWOrdered* GetSubObjects(void) const;
CBoss, specifically, CApplication, CDocument, CView, and CSubview. It returns a list of any subobjects associated with a given object. For example, the application would return a list of all its documents, a document would return a list of all its windows, a window would return a list of all its enclosed views, a subview would return a list of all its enclosed views, and so on. At the CView level, this is a "wide interface" method.
virtual void DoCommand(long theCommand,
void* theData=NULL);
DoCommand chain of events, which propagates commands up the XVT-Power++ application framework event hierarchy. The void pointer theData can be used to pass any user-defined structure to the DoCommand method.
CView objects can be handled just like CSubview objects.
virtual CView* FindDeepSubview(const CPoint& theLocation) const;
theLocation. Since CView contains no nested subviews, this method returns NULL.
virtual CView* FindSubview(const CPoint& theLocation) const;
theLocation. If it does not find one-which it does not in the case of CView-it returns NULL.
virtual CView* FindSubview(long theViewId) const;
FindSubview method of CSubview. CViews do not have subviews. Thus, this method always returns NULL.
virtual CView* GetSelectedView(void) const;
CView contains no nested subviews, this method returns NULL.
virtual CView* FindEventTarget(const CPoint& theLocation) const;
theLocation. This method can be overridden by a subview in order to trap all events regardless of the subviews it contains or to change the event targeting algorithm. For example, a list box contains many subviews (text items). When you click on a text item inside a list box, the event does not go to the CText view. Instead, the list box overrides FindEventTarget and traps the event by returning this (itself) as the target for the mouse events received. Then, it treats the mouse events as necessary, without sending them on to its subviews.
virtual const RWOrdered* GetSubviews(void) const;
GetSubviews method of CSubview. CViews do not have subviews. Thus, this method always returns NULL.
virtual CView* FindResourceView(long theContainerId,
long theId) const;
CView*. Note that CViews do not have subviews. Thus, this method always returns NULL when called using a CView container ID.
virtual BOOLEAN HitTest(const CPoint &theLoc) const;
virtual void DoTimer(long theTimerId);
E_TIMER) event. You set a timer using the XVT Portability Toolkit's xvt_timer_create function, which takes a window and a time interval (in milliseconds) and returns an ID number for the timer. This is the ID number passed to theTimerId of DoTimer. When the timer generates a timer event, CSwitchBoard passes it to the XVT Portability Toolkit-designated window via DoTimer. The window passes it on to its selected view, if it has one. The timer event may propagate upwards from a view to the window to the document and all the way to the application object, stopping at any point.
virtual void DoUser(long theUserId, void* theData);
E_USER) event. As noted in the XVT Portability Toolkit Guide, user events allow you to pass custom events to windows and dialogs. theUserId is the ID number that designates a particular kind of user event. The void pointer theData can be used to pass any user-defined structure to DoUser, just as you would for a DoCommand. As with timer events, CSwitchBoard passes a user event to a designated window. The window passes it on to its selected view, if it has one. The timer event may propagate upwards from a view to the window to the document and all the way to the application object, stopping at any point.
virtual void DoUpdateModel(
long theControllerId,
long theCommand,
const CModel* theModel);
DoUpdateModel() supports TDI messages applicable to view classes. These messages act on the view title and include
TDIClearCmd (clear title)
TDIReplaceCmd (replace title)
TDIAppendCmd (append to title)
virtual BOOLEAN Prepare(const CRect& theClippingRegion);
TRUE; it returns FALSE otherwise.
void BuildView(CSubview* theEnclosure,
const CRect& theRegion);
void CopyView(const CView& theView);