Browse Source

Added slider type LinearBarVertical.

tags/2021-05-28
jules 12 years ago
parent
commit
b6d825e133
3 changed files with 19 additions and 6 deletions
  1. +11
    -0
      modules/juce_core/native/juce_mac_Network.mm
  2. +7
    -6
      modules/juce_gui_basics/widgets/juce_Slider.cpp
  3. +1
    -0
      modules/juce_gui_basics/widgets/juce_Slider.h

+ 11
- 0
modules/juce_core/native/juce_mac_Network.mm View File

@@ -211,6 +211,10 @@ public:
initialised = true;
}
void didSendBodyData (int /*totalBytesWritten*/, int /*totalBytesExpected*/)
{
}
void finishedLoading()
{
hasFinished = true;
@@ -249,6 +253,8 @@ private:
addMethod (@selector (connection:didReceiveResponse:), didReceiveResponse, "v@:@@");
addMethod (@selector (connection:didFailWithError:), didFailWithError, "v@:@@");
addMethod (@selector (connection:didReceiveData:), didReceiveData, "v@:@@");
addMethod (@selector (connection:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite:totalBytesExpectedToWrite:),
connectionDidSendBodyData, "v@:@iii");
addMethod (@selector (connectionDidFinishLoading:), connectionDidFinishLoading, "v@:@");
registerClass();
@@ -273,6 +279,11 @@ private:
getState (self)->didReceiveData (newData);
}
static void connectionDidSendBodyData (id self, SEL, NSURLConnection*, NSInteger, NSInteger totalBytesWritten, NSInteger totalBytesExpected)
{
getState (self)->didSendBodyData (totalBytesWritten, totalBytesExpected);
}
static void connectionDidFinishLoading (id self, SEL, NSURLConnection*)
{
getState (self)->finishedLoading();


+ 7
- 6
modules/juce_gui_basics/widgets/juce_Slider.cpp View File

@@ -87,6 +87,7 @@ public:
bool isVertical() const noexcept
{
return style == LinearVertical
|| style == LinearBarVertical
|| style == TwoValueVertical
|| style == ThreeValueVertical;
}
@@ -574,7 +575,7 @@ public:
valueBox->addListener (this);
if (style == LinearBar)
if (style == LinearBar || style == LinearBarVertical)
{
valueBox->addMouseListener (&owner, false);
valueBox->setMouseCursor (MouseCursor::ParentCursor);
@@ -748,7 +749,7 @@ public:
if (style == RotaryHorizontalDrag
|| style == RotaryVerticalDrag
|| style == IncDecButtons
|| ((style == LinearHorizontal || style == LinearVertical || style == LinearBar)
|| ((style == LinearHorizontal || style == LinearVertical || style == LinearBar || style == LinearBarVertical)
&& ! snapsToMousePos))
{
const int mouseDiff = (style == RotaryHorizontalDrag
@@ -873,7 +874,7 @@ public:
{
if ((! menuShown)
&& maximum > minimum
&& ! (style == LinearBar && e.mouseWasClicked() && valueBox != nullptr && valueBox->isEditable()))
&& ! ((style == LinearBar || style == LinearBarVertical) && e.mouseWasClicked() && valueBox != nullptr && valueBox->isEditable()))
{
if (style == Rotary)
{
@@ -1076,7 +1077,7 @@ public:
style, owner);
}
if (style == LinearBar && valueBox == nullptr)
if ((style == LinearBar || style == LinearBarVertical) && valueBox == nullptr)
{
g.setColour (owner.findColour (Slider::textBoxOutlineColourId));
g.drawRect (0, 0, owner.getWidth(), owner.getHeight(), 1);
@@ -1097,7 +1098,7 @@ public:
const int tbw = jmax (0, jmin (textBoxWidth, localBounds.getWidth() - minXSpace));
const int tbh = jmax (0, jmin (textBoxHeight, localBounds.getHeight() - minYSpace));
if (style == LinearBar)
if (style == LinearBar || style == LinearBarVertical)
{
if (valueBox != nullptr)
valueBox->setBounds (localBounds);
@@ -1132,7 +1133,7 @@ public:
const int indent = lf.getSliderThumbRadius (owner);
if (style == LinearBar)
if (style == LinearBar || style == LinearBarVertical)
{
const int barIndent = 1;
sliderRegionStart = barIndent;


+ 1
- 0
modules/juce_gui_basics/widgets/juce_Slider.h View File

@@ -64,6 +64,7 @@ public:
LinearHorizontal, /**< A traditional horizontal slider. */
LinearVertical, /**< A traditional vertical slider. */
LinearBar, /**< A horizontal bar slider with the text label drawn on top of it. */
LinearBarVertical,
Rotary, /**< A rotary control that you move by dragging the mouse in a circular motion, like a knob.
@see setRotaryParameters */
RotaryHorizontalDrag, /**< A rotary control that you move by dragging the mouse left-to-right.


Loading…
Cancel
Save