summaryrefslogtreecommitdiff
path: root/src/menu.h
diff options
context:
space:
mode:
authorAndrzej Rybczak <electricityispower@gmail.com>2009-09-20 22:23:03 +0200
committerAndrzej Rybczak <electricityispower@gmail.com>2009-09-20 22:23:03 +0200
commitb47ad169dc9393250998ef77586e2b35d8db93a8 (patch)
treeee2f92314bcd06317763bfe19ca664637e96e423 /src/menu.h
parentd995b9f065e9d100d8857cbf794f334245807729 (diff)
add new function: Menu::CurrentlyDrawedPosition()
this'll be used to simplify displaying currently playing item
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())