/* * Copyright (c)1998 by Angry Red Planet. * * This code is distributed under a modified form of the * Artistic License. A copy of this license should have * been included with it; if this wasn't the case, the * entire package can be obtained at * . * * A logical GUI layout engine: the programmer describes * high-level relationships between the different user interface * object through formal container classes, which then take care * of their physical placement. The system is completely * font-sensitive and resizeable. * * ---------------------------------------------------------------------- * * ArpScrollArea.h * * A layout class that places scroll bars around an interior * area. Only one child is allowed, and it must possess its * own BView to which the scroller bars can be attached. * * ---------------------------------------------------------------------- * * Known Bugs * ~~~~~~~~~~ * * ---------------------------------------------------------------------- * * To Do * ~~~~~ * * ---------------------------------------------------------------------- * * History * ~~~~~~~ * * Dec 6, 1998: * First public release. * */ #pragma once #ifndef ARPLAYOUT_ARPSCROLLAREA_H #define ARPLAYOUT_ARPSCROLLAREA_H #ifndef ARPLAYOUT_ARPLAYOUTABLE_H #include #endif class ArpScrollArea : public ArpLayoutable { private: typedef ArpLayoutable inherited; public: ArpScrollArea(const char* name = 0); ArpScrollArea(BMessage* data); static ArpScrollArea* Instantiate(BMessage* archive); virtual status_t Archive(BMessage* data, bool deep=TRUE); /* Paremeters: * "ScrollHorizontal" and "ScrollVertical" * (bool) Indicate whether a horizontal and/or vertical * scroll bar should be shown to control the interior view. * A true value indicates that respective scroll bar will * be shown. Both defaults are false. * * "InsetCorner" (bool) Indicate whether space should * be reserved for a control in the bottom-right corner. * Set this to true for scroll views placed in the * bottom-right corner of a document window. * Default is false. * * "BorderStyle" (int32) Indicate type of frame to draw * around scroll area, as per BScrollView: B_PLAIN_BORDER, * B_FANCY_BORDER, or B_NO_BORDER. Default is B_FANCY_BORDER. */ static const char* ScrollHorizontalP; static const char* ScrollVerticalP; static const char* InsetCornerP; static const char* BorderStyleP; /* Retrieve scroll bars being used. */ BScrollBar* VScrollBar(void); BScrollBar* HScrollBar(void); /* Need to attach scroll bars to child view, when it is added. */ virtual ArpLayoutable* AddLayoutChild(ArpLayoutable* v, const BMessage& c = ArpNoParams, ArpLayoutable* before = NULL); virtual bool RemoveLayoutChild(ArpLayoutable* child); virtual void SetFocusShown(bool state, bool andParent); virtual void SetLayoutActivated(bool state); protected: virtual void DoSetParams(const ArpMessage* g, const ArpMessage* p); virtual bool DoParams(ArpMessage& p, const char* name); virtual void ComputeDimens(void); virtual void Layout(void); virtual void AttachView(BView* par_view, BView* before); virtual void DrawLayout(BView* inside, BRect region); ArpString PG_ScrollHorizontal; ArpString PG_ScrollVertical; ArpString PG_InsetCorner; ArpString PG_BorderStyle; bool PV_ScrollHorizontal; bool PV_ScrollVertical; bool PV_InsetCorner; int32 PV_BorderStyle; private: void update_scroll_bars(void); // Returns the child view that is being targetted. BView* get_child(void); // The last location of the scroll area in its parent. This // is stored so that we can invalidate that area when moved or // resized. BRect mLastFrame; // The vertical and horizontal scrollers. These are created // when the object is instantiated, and are valid for its // entire existance. BScrollBar* scroll_h; BScrollBar* scroll_v; // Current on/off status of scrollers. bool do_vert, do_horiz; // If true, there is something in the corner (most likely the // window's size control), so scroll bars should always be // inset from it. bool inset_corner; // Type of border to draw around view int32 border; // The scrollers' preferred width (vertical scroller) and // height (horizontal scroller) float s_width, s_height; }; #endif