Dillo v3.2.0-39-ge8be369a
Loading...
Searching...
No Matches
selection.hh
Go to the documentation of this file.
1/*
2 * Dillo Widget
3 *
4 * Copyright 2005-2007 Sebastian Geerken <sgeerken@dillo.org>
5 * Copyright 2025 Rodrigo Arias Mallo <rodarima@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef __DW_SELECTION_H__
22#define __DW_SELECTION_H__
23
24#ifndef __INCLUDED_FROM_DW_CORE_HH__
25# error Do not include this file directly, use "core.hh" instead.
26#endif
27
28namespace dw {
29namespace core {
30
199{
200public:
201 enum { END_OF_WORD = 1 << 30 };
202
203private:
205
206 // selection
207 enum {
212
215
216 // link handling
217 enum {
221
225
226 void resetSelection ();
227 void resetLink ();
228 void switchLinkToSelection (Iterator *it, int charPos);
229 void adjustSelection (Iterator *it, int charPos);
230 static int correctCharPos (DeepIterator *it, int charPos);
231
232 void highlight (bool fl, int dir)
233 { highlight0 (fl, from, fromChar, to, toChar, dir); }
234
235 void highlight0 (bool fl, DeepIterator *from, int fromChar,
236 DeepIterator *to, int toChar, int dir);
237public:
239
242
243 inline void setLayout (Layout *layout) { this->layout = layout; }
244 void reset ();
245 void copy (int selection);
246 bool buttonPress (Iterator *it, int charPos, int linkNo,
247 EventButton *event);
248 bool buttonRelease (Iterator *it, int charPos, int linkNo,
249 EventButton *event);
250 bool buttonMotion (Iterator *it, int charPos, int linkNo,
251 EventMotion *event);
252
253 bool handleEvent (EventType eventType, Iterator *it, int charPos,
254 int linkNo, MousePositionEvent *event);
255};
256
257} // namespace core
258} // namespace dw
259
260#endif // __DW_SELECTION_H__
A stack of iterators, to iterate recursively through a widget tree.
Definition iterator.hh:147
Represents a button press or release event.
Definition events.hh:58
Represents a mouse motion event.
Definition events.hh:68
Iterators are used to iterate through the contents of a widget.
Definition iterator.hh:20
The central class for managing and drawing a widget tree.
Definition layout.hh:37
Base class for all mouse events related to a specific position.
Definition events.hh:49
This class handles selections, as well as activation of links, which is closely related.
Definition selection.hh:199
void setLayout(Layout *layout)
Definition selection.hh:243
void highlight(bool fl, int dir)
Definition selection.hh:232
enum dw::core::SelectionState::@16 selectionState
bool handleEvent(EventType eventType, Iterator *it, int charPos, int linkNo, MousePositionEvent *event)
General form of dw::core::SelectionState::buttonPress, dw::core::SelectionState::buttonRelease and dw...
Definition selection.cc:234
bool buttonPress(Iterator *it, int charPos, int linkNo, EventButton *event)
Definition selection.cc:94
void adjustSelection(Iterator *it, int charPos)
This method is used by core::dw::SelectionState::buttonMotion and core::dw::SelectionState::buttonRel...
Definition selection.cc:294
bool buttonRelease(Iterator *it, int charPos, int linkNo, EventButton *event)
Definition selection.cc:160
static int correctCharPos(DeepIterator *it, int charPos)
This method deals especially with the case that a widget passes dw::core::SelectionState::END_OF_WORD...
Definition selection.cc:357
enum dw::core::SelectionState::@17 linkState
void copy(int selection)
Definition selection.cc:426
bool buttonMotion(Iterator *it, int charPos, int linkNo, EventMotion *event)
Definition selection.cc:211
void switchLinkToSelection(Iterator *it, int charPos)
This method is called when the user decides not to activate a link, but instead select text.
Definition selection.cc:261
void highlight0(bool fl, DeepIterator *from, int fromChar, DeepIterator *to, int toChar, int dir)
Definition selection.cc:370
Dw is in this namespace, or sub namespaces of this one.