edbee - Qt Editor Library
Go to the documentation of this file.
6 #pragma once
8 //#include <QAbstractScrollArea>
9 #include <QStringList>
10 #include <QWidget>
12 class QResizeEvent;
13 class QScrollBar;
15 namespace edbee {
17 class TextDocument;
18 class TextEditorCommandMap;
19 class TextEditorComponent;
20 class TextEditorConfig;
21 class TextEditorController;
22 class TextEditorKeyMap;
23 class TextEditorScrollArea;
24 class TextMarginComponent;
25 class TextRenderer;
26 class TextSelection;
32 class TextEditorWidget : public QWidget
33 {
35 public:
37  explicit TextEditorWidget(QWidget *parent = 0);
38  virtual ~TextEditorWidget();
40  void scrollPositionVisible( int xPosIn, int yPosIn );
42  // a whole bunch of getters
44  TextEditorConfig* config() const;
46  TextEditorKeyMap* keyMap() const;
47  TextDocument* textDocument() const;
48  TextRenderer* textRenderer() const;
54  void resetCaretTime();
55  void fullUpdate();
57  QScrollBar* horizontalScrollBar() const;
58  QScrollBar* verticalScrollBar() const;
59  void setVerticalScrollBar( QScrollBar* scrollBar );
60  void setHorizontalScrollBar( QScrollBar* scrollBar );
62 protected:
64  virtual void resizeEvent(QResizeEvent* event);
65  bool eventFilter(QObject *obj, QEvent *event );
67 signals:
68  void focusIn(QWidget* event);
69  void focusOut(QWidget* event);
71  void verticalScrollBarChanged( QScrollBar* newScrollBar );
72  void horizontalScrollBarChanged( QScrollBar* newScrollBar );
74 protected slots:
79 public slots:
81  void scrollTopToLine( int line );
82  virtual void updateLineAtOffset(int offset);
83  virtual void updateAreaAroundOffset(int offset, int width=8);
84  virtual void updateLine( int line, int length=1 );
85  virtual void updateComponents();
87  virtual void updateGeometryComponents();
89  virtual void updateRendererViewport();
91 private:
93  TextEditorController* controller_;
95  TextEditorScrollArea* scrollAreaRef_;
96  TextEditorComponent* editCompRef_;
97  TextMarginComponent* marginCompRef_;
99 };
101 } // edbee
This is the base and abstract class of a text document A TextDocument is the model part of the editor...
Definition: textdocument.h:40
virtual void updateGeometryComponents()
Updates the geometry for all components.
Definition: texteditorwidget.cpp:334
void setVerticalScrollBar(QScrollBar *scrollBar)
Use this method to change a scrollbar. By using this method listeners of the scrollbar well be inform...
Definition: texteditorwidget.cpp:229
A class for rendering the text.
Definition: textrenderer.h:34
QScrollBar * horizontalScrollBar() const
Return the horizontal scrollbar.
Definition: texteditorwidget.cpp:213
TextMarginComponent * textMarginComponent() const
Returns the active margin component.
Definition: texteditorwidget.cpp:183
TextEditorScrollArea * textScrollArea() const
Returns the active scroll area.
Definition: texteditorwidget.cpp:190
TextEditorConfig * config() const
Returns the confirguation object for this widget.
Definition: texteditorwidget.cpp:134
virtual void updateLineAtOffset(int offset)
updates the given line so it will be repainted offset the offset of the line that needs repainting ...
Definition: texteditorwidget.cpp:297
void focusOut(QWidget *event)
Definition: moc_texteditorwidget.cpp:244
virtual void updateAreaAroundOffset(int offset, int width=8)
updates the character before and at the given offest
Definition: texteditorwidget.cpp:307
void setHorizontalScrollBar(QScrollBar *scrollBar)
Use this method to change the horizontal scrollbar. By using this method listeners of the scrollbar w...
Definition: texteditorwidget.cpp:239
TextEditorKeyMap * keyMap() const
return the associated keymap
Definition: texteditorwidget.cpp:148
QScrollBar * verticalScrollBar() const
returns the vertical scrollbar
Definition: texteditorwidget.cpp:220
The class textselection is a RangeSet that is used by the view of the document.
Definition: textselection.h:24
TextEditorComponent * textEditorComponent() const
Returns the editor component-part of the editor.
Definition: texteditorwidget.cpp:176
virtual void resizeEvent(QResizeEvent *event)
This mehtod is called when a resize happens.
Definition: texteditorwidget.cpp:248
void connectHorizontalScrollBar()
Connects the horizontal scrollbar so it updates the rendering viewport.
Definition: texteditorwidget.cpp:284
virtual void updateRendererViewport()
Updates the renderer viewport.
Definition: texteditorwidget.cpp:347
This is the main texteditor-component (which is the true editor) This is the QWidget that recieves th...
Definition: texteditorcomponent.h:25
void verticalScrollBarChanged(QScrollBar *newScrollBar)
Definition: moc_texteditorwidget.cpp:251
The margin/line-number component This class is used for rendering line-numbers etc.
Definition: textmargincomponent.h:51
General configuration settings of the text editor.
Definition: texteditorconfig.h:17
void scrollTopToLine(int line)
this method scrolls the top position to the given line
Definition: texteditorwidget.cpp:125
bool eventFilter(QObject *obj, QEvent *event)
a basic event-filter for recieving focus-events of the editor
Definition: texteditorwidget.cpp:258
Copyright 2011-2013 - Reliable Bits Software by Blommers IT.
Definition: commentcommand.cpp:22
virtual void updateLine(int line, int length=1)
This method repaints the given lines.
Definition: texteditorwidget.cpp:317
TextEditorCommandMap * commandMap() const
Return the associated commandmap.
Definition: texteditorwidget.cpp:141
This is a texteditor map. This is used to map Command-Names to commands This class is the owner of th...
Definition: texteditorcommandmap.h:19
virtual void updateComponents()
Calls update on all components.
Definition: texteditorwidget.cpp:326
A text editor key map This key map, maps key-sequences to action-names.
Definition: texteditorkeymap.h:39
TextRenderer * textRenderer() const
Returns the text-renderer.
Definition: texteditorwidget.cpp:162
The texteditor works via the controller. The controller is the central point/mediater which maps/cont...
Definition: texteditorcontroller.h:37
TextDocument * textDocument() const
Returns the textdocument for this widget.
Definition: texteditorwidget.cpp:155
void horizontalScrollBarChanged(QScrollBar *newScrollBar)
Definition: moc_texteditorwidget.cpp:258
void fullUpdate()
This method performs a full update. Which means it callibirates the scrollbars invalidates all caches...
Definition: texteditorwidget.cpp:205
virtual ~TextEditorWidget()
The editor constructor.
Definition: texteditorwidget.cpp:97
This is the general edbee widget This core functionality of this widget is divided in several seperat...
Definition: texteditorwidget.h:32
void scrollPositionVisible(int xPosIn, int yPosIn)
This method makes sure the given position is visible.
Definition: texteditorwidget.cpp:109
void focusIn(QWidget *event)
Definition: moc_texteditorwidget.cpp:237
TextEditorWidget(QWidget *parent=0)
The default TextEditor widget constructor.
Definition: texteditorwidget.cpp:49
TextSelection * textSelection() const
Return the textselection.
Definition: texteditorwidget.cpp:169
void connectVerticalScrollBar()
Connects the vertical scrollbar so it updates the rendering viewport.
Definition: texteditorwidget.cpp:277
TextEditorController * controller() const
returns the controller for this editor
Definition: texteditorwidget.cpp:117
void resetCaretTime()
This method resets the caret time.
Definition: texteditorwidget.cpp:197
A special scrollarea that makes it possible to add components to the margins of it.
Definition: texteditorscrollarea.h:18