# PGScrollFrame¶

class PGScrollFrame

Bases: PGVirtualFrame, PGSliderBarNotify

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).

Inheritance diagram

explicit PGScrollFrame(std::string const &name = "")
void clear_horizontal_slider(void)

Removes the horizontal scroll bar from control of the frame. It is your responsibility to actually remove or hide the object itself.

void clear_vertical_slider(void)

Removes the vertical scroll bar from control of the frame. It is your responsibility to actually remove or hide the object itself.

void clear_virtual_frame(void)

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.

bool get_auto_hide(void) const

Returns the auto_hide flag. See set_auto_hide().

static TypeHandle get_class_type(void)
PGSliderBar *get_horizontal_slider(void) 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(void) const

Returns the manage_pieces flag. See set_manage_pieces().

PGSliderBar *get_vertical_slider(void) const

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

LVecBase4 const &get_virtual_frame(void) const

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.

bool has_virtual_frame(void) const

Returns true if the virtual frame has a bounding rectangle; see set_virtual_frame(). Most PGScrollFrame objects will have a virtual frame.

void recompute(void)

Forces the PGScrollFrame to recompute itself right now. Normally this should not be required.

void remanage(void)

Manages the position and size of the scroll bars. Normally this should not need to be called directly.

void set_auto_hide(bool auto_hide)

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.

void set_horizontal_slider(PGSliderBar *horizontal_slider)

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.

void set_manage_pieces(bool manage_pieces)

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.

void set_vertical_slider(PGSliderBar *vertical_slider)

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.

void set_virtual_frame(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top)
void set_virtual_frame(LVecBase4 const &virtual_frame)

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.

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.