Panda3D
Public Member Functions | Static Public Member Functions | Protected Member Functions

PGScrollFrame Class Reference

This is a special kind of frame that pretends to be much larger than it actually is. More...

#include "pgScrollFrame.h"

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

List of all members.

Public Member Functions

 PGScrollFrame (const string &name="")
void clear_horizontal_slider ()
 Removes the horizontal scroll bar from control of the frame.
void clear_vertical_slider ()
 Removes the vertical scroll bar from control of the frame.
void clear_virtual_frame ()
 Removes the virtual frame from the item.
virtual bool cull_callback (CullTraverser *trav, CullTraverserData &data)
 This function will be called during the cull traversal to perform any additional operations that should be performed at cull time.
virtual TypeHandle force_init_type ()
bool get_auto_hide () const
 Returns the auto_hide flag.
PGSliderBarget_horizontal_slider () const
 Returns the PGSliderBar that serves as the horizontal scroll bar for this frame, if any, or NULL if it is not set.
bool get_manage_pieces () const
 Returns the manage_pieces flag.
virtual TypeHandle get_type () const
PGSliderBarget_vertical_slider () const
 Returns the PGSliderBar that serves as the vertical scroll bar for this frame, if any, or NULL if it is not set.
const LVecBase4get_virtual_frame () const
 Returns the bounding rectangle of the virtual frame.
bool has_virtual_frame () const
 Returns true if the virtual frame has a bounding rectangle; see set_virtual_frame().
virtual PandaNodemake_copy () const
 Returns a newly-allocated Node that is a shallow copy of this one.
void recompute ()
 Forces the PGScrollFrame to recompute itself right now.
void remanage ()
 Manages the position and size of the scroll bars.
void set_auto_hide (bool auto_hide)
 Sets the auto_hide flag.
void set_horizontal_slider (PGSliderBar *horizontal_slider)
 Sets the PGSliderBar object that will serve as the horizontal scroll bar for this frame.
void set_manage_pieces (bool manage_pieces)
 Sets the manage_pieces flag.
void set_vertical_slider (PGSliderBar *vertical_slider)
 Sets the PGSliderBar object that will serve as the vertical scroll bar for this frame.
void set_virtual_frame (PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top)
 Sets the bounding rectangle of the virtual frame.
void set_virtual_frame (const LVecBase4 &virtual_frame)
 Sets the bounding rectangle of the virtual frame.
void setup (PN_stdfloat width, PN_stdfloat height, PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top, PN_stdfloat slider_width, PN_stdfloat bevel)
 Creates a PGScrollFrame with the indicated dimensions, and the indicated virtual frame.
virtual void xform (const LMatrix4 &mat)
 Transforms the contents of this node by the indicated matrix, if it means anything to do so.

Static Public Member Functions

static TypeHandle get_class_type ()
static void init_type ()

Protected Member Functions

 PGScrollFrame (const PGScrollFrame &copy)
virtual void frame_changed ()
 Called when the user changes the frame size.
virtual void item_draw_mask_changed (PGItem *item)
 Called whenever a watched PGItem's draw_mask has been changed.
virtual void item_frame_changed (PGItem *item)
 Called whenever a watched PGItem's frame has been changed.
virtual void item_transform_changed (PGItem *item)
 Called whenever a watched PGItem's local transform has been changed.
virtual void slider_bar_adjust (PGSliderBar *slider_bar)
 Called whenever a watched PGSliderBar's value has been changed by the user or programmatically.

Detailed Description

This is a special kind of frame that pretends to be much larger than it actually is.

You can scroll through the frame, as if you're looking through a window at the larger frame beneath. All children of this frame node are scrolled and clipped as if they were children of the larger, virtual frame.

This is implemented as a specialization of PGVirtualFrame, which handles the meat of the virtual canvas. This class adds automatic support for scroll bars, and restricts the virtual transform to translate only (no scale or rotate).

Definition at line 39 of file pgScrollFrame.h.


Member Function Documentation

void PGScrollFrame::clear_horizontal_slider ( ) [inline]

Removes the horizontal scroll bar from control of the frame.

It is your responsibility to actually remove or hide the object itself.

Definition at line 180 of file pgScrollFrame.I.

References set_horizontal_slider().

void PGScrollFrame::clear_vertical_slider ( ) [inline]

Removes the vertical scroll bar from control of the frame.

It is your responsibility to actually remove or hide the object itself.

Definition at line 226 of file pgScrollFrame.I.

References set_vertical_slider().

void PGScrollFrame::clear_virtual_frame ( ) [inline]

Removes the virtual frame from the item.

This effectively sets the virtual frame to the same size as the clip frame. Scrolling will no longer be possible.

Definition at line 82 of file pgScrollFrame.I.

bool PGScrollFrame::cull_callback ( CullTraverser trav,
CullTraverserData data 
) [virtual]

This function will be called during the cull traversal to perform any additional operations that should be performed at cull time.

This may include additional manipulation of render state or additional visible/invisible decisions, or any other arbitrary operation.

Note that this function will *not* be called unless set_cull_callback() is called in the constructor of the derived class. It is necessary to call set_cull_callback() to indicated that we require cull_callback() to be called.

By the time this function is called, the node has already passed the bounding-volume test for the viewing frustum, and the node's transform and state have already been applied to the indicated CullTraverserData object.

The return value is true if this node should be visible, or false if it should be culled.

Reimplemented from PGItem.

Definition at line 109 of file pgScrollFrame.cxx.

References remanage().

void PGScrollFrame::frame_changed ( ) [protected, virtual]

Called when the user changes the frame size.

Reimplemented from PGItem.

Definition at line 319 of file pgScrollFrame.cxx.

bool PGScrollFrame::get_auto_hide ( ) const [inline]

Returns the auto_hide flag.

See set_auto_hide().

Definition at line 146 of file pgScrollFrame.I.

PGSliderBar * PGScrollFrame::get_horizontal_slider ( ) const [inline]

Returns the PGSliderBar that serves as the horizontal scroll bar for this frame, if any, or NULL if it is not set.

Definition at line 192 of file pgScrollFrame.I.

bool PGScrollFrame::get_manage_pieces ( ) const [inline]

Returns the manage_pieces flag.

See set_manage_pieces().

Definition at line 112 of file pgScrollFrame.I.

PGSliderBar * PGScrollFrame::get_vertical_slider ( ) const [inline]

Returns the PGSliderBar that serves as the vertical scroll bar for this frame, if any, or NULL if it is not set.

Definition at line 238 of file pgScrollFrame.I.

const LVecBase4 & PGScrollFrame::get_virtual_frame ( ) const [inline]

Returns the bounding rectangle of the virtual frame.

See set_virtual_frame(). If has_virtual_frame() is false, this returns the item's clip frame.

Definition at line 55 of file pgScrollFrame.I.

References PGVirtualFrame::get_clip_frame().

Referenced by remanage().

bool PGScrollFrame::has_virtual_frame ( ) const [inline]

Returns true if the virtual frame has a bounding rectangle; see set_virtual_frame().

Most PGScrollFrame objects will have a virtual frame.

Definition at line 68 of file pgScrollFrame.I.

void PGScrollFrame::item_draw_mask_changed ( PGItem item) [protected, virtual]

Called whenever a watched PGItem's draw_mask has been changed.

Reimplemented from PGItemNotify.

Definition at line 357 of file pgScrollFrame.cxx.

void PGScrollFrame::item_frame_changed ( PGItem item) [protected, virtual]

Called whenever a watched PGItem's frame has been changed.

Reimplemented from PGItemNotify.

Definition at line 345 of file pgScrollFrame.cxx.

void PGScrollFrame::item_transform_changed ( PGItem item) [protected, virtual]

Called whenever a watched PGItem's local transform has been changed.

Reimplemented from PGItemNotify.

Definition at line 333 of file pgScrollFrame.cxx.

PandaNode * PGScrollFrame::make_copy ( ) const [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 PGVirtualFrame.

Definition at line 78 of file pgScrollFrame.cxx.

void PGScrollFrame::recompute ( ) [inline]

Forces the PGScrollFrame to recompute itself right now.

Normally this should not be required.

Definition at line 250 of file pgScrollFrame.I.

Referenced by remanage().

void PGScrollFrame::remanage ( )

Manages the position and size of the scroll bars.

Normally this should not need to be called directly.

Definition at line 202 of file pgScrollFrame.cxx.

References PGItem::get_frame(), PGItem::get_frame_style(), PGFrameStyle::get_internal_frame(), PGItem::get_state(), get_virtual_frame(), and recompute().

Referenced by cull_callback().

void PGScrollFrame::set_auto_hide ( bool  auto_hide) [inline]

Sets the auto_hide flag.

When this is true, the two scroll bars are automatically hidden if they are not needed (that is, if the virtual frame would fit within the clip frame without them), and they are automatically shown when they are needed.

Setting this flag true forces the manage_pieces flag to also be set true.

Definition at line 130 of file pgScrollFrame.I.

References set_manage_pieces().

Referenced by setup().

void PGScrollFrame::set_horizontal_slider ( PGSliderBar horizontal_slider) [inline]

Sets the PGSliderBar object that will serve as the horizontal scroll bar for this frame.

It is your responsibility to parent this slider bar to the frame and move it to the appropriate place.

Definition at line 160 of file pgScrollFrame.I.

References PGSliderBar::set_notify().

Referenced by clear_horizontal_slider(), and setup().

void PGScrollFrame::set_manage_pieces ( bool  manage_pieces) [inline]

Sets the manage_pieces flag.

When this is true, the sub-pieces of the scroll frame--that is, the two scroll bars--are automatically positioned and/or resized when the scroll frame's overall frame is changed. They are also automatically resized to fill in the gap when one or the other is hidden.

Definition at line 98 of file pgScrollFrame.I.

Referenced by set_auto_hide(), and setup().

void PGScrollFrame::set_vertical_slider ( PGSliderBar vertical_slider) [inline]

Sets the PGSliderBar object that will serve as the vertical scroll bar for this frame.

It is your responsibility to parent this slider bar to the frame and move it to the appropriate place.

Definition at line 206 of file pgScrollFrame.I.

References PGSliderBar::set_notify().

Referenced by clear_vertical_slider(), and setup().

void PGScrollFrame::set_virtual_frame ( PN_stdfloat  left,
PN_stdfloat  right,
PN_stdfloat  bottom,
PN_stdfloat  top 
) [inline]

Sets the bounding rectangle of the virtual frame.

This is the size of the large, virtual canvas which we can see only a portion of at any given time.

Definition at line 24 of file pgScrollFrame.I.

Referenced by setup().

void PGScrollFrame::set_virtual_frame ( const LVecBase4 frame) [inline]

Sets the bounding rectangle of the virtual frame.

This is the size of the large, virtual canvas which we can see only a portion of at any given time.

Definition at line 36 of file pgScrollFrame.I.

void PGScrollFrame::setup ( PN_stdfloat  width,
PN_stdfloat  height,
PN_stdfloat  left,
PN_stdfloat  right,
PN_stdfloat  bottom,
PN_stdfloat  top,
PN_stdfloat  slider_width,
PN_stdfloat  bevel 
)
void PGScrollFrame::slider_bar_adjust ( PGSliderBar slider_bar) [protected, virtual]

Called whenever a watched PGSliderBar's value has been changed by the user or programmatically.

Reimplemented from PGSliderBarNotify.

Definition at line 370 of file pgScrollFrame.cxx.

void PGScrollFrame::xform ( const LMatrix4 mat) [virtual]

Transforms the contents of this node by the indicated matrix, if it means anything to do so.

For most kinds of nodes, this does nothing.

Reimplemented from PGItem.

Definition at line 131 of file pgScrollFrame.cxx.


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