Slider look and feel


#1

I can’t get all the LookAndFeel methods to run, my LookAndFeel class has those two members, and this look and feel is set as the default look and feel

void drawRotarySlider (Graphics& g, int x, int y, int width, int height, float sliderPos, float rotaryStartAngle, float rotaryEndAngle, Slider& slider);
Label* createSliderTextBox(Slider& slider);
ImageEffectFilter* getSliderEffect ();

the createSliderTextBox and the getSliderEffect methods never get called, but the drawRotarySlider method gets called and works, is there something “extra” to make them work ?

edit:
actualy they get called, when i explicitly set the lookandfeel to the component that is using some sliders, however the default look and feel behaves as described above.


#2

Sounds to me like you might have accidentally set another lookandfeel somewhere (e.g. for a top-level window) that’s being picked up instead of the default one.


#3

Well you might be right there is a lot going on in terms of components parents and other. But i’ll live with explicitly setting my look and feel to the component.

I have one question though, i’d like to draw a tabbed button bar like on the MAC, but i can’t figure out how to determine the last tabbed button, i can find the first one (tabIndex==0) but how do i find the last one ? only method of the lookandfeel set gets the actual tabbedbuttonbar and that is drawTabAreaBehindFrontButton. Is there a way to find this in other methods ?


#4

You could use the Button::setConnectedEdges stuff to do that, perhaps?


#5

i know how to draw it i just don’t know when in terms of the LookAndFeel methods, i now when to set the left edges for the 1st button but when do i set the right edges for the last one ? (how).


#6

Ah, I see… Hmm, good question… I guess you could call getTabButton (getNumTabs() - 1) and see if that’s the button in question.


#7

in witch method of the lookAndFeel class ? the only one that gets a TabbedButtonBar reference is the drawTabAreaBehindFrontButton


#8

Drat. Yes, it really does need to provide a reference to the bar object.

Ok, I can’t see any way to do it other than to change that method to include the bar. I guess I’ll need to do that…


#9

ah no, hang on… You can just do this:

…I’d rather avoid messing with the method signatures if possible, it’d break a lot of code.


#10

yeah i’m with you on the “let’s not change those methods” thing.