2015-09-25 21:37:19 +02:00
|
|
|
// File: fscrollbar.h
|
|
|
|
// Provides: class FScrollbar
|
|
|
|
//
|
|
|
|
// Inheritance diagram
|
|
|
|
// ═══════════════════
|
|
|
|
//
|
|
|
|
// ▕▔▔▔▔▔▔▔▔▔▏ ▕▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FObject ▏ ▕ FTerm ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▁▏ ▕▁▁▁▁▁▁▁▁▁▏
|
|
|
|
// ▲ ▲
|
|
|
|
// │ │
|
|
|
|
// └─────┬─────┘
|
|
|
|
// │
|
2016-10-11 04:57:36 +02:00
|
|
|
// ▕▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FVTerm ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▏
|
|
|
|
// ▲
|
|
|
|
// │
|
2015-09-25 21:37:19 +02:00
|
|
|
// ▕▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FWidget ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▁▏
|
|
|
|
// ▲
|
|
|
|
// │
|
|
|
|
// ▕▔▔▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FScrollbar ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▁▁▁▁▏
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2017-04-09 20:08:53 +02:00
|
|
|
#ifndef FSCROLLBAR_H
|
|
|
|
#define FSCROLLBAR_H
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
#include "fwidget.h"
|
|
|
|
|
2015-09-25 21:37:19 +02:00
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FScrollbar
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
#pragma pack(push)
|
|
|
|
#pragma pack(1)
|
|
|
|
|
|
|
|
class FScrollbar : public FWidget
|
|
|
|
{
|
|
|
|
public:
|
2016-11-02 00:37:58 +01:00
|
|
|
// Using-declarations
|
|
|
|
using FWidget::setGeometry;
|
|
|
|
|
|
|
|
// Enumeration
|
2016-09-27 00:46:05 +02:00
|
|
|
enum sType
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
|
|
|
noScroll = 0,
|
|
|
|
scrollJump = 1,
|
|
|
|
scrollStepBackward = 2,
|
|
|
|
scrollStepForward = 3,
|
|
|
|
scrollPageBackward = 4,
|
|
|
|
scrollPageForward = 5,
|
|
|
|
scrollWheelUp = 6,
|
|
|
|
scrollWheelDown = 7
|
|
|
|
};
|
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
// Constructors
|
|
|
|
explicit FScrollbar(FWidget* = 0);
|
|
|
|
FScrollbar (int = fc::vertical, FWidget* = 0);
|
|
|
|
|
|
|
|
// Destructor
|
|
|
|
virtual ~FScrollbar();
|
|
|
|
|
|
|
|
// Accessors
|
|
|
|
const char* getClassName() const;
|
|
|
|
int getValue() const;
|
|
|
|
sType getScrollType() const;
|
|
|
|
|
|
|
|
// Mutators
|
|
|
|
void setMinimum (int);
|
|
|
|
void setMaximum (int);
|
|
|
|
void setRange (int, int);
|
|
|
|
void setValue (int);
|
2017-04-09 20:08:53 +02:00
|
|
|
void setSteps (double);
|
2016-11-02 00:37:58 +01:00
|
|
|
void setPageSize (int, int);
|
|
|
|
void setOrientation (int);
|
|
|
|
void setGeometry (int, int, int, int, bool = true);
|
|
|
|
|
|
|
|
// Methods
|
|
|
|
void resize();
|
|
|
|
void redraw();
|
|
|
|
void calculateSliderValues();
|
|
|
|
void drawButtons();
|
|
|
|
void drawBar();
|
|
|
|
|
|
|
|
// Event handlers
|
|
|
|
void onMouseDown (FMouseEvent*);
|
|
|
|
void onMouseUp (FMouseEvent*);
|
|
|
|
void onMouseMove (FMouseEvent*);
|
|
|
|
void onWheel (FWheelEvent*);
|
|
|
|
void onTimer (FTimerEvent*);
|
|
|
|
|
2016-09-27 00:46:05 +02:00
|
|
|
private:
|
2016-11-02 00:37:58 +01:00
|
|
|
// Disable copy constructor
|
|
|
|
FScrollbar (const FScrollbar&);
|
|
|
|
|
|
|
|
// Disable assignment operator (=)
|
|
|
|
FScrollbar& operator = (const FScrollbar&);
|
|
|
|
|
|
|
|
// Methods
|
|
|
|
void init();
|
|
|
|
void draw();
|
|
|
|
sType getClickedScrollType (int, int);
|
|
|
|
void processMiddleButton (int, int);
|
|
|
|
void processScroll();
|
|
|
|
|
|
|
|
// Data Members
|
2017-04-09 20:08:53 +02:00
|
|
|
sType scroll_type;
|
|
|
|
bool threshold_reached;
|
|
|
|
int threshold_time;
|
|
|
|
int repeat_time;
|
|
|
|
int slider_click_pos;
|
|
|
|
int slider_click_stop_pos;
|
|
|
|
int current_slider_pos;
|
|
|
|
int slider_pos;
|
|
|
|
int slider_length;
|
|
|
|
int bar_length;
|
|
|
|
int val;
|
|
|
|
int min;
|
|
|
|
int max;
|
|
|
|
double steps;
|
|
|
|
int pageSize;
|
|
|
|
int length;
|
|
|
|
int bar_orientation;
|
|
|
|
int max_color;
|
2015-05-23 13:35:12 +02:00
|
|
|
};
|
|
|
|
#pragma pack(pop)
|
|
|
|
|
|
|
|
|
|
|
|
// FScrollbar inline functions
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline const char* FScrollbar::getClassName() const
|
|
|
|
{ return "FScrollbar"; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline int FScrollbar::getValue() const
|
|
|
|
{ return val; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2016-09-27 00:46:05 +02:00
|
|
|
inline FScrollbar::sType FScrollbar::getScrollType() const
|
|
|
|
{ return scroll_type; }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2017-04-09 20:08:53 +02:00
|
|
|
#endif // FSCROLLBAR_H
|