1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Minor tooltipwindow fix.

This commit is contained in:
jules 2012-11-27 12:06:02 +00:00
parent af094f3448
commit 88571ee8da
2 changed files with 12 additions and 20 deletions

View file

@ -1508,11 +1508,7 @@ void LookAndFeel::drawRotarySlider (Graphics& g,
{
Path filledArc;
filledArc.addPieSegment (rx, ry, rw, rw,
rotaryStartAngle,
angle,
thickness);
filledArc.addPieSegment (rx, ry, rw, rw, rotaryStartAngle, angle, thickness);
g.fillPath (filledArc);
}
@ -1619,8 +1615,8 @@ void LookAndFeel::drawTooltip (Graphics& g, const String& text, int width, int h
g.drawRect (0, 0, width, height, 1);
#endif
const TextLayout tl (LookAndFeelHelpers::layoutTooltipText (text, findColour (TooltipWindow::textColourId)));
tl.draw (g, Rectangle<float> ((float) width, (float) height));
LookAndFeelHelpers::layoutTooltipText (text, findColour (TooltipWindow::textColourId))
.draw (g, Rectangle<float> ((float) width, (float) height));
}
//==============================================================================
@ -1635,9 +1631,7 @@ void LookAndFeel::layoutFilenameComponent (FilenameComponent& filenameComp,
{
browseButton->setSize (80, filenameComp.getHeight());
TextButton* const tb = dynamic_cast <TextButton*> (browseButton);
if (tb != nullptr)
if (TextButton* const tb = dynamic_cast <TextButton*> (browseButton))
tb->changeWidthToFitText();
browseButton->setTopRightPosition (filenameComp.getWidth(), 0);

View file

@ -23,10 +23,9 @@
==============================================================================
*/
TooltipWindow::TooltipWindow (Component* const parent_,
const int millisecondsBeforeTipAppears_)
TooltipWindow::TooltipWindow (Component* const parentComp, const int delayMs)
: Component ("tooltip"),
millisecondsBeforeTipAppears (millisecondsBeforeTipAppears_),
millisecondsBeforeTipAppears (delayMs),
mouseClicks (0),
mouseWheelMoves (0),
lastHideTime (0),
@ -39,8 +38,8 @@ TooltipWindow::TooltipWindow (Component* const parent_,
setAlwaysOnTop (true);
setOpaque (true);
if (parent_ != nullptr)
parent_->addChildComponent (this);
if (parentComp != nullptr)
parentComp->addChildComponent (this);
}
TooltipWindow::~TooltipWindow()
@ -120,10 +119,9 @@ String TooltipWindow::getTipFor (Component* const c)
&& Process::isForegroundProcess()
&& ! ModifierKeys::getCurrentModifiers().isAnyMouseButtonDown())
{
TooltipClient* const ttc = dynamic_cast <TooltipClient*> (c);
if (ttc != nullptr && ! c->isCurrentlyBlockedByAnotherModalComponent())
return ttc->getTooltip();
if (TooltipClient* const ttc = dynamic_cast <TooltipClient*> (c))
if (! c->isCurrentlyBlockedByAnotherModalComponent())
return ttc->getTooltip();
}
return String::empty;
@ -148,7 +146,7 @@ void TooltipWindow::timerCallback()
Desktop& desktop = Desktop::getInstance();
const int clickCount = desktop.getMouseButtonClickCounter();
const int wheelCount = desktop.getMouseButtonClickCounter();
const int wheelCount = desktop.getMouseWheelMoveCounter();
const bool mouseWasClicked = (clickCount > mouseClicks || wheelCount > mouseWheelMoves);
mouseClicks = clickCount;
mouseWheelMoves = wheelCount;