ultimatepp/bazaar/AutoScroller/AutoScroller.h
klugier bf5cedfca7 Bazaar: AutoScruoller now in Upp namespace.
git-svn-id: svn://ultimatepp.org/upp/trunk@15025 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2020-09-12 21:29:10 +00:00

38 lines
885 B
C++

#ifndef _AutoScroller_AutoScroller_h_
#define _AutoScroller_AutoScroller_h_
#include <CtrlLib/CtrlLib.h>
namespace Upp
{
template<class C = ParentCtrl>
class AutoScroller : public C
{
public:
using CLASSNAME = AutoScroller<C>;
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