mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-17 00:44:19 +00:00
This commit is contained in:
parent
b984a63600
commit
2b18ef2392
4 changed files with 30 additions and 4 deletions
|
|
@ -350,7 +350,6 @@ ListBox::ListBox (const String& name, ListBoxModel* const model_)
|
|||
totalItems (0),
|
||||
rowHeight (22),
|
||||
minimumRowWidth (0),
|
||||
scrollBarSize (18),
|
||||
outlineThickness (0),
|
||||
lastRowSelected (-1),
|
||||
mouseMoveSelects (false),
|
||||
|
|
@ -424,6 +423,11 @@ void ListBox::visibilityChanged()
|
|||
viewport->updateVisibleArea (true);
|
||||
}
|
||||
|
||||
Viewport* ListBox::getViewPort() const throw()
|
||||
{
|
||||
return viewport;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
void ListBox::updateContent()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -527,6 +527,13 @@ public:
|
|||
*/
|
||||
Image* createSnapshotOfSelectedRows();
|
||||
|
||||
/** Returns the viewport that this ListBox uses.
|
||||
|
||||
You may need to use this to change parameters such as whether scrollbars
|
||||
are shown, etc.
|
||||
*/
|
||||
Viewport* getViewPort() const throw();
|
||||
|
||||
|
||||
//==============================================================================
|
||||
/** @internal */
|
||||
|
|
@ -562,7 +569,7 @@ private:
|
|||
ListViewport* viewport;
|
||||
Component* headerComponent;
|
||||
int totalItems, rowHeight, minimumRowWidth;
|
||||
int scrollBarSize, outlineThickness;
|
||||
int outlineThickness;
|
||||
int lastMouseX, lastMouseY, lastRowSelected;
|
||||
bool mouseMoveSelects, multipleSelection, hasDoneInitialUpdate;
|
||||
SparseSet <int> selected;
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ ScrollBar::ScrollBar (const bool vertical_,
|
|||
minimumDelayInMillisecs (10),
|
||||
vertical (vertical_),
|
||||
isDraggingThumb (false),
|
||||
alwaysVisible (false),
|
||||
upButton (0),
|
||||
downButton (0),
|
||||
listeners (2)
|
||||
|
|
@ -234,7 +235,7 @@ void ScrollBar::updateThumbPosition() throw()
|
|||
newThumbStart += roundDoubleToInt (((rangeStart - minimum) * (thumbAreaSize - newThumbSize))
|
||||
/ ((maximum - minimum) - rangeSize));
|
||||
|
||||
setVisible (maximum - minimum > rangeSize && rangeSize > 0.0);
|
||||
setVisible (alwaysVisible || (maximum - minimum > rangeSize && rangeSize > 0.0));
|
||||
|
||||
if (thumbStart != newThumbStart || thumbSize != newThumbSize)
|
||||
{
|
||||
|
|
@ -283,6 +284,12 @@ void ScrollBar::setButtonVisibility (const bool buttonsAreVisible)
|
|||
updateThumbPosition();
|
||||
}
|
||||
|
||||
void ScrollBar::setAutoHide (const bool shouldHideWhenFullRange)
|
||||
{
|
||||
alwaysVisible = ! shouldHideWhenFullRange;
|
||||
updateThumbPosition();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
void ScrollBar::paint (Graphics& g)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -116,6 +116,14 @@ public:
|
|||
/** Shows or hides the scrollbar's buttons. */
|
||||
void setButtonVisibility (const bool buttonsAreVisible);
|
||||
|
||||
/** Tells the scrollbar whether to make itself invisible when not needed.
|
||||
|
||||
The default behaviour is for a scrollbar to become invisible when the thumb
|
||||
fills the whole of its range (i.e. when it can't be moved). Setting this
|
||||
value to false forces the bar to always be visible.
|
||||
*/
|
||||
void setAutoHide (const bool shouldHideWhenFullRange);
|
||||
|
||||
//==============================================================================
|
||||
/** Sets the minimum and maximum values that the bar will move between.
|
||||
|
||||
|
|
@ -287,7 +295,7 @@ private:
|
|||
int thumbAreaStart, thumbAreaSize, thumbStart, thumbSize;
|
||||
int dragStartMousePos, lastMousePos;
|
||||
int initialDelayInMillisecs, repeatDelayInMillisecs, minimumDelayInMillisecs;
|
||||
bool vertical, isDraggingThumb;
|
||||
bool vertical, isDraggingThumb, alwaysVisible;
|
||||
Button* upButton;
|
||||
Button* downButton;
|
||||
SortedSet <void*> listeners;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue