1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +00:00

Changed some return types from being const objects to non-const objects (for better c++11 compliance in future). This may mean that you need to remove the 'const' from your own code if you override the virtual methods that have changed.

This commit is contained in:
Julian Storer 2011-08-19 21:34:34 +01:00
parent dab3472756
commit 2c328dfedc
79 changed files with 126 additions and 128 deletions

View file

@ -527,7 +527,7 @@ void MidiKeyboardComponent::setOctaveForMiddleC (const int octaveNumForMiddleC_)
repaint();
}
const String MidiKeyboardComponent::getWhiteNoteText (const int midiNoteNumber)
String MidiKeyboardComponent::getWhiteNoteText (const int midiNoteNumber)
{
if (keyWidth > 14.0f && midiNoteNumber % 12 == 0)
return MidiMessage::getMidiNoteName (midiNoteNumber, true, true, octaveNumForMiddleC);

View file

@ -333,7 +333,7 @@ protected:
@see setOctaveForMiddleC
*/
virtual const String getWhiteNoteText (const int midiNoteNumber);
virtual String getWhiteNoteText (const int midiNoteNumber);
/** Draws the up and down buttons that change the base note. */
virtual void drawUpDownButton (Graphics& g, int w, int h,

View file

@ -123,7 +123,7 @@ bool Graphics::isClipEmpty() const
return context->isClipEmpty();
}
const Rectangle<int> Graphics::getClipBounds() const
Rectangle<int> Graphics::getClipBounds() const
{
return context->getClipBounds();
}

View file

@ -547,7 +547,7 @@ public:
@see getClipRegion, clipRegionIntersects
*/
const Rectangle<int> getClipBounds() const;
Rectangle<int> getClipBounds() const;
/** Checks whether a rectangle overlaps the context's clipping region.

View file

@ -76,7 +76,7 @@ public:
virtual void clipToImageAlpha (const Image& sourceImage, const AffineTransform& transform) = 0;
virtual bool clipRegionIntersects (const Rectangle<int>& r) = 0;
virtual const Rectangle<int> getClipBounds() const = 0;
virtual Rectangle<int> getClipBounds() const = 0;
virtual bool isClipEmpty() const = 0;
virtual void saveState() = 0;

View file

@ -153,7 +153,7 @@ bool LowLevelGraphicsPostScriptRenderer::clipRegionIntersects (const Rectangle<i
return stateStack.getLast()->clip.intersectsRectangle (r.translated (stateStack.getLast()->xOffset, stateStack.getLast()->yOffset));
}
const Rectangle<int> LowLevelGraphicsPostScriptRenderer::getClipBounds() const
Rectangle<int> LowLevelGraphicsPostScriptRenderer::getClipBounds() const
{
return stateStack.getLast()->clip.getBounds().translated (-stateStack.getLast()->xOffset,
-stateStack.getLast()->yOffset);

View file

@ -65,7 +65,7 @@ public:
void endTransparencyLayer();
bool clipRegionIntersects (const Rectangle<int>& r);
const Rectangle<int> getClipBounds() const;
Rectangle<int> getClipBounds() const;
bool isClipEmpty() const;
//==============================================================================

View file

@ -2281,7 +2281,7 @@ bool LowLevelGraphicsSoftwareRenderer::clipRegionIntersects (const Rectangle<int
return currentState->clipRegionIntersects (r);
}
const Rectangle<int> LowLevelGraphicsSoftwareRenderer::getClipBounds() const
Rectangle<int> LowLevelGraphicsSoftwareRenderer::getClipBounds() const
{
return currentState->getClipBounds();
}

View file

@ -59,7 +59,7 @@ public:
void clipToImageAlpha (const Image& sourceImage, const AffineTransform& transform);
bool clipRegionIntersects (const Rectangle<int>& r);
const Rectangle<int> getClipBounds() const;
Rectangle<int> getClipBounds() const;
bool isClipEmpty() const;
void saveState();

View file

@ -410,7 +410,7 @@ public:
static SharedImage* createNativeImage (PixelFormat format, int width, int height, bool clearImage);
static SharedImage* createSoftwareImage (PixelFormat format, int width, int height, bool clearImage);
const PixelFormat getPixelFormat() const noexcept { return format; }
PixelFormat getPixelFormat() const noexcept { return format; }
int getWidth() const noexcept { return width; }
int getHeight() const noexcept { return height; }

View file

@ -400,7 +400,7 @@ public:
return getClipBounds().intersects (r);
}
const Rectangle<int> getClipBounds() const
Rectangle<int> getClipBounds() const
{
JNIEnv* env = getEnv();
jobject rect = getCanvas().callObjectMethod (Canvas.getClipBounds2);

View file

@ -45,7 +45,7 @@ public:
void clipToPath (const Path& path, const AffineTransform& transform);
void clipToImageAlpha (const Image& sourceImage, const AffineTransform& transform);
bool clipRegionIntersects (const Rectangle<int>& r);
const Rectangle<int> getClipBounds() const;
Rectangle<int> getClipBounds() const;
bool isClipEmpty() const;
//==============================================================================

View file

@ -272,7 +272,7 @@ bool CoreGraphicsContext::clipRegionIntersects (const Rectangle<int>& r)
return getClipBounds().intersects (r);
}
const Rectangle<int> CoreGraphicsContext::getClipBounds() const
Rectangle<int> CoreGraphicsContext::getClipBounds() const
{
if (! lastClipRectIsValid)
{

View file

@ -160,7 +160,7 @@ public:
return currentState->clipRect.intersects (r2);
}
const Rectangle<int> getClipBounds() const
Rectangle<int> getClipBounds() const
{
// xxx could this take into account complex clip regions?
return currentState->clipRect - currentState->origin;

View file

@ -1646,7 +1646,7 @@ void Component::setMouseCursor (const MouseCursor& newCursor)
}
}
const MouseCursor Component::getMouseCursor()
MouseCursor Component::getMouseCursor()
{
return cursor;
}

View file

@ -1406,7 +1406,7 @@ public:
@see MouseCursor
*/
virtual const MouseCursor getMouseCursor();
virtual MouseCursor getMouseCursor();
/** Forces the current mouse cursor to be updated.

View file

@ -57,7 +57,7 @@ public:
The index should be in the range 0 to (getNumSelectedFiles() - 1).
@see getNumSelectedFiles
*/
virtual const File getSelectedFile (int index) const = 0;
virtual File getSelectedFile (int index) const = 0;
/** Deselects any selected files. */
virtual void deselectAllFiles() = 0;

View file

@ -47,7 +47,7 @@ int FileListComponent::getNumSelectedFiles() const
return getNumSelectedRows();
}
const File FileListComponent::getSelectedFile (int index) const
File FileListComponent::getSelectedFile (int index) const
{
return fileList.getFile (getSelectedRow (index));
}

View file

@ -68,7 +68,7 @@ public:
The index should be in the range 0 to (getNumSelectedFiles() - 1).
@see getNumSelectedFiles
*/
const File getSelectedFile (int index = 0) const;
File getSelectedFile (int index = 0) const;
/** Deselects any files that are currently selected. */
void deselectAllFiles();

View file

@ -227,7 +227,7 @@ FileTreeComponent::~FileTreeComponent()
}
//==============================================================================
const File FileTreeComponent::getSelectedFile (const int index) const
File FileTreeComponent::getSelectedFile (const int index) const
{
const FileListTreeItem* const item = dynamic_cast <const FileListTreeItem*> (getSelectedItem (index));

View file

@ -64,7 +64,7 @@ public:
The index should be in the range 0 to (getNumSelectedFiles() - 1).
@see getNumSelectedFiles
*/
const File getSelectedFile (int index = 0) const;
File getSelectedFile (int index = 0) const;
/** Deselects any files that are currently selected. */
void deselectAllFiles();

View file

@ -54,7 +54,7 @@ public:
/** Returns the extents of the selected text region, or an empty range if
nothing is selected,
*/
virtual const Range<int> getHighlightedRegion() const = 0;
virtual Range<int> getHighlightedRegion() const = 0;
/** Sets the currently-selected text region. */
virtual void setHighlightedRegion (const Range<int>& newRange) = 0;
@ -65,13 +65,13 @@ public:
virtual void setTemporaryUnderlining (const Array <Range<int> >& underlinedRegions) = 0;
/** Returns a specified sub-section of the text. */
virtual const String getTextInRange (const Range<int>& range) const = 0;
virtual String getTextInRange (const Range<int>& range) const = 0;
/** Inserts some text, overwriting the selected text region, if there is one. */
virtual void insertTextAtCaret (const String& textToInsert) = 0;
/** Returns the position of the caret, relative to the component's origin. */
virtual const Rectangle<int> getCaretRectangle() = 0;
virtual Rectangle<int> getCaretRectangle() = 0;
};

View file

@ -68,7 +68,7 @@ const ResizableBorderComponent::Zone ResizableBorderComponent::Zone::fromPositio
return Zone (z);
}
const MouseCursor ResizableBorderComponent::Zone::getMouseCursor() const noexcept
MouseCursor ResizableBorderComponent::Zone::getMouseCursor() const noexcept
{
MouseCursor::StandardCursorType mc = MouseCursor::NormalCursor;

View file

@ -122,7 +122,7 @@ public:
const Point<int>& position);
/** Returns an appropriate mouse-cursor for this resize zone. */
const MouseCursor getMouseCursor() const noexcept;
MouseCursor getMouseCursor() const noexcept;
/** Returns true if dragging this zone will move the enire object without resizing it. */
bool isDraggingWholeObject() const noexcept { return zone == centre; }

View file

@ -327,7 +327,7 @@ void LookAndFeel::setDefaultSansSerifTypefaceName (const String& newName)
}
//==============================================================================
const MouseCursor LookAndFeel::getMouseCursorFor (Component& component)
MouseCursor LookAndFeel::getMouseCursorFor (Component& component)
{
return component.getMouseCursor();
}

View file

@ -142,7 +142,7 @@ public:
/** Override this to get the chance to swap a component's mouse cursor for a
customised one.
*/
virtual const MouseCursor getMouseCursorFor (Component& component);
virtual MouseCursor getMouseCursorFor (Component& component);
//==============================================================================
/** Draws the lozenge-shaped background for a standard button. */

View file

@ -64,7 +64,7 @@ public:
If you need to change this string, call refresh() to update the component.
*/
virtual const String getButtonText() const = 0;
virtual String getButtonText() const = 0;
//==============================================================================
/** @internal */

View file

@ -96,7 +96,7 @@ void TextPropertyComponent::setText (const String& newText)
textEditor->setText (newText, true);
}
const String TextPropertyComponent::getText() const
String TextPropertyComponent::getText() const
{
return textEditor->getText();
}

View file

@ -77,7 +77,7 @@ public:
/** Returns the text that should be shown in the text editor.
*/
virtual const String getText() const;
virtual String getText() const;
//==============================================================================

View file

@ -861,7 +861,7 @@ void ListBox::repaintRow (const int rowNumber) noexcept
repaint (getRowPosition (rowNumber, true));
}
const Image ListBox::createSnapshotOfSelectedRows (int& imageX, int& imageY)
Image ListBox::createSnapshotOfSelectedRows (int& imageX, int& imageY)
{
Rectangle<int> imageArea;
const int firstRow = getRowContainingPosition (0, 0);

View file

@ -524,7 +524,7 @@ public:
@see Component::createComponentSnapshot
*/
virtual const Image createSnapshotOfSelectedRows (int& x, int& y);
virtual Image createSnapshotOfSelectedRows (int& x, int& y);
/** Returns the viewport that this ListBox uses.

View file

@ -779,7 +779,7 @@ void TableHeaderComponent::mouseUp (const MouseEvent& e)
dragOverlayComp = nullptr;
}
const MouseCursor TableHeaderComponent::getMouseCursor()
MouseCursor TableHeaderComponent::getMouseCursor()
{
if (columnIdBeingResized != 0 || (getResizeDraggerAt (getMouseXYRelative().getX()) != 0 && ! isMouseButtonDown()))
return MouseCursor (MouseCursor::LeftRightResizeCursor);

View file

@ -389,7 +389,7 @@ public:
/** @internal */
void mouseUp (const MouseEvent&);
/** @internal */
const MouseCursor getMouseCursor();
MouseCursor getMouseCursor();
/** Can be overridden for more control over the pop-up menu behaviour. */
virtual void showColumnChooserMenu (int columnIdClicked);

View file

@ -892,7 +892,7 @@ public:
owner.timerCallbackInt();
}
const MouseCursor getMouseCursor()
MouseCursor getMouseCursor()
{
return owner.getMouseCursor();
}
@ -1417,7 +1417,7 @@ void TextEditor::scrollEditorToPositionCaret (const int desiredCaretX,
viewport->setViewPosition (vx, vy);
}
const Rectangle<int> TextEditor::getCaretRectangle()
Rectangle<int> TextEditor::getCaretRectangle()
{
float cursorX, cursorY;
float cursorHeight = currentFont.getHeight(); // (in case the text is empty and the call below doesn't set this value)
@ -2462,7 +2462,7 @@ String TextEditor::getText() const
return mo.toString();
}
const String TextEditor::getTextInRange (const Range<int>& range) const
String TextEditor::getTextInRange (const Range<int>& range) const
{
if (range.isEmpty())
return String::empty;

View file

@ -335,7 +335,7 @@ public:
String getText() const;
/** Returns a section of the contents of the editor. */
const String getTextInRange (const Range<int>& textRange) const;
String getTextInRange (const Range<int>& textRange) const;
/** Returns true if there are no characters in the editor.
@ -428,7 +428,7 @@ public:
The rectangle returned is relative to the component's top-left corner.
@see scrollEditorToPositionCaret
*/
const Rectangle<int> getCaretRectangle();
Rectangle<int> getCaretRectangle();
/** Selects a section of the text. */
void setHighlightedRegion (const Range<int>& newSelection);
@ -437,7 +437,7 @@ public:
If nothing is selected, this will return an empty range.
@see setHighlightedRegion
*/
const Range<int> getHighlightedRegion() const { return selection; }
Range<int> getHighlightedRegion() const { return selection; }
/** Returns the section of text that is currently selected. */
String getHighlightedText() const;

View file

@ -582,7 +582,7 @@ StringArray CPlusPlusCodeTokeniser::getTokenTypes()
return StringArray (types);
}
const Colour CPlusPlusCodeTokeniser::getDefaultColour (const int tokenType)
Colour CPlusPlusCodeTokeniser::getDefaultColour (const int tokenType)
{
const uint32 colours[] =
{

View file

@ -61,7 +61,7 @@ public:
//==============================================================================
int readNextToken (CodeDocument::Iterator& source);
StringArray getTokenTypes();
const Colour getDefaultColour (int tokenType);
Colour getDefaultColour (int tokenType);
/** This is a handy method for checking whether a string is a c++ reserved keyword. */
static bool isReservedKeyword (const String& token) noexcept;

View file

@ -306,7 +306,7 @@ void CodeEditorComponent::setTemporaryUnderlining (const Array <Range<int> >&)
jassertfalse; // TODO Windows IME not yet supported for this comp..
}
const Rectangle<int> CodeEditorComponent::getCaretRectangle()
Rectangle<int> CodeEditorComponent::getCaretRectangle()
{
return getLocalArea (caret, caret->getLocalBounds());
}
@ -568,7 +568,7 @@ void CodeEditorComponent::scrollToKeepCaretOnScreen()
scrollToColumn (column);
}
const Rectangle<int> CodeEditorComponent::getCharacterBounds (const CodeDocument::Position& pos) const
Rectangle<int> CodeEditorComponent::getCharacterBounds (const CodeDocument::Position& pos) const
{
return Rectangle<int> (roundToInt ((gutter - xOffset * charWidth) + indexToColumn (pos.getLineNumber(), pos.getIndexInLine()) * charWidth),
(pos.getLineNumber() - firstLineOnScreen) * lineHeight,
@ -576,7 +576,7 @@ const Rectangle<int> CodeEditorComponent::getCharacterBounds (const CodeDocument
lineHeight);
}
const CodeDocument::Position CodeEditorComponent::getPositionAt (int x, int y)
CodeDocument::Position CodeEditorComponent::getPositionAt (int x, int y)
{
const int line = y / lineHeight + firstLineOnScreen;
const int column = roundToInt ((x - (gutter - xOffset * charWidth)) / charWidth);
@ -879,7 +879,7 @@ void CodeEditorComponent::timerCallback()
}
//==============================================================================
const Range<int> CodeEditorComponent::getHighlightedRegion() const
Range<int> CodeEditorComponent::getHighlightedRegion() const
{
return Range<int> (selectionStart.getPosition(), selectionEnd.getPosition());
}
@ -890,7 +890,7 @@ void CodeEditorComponent::setHighlightedRegion (const Range<int>& newRange)
moveCaretTo (CodeDocument::Position (&document, newRange.getEnd()), true);
}
const String CodeEditorComponent::getTextInRange (const Range<int>& range) const
String CodeEditorComponent::getTextInRange (const Range<int>& range) const
{
return document.getTextBetween (CodeDocument::Position (&document, range.getStart()),
CodeDocument::Position (&document, range.getEnd()));

View file

@ -89,10 +89,10 @@ public:
int getNumColumnsOnScreen() const noexcept { return columnsOnScreen; }
/** Returns the current caret position. */
const CodeDocument::Position getCaretPos() const { return caretPos; }
CodeDocument::Position getCaretPos() const { return caretPos; }
/** Returns the position of the caret, relative to the editor's origin. */
const Rectangle<int> getCaretRectangle();
Rectangle<int> getCaretRectangle();
/** Moves the caret.
If selecting is true, the section of the document between the current
@ -104,12 +104,12 @@ public:
/** Returns the on-screen position of a character in the document.
The rectangle returned is relative to this component's top-left origin.
*/
const Rectangle<int> getCharacterBounds (const CodeDocument::Position& pos) const;
Rectangle<int> getCharacterBounds (const CodeDocument::Position& pos) const;
/** Finds the character at a given on-screen position.
The co-ordinates are relative to this component's top-left origin.
*/
const CodeDocument::Position getPositionAt (int x, int y);
CodeDocument::Position getPositionAt (int x, int y);
//==============================================================================
bool moveCaretLeft (bool moveInWholeWordSteps, bool selecting);
@ -144,9 +144,9 @@ public:
void insertTabAtCaret();
//==============================================================================
const Range<int> getHighlightedRegion() const;
Range<int> getHighlightedRegion() const;
void setHighlightedRegion (const Range<int>& newRange);
const String getTextInRange (const Range<int>& range) const;
String getTextInRange (const Range<int>& range) const;
//==============================================================================
/** Changes the current tab settings.

View file

@ -60,7 +60,7 @@ public:
/** Returns a suggested syntax highlighting colour for a specified
token type.
*/
virtual const Colour getDefaultColour (int tokenType) = 0;
virtual Colour getDefaultColour (int tokenType) = 0;
private:

View file

@ -360,7 +360,7 @@ ColourSelector::~ColourSelector()
}
//==============================================================================
const Colour ColourSelector::getCurrentColour() const
Colour ColourSelector::getCurrentColour() const
{
return ((flags & showAlphaChannel) != 0) ? colour
: colour.withAlpha ((uint8) 0xff);
@ -570,7 +570,7 @@ int ColourSelector::getNumSwatches() const
return 0;
}
const Colour ColourSelector::getSwatchColour (const int) const
Colour ColourSelector::getSwatchColour (const int) const
{
jassertfalse; // if you've overridden getNumSwatches(), you also need to implement this method
return Colours::black;

View file

@ -78,7 +78,7 @@ public:
@see setCurrentColour
*/
const Colour getCurrentColour() const;
Colour getCurrentColour() const;
/** Changes the colour that is currently being shown.
*/
@ -101,7 +101,7 @@ public:
setSwatchColour(), to return the number of colours you want, and to set and retrieve
their values.
*/
virtual const Colour getSwatchColour (int index) const;
virtual Colour getSwatchColour (int index) const;
/** Called by the selector when the user puts a new colour into one of the swatches.

View file

@ -112,7 +112,7 @@ public:
return [EAGLContext currentContext] == context;
}
const OpenGLPixelFormat getPixelFormat() const { return pixelFormat; }
OpenGLPixelFormat getPixelFormat() const { return pixelFormat; }
void* getRawContext() const noexcept { return glLayer; }
void updateWindowPosition (const Rectangle<int>& bounds)

View file

@ -132,7 +132,7 @@ public:
return glXGetCurrentContext() == renderContext;
}
const OpenGLPixelFormat getPixelFormat() const
OpenGLPixelFormat getPixelFormat() const
{
return pixelFormat;
}

View file

@ -205,7 +205,7 @@ public:
return [NSOpenGLContext currentContext] == renderContext;
}
const OpenGLPixelFormat getPixelFormat() const { return pixelFormat; }
OpenGLPixelFormat getPixelFormat() const { return pixelFormat; }
void* getRawContext() const noexcept { return renderContext; }
void updateWindowPosition (const Rectangle<int>&) {}

View file

@ -143,7 +143,7 @@ public:
return wglGetCurrentContext() == renderContext;
}
const OpenGLPixelFormat getPixelFormat() const
OpenGLPixelFormat getPixelFormat() const
{
OpenGLPixelFormat pf;

View file

@ -241,7 +241,7 @@ OpenGLComponent::~OpenGLComponent()
componentWatcher = nullptr;
}
const OpenGLPixelFormat OpenGLComponent::getPixelFormat() const
OpenGLPixelFormat OpenGLComponent::getPixelFormat() const
{
OpenGLPixelFormat pf;

View file

@ -78,7 +78,7 @@ public:
void setPixelFormat (const OpenGLPixelFormat& formatToUse);
/** Returns the pixel format that this component is currently using. */
const OpenGLPixelFormat getPixelFormat() const;
OpenGLPixelFormat getPixelFormat() const;
/** Specifies an OpenGL context which should be shared with the one that this
component is using.

View file

@ -70,7 +70,7 @@ public:
//==============================================================================
/** Returns the pixel format being used by this context. */
virtual const OpenGLPixelFormat getPixelFormat() const = 0;
virtual OpenGLPixelFormat getPixelFormat() const = 0;
/** For windowed contexts, this moves the context within the bounds of
its parent window.