(LookAndFeel) TextEditor->Viewport related requests


im in the middle of building a complete LookAndFeel and have a couple of requests/questions that relate to the TextEditor class.

in the Viewport class itself theres a hardcoded attribute named scrollbarEdgeGap which seems to offset the scrollbars from the lower and right edges if the viewport scrollbars become visible. Is there a chance to add a method to set/get this value in the Viewport class, so the edge gap can be removed?

the TextEditor->Viewport is currently bounded perfectly by the TextEditor, meaning that drawing an outline around the bounds of the TextEditor draws over the Viewport scrollbars and the internal text as well. If we had a way of specifying an indent (and getting it as well) we could just inset the Viewport by this amount within the TextEditor::resized method, eg assuming we had a set/getEdgeIndent() method in TextEditor:

[code]void TextEditor::resized()
int edge = getEdgeIndent();
viewport->setBounds (edge, edge, getWidth()-(2edge), getHeight()-(2edge));



this would mean we can inset the viewport by the same width as the TextEditor outline we are drawing in the LookAndFeel.

it would also be great to have methods in the TextEditor to return some information about the Viewport dimensions like getViewportWidth/Height/X/Y but im wondering if its easier to just provide a TextEditor method to return the internal Viewport itself?

ok, more LookAndFeel related questions soon :wink:


I’ll chime in here for requesting exposing data members wherever repaints are allowed in subclasses or LookAndFeel. Jules, how about it? Case in point: Slider doesn’t expose “interval” which makes it impossible to draw tick marks in my LookAndFeel unless I hack the Slider class directly to allow this.

colinbear: Do what I do for now. Add your own methods of setValue() and getValue() <ooh, shudder – I can’t believe I just suggested that> which only require a simple cut’n’paste whenever JUCE is updated.

  • kbj


Thanks for that. Looking at that scrollbarEdgeGap thing, I think I’ll probably get rid of it, as it’s really not the job of the Viewport to leave gaps. And also a good idea about having an indent around the texteditor.

And yep, don’t know why I didn’t already have an access method for the slider interval…