Panda3D
Public Member Functions | Static Public Member Functions | Protected Member Functions
PGVirtualFrame Class Reference

This represents a frame that is rendered as a window onto another (possibly much larger) canvas. More...

#include "pgVirtualFrame.h"

Inheritance diagram for PGVirtualFrame:
PGItem PandaNode TypedWritable Namable LinkedListNode ReferenceCount TypedObject MemoryBase MemoryBase MemoryBase PGScrollFrame

List of all members.

Public Member Functions

 PGVirtualFrame (const string &name="")
void clear_clip_frame ()
 Removes the clip frame from the item.
virtual TypeHandle force_init_type ()
PandaNodeget_canvas_node () const
 Returns the special node that holds all of the children that appear in the virtual canvas.
PandaNodeget_canvas_parent () const
 Returns the parent node of the canvas_node.
const TransformStateget_canvas_transform () const
 Returns the transform of the virtual canvas.
const LVecBase4get_clip_frame () const
 Returns the bounding rectangle of the clip frame.
virtual TypeHandle get_type () const
bool has_clip_frame () const
 Returns true if the clip frame has been set; see set_clip_frame().
void set_canvas_transform (const TransformState *transform)
 Changes the transform of the virtual canvas.
void set_clip_frame (PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top)
 Sets the bounding rectangle of the clip frame.
void set_clip_frame (const LVecBase4 &clip_frame)
 Sets the bounding rectangle of the clip frame.
void setup (PN_stdfloat width, PN_stdfloat height)
 Creates a PGVirtualFrame with the indicated dimensions.

Static Public Member Functions

static TypeHandle get_class_type ()
static void init_type ()

Protected Member Functions

 PGVirtualFrame (const PGVirtualFrame &copy)
virtual void clip_frame_changed ()
 Called when the user changes the clip_frame size.
virtual PandaNodemake_copy () const
 Returns a newly-allocated Node that is a shallow copy of this one.
virtual void r_copy_children (const PandaNode *from, InstanceMap &inst_map, Thread *current_thread)
 This is called by r_copy_subgraph(); the copy has already been made of this particular node (and this is the copy); this function's job is to copy all of the children from the original.

Detailed Description

This represents a frame that is rendered as a window onto another (possibly much larger) canvas.

You can only see the portion of the canvas that is below the window at any given time.

This works simply by automatically defining a scissor effect to be applied to a special child node, called the canvas_node, of the PGVirtualFrame node. Every object that is parented to the canvas_node will be clipped by the scissor effect. Also, you can modify the canvas_transform through convenience methods here, which actually modifies the transform on the canvas_node.

The net effect is that the virtual canvas is arbitrarily large, and we can peek at it through the scissor region, and scroll through different parts of it by modifying the canvas_transform.

See PGScrollFrame for a specialization of this class that handles the traditional scrolling canvas, with scroll bars.

Definition at line 50 of file pgVirtualFrame.h.


Member Function Documentation

Removes the clip frame from the item.

This disables clipping.

Definition at line 188 of file pgVirtualFrame.cxx.

References clip_frame_changed().

Referenced by r_copy_children().

void PGVirtualFrame::clip_frame_changed ( ) [protected, virtual]

Called when the user changes the clip_frame size.

Definition at line 204 of file pgVirtualFrame.cxx.

Referenced by clear_clip_frame(), and set_clip_frame().

Returns the special node that holds all of the children that appear in the virtual canvas.

Definition at line 90 of file pgVirtualFrame.I.

Referenced by r_copy_children().

Returns the parent node of the canvas_node.

Definition at line 101 of file pgVirtualFrame.I.

Referenced by r_copy_children().

Returns the transform of the virtual canvas.

This transform is applied to all child nodes of the canvas_node.

Definition at line 78 of file pgVirtualFrame.I.

const LVecBase4 & PGVirtualFrame::get_clip_frame ( ) const [inline]

Returns the bounding rectangle of the clip frame.

See set_clip_frame(). If has_clip_frame() is false, this returns the item's actual frame.

Definition at line 39 of file pgVirtualFrame.I.

References PGItem::get_frame().

Referenced by PGScrollFrame::get_virtual_frame().

bool PGVirtualFrame::has_clip_frame ( ) const [inline]

Returns true if the clip frame has been set; see set_clip_frame().

If it has not been set, objects in the virtual frame will not be clipped.

Definition at line 52 of file pgVirtualFrame.I.

PandaNode * PGVirtualFrame::make_copy ( ) const [protected, virtual]

Returns a newly-allocated Node that is a shallow copy of this one.

It will be a different Node pointer, but its internal data may or may not be shared with that of the original Node.

Reimplemented from PGItem.

Reimplemented in PGScrollFrame.

Definition at line 74 of file pgVirtualFrame.cxx.

void PGVirtualFrame::r_copy_children ( const PandaNode from,
PandaNode::InstanceMap &  inst_map,
Thread current_thread 
) [protected, virtual]

This is called by r_copy_subgraph(); the copy has already been made of this particular node (and this is the copy); this function's job is to copy all of the children from the original.

Note that it includes the parameter inst_map, which is a map type, and is not (and cannot be) exported from PANDA.DLL. Thus, any derivative of PandaNode that is not also a member of PANDA.DLL *cannot* access this map, and probably should not even override this function.

Reimplemented from PandaNode.

Definition at line 95 of file pgVirtualFrame.cxx.

References clear_clip_frame(), get_canvas_node(), get_canvas_parent(), PandaNode::remove_child(), and set_clip_frame().

void PGVirtualFrame::set_canvas_transform ( const TransformState transform) [inline]

Changes the transform of the virtual canvas.

This transform is applied to all child nodes of the canvas_node.

Definition at line 65 of file pgVirtualFrame.I.

void PGVirtualFrame::set_clip_frame ( PN_stdfloat  left,
PN_stdfloat  right,
PN_stdfloat  bottom,
PN_stdfloat  top 
) [inline]

Sets the bounding rectangle of the clip frame.

This is the size of the small window through which we can see the virtual canvas. Normally, this is the same size as the actual frame or smaller (typically it is smaller by the size of the bevel, or to make room for scroll bars).

Definition at line 27 of file pgVirtualFrame.I.

Referenced by r_copy_children(), PGScrollFrame::setup(), and setup().

void PGVirtualFrame::set_clip_frame ( const LVecBase4 frame)

Sets the bounding rectangle of the clip frame.

This is the size of the small window through which we can see the virtual canvas. Normally, this is the same size as the actual frame or smaller (typically it is smaller by the size of the bevel, or to make room for scroll bars).

Definition at line 164 of file pgVirtualFrame.cxx.

References clip_frame_changed().

void PGVirtualFrame::setup ( PN_stdfloat  width,
PN_stdfloat  height 
)

The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations