458 lines
9.0 KiB
Plaintext
458 lines
9.0 KiB
Plaintext
/*
|
|
* Copyright 2014 Haiku, Inc. All rights reserved.
|
|
* Distributed under the terms of the MIT License.
|
|
*
|
|
* Authors:
|
|
* John Scipione, jscipione@gmail.com
|
|
*
|
|
* Corresponds to:
|
|
* headers/os/interface/ScrollView.h hrev47312
|
|
* src/kits/interface/ScrollView.cpp hrev47312
|
|
*/
|
|
|
|
|
|
/*!
|
|
\file ScrollView.h
|
|
\ingroup interface
|
|
\ingroup libbe
|
|
\brief BScrollView class definition.
|
|
\since BeOS R3
|
|
*/
|
|
|
|
|
|
/*!
|
|
\class BScrollView
|
|
\ingroup interface
|
|
\ingroup libbe
|
|
\brief A convenience class used to add scrolling to a target view.
|
|
|
|
The BScrollView class conveniently provides a container view
|
|
adding the scroll bars and target view as siblings so that when one
|
|
is moved or resized the rest can follow.
|
|
|
|
\see BScrollBar to learn more about how scroll bars work.
|
|
|
|
\sa BView::ScrollTo()
|
|
\sa BView::ScrollBy()
|
|
\sa BView::TargetedByScrollView()
|
|
|
|
\since BeOS R3
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn BScrollView::BScrollView(const char* name, BView* target,
|
|
uint32 resizingMode, uint32 flags, bool horizontal, bool vertical,
|
|
border_style border)
|
|
\brief Instantiates a new scroll view and connects it to the \a target
|
|
view.
|
|
|
|
\param name The name of the scroll bar, can be \c NULL.
|
|
\param target The \a target view to scroll, can be \c NULL.
|
|
\param resizingMode Defines the scroll view's behavior when its parent
|
|
is resized. See BView for details.
|
|
\param flags The view flags. See BView for details.
|
|
\param horizontal Whether or not to include a horizontal scroll bar.
|
|
\param vertical Whether or not to include a vertical scroll bar.
|
|
\param border The border style to use, options include:
|
|
- \c B_PLAIN_BORDER
|
|
- \c B_FANCY_BORDER
|
|
- \c B_NO_BORDER
|
|
|
|
\sa SetTarget()
|
|
\sa SetBorder()
|
|
|
|
\since BeOS R3
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn BScrollView::BScrollView(const char* name, BView* target, uint32 flags,
|
|
bool horizontal, bool vertical, border_style border)
|
|
\brief Instantiates a new scroll view and connects it to the \a target
|
|
view suitable for use in a BLayout.
|
|
|
|
\param name The name of the scroll bar, can be \c NULL.
|
|
\param target The \a target view to scroll, can be \c NULL.
|
|
\param flags The view flags. See BView for details.
|
|
\param horizontal Whether or not to include a horizontal scroll bar.
|
|
\param vertical Whether or not to include a vertical scroll bar.
|
|
\param border The border style to use, options include:
|
|
- \c B_PLAIN_BORDER
|
|
- \c B_FANCY_BORDER
|
|
- \c B_NO_BORDER
|
|
|
|
\sa SetTarget()
|
|
\sa SetBorder()
|
|
|
|
\since Haiku R1
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn BScrollView::BScrollView(BMessage* archive)
|
|
\brief Archive constructor.
|
|
|
|
\param archive The message \a data to construct the scroll view from.
|
|
|
|
\since BeOS R3
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn BScrollView::~BScrollView()
|
|
\brief Destructor method.
|
|
|
|
Deletes the scroll view, sets the target to \c NULL and frees any
|
|
memory used.
|
|
|
|
\since BeOS R3
|
|
*/
|
|
|
|
|
|
/*!
|
|
\name Archiving
|
|
*/
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
/*!
|
|
\fn BArchivable* BScrollView::Instantiate(BMessage* archive)
|
|
\brief Creates a new BScrollView object from the \a archive message.
|
|
|
|
\return A newly created scroll view or \c NULL if the message doesn't
|
|
contain an archived BScrollView object.
|
|
|
|
\since BeOS R3
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn status_t BScrollView::Archive(BMessage* archive, bool deep) const
|
|
\brief Archives the object into the \a archive message.
|
|
|
|
\param archive A pointer to the BMessage object to archive the object into.
|
|
\param deep Whether or not to archive child views as well.
|
|
|
|
\return A status code, \c B_OK if everything went well or an error code
|
|
otherwise.
|
|
|
|
\since BeOS R3
|
|
*/
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
/*!
|
|
\name Hook Methods
|
|
*/
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
/*!
|
|
\fn void BScrollView::AllAttached()
|
|
\copydoc BView::AllAttached()
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn void BScrollView::AllDetached()
|
|
\copydoc BView::AllDetached()
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn void BScrollView::AttachedToWindow()
|
|
\brief Hook method called when the scroll bar is attached to a window.
|
|
|
|
Checks if the window uses \c B_DOCUMENT_LOOK and adjust the size of the bars
|
|
to make room for the window resize knob.
|
|
|
|
\copydetails BView::AttachedToWindow()
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn void BScrollView::DetachedFromWindow()
|
|
\brief Hook method called when the object is detached from a window.
|
|
|
|
\copydetails BView::DetachedFromWindow()
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn void BScrollView::Draw(BRect updateRect)
|
|
\brief Draws the area of the scroll view that intersects \a updateRect.
|
|
|
|
\param updateRect The rectangular area to be drawn.
|
|
|
|
\since BeOS R3
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn void BScrollView::MakeFocus(bool focus)
|
|
\brief Makes the scroll view the current focus view of the window or gives
|
|
up being the window's focus view.
|
|
|
|
\copydetails BView::MakeFocus()
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn void BScrollView::FrameMoved(BPoint newPosition)
|
|
\brief Hook method called when the scroll view is moved.
|
|
|
|
\copydetails BView::FrameMoved()
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn void BScrollView::FrameResized(float newWidth, float newHeight)
|
|
\brief Hook method called when the scroll view is resized.
|
|
|
|
\copydetails BView::FrameResized()
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn void BScrollView::MessageReceived(BMessage* message)
|
|
\copydoc BView::MessageReceived()
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn void BScrollView::MouseDown(BPoint where)
|
|
\copydoc BView::MouseDown()
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn void BScrollView::MouseMoved(BPoint where, uint32 code,
|
|
const BMessage* dragMessage)
|
|
\copydoc BView::MouseMoved()
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn void BScrollView::MouseUp(BPoint where)
|
|
\copydoc BView::MouseUp()
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn void BScrollView::WindowActivated(bool active)
|
|
\copydoc BView::WindowActivated()
|
|
*/
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
/*!
|
|
\fn void BScrollView::GetPreferredSize(float* _width, float* _height)
|
|
\brief Fill out the preferred width and height of the scroll view
|
|
into the \a _width and \a _height parameters.
|
|
|
|
\copydetails BView::GetPreferredSize()
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn BSize BScrollView::MinSize()
|
|
\brief Return the scroll view's minimum size.
|
|
|
|
\return The minimum size of the scroll view as a BSize.
|
|
|
|
\sa BAbstractLayout::MinSize()
|
|
|
|
\since Haiku R1
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn BSize BScrollView::MaxSize()
|
|
\brief Return the scroll view's maximum size.
|
|
|
|
\return The maximum size of the scroll view as a BSize.
|
|
|
|
\sa BAbstractLayout::MaxSize()
|
|
|
|
\since Haiku R1
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn BSize BScrollView::PreferredSize()
|
|
\brief Return the scroll view's preferred size.
|
|
|
|
\return The preferred size of the scroll view as a BSize.
|
|
|
|
\sa BAbstractLayout::PreferredSize()
|
|
|
|
\since Haiku R1
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn void BScrollView::ResizeToPreferred()
|
|
\brief Resizes the scroll view to its preferred size keeping the position of
|
|
the left top corner constant.
|
|
|
|
\copydetails BView::ResizeToPreferred()
|
|
*/
|
|
|
|
|
|
/*!
|
|
\name BScrollBar
|
|
*/
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
/*!
|
|
\fn BScrollBar* BScrollView::ScrollBar(orientation posture) const
|
|
\brief Returns the BScrollBar object at the given \a direction.
|
|
|
|
\param direction The \a direction of the scroll bar to get.
|
|
|
|
\returns A pointer to the desired BScrollBar object or \c NULL
|
|
if there is no scroll bar at that location.
|
|
|
|
\since BeOS R3
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn void BScrollView::SetBorder(border_style border)
|
|
\brief Set the border style of the scroll view.
|
|
|
|
\param border The border style constant to use, on of the following:
|
|
- \c B_PLAIN_BORDER
|
|
- \c B_FANCY_BORDER
|
|
- \c B_NO_BORDER
|
|
|
|
\since BeOS R3
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn border_style BScrollView::Border() const
|
|
\brief Return the border style used.
|
|
|
|
\return The border style constant used.
|
|
|
|
\since BeOS R3
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn status_t BScrollView::SetBorderHighlighted(bool highlight)
|
|
\brief Highlights or unhighlights the border of the scroll view's
|
|
scroll bars.
|
|
|
|
\param highlight \c true to turn highlighting on, \c false to remove it.
|
|
|
|
\return If successful returns \c B_OK, otherwise, returns \c B_ERROR.
|
|
|
|
\since BeOS R3
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn bool BScrollView::IsBorderHighlighted() const
|
|
\brief Returns whether or not the border is highlighted.
|
|
|
|
\return \c true if the border is highlighted, \c false otherwise.
|
|
|
|
\since BeOS R3
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn void BScrollView::SetTarget(BView* target)
|
|
\brief Sets the \a target view that the scroll bars operates on unsetting
|
|
the previous target.
|
|
|
|
\param target The \a target view to set.
|
|
|
|
\since Haiku R1
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn BView* BScrollView::Target() const
|
|
\brief Returns a pointer to the target view.
|
|
|
|
\return A pointer to a BView object that represents the target view or
|
|
\c NULL if the target is not set.
|
|
|
|
\since Haiku R1
|
|
*/
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
/*!
|
|
\name Scripting
|
|
*/
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
/*!
|
|
\fn BHandler* BScrollView::ResolveSpecifier(BMessage* message, int32 index,
|
|
BMessage* specifier, int32 what, const char* property)
|
|
\brief Determine the proper handler for a scripting message.
|
|
|
|
\copydetails BView::ResolveSpecifier()
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn status_t BScrollView::GetSupportedSuites(BMessage* message)
|
|
\brief Reports the suites of messages and specifiers understood by the
|
|
scroll view.
|
|
|
|
\copydetails BView::GetSupportedSuites()
|
|
*/
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
/*!
|
|
\fn status_t BScrollView::Perform(perform_code code, void* _data)
|
|
\brief Perform some action. (Internal Method)
|
|
|
|
\since Haiku R1
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn void BScrollView::LayoutInvalidated(bool descendants)
|
|
\brief Hook method called when the layout is invalidated.
|
|
|
|
The default implementation does nothing.
|
|
|
|
\param descendants Whether or not child views have also been invalidated.
|
|
|
|
\since Haiku R1
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn void BScrollView::DoLayout()
|
|
\brief Layout view within the layout context.
|
|
|
|
\since Haiku R1
|
|
*/
|