I had created a StretchableLayoutResizerBar, and also addAndMakeVisible(). Here I want to make it visible whether the mouse is on it or not. Does anyone knows? Thanks…
daniel
December 15, 2019, 4:54pm
2
Unfortunately the StretchableLayoutResizerBar doesn’t use ColourIds. But you can override the LookAndFeel and implement your own:
g.drawImageAt (cachedImage, 0, 0);
g.setColour (currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).withAlpha (0.8f));
g.fillPath (path);
g.setColour (currentColourScheme.getUIColour (ColourScheme::UIColour::outline).withAlpha (0.8f));
g.strokePath (path, PathStrokeType (2.0f));
}
//==============================================================================
void LookAndFeel_V4::drawStretchableLayoutResizerBar (Graphics& g, int /*w*/, int /*h*/, bool /*isVerticalBar*/,
bool isMouseOver, bool isMouseDragging)
{
if (isMouseOver || isMouseDragging)
g.fillAll (currentColourScheme.getUIColour (ColourScheme::UIColour::defaultFill).withAlpha (0.5f));
}
//==============================================================================
void LookAndFeel_V4::initialiseColours()
{
const uint32 transparent = 0x00000000;
You have access to isMouseOver and isMouseDragging, so you have all freedom.
Ok, thank you, I will try this way.
Does this function is a callback function? I override this function, but it’s sitll visible only when my mouse over the StretchableLayoutResizerBar.
daniel
December 16, 2019, 10:16am
5
It is called from repaint().
Thanks to the setting setRepaintsOnMouseActivity (true)
a repaint is called on all mouse activities, includig mouseEnter and mouseExit.
namespace juce
{
StretchableLayoutResizerBar::StretchableLayoutResizerBar (StretchableLayoutManager* layout_,
const int index,
const bool vertical)
: layout (layout_),
itemIndex (index),
isVertical (vertical)
{
setRepaintsOnMouseActivity (true);
setMouseCursor (vertical ? MouseCursor::LeftRightResizeCursor
: MouseCursor::UpDownResizeCursor);
}
StretchableLayoutResizerBar::~StretchableLayoutResizerBar()
{
}
//==============================================================================
void StretchableLayoutResizerBar::paint (Graphics& g)
If you don’t see an effect, maybe the StretchableLayoutResizerBar is not using your new LookAndFeel?
Ok, I get it, thank you so much.