add new function: Menu::CurrentlyDrawedPosition()
this'll be used to simplify displaying currently playing item
This commit is contained in:
10
src/menu.h
10
src/menu.h
@@ -451,6 +451,12 @@ namespace NCurses
|
|||||||
///
|
///
|
||||||
virtual size_t Size() const;
|
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
|
/// @return reference to last item on the list
|
||||||
/// @throw List::InvalidItem if requested item is separator
|
/// @throw List::InvalidItem if requested item is separator
|
||||||
///
|
///
|
||||||
@@ -523,6 +529,8 @@ namespace NCurses
|
|||||||
bool highlightEnabled;
|
bool highlightEnabled;
|
||||||
bool useCyclicScrolling;
|
bool useCyclicScrolling;
|
||||||
|
|
||||||
|
size_t itsCurrentlyDrawedPosition;
|
||||||
|
|
||||||
Buffer *itsSelectedPrefix;
|
Buffer *itsSelectedPrefix;
|
||||||
Buffer *itsSelectedSuffix;
|
Buffer *itsSelectedSuffix;
|
||||||
};
|
};
|
||||||
@@ -714,7 +722,7 @@ template <typename T> void NCurses::Menu<T>::Refresh()
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t line = 0;
|
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);
|
GotoXY(0, line);
|
||||||
if (i >= itsOptionsPtr->size())
|
if (i >= itsOptionsPtr->size())
|
||||||
|
|||||||
Reference in New Issue
Block a user