25 #ifndef JUCE_CODEEDITORCOMPONENT_H_INCLUDED 26 #define JUCE_CODEEDITORCOMPONENT_H_INCLUDED 66 void loadContent (
const String& newContent);
119 void setLineNumbersShown (
bool shouldBeShown);
122 bool moveCaretLeft (
bool moveInWholeWordSteps,
bool selecting);
123 bool moveCaretRight (
bool moveInWholeWordSteps,
bool selecting);
124 bool moveCaretUp (
bool selecting);
125 bool moveCaretDown (
bool selecting);
128 bool pageUp (
bool selecting);
129 bool pageDown (
bool selecting);
130 bool moveCaretToTop (
bool selecting);
131 bool moveCaretToStartOfLine (
bool selecting);
132 bool moveCaretToEnd (
bool selecting);
133 bool moveCaretToEndOfLine (
bool selecting);
134 bool deleteBackwards (
bool moveInWholeWordSteps);
135 bool deleteForwards (
bool moveInWholeWordSteps);
136 bool deleteWhitespaceBackwardsToTabStop();
137 virtual bool copyToClipboard();
138 virtual bool cutToClipboard();
139 virtual bool pasteFromClipboard();
147 void scrollToLine (
int newFirstLineOnScreen);
148 void scrollBy (
int deltaLines);
149 void scrollToColumn (
int newFirstColumnOnScreen);
150 void scrollToKeepCaretOnScreen();
151 void scrollToKeepLinesOnScreen (
Range<int> linesToShow);
154 void insertTabAtCaret();
156 void indentSelection();
157 void unindentSelection();
161 bool isHighlightActive()
const noexcept;
182 int lastTopLine, lastCaretPos, lastSelectionEnd;
190 void setTabSize (
int numSpacesPerTab,
bool insertSpacesInsteadOfTabCharacters);
203 String getTabString (
int numSpaces)
const;
208 void setFont (
const Font& newFont);
214 void setReadOnly (
bool shouldBeReadOnly)
noexcept;
247 Colour getColourForTokenType (
int tokenType)
const;
259 backgroundColourId = 0x1004500,
260 highlightColourId = 0x1004502,
261 defaultTextColourId = 0x1004503,
262 lineNumberBackgroundId = 0x1004504,
263 lineNumberTextId = 0x1004505,
268 void setScrollbarThickness (
int thickness);
275 virtual void handleReturnKey();
277 virtual void handleTabKey();
279 virtual void handleEscapeKey();
299 virtual void addPopupMenuItems (
PopupMenu& menuToAddTo,
313 virtual void performPopupMenuAction (
int menuItemID);
328 void resized()
override;
330 bool keyPressed (
const KeyPress&)
override;
338 void mouseDoubleClick (
const MouseEvent&)
override;
346 bool isTextInputActive()
const override;
363 int firstLineOnScreen, spacesPerTab;
365 int lineHeight, linesOnScreen, columnsOnScreen;
366 int scrollbarThickness, columnToTryToMaintain;
367 bool readOnly, useSpacesForTabs, showLineNumbers, shouldFollowDocumentChanges;
373 ScrollBar verticalScrollBar, horizontalScrollBar;
389 draggingSelectionStart,
401 void rebuildLineTokens();
402 void rebuildLineTokensAsync();
403 void codeDocumentChanged (
int start,
int end);
406 void clearCachedIterators (
int firstLineToBeInvalid);
407 void updateCachedIterators (
int maxLineNum);
410 void moveLineDelta (
int delta,
bool selecting);
411 int getGutterSize() const noexcept;
414 void insertText (const
String&);
415 virtual
void updateCaretPosition();
416 void updateScrollBars();
417 void scrollToLineInternal (
int line);
418 void scrollToColumnInternal (
double column);
419 void newTransaction();
421 void indentSelectedLines (
int spacesToAdd);
422 bool skipBackwardsToPreviousTab();
425 int indexToColumn (
int line,
int index) const noexcept;
426 int columnToIndex (
int line,
int column) const noexcept;
432 #endif // JUCE_CODEEDITORCOMPONENT_H_INCLUDED int getTabSize() const noexcept
Definition: juce_CodeEditorComponent.h:195
Definition: juce_ApplicationCommandManager.h:84
virtual Rectangle< int > getCaretRectangle()=0
Definition: juce_KeyPress.h:37
Definition: juce_CodeEditorComponent.h:167
virtual void insertTextAtCaret(const String &textToInsert)=0
Definition: juce_Font.h:39
Definition: juce_CodeEditorComponent.cpp:25
int getNumLinesOnScreen() const noexcept
Definition: juce_CodeEditorComponent.h:79
#define noexcept
Definition: juce_CompilerSupport.h:141
Colour colour
Definition: juce_CodeEditorComponent.h:225
Definition: juce_CodeEditorComponent.cpp:247
bool areSpacesInsertedForTabs() const
Definition: juce_CodeEditorComponent.h:200
Definition: juce_Range.h:44
ColourIds
Definition: juce_CodeEditorComponent.h:257
CodeDocument & getDocument() const noexcept
Definition: juce_CodeEditorComponent.h:60
const ColourScheme & getColourScheme() const noexcept
Definition: juce_CodeEditorComponent.h:241
Definition: juce_CodeDocument.h:59
FocusChangeType
Definition: juce_Component.h:1702
Definition: juce_CodeDocument.h:354
CodeDocument::Position getSelectionEnd() const
Definition: juce_CodeEditorComponent.h:116
Definition: juce_String.h:43
Definition: juce_TextInputTarget.h:38
Definition: juce_CodeEditorComponent.h:220
const Font & getFont() const noexcept
Definition: juce_CodeEditorComponent.h:211
#define JUCE_API
Definition: juce_StandardHeader.h:139
Definition: juce_ApplicationCommandTarget.h:58
CodeDocument::Position getSelectionStart() const
Definition: juce_CodeEditorComponent.h:113
Definition: juce_Rectangle.h:36
virtual void setHighlightedRegion(const Range< int > &newRange)=0
Definition: juce_Colour.h:35
Definition: juce_ApplicationCommandTarget.h:44
Definition: juce_CodeDocument.h:42
Definition: juce_Component.h:33
CodeDocument::Position getCaretPos() const
Definition: juce_CodeEditorComponent.h:90
Definition: juce_MouseEvent.h:329
Definition: juce_CodeEditorComponent.h:222
int getNumColumnsOnScreen() const noexcept
Definition: juce_CodeEditorComponent.h:87
bool isReadOnly() const noexcept
Definition: juce_CodeEditorComponent.h:217
Definition: juce_CodeTokeniser.h:36
Definition: juce_ContainerDeletePolicy.h:44
Definition: juce_ApplicationCommandID.h:83
float getCharWidth() const noexcept
Definition: juce_CodeEditorComponent.h:70
Definition: juce_Array.h:60
int getFirstLineOnScreen() const noexcept
Definition: juce_CodeEditorComponent.h:82
int CommandID
Definition: juce_ApplicationCommandID.h:37
Definition: juce_ApplicationCommandID.h:86
Definition: juce_OwnedArray.h:55
Definition: juce_ApplicationCommandID.h:80
Definition: juce_CodeEditorComponent.h:38
Definition: juce_GraphicsContext.h:42
Array< TokenType > types
Definition: juce_CodeEditorComponent.h:228
Definition: juce_ApplicationCommandID.h:77
Definition: juce_ApplicationCommandID.h:68
int getScrollbarThickness() const noexcept
Definition: juce_CodeEditorComponent.h:271
Definition: juce_CodeEditorComponent.cpp:283
Definition: juce_ApplicationCommandInfo.h:42
int getLineHeight() const noexcept
Definition: juce_CodeEditorComponent.h:73
virtual Range< int > getHighlightedRegion() const =0
String name
Definition: juce_CodeEditorComponent.h:224
Definition: juce_MouseEvent.h:36
virtual String getTextInRange(const Range< int > &range) const =0