| @@ -690,6 +690,8 @@ bool ProjectContentComponent::reinvokeCommandAfterClosingPropertyEditors (const | |||||
| void ProjectContentComponent::showBubbleMessage (const Rectangle<int>& pos, const String& text) | void ProjectContentComponent::showBubbleMessage (const Rectangle<int>& pos, const String& text) | ||||
| { | { | ||||
| addChildComponent (&bubbleMessage); | addChildComponent (&bubbleMessage); | ||||
| bubbleMessage.setColour (BubbleComponent::backgroundColourId, Colours::white.withAlpha (0.7f)); | |||||
| bubbleMessage.setColour (BubbleComponent::outlineColourId, Colours::black.withAlpha (0.8f)); | |||||
| bubbleMessage.setAlwaysOnTop (true); | bubbleMessage.setAlwaysOnTop (true); | ||||
| bubbleMessage.showAt (pos, AttributedString (text), 3000, true, false); | bubbleMessage.showAt (pos, AttributedString (text), 3000, true, false); | ||||
| @@ -221,6 +221,9 @@ LookAndFeel::LookAndFeel() | |||||
| GroupComponent::outlineColourId, 0x66000000, | GroupComponent::outlineColourId, 0x66000000, | ||||
| GroupComponent::textColourId, 0xff000000, | GroupComponent::textColourId, 0xff000000, | ||||
| BubbleComponent::backgroundColourId, 0xeeeeeebb, | |||||
| BubbleComponent::outlineColourId, 0x77000000, | |||||
| DirectoryContentsDisplayComponent::highlightColourId, textHighlightColour, | DirectoryContentsDisplayComponent::highlightColourId, textHighlightColour, | ||||
| DirectoryContentsDisplayComponent::textColourId, 0xff000000, | DirectoryContentsDisplayComponent::textColourId, 0xff000000, | ||||
| @@ -949,25 +952,17 @@ void LookAndFeel::drawTreeviewPlusMinusBox (Graphics& g, int x, int y, int w, in | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| void LookAndFeel::drawBubble (Graphics& g, | |||||
| float tipX, float tipY, | |||||
| float boxX, float boxY, | |||||
| float boxW, float boxH) | |||||
| void LookAndFeel::drawBubble (Graphics& g, BubbleComponent& comp, | |||||
| const Point<float>& tip, const Rectangle<float>& body) | |||||
| { | { | ||||
| const Rectangle<float> body (boxX, boxY, boxW, boxH); | |||||
| Path p; | Path p; | ||||
| p.addBubble (body, | |||||
| body.getUnion (Rectangle<float> (tipX, tipY, 1.0f, 1.0f)), | |||||
| Point<float> (tipX, tipY), | |||||
| 5.0f, jmin (15.0f, boxW * 0.2f, boxH * 0.2f)); | |||||
| p.addBubble (body, body.getUnion (Rectangle<float> (tip.x, tip.y, 1.0f, 1.0f)), | |||||
| tip, 5.0f, jmin (15.0f, body.getWidth() * 0.2f, body.getHeight() * 0.2f)); | |||||
| //xxx need to take comp as param for colour | |||||
| g.setColour (findColour (TooltipWindow::backgroundColourId).withAlpha (0.9f)); | |||||
| g.setColour (comp.findColour (BubbleComponent::backgroundColourId)); | |||||
| g.fillPath (p); | g.fillPath (p); | ||||
| //xxx as above | |||||
| g.setColour (findColour (TooltipWindow::textColourId).withAlpha (0.4f)); | |||||
| g.setColour (comp.findColour (BubbleComponent::outlineColourId)); | |||||
| g.strokePath (p, PathStrokeType (1.33f)); | g.strokePath (p, PathStrokeType (1.33f)); | ||||
| } | } | ||||
| @@ -57,6 +57,7 @@ class ImageButton; | |||||
| class CallOutBox; | class CallOutBox; | ||||
| class Drawable; | class Drawable; | ||||
| class CaretComponent; | class CaretComponent; | ||||
| class BubbleComponent; | |||||
| //============================================================================== | //============================================================================== | ||||
| /** | /** | ||||
| @@ -335,9 +336,8 @@ public: | |||||
| Button* goUpButton); | Button* goUpButton); | ||||
| //============================================================================== | //============================================================================== | ||||
| virtual void drawBubble (Graphics& g, | |||||
| float tipX, float tipY, | |||||
| float boxX, float boxY, float boxW, float boxH); | |||||
| virtual void drawBubble (Graphics& g, BubbleComponent&, | |||||
| const Point<float>& tip, const Rectangle<float>& body); | |||||
| //============================================================================== | //============================================================================== | ||||
| virtual void drawLasso (Graphics& g, Component& lassoComp); | virtual void drawLasso (Graphics& g, Component& lassoComp); | ||||
| @@ -665,6 +665,7 @@ private: | |||||
| virtual int drawTabAreaBehindFrontButton (Graphics&, int, int, TabbedButtonBar&, TabbedButtonBar::Orientation) { return 0; } | virtual int drawTabAreaBehindFrontButton (Graphics&, int, int, TabbedButtonBar&, TabbedButtonBar::Orientation) { return 0; } | ||||
| virtual int drawTabButtonText (Graphics&, int, int, int, int, const Colour&, int, const String&, Button&, TabbedButtonBar::Orientation, bool, bool, bool) { return 0; } | virtual int drawTabButtonText (Graphics&, int, int, int, int, const Colour&, int, const String&, Button&, TabbedButtonBar::Orientation, bool, bool, bool) { return 0; } | ||||
| virtual int getTabButtonBestWidth (int, const String&, int, Button&) { return 0; } | virtual int getTabButtonBestWidth (int, const String&, int, Button&) { return 0; } | ||||
| virtual int drawBubble (Graphics&, float, float, float, float, float, float) { return 0; } | |||||
| #endif | #endif | ||||
| class GlassWindowButton; | class GlassWindowButton; | ||||
| @@ -37,9 +37,7 @@ BubbleComponent::~BubbleComponent() {} | |||||
| //============================================================================== | //============================================================================== | ||||
| void BubbleComponent::paint (Graphics& g) | void BubbleComponent::paint (Graphics& g) | ||||
| { | { | ||||
| getLookAndFeel().drawBubble (g, (float) arrowTip.x, (float) arrowTip.y, | |||||
| (float) content.getX(), (float) content.getY(), | |||||
| (float) content.getWidth(), (float) content.getHeight()); | |||||
| getLookAndFeel().drawBubble (g, *this, arrowTip.toFloat(), content.toFloat()); | |||||
| g.reduceClipRegion (content); | g.reduceClipRegion (content); | ||||
| g.setOrigin (content.getX(), content.getY()); | g.setOrigin (content.getX(), content.getY()); | ||||
| @@ -123,6 +123,19 @@ public: | |||||
| */ | */ | ||||
| void setPosition (const Rectangle<int>& rectangleToPointTo); | void setPosition (const Rectangle<int>& rectangleToPointTo); | ||||
| //============================================================================== | |||||
| /** A set of colour IDs to use to change the colour of various aspects of the bubble component. | |||||
| These constants can be used either via the Component::setColour(), or LookAndFeel::setColour() | |||||
| methods. | |||||
| @see Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour | |||||
| */ | |||||
| enum ColourIds | |||||
| { | |||||
| backgroundColourId = 0x1000af0, /**< A background colour to fill the bubble with. */ | |||||
| outlineColourId = 0x1000af1 /**< The colour to use for an outline around the bubble. */ | |||||
| }; | |||||
| protected: | protected: | ||||
| //============================================================================== | //============================================================================== | ||||