CtrlLib: SliderCtrl now suports wantfocus and displays focus better

git-svn-id: svn://ultimatepp.org/upp/trunk@1652 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2009-10-22 20:09:46 +00:00
parent a7eadc19e3
commit 4d38ee9d2d
2 changed files with 15 additions and 0 deletions

View file

@ -45,6 +45,8 @@ void SliderCtrl::Paint(Draw& w)
w.DrawImage(SliderToClient(value), (size.cy - CtrlImg::hthumb().GetSize().cy) >> 1,
HasCapture() || HasFocus() ? CtrlImg::hthumb1() : CtrlImg::hthumb());
}
if(HasFocus())
DrawFocus(w, size);
}
bool SliderCtrl::Key(dword key, int repcnt)
@ -67,6 +69,7 @@ void SliderCtrl::LeftDown(Point pos, dword keyflags)
{
if(!IsEditable())
return;
SetWantFocus();
int thumb = SliderToClient(value);
int p = HoVe(pos.x, pos.y);
if(IsNull(thumb)) {
@ -209,6 +212,16 @@ void SliderCtrl::Inc()
}
}
void SliderCtrl::GotFocus()
{
Refresh();
}
void SliderCtrl::LostFocus()
{
Refresh();
}
SliderCtrl::~SliderCtrl() {}
END_UPP_NAMESPACE

View file

@ -23,6 +23,8 @@ public:
virtual void LeftRepeat(Point pos, dword keyflags);
virtual void LeftUp(Point pos, dword keyflags);
virtual void MouseMove(Point pos, dword keyflags);
virtual void GotFocus();
virtual void LostFocus();
virtual void SetData(const Value& value);
virtual Value GetData() const;