From eadcda5e12edd04ed53a751fb2c810f87d4e686d Mon Sep 17 00:00:00 2001 From: cxl Date: Sun, 4 Jan 2009 14:07:35 +0000 Subject: [PATCH] SliderCtrl chameleon, Prompt fix git-svn-id: svn://ultimatepp.org/upp/trunk@726 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/CtrlLib/ChWin32.cpp | 5 +++++ uppsrc/CtrlLib/Prompt.cpp | 2 +- uppsrc/CtrlLib/SliderCtrl.cpp | 6 ++++-- uppsrc/CtrlLib/XPTheme.dli | 1 + 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/uppsrc/CtrlLib/ChWin32.cpp b/uppsrc/CtrlLib/ChWin32.cpp index f6a09310b..248162615 100644 --- a/uppsrc/CtrlLib/ChWin32.cpp +++ b/uppsrc/CtrlLib/ChWin32.cpp @@ -466,6 +466,11 @@ void ChHostSkin() Win32Look(s.arealook, XP_REBAR, 0, 1); } + CtrlImg::Set("hthumb", XpImage(XP_TRACKBAR, TKP_THUMB, TUS_NORMAL, Null, Size(10, 20))); + CtrlImg::Set("hthumb1", XpImage(XP_TRACKBAR, TKP_THUMB, TUS_PRESSED, Null, Size(10, 20))); + CtrlImg::Set("vthumb", XpImage(XP_TRACKBAR, TKP_THUMBVERT, TUS_NORMAL, Null, Size(20, 10))); + CtrlImg::Set("vthumb1", XpImage(XP_TRACKBAR, TKP_THUMBVERT, TUS_PRESSED, Null, Size(20, 10))); + XpElement e; for(int i = 0; i < 4; i++) { { diff --git a/uppsrc/CtrlLib/Prompt.cpp b/uppsrc/CtrlLib/Prompt.cpp index 7032ce1e2..d9ab2d904 100644 --- a/uppsrc/CtrlLib/Prompt.cpp +++ b/uppsrc/CtrlLib/Prompt.cpp @@ -110,7 +110,7 @@ int Prompt(Callback1 WhenLink, Vector wins = Ctrl::GetTopWindows(); for(int i = 0; i < wins.GetCount(); i++) { TopWindow *w = dynamic_cast(wins[i]); - if(w->GetScreenRect().Intersects(dlg.GetScreenRect()) && w->IsTopMost()) { + if(w && w->GetScreenRect().Intersects(dlg.GetScreenRect()) && w->IsTopMost()) { dlg.TopMost(); break; } diff --git a/uppsrc/CtrlLib/SliderCtrl.cpp b/uppsrc/CtrlLib/SliderCtrl.cpp index 559c9c1db..ec64a5976 100644 --- a/uppsrc/CtrlLib/SliderCtrl.cpp +++ b/uppsrc/CtrlLib/SliderCtrl.cpp @@ -160,9 +160,11 @@ int SliderCtrl::ClientToSlider(int p) const { if(max <= min) return min; + Size hsz = CtrlImg::hthumb().GetSize(); + Size vsz = CtrlImg::vthumb().GetSize(); + p -= HoVe(hsz.cx / 2, vsz.cy / 2); return minmax(min + iscale(p, max - min, - HoVe(GetSize().cx - CtrlImg::hthumb().GetSize().cx, - GetSize().cy - CtrlImg::vthumb().GetSize().cy)), min, max); + HoVe(GetSize().cx - hsz.cx, GetSize().cy - vsz.cy)), min, max); } void SliderCtrl::Dec() diff --git a/uppsrc/CtrlLib/XPTheme.dli b/uppsrc/CtrlLib/XPTheme.dli index ea74aa608..c4499f213 100644 --- a/uppsrc/CtrlLib/XPTheme.dli +++ b/uppsrc/CtrlLib/XPTheme.dli @@ -26,3 +26,4 @@ WIDGET(TAB) WIDGET(TOOLBAR) WIDGET(MENU) WIDGET(REBAR) +WIDGET(TRACKBAR)