* Made B_V_SCROLL_BAR_WIDTH & B_H_SCROLL_BAR_HEIGHT float constants.
* Added a TODO to some stuff that probably shouldn't be in a public header. * Cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18174 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
2f13f213de
commit
2ee47d3ff9
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2001-2005, Haiku, Inc.
|
* Copyright (c) 2001-2006, Haiku, Inc.
|
||||||
* Distributed under the terms of the MIT license.
|
* Distributed under the terms of the MIT license.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@ -8,133 +8,117 @@
|
|||||||
* Stefano Ceccherini (burton666@libero.it)
|
* Stefano Ceccherini (burton666@libero.it)
|
||||||
* Stephan Aßmus <superstippi@gmx.de>
|
* Stephan Aßmus <superstippi@gmx.de>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SCROLL_BAR_H
|
#ifndef _SCROLL_BAR_H
|
||||||
#define _SCROLL_BAR_H
|
#define _SCROLL_BAR_H
|
||||||
|
|
||||||
|
|
||||||
#include <BeBuild.h>
|
#include <BeBuild.h>
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
|
|
||||||
//----------------------------------------------------------------
|
|
||||||
//----- scroll bar defines ---------------------------------------
|
|
||||||
|
|
||||||
#define B_V_SCROLL_BAR_WIDTH 14.0
|
#define B_V_SCROLL_BAR_WIDTH 14.0f
|
||||||
#define B_H_SCROLL_BAR_HEIGHT 14.0
|
#define B_H_SCROLL_BAR_HEIGHT 14.0f
|
||||||
|
|
||||||
|
// TODO: shouldn't these be moved into the implementation?
|
||||||
#define SCROLL_BAR_MAXIMUM_KNOB_SIZE 50
|
#define SCROLL_BAR_MAXIMUM_KNOB_SIZE 50
|
||||||
#define SCROLL_BAR_MINIMUM_KNOB_SIZE 9
|
#define SCROLL_BAR_MINIMUM_KNOB_SIZE 9
|
||||||
|
|
||||||
#define DISABLES_ON_WINDOW_DEACTIVATION 1
|
#define DISABLES_ON_WINDOW_DEACTIVATION 1
|
||||||
|
|
||||||
//----------------------------------------------------------------
|
|
||||||
//----- BScrollBar class -----------------------------------------
|
|
||||||
|
|
||||||
class BScrollBar : public BView {
|
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;
|
||||||
|
|
||||||
public:
|
virtual void AttachedToWindow();
|
||||||
BScrollBar( BRect frame,
|
void SetValue(float value);
|
||||||
const char *name,
|
float Value() const;
|
||||||
BView *target,
|
void SetProportion(float);
|
||||||
float min,
|
float Proportion() const;
|
||||||
float max,
|
virtual void ValueChanged(float newValue);
|
||||||
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 SetRange(float min, float max);
|
||||||
void SetValue(float value);
|
void GetRange(float *min, float *max) const;
|
||||||
float Value() const;
|
void SetSteps(float smallStep, float largeStep);
|
||||||
void SetProportion(float);
|
void GetSteps(float *smallStep, float *largeStep) const;
|
||||||
float Proportion() const;
|
void SetTarget(BView *target);
|
||||||
virtual void ValueChanged(float newValue);
|
void SetTarget(const char *targetName);
|
||||||
|
BView *Target() const;
|
||||||
|
orientation Orientation() const;
|
||||||
|
|
||||||
void SetRange(float min, float max);
|
virtual void MessageReceived(BMessage *msg);
|
||||||
void GetRange(float *min, float *max) const;
|
virtual void MouseDown(BPoint pt);
|
||||||
void SetSteps(float smallStep, float largeStep);
|
virtual void MouseUp(BPoint pt);
|
||||||
void GetSteps(float *smallStep, float *largeStep) const;
|
virtual void MouseMoved(BPoint pt, uint32 code, const BMessage *msg);
|
||||||
void SetTarget(BView *target);
|
virtual void DetachedFromWindow();
|
||||||
void SetTarget(const char *targetName);
|
virtual void Draw(BRect updateRect);
|
||||||
BView *Target() const;
|
virtual void FrameMoved(BPoint new_position);
|
||||||
orientation Orientation() const;
|
virtual void FrameResized(float new_width, float new_height);
|
||||||
|
|
||||||
virtual void MessageReceived(BMessage *msg);
|
virtual BHandler *ResolveSpecifier(BMessage *msg, int32 index,
|
||||||
virtual void MouseDown(BPoint pt);
|
BMessage *specifier, int32 form,
|
||||||
virtual void MouseUp(BPoint pt);
|
const char *property);
|
||||||
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,
|
virtual void ResizeToPreferred();
|
||||||
int32 index,
|
virtual void GetPreferredSize(float *width, float *height);
|
||||||
BMessage *specifier,
|
virtual void MakeFocus(bool state = true);
|
||||||
int32 form,
|
virtual void AllAttached();
|
||||||
const char *property);
|
virtual void AllDetached();
|
||||||
|
virtual status_t GetSupportedSuites(BMessage *data);
|
||||||
|
|
||||||
virtual void ResizeToPreferred();
|
virtual status_t Perform(perform_code d, void *arg);
|
||||||
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);
|
|
||||||
|
|
||||||
|
|
||||||
//----- Private or reserved -----------------------------------------
|
|
||||||
virtual status_t Perform(perform_code d, void *arg);
|
|
||||||
|
|
||||||
#if DISABLES_ON_WINDOW_DEACTIVATION
|
#if DISABLES_ON_WINDOW_DEACTIVATION
|
||||||
virtual void WindowActivated(bool active);
|
virtual void WindowActivated(bool active);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class Private;
|
class Private;
|
||||||
friend class Private;
|
friend class Private;
|
||||||
|
|
||||||
friend status_t control_scrollbar(scroll_bar_info *info, BScrollBar *bar); // for use within the preflet
|
friend status_t control_scrollbar(scroll_bar_info *info, BScrollBar *bar);
|
||||||
|
// for use within the preflet
|
||||||
|
|
||||||
virtual void _ReservedScrollBar1();
|
virtual void _ReservedScrollBar1();
|
||||||
virtual void _ReservedScrollBar2();
|
virtual void _ReservedScrollBar2();
|
||||||
virtual void _ReservedScrollBar3();
|
virtual void _ReservedScrollBar3();
|
||||||
virtual void _ReservedScrollBar4();
|
virtual void _ReservedScrollBar4();
|
||||||
|
|
||||||
BScrollBar &operator=(const BScrollBar &);
|
BScrollBar &operator=(const BScrollBar &);
|
||||||
|
|
||||||
bool _DoubleArrows() const;
|
bool _DoubleArrows() const;
|
||||||
void _UpdateThumbFrame();
|
void _UpdateThumbFrame();
|
||||||
float _ValueFor(BPoint where) const;
|
float _ValueFor(BPoint where) const;
|
||||||
int32 _ButtonFor(BPoint where) const;
|
int32 _ButtonFor(BPoint where) const;
|
||||||
BRect _ButtonRectFor(int32 button) const;
|
BRect _ButtonRectFor(int32 button) const;
|
||||||
void _UpdateTargetValue(BPoint where);
|
void _UpdateTargetValue(BPoint where);
|
||||||
void _UpdateArrowButtons();
|
void _UpdateArrowButtons();
|
||||||
void _DrawDisabledBackground(BRect area,
|
void _DrawDisabledBackground(BRect area,
|
||||||
const rgb_color& light,
|
const rgb_color& light, const rgb_color& dark,
|
||||||
const rgb_color& dark,
|
const rgb_color& fill);
|
||||||
const rgb_color& fill);
|
void _DrawArrowButton(int32 direction,
|
||||||
void _DrawArrowButton(int32 direction,
|
bool doubleArrows, BRect frame,
|
||||||
bool doubleArrows,
|
const BRect& updateRect,
|
||||||
BRect frame,
|
bool enabled, bool down);
|
||||||
const BRect& updateRect,
|
|
||||||
bool enabled, bool down);
|
|
||||||
|
|
||||||
float fMin;
|
float fMin;
|
||||||
float fMax;
|
float fMax;
|
||||||
float fSmallStep;
|
float fSmallStep;
|
||||||
float fLargeStep;
|
float fLargeStep;
|
||||||
float fValue;
|
float fValue;
|
||||||
float fProportion;
|
float fProportion;
|
||||||
BView* fTarget;
|
BView* fTarget;
|
||||||
orientation fOrientation;
|
orientation fOrientation;
|
||||||
char* fTargetName;
|
char* fTargetName;
|
||||||
|
|
||||||
Private* fPrivateData;
|
Private* fPrivateData;
|
||||||
|
|
||||||
uint32 _reserved[3];
|
uint32 _reserved[3];
|
||||||
};
|
};
|
||||||
|
|
||||||
//-------------------------------------------------------------
|
#endif // _SCROLL_BAR_H
|
||||||
//-------------------------------------------------------------
|
|
||||||
|
|
||||||
#endif // _SCROLL_BAR_H
|
|
||||||
|
Loading…
Reference in New Issue
Block a user