summaryrefslogtreecommitdiff
path: root/vcl/source/window/dlgctrl.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/source/window/dlgctrl.cxx')
-rw-r--r--vcl/source/window/dlgctrl.cxx46
1 files changed, 10 insertions, 36 deletions
diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx
index 6c481da574a6..e6c1ddd8d0ab 100644
--- a/vcl/source/window/dlgctrl.cxx
+++ b/vcl/source/window/dlgctrl.cxx
@@ -533,39 +533,14 @@ namespace
return (pWindow && isVisibleInLayout(pWindow) && isEnabledInLayout(pWindow) && pWindow->IsInputEnabled());
}
- bool backInGroup(std::vector<RadioButton*>::reverse_iterator aRevStart, std::vector<RadioButton*> &rGroup)
+ bool focusNextInGroup(std::vector<RadioButton*>::iterator aStart, std::vector<RadioButton*> &rGroup)
{
- std::vector<RadioButton*>::reverse_iterator aI(aRevStart);
- while (aI != rGroup.rend())
- {
- Window *pWindow = *aI;
-
- if (isSuitableDestination(pWindow))
- {
- pWindow->ImplControlFocus( GETFOCUS_CURSOR | GETFOCUS_BACKWARD );
- return true;
- }
- }
-
- aI = rGroup.rbegin();
- while (aI != aRevStart)
- {
- Window *pWindow = *aI;
-
- if (isSuitableDestination(pWindow))
- {
- pWindow->ImplControlFocus( GETFOCUS_CURSOR | GETFOCUS_BACKWARD );
- return true;
- }
- }
+ std::vector<RadioButton*>::iterator aI(aStart);
- return false;
- }
+ if (aStart != rGroup.end())
+ ++aI;
- bool forwardInGroup(std::vector<RadioButton*>::iterator aStart, std::vector<RadioButton*> &rGroup)
- {
- std::vector<RadioButton*>::iterator aI(aStart);
- while (++aI != rGroup.end())
+ for (; aI != rGroup.end(); ++aI)
{
Window *pWindow = *aI;
@@ -576,8 +551,7 @@ namespace
}
}
- aI = rGroup.begin();
- while (aI != aStart)
+ for (aI = rGroup.begin(); aI != aStart; ++aI)
{
Window *pWindow = *aI;
@@ -598,14 +572,14 @@ namespace
if (aGroup.size() == 1) //only one button in group
return false;
+ if (bBackward)
+ std::reverse(aGroup.begin(), aGroup.end());
+
std::vector<RadioButton*>::iterator aStart(std::find(aGroup.begin(), aGroup.end(), pSourceWindow));
assert(aStart != aGroup.end());
- if (bBackward)
- return backInGroup(std::vector<RadioButton*>::reverse_iterator(aStart), aGroup);
- else
- return forwardInGroup(aStart, aGroup);
+ return focusNextInGroup(aStart, aGroup);
}
}