2005-11-07 04:26:13 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2001-2005, Haiku, Inc.
|
|
|
|
* Distributed under the terms of the MIT license.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Marc Flerackers (mflerackers@androme.be)
|
|
|
|
* DarkWyrm (bpmagic@columbus.rr.com)
|
2005-11-07 04:33:09 +03:00
|
|
|
* Stefano Ceccherini (burton666@libero.it)
|
2005-11-07 04:26:13 +03:00
|
|
|
* Stephan Aßmus <superstippi@gmx.de>
|
|
|
|
*/
|
|
|
|
|
2002-10-23 17:54:44 +04:00
|
|
|
#ifndef _SCROLL_BAR_H
|
|
|
|
#define _SCROLL_BAR_H
|
|
|
|
|
|
|
|
#include <BeBuild.h>
|
|
|
|
#include <View.h>
|
|
|
|
|
2002-12-31 02:35:10 +03:00
|
|
|
//----------------------------------------------------------------
|
|
|
|
//----- scroll bar defines ---------------------------------------
|
2002-10-23 17:54:44 +04:00
|
|
|
|
|
|
|
#define B_V_SCROLL_BAR_WIDTH 14.0
|
|
|
|
#define B_H_SCROLL_BAR_HEIGHT 14.0
|
|
|
|
|
2004-10-09 02:36:54 +04:00
|
|
|
#define SCROLL_BAR_MAXIMUM_KNOB_SIZE 50
|
|
|
|
#define SCROLL_BAR_MINIMUM_KNOB_SIZE 9
|
|
|
|
|
2005-11-15 03:23:03 +03:00
|
|
|
#define DISABLES_ON_WINDOW_DEACTIVATION 1
|
|
|
|
|
2002-12-31 02:35:10 +03:00
|
|
|
//----------------------------------------------------------------
|
|
|
|
//----- BScrollBar class -----------------------------------------
|
|
|
|
|
2002-10-23 17:54:44 +04:00
|
|
|
class BScrollBar : public BView {
|
|
|
|
|
|
|
|
public:
|
|
|
|
BScrollBar( BRect frame,
|
|
|
|
const char *name,
|
|
|
|
BView *target,
|
|
|
|
float min,
|
|
|
|
float max,
|
|
|
|
orientation direction);
|
|
|
|
BScrollBar(BMessage *data);
|
|
|
|
virtual ~BScrollBar();
|
|
|
|
static BArchivable *Instantiate(BMessage *data);
|
|
|
|
virtual status_t Archive(BMessage *data, bool deep = true) const;
|
|
|
|
|
|
|
|
virtual void AttachedToWindow();
|
|
|
|
void SetValue(float value);
|
|
|
|
float Value() const;
|
|
|
|
void SetProportion(float);
|
|
|
|
float Proportion() const;
|
|
|
|
virtual void ValueChanged(float newValue);
|
|
|
|
|
|
|
|
void SetRange(float min, float max);
|
|
|
|
void GetRange(float *min, float *max) const;
|
|
|
|
void SetSteps(float smallStep, float largeStep);
|
|
|
|
void GetSteps(float *smallStep, float *largeStep) const;
|
|
|
|
void SetTarget(BView *target);
|
|
|
|
void SetTarget(const char *targetName);
|
|
|
|
BView *Target() const;
|
|
|
|
orientation Orientation() const;
|
|
|
|
|
|
|
|
virtual void MessageReceived(BMessage *msg);
|
|
|
|
virtual void MouseDown(BPoint pt);
|
|
|
|
virtual void MouseUp(BPoint pt);
|
|
|
|
virtual void MouseMoved(BPoint pt, uint32 code, const BMessage *msg);
|
|
|
|
virtual void DetachedFromWindow();
|
|
|
|
virtual void Draw(BRect updateRect);
|
|
|
|
virtual void FrameMoved(BPoint new_position);
|
|
|
|
virtual void FrameResized(float new_width, float new_height);
|
|
|
|
|
|
|
|
virtual BHandler *ResolveSpecifier(BMessage *msg,
|
|
|
|
int32 index,
|
|
|
|
BMessage *specifier,
|
|
|
|
int32 form,
|
|
|
|
const char *property);
|
|
|
|
|
|
|
|
virtual void ResizeToPreferred();
|
|
|
|
virtual void GetPreferredSize(float *width, float *height);
|
|
|
|
virtual void MakeFocus(bool state = true);
|
|
|
|
virtual void AllAttached();
|
|
|
|
virtual void AllDetached();
|
|
|
|
virtual status_t GetSupportedSuites(BMessage *data);
|
|
|
|
|
|
|
|
|
2002-12-31 02:35:10 +03:00
|
|
|
//----- Private or reserved -----------------------------------------
|
2002-10-23 17:54:44 +04:00
|
|
|
virtual status_t Perform(perform_code d, void *arg);
|
|
|
|
|
2005-11-15 03:23:03 +03:00
|
|
|
#if DISABLES_ON_WINDOW_DEACTIVATION
|
|
|
|
virtual void WindowActivated(bool active);
|
|
|
|
#endif
|
|
|
|
|
2002-10-23 17:54:44 +04:00
|
|
|
private:
|
2005-05-31 16:58:08 +04:00
|
|
|
class Private;
|
|
|
|
friend class Private;
|
2005-07-07 18:33:19 +04:00
|
|
|
|
2004-10-09 02:36:54 +04:00
|
|
|
friend status_t control_scrollbar(scroll_bar_info *info, BScrollBar *bar); // for use within the preflet
|
2005-07-07 18:33:19 +04:00
|
|
|
|
2002-10-23 17:54:44 +04:00
|
|
|
virtual void _ReservedScrollBar1();
|
|
|
|
virtual void _ReservedScrollBar2();
|
|
|
|
virtual void _ReservedScrollBar3();
|
|
|
|
virtual void _ReservedScrollBar4();
|
|
|
|
|
|
|
|
BScrollBar &operator=(const BScrollBar &);
|
|
|
|
|
2005-07-07 18:33:19 +04:00
|
|
|
bool _DoubleArrows() const;
|
|
|
|
void _UpdateThumbFrame();
|
|
|
|
float _ValueFor(BPoint where) const;
|
|
|
|
int32 _ButtonFor(BPoint where) const;
|
|
|
|
BRect _ButtonRectFor(int32 button) const;
|
|
|
|
void _UpdateTargetValue(BPoint where);
|
|
|
|
void _UpdateArrowButtons();
|
2005-11-15 03:23:03 +03:00
|
|
|
void _DrawDisabledBackground(BRect area,
|
|
|
|
const rgb_color& light,
|
|
|
|
const rgb_color& dark,
|
|
|
|
const rgb_color& fill);
|
2005-07-07 18:33:19 +04:00
|
|
|
void _DrawArrowButton(int32 direction,
|
2005-11-15 03:23:03 +03:00
|
|
|
bool doubleArrows,
|
2005-11-07 04:26:13 +03:00
|
|
|
BRect frame,
|
|
|
|
const BRect& updateRect,
|
2005-11-15 03:23:03 +03:00
|
|
|
bool enabled, bool down);
|
2005-07-03 11:42:24 +04:00
|
|
|
|
2002-10-23 17:54:44 +04:00
|
|
|
float fMin;
|
|
|
|
float fMax;
|
|
|
|
float fSmallStep;
|
|
|
|
float fLargeStep;
|
|
|
|
float fValue;
|
|
|
|
float fProportion;
|
|
|
|
BView* fTarget;
|
|
|
|
orientation fOrientation;
|
2005-07-07 18:33:19 +04:00
|
|
|
char* fTargetName;
|
2002-12-31 02:35:10 +03:00
|
|
|
|
2005-07-07 18:33:19 +04:00
|
|
|
Private* fPrivateData;
|
2002-12-31 02:35:10 +03:00
|
|
|
|
|
|
|
uint32 _reserved[3];
|
2002-10-23 17:54:44 +04:00
|
|
|
};
|
|
|
|
|
2002-12-31 02:35:10 +03:00
|
|
|
//-------------------------------------------------------------
|
|
|
|
//-------------------------------------------------------------
|
2002-10-23 17:54:44 +04:00
|
|
|
|
2002-12-31 02:35:10 +03:00
|
|
|
#endif // _SCROLL_BAR_H
|