mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-17 14:16:10 -06:00
37 lines
860 B
C++
37 lines
860 B
C++
#ifndef _AutoScroller_AutoScroller_h_
|
|
#define _AutoScroller_AutoScroller_h_
|
|
|
|
#include <CtrlLib/CtrlLib.h>
|
|
using namespace Upp;
|
|
|
|
template<class C = ParentCtrl>
|
|
class AutoScroller : public C
|
|
{
|
|
public:
|
|
typedef AutoScroller<C> CLASSNAME;
|
|
AutoScroller();
|
|
|
|
public:
|
|
virtual void Layout();
|
|
|
|
void EnableScroll(bool b = true);
|
|
void DisableScroll() { EnableScroll(false); }
|
|
bool IsEnabledScroll() const { return scroll.x.IsEnabled() || scroll.y.IsEnabled(); }
|
|
|
|
void AddPane(Ctrl& c) { ClearPane(); pane = &c; C::Add(c); }
|
|
Ctrl* GetPane() const { return pane; }
|
|
inline bool HasPane() const { return (~pane != NULL); }
|
|
void ClearPane() { if(! ~pane) return; pane->Remove(); pane = NULL; }
|
|
|
|
void Scroll(const Point& p);
|
|
void OnScroll();
|
|
|
|
Callback WhenScrolled;
|
|
ScrollBars scroll;
|
|
|
|
protected:
|
|
Ptr<Ctrl> pane;
|
|
};
|
|
|
|
|
|
#endif
|