1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-07 04:10:08 +00:00

Added support for c++11 override and final keywords, and blank definitions for older compilers.

This commit is contained in:
jules 2013-04-22 18:00:27 +01:00
parent e6b717e713
commit 69b90487aa
3 changed files with 38 additions and 19 deletions

View file

@ -341,7 +341,7 @@ public:
findNext.setCommandToTrigger (cm, CommandIDs::findNext, true);
}
void paint (Graphics& g)
void paint (Graphics& g) override
{
Path outline;
outline.addRoundedRectangle (1.0f, 1.0f, getWidth() - 2.0f, getHeight() - 2.0f, 8.0f);
@ -352,7 +352,7 @@ public:
g.strokePath (outline, PathStrokeType (1.0f));
}
void resized()
void resized() override
{
int y = 30;
editor.setBounds (10, y, getWidth() - 20, 24);
@ -362,12 +362,12 @@ public:
findPrev.setBounds (getWidth() - 70, y, 30, 22);
}
void buttonClicked (Button*)
void buttonClicked (Button*) override
{
setCaseSensitiveSearch (caseButton.getToggleState());
}
void textEditorTextChanged (TextEditor&)
void textEditorTextChanged (TextEditor&) override
{
setSearchString (editor.getText());
@ -375,14 +375,14 @@ public:
ed->findNext (true, false);
}
void textEditorFocusLost (TextEditor&) {}
void textEditorFocusLost (TextEditor&) override {}
void textEditorReturnKeyPressed (TextEditor&)
void textEditorReturnKeyPressed (TextEditor&) override
{
commandManager->invokeDirectly (CommandIDs::findNext, true);
}
void textEditorEscapeKeyPressed (TextEditor&)
void textEditorEscapeKeyPressed (TextEditor&) override
{
if (GenericCodeEditorComponent* ed = getOwner())
ed->hideFindPanel();

View file

@ -305,6 +305,10 @@ namespace juce
#define JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS 1
#endif
#ifndef JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL
#define JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL 1
#endif
#ifndef JUCE_COMPILER_SUPPORTS_ARC
#define JUCE_COMPILER_SUPPORTS_ARC 1
#endif
@ -315,6 +319,14 @@ namespace juce
#define JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS 1
#endif
#if defined (_MSC_VER) && _MSC_VER >= 1700
#define JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL 1
#endif
#if (! JUCE_CLANG) && defined (__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 40700
#define JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL 1
#endif
//==============================================================================
// Declare some fake versions of nullptr and noexcept, for older compilers:
#if ! (DOXYGEN || JUCE_COMPILER_SUPPORTS_NOEXCEPT)
@ -334,4 +346,11 @@ namespace juce
#define nullptr (0)
#endif
#if ! (DOXYGEN || JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL)
#undef override
#define override
#undef final
#define final
#endif
#endif // __JUCE_PLATFORMDEFS_JUCEHEADER__

View file

@ -33,7 +33,7 @@ public:
{
}
void paint (Graphics& g)
void paint (Graphics& g) override
{
if (ListBoxModel* m = owner.getModel())
m->paintListBoxItem (row, g, getWidth(), getHeight(), selected);
@ -60,7 +60,7 @@ public:
}
}
void mouseDown (const MouseEvent& e)
void mouseDown (const MouseEvent& e) override
{
isDragging = false;
selectRowOnMouseUp = false;
@ -81,7 +81,7 @@ public:
}
}
void mouseUp (const MouseEvent& e)
void mouseUp (const MouseEvent& e) override
{
if (isEnabled() && selectRowOnMouseUp && ! isDragging)
{
@ -92,14 +92,14 @@ public:
}
}
void mouseDoubleClick (const MouseEvent& e)
void mouseDoubleClick (const MouseEvent& e) override
{
if (ListBoxModel* m = owner.getModel())
if (isEnabled())
m->listBoxItemDoubleClicked (row, e);
}
void mouseDrag (const MouseEvent& e)
void mouseDrag (const MouseEvent& e) override
{
if (ListBoxModel* m = owner.getModel())
{
@ -121,13 +121,13 @@ public:
}
}
void resized()
void resized() override
{
if (customComponent != nullptr)
customComponent->setBounds (getLocalBounds());
}
String getTooltip()
String getTooltip() override
{
if (ListBoxModel* m = owner.getModel())
return m->getTooltipForRow (row);
@ -183,7 +183,7 @@ public:
return -1;
}
void visibleAreaChanged (const Rectangle<int>&)
void visibleAreaChanged (const Rectangle<int>&) override
{
updateVisibleArea (true);
@ -297,13 +297,13 @@ public:
}
}
void paint (Graphics& g)
void paint (Graphics& g) override
{
if (isOpaque())
g.fillAll (owner.findColour (ListBox::backgroundColourId));
}
bool keyPressed (const KeyPress& key)
bool keyPressed (const KeyPress& key) override
{
if (key.isKeyCode (KeyPress::upKey)
|| key.isKeyCode (KeyPress::downKey)
@ -343,13 +343,13 @@ public:
owner.addMouseListener (this, true);
}
void mouseMove (const MouseEvent& e)
void mouseMove (const MouseEvent& e) override
{
const MouseEvent e2 (e.getEventRelativeTo (&owner));
owner.selectRow (owner.getRowContainingPosition (e2.x, e2.y), true);
}
void mouseExit (const MouseEvent& e)
void mouseExit (const MouseEvent& e) override
{
mouseMove (e);
}