summaryrefslogtreecommitdiff
path: root/src/menu.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/menu.h')
-rw-r--r--src/menu.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/menu.h b/src/menu.h
index 30a77ede..bbbe9ebd 100644
--- a/src/menu.h
+++ b/src/menu.h
@@ -451,6 +451,12 @@ namespace NCurses
///
virtual size_t Size() const;
+ /// @return position of currently drawed item. The result is
+ /// defined only within drawing function that is called by Refresh()
+ /// @see Refresh()
+ ///
+ size_t CurrentlyDrawedPosition() const { return itsCurrentlyDrawedPosition; }
+
/// @return reference to last item on the list
/// @throw List::InvalidItem if requested item is separator
///
@@ -523,6 +529,8 @@ namespace NCurses
bool highlightEnabled;
bool useCyclicScrolling;
+ size_t itsCurrentlyDrawedPosition;
+
Buffer *itsSelectedPrefix;
Buffer *itsSelectedSuffix;
};
@@ -714,7 +722,7 @@ template <typename T> void NCurses::Menu<T>::Refresh()
}
size_t line = 0;
- for (size_t i = itsBeginning; i < itsBeginning+itsHeight; ++i)
+ for (size_t &i = (itsCurrentlyDrawedPosition = itsBeginning); i < itsBeginning+itsHeight; ++i)
{
GotoXY(0, line);
if (i >= itsOptionsPtr->size())