Taxonomy Categories:
Member Functions:
Interface Category:
API.
Inherits From:
TView
Inherited By:
TBackgroundView
TBoxView
Purpose:
TLayoutView derives from TView and adds the protocol for accessing subviews directly by index instead of always having to use an iterator. Changing the size of an TLayoutView calls the dynamically bound function PlaceAndSizeChildren. This function should be overridden in derived classes to implement a layout strategy. TLayoutView is used by TBoxView and TBackgroundView. TLayoutView has the following features: (1) it's always rectangular and the top/left corner is always (0,0); (2) it draws nothing (its children draw); and (3) it cannot be transformed.
Instantiation:
Always allocate on the heap. Will be adopted to be used.
Deriving Classes:
Deriving classes typically override PlaceAndSizeChildren to implement a specific layout. Derived classes are TBoxView and TBackgroundView.
Concurrency:
Not multithread safe.
Resource Use:
No special requirements.
Member Function: TLayoutView::Count
virtual long Count () const
Interface Category:
API.
Purpose:
Returns the number of subviews this view contains.
Calling Context:
Called from the same thread as the view. You can call this function directly.
Parameters:
Return Value:
Returns the number of subviews.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLayoutView::GetChild
virtual TView * GetChild (long index) const
Interface Category:
API.
Purpose:
Retrieves a subview at a given index.
Calling Context:
Called from the same thread as the view. You can call this function directly.
Parameters:
- long index -The given index.
Return Value:
Returns a TView or NIL if index is out of bounds.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLayoutView::GetBounds
virtual void GetBounds (TGArea & area) const
Interface Category:
API.
Purpose:
Returns the bounds of this view through the parameter. The bounds for TLayoutView are the same as the allocated area.
Calling Context:
Call from the same thread as the view. The area parameter should be created, but its value will be ignored, and the returned area will be returned through the parameter.
Parameters:
- TGArea & area -The bounds of this view as returned by this function. Input value ignored.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
This function is protected.
Member Function: TLayoutView::PlaceAndSizeChildren
virtual void PlaceAndSizeChildren (const TGRect & area)
Interface Category:
API.
Purpose:
Positions and resizes children based on new allocated area.
Calling Context:
Called whenever the size of the view changes.
Parameters:
- const TGRect & area -The new allocated area.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
This function is protected.
Member Function: TLayoutView::HandleAllocatedAreaChanged
virtual void HandleAllocatedAreaChanged (const TGArea & area)
Interface Category:
API.
Purpose:
Positions and resizes this view's child views based on its new allocated area.
Calling Context:
Called whenever the size of the view changes.
Parameters:
- const TGArea & area -The new allocated area for the view.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
This function is protected.
Member Function: TLayoutView::DrawContents
virtual void DrawContents (TGrafPort & port) const
Interface Category:
API.
Purpose:
Draws the contents of this view to the specified port. This function does nothing.
Calling Context:
Called when the layout view needs to redraw itself.
Parameters:
- TGrafPort & port -The port to which to render the view.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
This function is protected.
Member Function: TLayoutView::operator=
TLayoutView & operator =(const TLayoutView &)
Interface Category:
API.
Purpose:
Assignment operator.
Calling Context:
Call this function by using the operator in an assignment statement.
Parameters:
Return Value:
Returns a const reference to the left-hand side object.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
This operator is protected.
virtual ~ TLayoutView ()
Interface Category:
API.
Purpose:
Destructor.
Calling Context:
Called to destroy an object.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
- TLayoutView ()
- TLayoutView (const TLayoutView & other)
Interface Category:
API.
Purpose:
- Default constructor.
- Copy constructor.
Calling Context:
- Called by the stream-in operators.
- Called to copy an object.
Parameters:
- Takes no parameters.
- const TLayoutView & other -The object to copy.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLayoutView::GetOpaquelyDrawnArea
virtual void GetOpaquelyDrawnArea (TGArea & opaqueArea)
Interface Category:
API.
Purpose:
Overridden to return empty area to indicate that this view is transparent.
Calling Context:
Called by View System.
Parameters:
- TGArea & opaqueArea -Area to fillin.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLayoutView::HandleAfterConnectionToViewRoot
virtual void HandleAfterConnectionToViewRoot ()
Interface Category:
API.
Purpose:
Called by the View system after a view is connected to a rooted view hierarchy. The connection has occurred by the time this function is called. As such, you can get things like the request processor, the direct drawing GrafPort, and the event receiver. All views from the point of connection on down have this function called on them, with parent views getting called before child views.
Calling Context:
Called by the View system after the view is connected (directly or indirectly) to the view root.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
This function is useful for anyone using input in views.
Member Function: TLayoutView::HandleNumberofChildrenChanged
virtual void HandleNumberofChildrenChanged ()
Interface Category:
API.
Purpose:
Handles updating the view hierarchy when the number of child views changes.
Calling Context:
Called for a parent view when the number of its child view changes. Derived classes can override this member function when they want to know when things have changed. The derived function should call the base class version at some point during its execution.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
This function is called outside of the scope of the view hierarchy lock.
Member Function: TLayoutView::NeedsClipping
virtual bool NeedsClipping ()
Interface Category:
API.
Purpose:
Overridden to return false. This view does not need clipping.
Calling Context:
Called by the View system. Derived classes can override this and set the returned value to false, but they must ensure that the view (or its children) does not draw beyond its bounds. You can call this function directly.
Parameters:
Return Value:
Always returns false.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.