DrawableButton Indent


#1

Is there a way to remove the indent in a DrawableButton?


#2

Can’t remember offhand, but you could always override the paint method if you need some really custom stuff.


#3

Well I want to have two DrawableButtons that share an edge like you can do with normal buttons. If I use the ImageRaw ButtonStyle then everything works fine but the image won’t resize to the button size. If I use ImageFitted the image is inset so it won’t line up with button next to it. Here’s the offending code in DrawableButton.cpp

[code] const int textH = (style == ImageAboveTextLabel)
? jmin (16, proportionOfHeight (0.25f))
: 0;

    const int indentX = jmin (3, proportionOfWidth (0.05f));
    const int indentY = jmin (3, proportionOfHeight (0.05f));

    imageSpace.setBounds (indentX, indentY,
                          getWidth() - indentX * 2,
                          getHeight() - indentY * 2 - textH);

[/code]

Is there any reason to have an inset?


#4

well you do often want an inset, so that the button can have a hit region bigger than the image itself. But I’ll see if I can find a neat way to make it optional.


#5

ahh, that makes sense. thanks :smiley:


#6