~ubuntu-branches/ubuntu/precise/konsole/precise-proposed

« back to all changes in this revision

Viewing changes to src/ScreenWindow.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2011-12-16 13:14:43 UTC
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: package-import@ubuntu.com-20111216131443-rhdplbmmuxntat3k
Tags: upstream-4.7.90
ImportĀ upstreamĀ versionĀ 4.7.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
 
36
36
/**
37
37
 * Provides a window onto a section of a terminal screen.  A terminal widget can then render
38
 
 * the contents of the window and use the window to change the terminal screen's selection 
 
38
 * the contents of the window and use the window to change the terminal screen's selection
39
39
 * in response to mouse or keyboard input.
40
40
 *
41
41
 * A new ScreenWindow for a terminal session can be created by calling Emulation::createWindow()
55
55
Q_OBJECT
56
56
 
57
57
public:
58
 
    /** 
 
58
    /**
59
59
     * Constructs a new screen window with the given parent.
60
60
     * A screen must be specified by calling setScreen() before calling getImage() or getLineProperties().
61
61
     *
72
72
    /** Returns the screen which this window looks onto */
73
73
    Screen* screen() const;
74
74
 
75
 
    /** 
 
75
    /**
76
76
     * Returns the image of characters which are currently visible through this window
77
77
     * onto the screen.
78
78
     *
89
89
 
90
90
    /**
91
91
     * Returns the number of lines which the region of the window
92
 
     * specified by scrollRegion() has been scrolled by since the last call 
93
 
     * to resetScrollCount().  scrollRegion() is in most cases the 
 
92
     * specified by scrollRegion() has been scrolled by since the last call
 
93
     * to resetScrollCount().  scrollRegion() is in most cases the
94
94
     * whole window, but will be a smaller area in, for example, applications
95
95
     * which provide split-screen facilities.
96
96
     *
97
97
     * This is not guaranteed to be accurate, but allows views to optimize
98
98
     * rendering by reducing the amount of costly text rendering that
99
 
     * needs to be done when the output is scrolled. 
 
99
     * needs to be done when the output is scrolled.
100
100
     */
101
101
    int scrollCount() const;
102
102
 
106
106
    void resetScrollCount();
107
107
 
108
108
    /**
109
 
     * Returns the area of the window which was last scrolled, this is 
 
109
     * Returns the area of the window which was last scrolled, this is
110
110
     * usually the whole window area.
111
111
     *
112
112
     * Like scrollCount(), this is not guaranteed to be accurate,
114
114
     */
115
115
    QRect scrollRegion() const;
116
116
 
117
 
    /** 
118
 
     * Sets the start of the selection to the given @p line and @p column within 
 
117
    /**
 
118
     * Sets the start of the selection to the given @p line and @p column within
119
119
     * the window.
120
120
     */
121
121
    void setSelectionStart( int column , int line , bool columnMode );
124
124
     * the window.
125
125
     */
126
126
    void setSelectionEnd( int column , int line ); 
 
127
 
 
128
    /**
 
129
     * Sets the selection as the range specified by line @p start and line @p
 
130
     * end in the whole history.
 
131
     *
 
132
     * Both @p start and @p end are absolute line number in the whole history,
 
133
     * not relative line number in the window. This make it possible to select
 
134
     * range larger than the window . A good use case is selecting the whole
 
135
     * history.
 
136
     */
 
137
    void setSelectionByLineRange(int start, int end);
 
138
 
127
139
    /**
128
140
     * Retrieves the start of the selection within the window.
129
141
     */
136
148
     * Returns true if the character at @p line , @p column is part of the selection.
137
149
     */
138
150
    bool isSelected( int column , int line );
139
 
    /** 
 
151
    /**
140
152
     * Clears the current selection
141
153
     */
142
154
    void clearSelection();
147
159
    int windowLines() const;
148
160
    /** Returns the number of columns in the window */
149
161
    int windowColumns() const;
150
 
    
 
162
 
151
163
    /** Returns the total number of lines in the screen */
152
164
    int lineCount() const;
153
165
    /** Returns the total number of columns in the screen */
156
168
    /** Returns the index of the line which is currently at the top of this window */
157
169
    int currentLine() const;
158
170
 
159
 
    /** 
160
 
     * Returns the position of the cursor 
 
171
    /**
 
172
     * Returns the position of the cursor
161
173
     * within the window.
162
174
     */
163
175
    QPoint cursorPosition() const;
164
176
 
165
 
    /** 
 
177
    /**
166
178
     * Convenience method. Returns true if the window is currently at the bottom
167
179
     * of the screen.
168
180
     */
176
188
    {
177
189
        /** Scroll the window down by a given number of lines. */
178
190
        ScrollLines,
179
 
        /** 
 
191
        /**
180
192
         * Scroll the window down by a given number of pages, where
181
193
         * one page is windowLines() lines
182
194
         */
183
195
        ScrollPages
184
196
    };
185
197
 
186
 
    /** 
 
198
    /**
187
199
     * Scrolls the window relative to its current position on the screen.
188
200
     *
189
201
     * @param mode Specifies whether @p amount refers to the number of lines or the number
190
 
     * of pages to scroll.    
 
202
     * of pages to scroll.
191
203
     * @param amount The number of lines or pages ( depending on @p mode ) to scroll by.  If
192
204
     * this number is positive, the view is scrolled down.  If this number is negative, the view
193
205
     * is scrolled up.
194
206
     */
195
207
    void scrollBy( RelativeScrollMode mode , int amount );
196
208
 
197
 
    /** 
 
209
    /**
198
210
     * Specifies whether the window should automatically move to the bottom
199
211
     * of the screen when new output is added.
200
212
     *
201
 
     * If this is set to true, the window will be moved to the bottom of the associated screen ( see 
 
213
     * If this is set to true, the window will be moved to the bottom of the associated screen ( see
202
214
     * screen() ) when the notifyOutputChanged() method is called.
203
215
     */
204
216
    void setTrackOutput(bool trackOutput);
205
 
    /** 
 
217
    /**
206
218
     * Returns whether the window automatically moves to the bottom of the screen as
207
219
     * new output is added.  See setTrackOutput()
208
220
     */
216
228
    QString selectedText( bool preserveLineBreaks ) const;
217
229
 
218
230
public slots:
219
 
    /** 
 
231
    /**
220
232
     * Notifies the window that the contents of the associated terminal screen have changed.
221
233
     * This moves the window to the bottom of the screen if trackOutput() is true and causes
222
234
     * the outputChanged() signal to be emitted.
225
237
 
226
238
signals:
227
239
    /**
228
 
     * Emitted when the contents of the associated terminal screen (see screen()) changes. 
 
240
     * Emitted when the contents of the associated terminal screen (see screen()) changes.
229
241
     */
230
242
    void outputChanged();
231
243
 
232
244
    /**
233
245
     * Emitted when the screen window is scrolled to a different position.
234
 
     * 
 
246
     *
235
247
     * @param line The line which is now at the top of the window.
236
248
     */
237
249
    void scrolled(int line);