Dillo
selection.hh
Go to the documentation of this file.
1 #ifndef __DW_SELECTION_H__
2 #define __DW_SELECTION_H__
3 
4 #ifndef __INCLUDED_FROM_DW_CORE_HH__
5 # error Do not include this file directly, use "core.hh" instead.
6 #endif
7 
8 namespace dw {
9 namespace core {
10 
179 {
180 public:
181  enum { END_OF_WORD = 1 << 30 };
182 
183 private:
185 
186  // selection
187  enum {
191  } selectionState;
192 
195 
196  // link handling
197  enum {
200  } linkState;
201 
205 
206  void resetSelection ();
207  void resetLink ();
208  void switchLinkToSelection (Iterator *it, int charPos);
209  void adjustSelection (Iterator *it, int charPos);
210  static int correctCharPos (DeepIterator *it, int charPos);
211 
212  void highlight (bool fl, int dir)
213  { highlight0 (fl, from, fromChar, to, toChar, dir); }
214 
215  void highlight0 (bool fl, DeepIterator *from, int fromChar,
216  DeepIterator *to, int toChar, int dir);
217  void copy ();
218 
219 public:
221 
222  SelectionState ();
223  ~SelectionState ();
224 
225  inline void setLayout (Layout *layout) { this->layout = layout; }
226  void reset ();
227  bool buttonPress (Iterator *it, int charPos, int linkNo,
228  EventButton *event);
229  bool buttonRelease (Iterator *it, int charPos, int linkNo,
230  EventButton *event);
231  bool buttonMotion (Iterator *it, int charPos, int linkNo,
232  EventMotion *event);
233 
234  bool handleEvent (EventType eventType, Iterator *it, int charPos,
235  int linkNo, MousePositionEvent *event);
236 };
237 
238 } // namespace core
239 } // namespace dw
240 
241 #endif // __DW_SELECTION_H__
Definition: selection.hh:190
int toChar
Definition: selection.hh:194
DeepIterator * link
Definition: selection.hh:203
Definition: selection.hh:198
Layout * layout
Definition: selection.hh:184
This class handles selections, as well as activation of links, which is closely related.
Definition: selection.hh:178
SelectionState()
Definition: selection.cc:47
void copy()
Definition: selection.cc:425
The central class for managing and drawing a widget tree.
Definition: layout.hh:16
Definition: selection.hh:199
Represents a button press or release event.
Definition: events.hh:57
int fromChar
Definition: selection.hh:194
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:233
void adjustSelection(Iterator *it, int charPos)
This method is used by core::dw::SelectionState::buttonMotion and core::dw::SelectionState::buttonRel...
Definition: selection.cc:293
void highlight(bool fl, int dir)
Definition: selection.hh:212
~SelectionState()
Definition: selection.cc:61
Definition: selection.hh:188
Iterators are used to iterate through the contents of a widget.
Definition: iterator.hh:19
enum dw::core::SelectionState::@13 selectionState
void resetSelection()
Definition: selection.cc:73
bool buttonPress(Iterator *it, int charPos, int linkNo, EventButton *event)
Definition: selection.cc:93
bool buttonMotion(Iterator *it, int charPos, int linkNo, EventMotion *event)
Definition: selection.cc:210
void reset()
Definition: selection.cc:67
int linkChar
Definition: selection.hh:204
Base class for all mouse events related to a specific position.
Definition: events.hh:48
void resetLink()
Definition: selection.cc:85
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:260
DeepIterator * from
Definition: selection.hh:193
Definition: selection.hh:220
Definition: selection.hh:189
int linkNumber
Definition: selection.hh:204
void setLayout(Layout *layout)
Definition: selection.hh:225
A stack of iterators, to iterate recursively through a widget tree.
Definition: iterator.hh:146
EventType
Definition: selection.hh:220
int linkButton
Definition: selection.hh:202
Dw is in this namespace, or sub namespaces of this one.
Definition: alignedtablecell.cc:28
DeepIterator * to
Definition: selection.hh:193
Represents a mouse motion event.
Definition: events.hh:67
void highlight0(bool fl, DeepIterator *from, int fromChar, DeepIterator *to, int toChar, int dir)
Definition: selection.cc:369
enum dw::core::SelectionState::@14 linkState
Definition: selection.hh:220
Definition: selection.hh:220
bool buttonRelease(Iterator *it, int charPos, int linkNo, EventButton *event)
Definition: selection.cc:159
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:356
Definition: selection.hh:181