Browse Source

tags/2021-05-28
jules 17 years ago
parent
commit
2b18ef2392
4 changed files with 30 additions and 4 deletions
  1. +5
    -1
      src/juce_appframework/gui/components/controls/juce_ListBox.cpp
  2. +8
    -1
      src/juce_appframework/gui/components/controls/juce_ListBox.h
  3. +8
    -1
      src/juce_appframework/gui/components/layout/juce_ScrollBar.cpp
  4. +9
    -1
      src/juce_appframework/gui/components/layout/juce_ScrollBar.h

+ 5
- 1
src/juce_appframework/gui/components/controls/juce_ListBox.cpp View File

@@ -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()
{


+ 8
- 1
src/juce_appframework/gui/components/controls/juce_ListBox.h View File

@@ -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;


+ 8
- 1
src/juce_appframework/gui/components/layout/juce_ScrollBar.cpp View File

@@ -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)
{


+ 9
- 1
src/juce_appframework/gui/components/layout/juce_ScrollBar.h View File

@@ -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…
Cancel
Save