diff options
author | Andrzej Rybczak <electricityispower@gmail.com> | 2009-09-20 22:23:03 +0200 |
---|---|---|
committer | Andrzej Rybczak <electricityispower@gmail.com> | 2009-09-20 22:23:03 +0200 |
commit | b47ad169dc9393250998ef77586e2b35d8db93a8 (patch) | |
tree | ee2f92314bcd06317763bfe19ca664637e96e423 /src/menu.h | |
parent | d995b9f065e9d100d8857cbf794f334245807729 (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.h | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -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()) |