From dfa1093a416a4cf268556a5e49005c04f219e919 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 19 Feb 2004 02:06:12 +0000 Subject: [PATCH] Rewrote the BScrollView header from scratch. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6642 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/interface/ScrollView.h | 150 ++++++++++++++---------------- 1 file changed, 68 insertions(+), 82 deletions(-) diff --git a/headers/os/interface/ScrollView.h b/headers/os/interface/ScrollView.h index b48193613c..c3a90841ec 100644 --- a/headers/os/interface/ScrollView.h +++ b/headers/os/interface/ScrollView.h @@ -1,106 +1,92 @@ -/******************************************************************************* -/ -/ File: ScrollView.h -/ -/ Description: BScrollView provides scrolling machinery for its contents -/ (where the "contents" is some other view). -/ -/ Copyright 1993-98, Be Incorporated, All Rights Reserved -/ -*******************************************************************************/ +/* +** Copyright 2004, OpenBeOS. All Rights Reserved. +** Distributed under the terms of the OpenBeOS License. +*/ +#ifndef _SCROLL_VIEW_H +#define _SCROLL_VIEW_H -#ifndef _SCROLL_VIEW_H -#define _SCROLL_VIEW_H +/** The BScrollView is a convenience class to add a scrolling + * mechanism to the target view. + */ -#include -#include /* For convenience */ -#include +#include -/*----------------------------------------------------------------*/ -/*----- BScrollView class ----------------------------------------*/ class BScrollView : public BView { + public: + BScrollView(const char *name, BView *target, + uint32 resizeMask = B_FOLLOW_LEFT | B_FOLLOW_TOP, + uint32 flags = 0, bool horizontal = false, bool vertical = false, + border_style border = B_FANCY_BORDER); + BScrollView(BMessage *data); + virtual ~BScrollView(); -public: - BScrollView(const char *name, - BView *target, - uint32 resizeMask = B_FOLLOW_LEFT | - B_FOLLOW_TOP, - uint32 flags = 0, - bool horizontal = false, - bool vertical = false, - border_style border = B_FANCY_BORDER); - BScrollView(BMessage *data); -virtual ~BScrollView(); -static BArchivable *Instantiate(BMessage *data); -virtual status_t Archive(BMessage *data, bool deep = true) const; + static BArchivable *Instantiate(BMessage *data); + virtual status_t Archive(BMessage *data, bool deep = true) const; -virtual void Draw(BRect updateRect); -virtual void AttachedToWindow(); - BScrollBar *ScrollBar(orientation flag) const; + virtual void Draw(BRect updateRect); + virtual void AttachedToWindow(); -virtual void SetBorder(border_style border); - border_style Border() const; + BScrollBar *ScrollBar(orientation posture); -virtual status_t SetBorderHighlighted(bool state); - bool IsBorderHighlighted() const; + virtual void SetBorder(border_style border); + border_style Border() const; - void SetTarget(BView *new_target); - BView *Target() const; + virtual void SetBorderHighlighted(bool state); + bool IsBorderHighlighted() const; -virtual void MessageReceived(BMessage *msg); -virtual void MouseDown(BPoint pt); -virtual void WindowActivated(bool state); -virtual void MouseUp(BPoint pt); -virtual void MouseMoved(BPoint pt, uint32 code, const BMessage *msg); -virtual void DetachedFromWindow(); -virtual void AllAttached(); -virtual void AllDetached(); -virtual void FrameMoved(BPoint new_position); -virtual void FrameResized(float new_width, float new_height); + void SetTarget(BView *target); + BView *Target() const; -virtual BHandler *ResolveSpecifier(BMessage *msg, - int32 index, - BMessage *specifier, - int32 form, - const char *property); + virtual void MessageReceived(BMessage *message); + virtual void MouseDown(BPoint point); -virtual void ResizeToPreferred(); -virtual void GetPreferredSize(float *width, float *height); -virtual void MakeFocus(bool state = true); -virtual status_t GetSupportedSuites(BMessage *data); + virtual void WindowActivated(bool active); + virtual void MouseUp(BPoint point); + virtual void MouseMoved(BPoint point, uint32 code, const BMessage *msg); -/*----- Private or reserved -----------------------------------------*/ -virtual status_t Perform(perform_code d, void *arg); + virtual void DetachedFromWindow(); + virtual void AllAttached(); + virtual void AllDetached(); -private: + virtual void FrameMoved(BPoint position); + virtual void FrameResized(float width, float height); -friend class BView; + virtual BHandler *ResolveSpecifier(BMessage *message, int32 index, + BMessage *specifier, int32 form, const char *property); -virtual void _ReservedScrollView1(); -virtual void _ReservedScrollView2(); -virtual void _ReservedScrollView3(); -virtual void _ReservedScrollView4(); + virtual void ResizeToPreferred(); + virtual void GetPreferredSize(float *_width, float *_height); + virtual void MakeFocus(bool state = true); + virtual status_t GetSupportedSuites(BMessage *data); - BScrollView &operator=(const BScrollView &); + // private or reserved methods are following -static BRect CalcFrame(BView *, bool, bool, border_style); - int32 ModFlags(int32, border_style); - void InitObject(); + virtual status_t Perform(perform_code d, void *arg); - BView *fTarget; - BScrollBar *fHSB; - BScrollBar *fVSB; - border_style fBorder; - uint16 fPrevWidth; - uint16 fPrevHeight; + private: + friend class BView; - uint32 _reserved[3]; /* was 4 */ + virtual void _ReservedScrollView1(); + virtual void _ReservedScrollView2(); + virtual void _ReservedScrollView3(); + virtual void _ReservedScrollView4(); - bool fHighlighted; + BScrollView &operator=(const BScrollView &); + + static BRect CalcFrame(BView *target, bool h, bool v, border_style); + int32 ModFlags(int32, border_style); + void InitObject(); + + BView *fTarget; + BScrollBar *fHorizontalScrollBar; + BScrollBar *fVerticalScrollBar; + border_style fBorder; + uint16 fPreviousWidth; + uint16 fPreviousHeight; + bool fHighlighted; + + uint32 _reserved[3]; }; -/*-------------------------------------------------------------*/ -/*-------------------------------------------------------------*/ - -#endif /* _SCROLL_VIEW_H */ +#endif /* _SCROLL_VIEW_H */