CtrlLib: ScrollBar::IsActive

git-svn-id: svn://ultimatepp.org/upp/trunk@5579 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2012-11-22 14:11:04 +00:00
parent d39b7435b5
commit dce91d6c63
2 changed files with 12 additions and 8 deletions

View file

@ -66,6 +66,7 @@ ScrollBar::ScrollBar() {
style = NULL;
SetStyle(StyleDefault());
BackPaint();
is_active = false;
}
ScrollBar::~ScrollBar() {}
@ -326,18 +327,18 @@ bool ScrollBar::Set(int apagepos) {
void ScrollBar::Set(int _pagepos, int _pagesize, int _totalsize) {
pagesize = _pagesize;
totalsize = _totalsize;
bool a = totalsize > pagesize && pagesize > 0;
if(autohide && a != IsShown()) {
Show(a);
is_active = totalsize > pagesize && pagesize > 0;
if(autohide && is_active != IsShown()) {
Show(is_active);
WhenVisibility();
}
if(autodisable) {
if(prev.IsEnabled() != a)
if(prev.IsEnabled() != is_active)
Refresh();
prev.Enable(a);
next.Enable(a);
prev2.Enable(a);
next2.Enable(a);
prev.Enable(is_active);
next.Enable(is_active);
prev2.Enable(is_active);
next2.Enable(is_active);
}
Set(_pagepos);
}

View file

@ -43,6 +43,7 @@ private:
int minthumb;
bool autohide:1;
bool autodisable:1;
bool is_active:1;
const Style *style;
@ -75,6 +76,8 @@ public:
bool Set(int pagepos);
void SetPage(int pagesize);
void SetTotal(int totalsize);
bool IsActive() const { return is_active; }
bool ScrollInto(int pos, int linesize);
bool ScrollInto(int pos) { return ScrollInto(pos, linesize); }