From b6d825e1336f4ba5849c11a34e295f9a0bbf455c Mon Sep 17 00:00:00 2001 From: jules Date: Mon, 5 Nov 2012 20:33:34 +0000 Subject: [PATCH] Added slider type LinearBarVertical. --- modules/juce_core/native/juce_mac_Network.mm | 11 +++++++++++ modules/juce_gui_basics/widgets/juce_Slider.cpp | 13 +++++++------ modules/juce_gui_basics/widgets/juce_Slider.h | 1 + 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/modules/juce_core/native/juce_mac_Network.mm b/modules/juce_core/native/juce_mac_Network.mm index 757bf39985..574164f92d 100644 --- a/modules/juce_core/native/juce_mac_Network.mm +++ b/modules/juce_core/native/juce_mac_Network.mm @@ -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(); diff --git a/modules/juce_gui_basics/widgets/juce_Slider.cpp b/modules/juce_gui_basics/widgets/juce_Slider.cpp index 943ad73818..1575e69211 100644 --- a/modules/juce_gui_basics/widgets/juce_Slider.cpp +++ b/modules/juce_gui_basics/widgets/juce_Slider.cpp @@ -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; diff --git a/modules/juce_gui_basics/widgets/juce_Slider.h b/modules/juce_gui_basics/widgets/juce_Slider.h index fb5177ef26..0fdd97bb52 100644 --- a/modules/juce_gui_basics/widgets/juce_Slider.h +++ b/modules/juce_gui_basics/widgets/juce_Slider.h @@ -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.