fltk  1.3.5-source
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X.
  Fossies Dox: fltk-1.3.5-source.tar.bz2  ("inofficial" and yet experimental doxygen-generated source code documentation)  

Fl_Text_Editor.cxx
Go to the documentation of this file.
1 //
2 // "$Id$"
3 //
4 // Copyright 2001-2010 by Bill Spitzak and others.
5 // Original code Copyright Mark Edel. Permission to distribute under
6 // the LGPL for the FLTK library granted by Mark Edel.
7 //
8 // This library is free software. Distribution and use rights are outlined in
9 // the file "COPYING" which should have been included with this file. If this
10 // file is missing or damaged, see the license at:
11 //
12 // http://www.fltk.org/COPYING.php
13 //
14 // Please report all bugs and problems on the following page:
15 //
16 // http://www.fltk.org/str.php
17 //
18 
19 #include <stdio.h>
20 #include <stdlib.h>
21 #include "flstring.h"
22 #include <ctype.h>
23 #include <FL/Fl.H>
24 #include <FL/Fl_Window.H>
25 #include <FL/Fl_Text_Editor.H>
26 #include <FL/fl_ask.H>
27 
28 
29 /* Keyboard Control Matrix
30 
31 key\modifier plain Ctrl Alt Meta
32  left 1/1 13/9 0/13 0/9
33  right 2/2 14/10 0/14 0/10
34  up 3/19 21/7 0/15 0/17
35  down 4/20 22/8 0/16 0/18
36  home 9/5 17/0 0/0 0/0
37  end 10/6 18/0 0/0 0/0
38  page up 11/7 23/0 0/11 0/0
39  page down 12/8 24/0 0/12 0/0
40  (FLTK action / OS X action)
41  (adding the shift key extends the selection, all other combinations are no-op)
42 
43  0: no-op
44  1: move cursor to the left, at line beginning wrap to end of prev line, at doc start no-op
45  2: move cursor to the right, at line end move to beginning of the next line, at doc end no-op
46  3: move cursor up, at doc top no-op
47  4: move cursor down, at doc bottom no-op
48  5: scroll display to top of text (cursor unchanged)
49  6: scroll display to end of text (cursor unchanged)
50  7: scroll text down one page (cursor unchanged)
51  8: scroll text up one page (cursor unchanged)
52  9: move cursor to beginning of line
53  10: move cursor to end of line
54  11: move cursor up one page and scroll down
55  12: move cursor down one page and scroll up
56  13: move to the beginning of the word or the previous word
57  14: move to the end of the word or the next word
58  15: if start of line: start of prev line, else start of this line
59  16: if end of line: end of next line, else end of this line
60  17: move cursor to the beginning of the document
61  18: move cursor to the end of the document
62  19: move cursor up, at doc top: home, at doc start: no-op)
63  20: move cursor down, at doc bot: end, at doc end: no-op)
64  21: scroll text down one line (cursor unchanged)
65  22: scroll text up one line (cursor unchanged)
66  23: move cursor to the beginning of the top of the screen
67  24: move cursor to the beginning of the bottom of the window
68 */
69 
71 Fl_Text_Editor::Fl_Text_Editor(int X, int Y, int W, int H, const char* l)
72  : Fl_Text_Display(X, Y, W, H, l) {
73  mCursorOn = 1;
74  insert_mode_ = 1;
75  key_bindings = 0;
77 
78  // handle the default key bindings
80 
81  // handle everything else
83 }
84 
85 #ifndef FL_DOXYGEN
87 #endif
88 
89 // These are the default key bindings every widget should start with
90 static struct {
91  int key;
92  int state;
133 //{ FL_Clear, 0, Fl_Text_Editor::delete_to_eol },
143 
144 #ifdef __APPLE__
145  // Define CMD+key accelerators...
159 #endif // __APPLE__
160 
161  { 0, 0, 0 }
162 };
163 
166  for (int i = 0; default_key_bindings[i].key; i++) {
170  list);
171  }
172 }
173 
175 #if FLTK_ABI_VERSION < 10304
176 // OLD - non-const
178 #else
179 // NEW - const (STR#3306)
181 #endif
182 {
183  Key_Binding* cur;
184  for (cur = list; cur; cur = cur->next)
185  if (cur->key == key)
186  if (cur->state == FL_TEXT_EDITOR_ANY_STATE || cur->state == state)
187  break;
188  if (!cur) return 0;
189  return cur->function;
190 }
191 
194  Key_Binding *cur, *next;
195  for (cur = *list; cur; cur = next) {
196  next = cur->next;
197  delete cur;
198  }
199  *list = 0;
200 }
201 
210  Key_Binding *cur, *last = 0;
211  for (cur = *list; cur; last = cur, cur = cur->next)
212  if (cur->key == key && cur->state == state) break;
213  if (!cur) return;
214  if (last) last->next = cur->next;
215  else *list = cur->next;
216  delete cur;
217 }
218 
226 void Fl_Text_Editor::add_key_binding(int key, int state, Key_Func function,
227  Key_Binding** list) {
228  Key_Binding* kb = new Key_Binding;
229  kb->key = key;
230  kb->state = state;
231  kb->function = function;
232  kb->next = *list;
233  *list = kb;
234 }
235 
237 
239  if (e->buffer()->selected()) {
240  e->insert_position(e->buffer()->primary_selection()->start());
241  e->buffer()->remove_selection();
242  }
243 }
244 
249  // FIXME: this function is a mess! Fix this!
250  if (!c || (!isprint(c) && c != '\t')) return 0;
251  char s[2] = "\0";
252  s[0] = (char)c;
253  kill_selection(e);
254  if (e->insert_mode()) e->insert(s);
255  else e->overstrike(s);
257  e->set_changed();
258  if (e->when()&FL_WHEN_CHANGED) e->do_callback();
259  return 1;
260 }
261 
270  return 0; // don't handle
271 }
272 
279  if (!e->buffer()->selected() && e->move_left()) {
280  int p1 = e->insert_position();
281  int p2 = e->buffer()->next_char(p1);
282  e->buffer()->select(p1, p2);
283  }
284  kill_selection(e);
286  e->set_changed();
287  if (e->when()&FL_WHEN_CHANGED) e->do_callback();
288  return 1;
289 }
290 
295  kill_selection(e);
296  e->insert("\n");
298  e->set_changed();
299  if (e->when()&FL_WHEN_CHANGED) e->do_callback();
300  return 1;
301 }
302 
303 extern void fl_text_drag_me(int pos, Fl_Text_Display* d);
318  int i;
319  int selected = e->buffer()->selected();
320  if (!selected)
321  e->dragPos = e->insert_position();
322  e->buffer()->unselect();
323  Fl::copy("", 0, 0);
324  switch (c) {
325  case FL_Home:
326  e->insert_position(e->buffer()->line_start(e->insert_position()));
327  break;
328  case FL_End:
329  e->insert_position(e->buffer()->line_end(e->insert_position()));
330  break;
331  case FL_Left:
332  e->move_left();
333  break;
334  case FL_Right:
335  e->move_right();
336  break;
337  case FL_Up:
338  e->move_up();
339  break;
340  case FL_Down:
341  e->move_down();
342  break;
343  case FL_Page_Up:
344  for (i = 0; i < e->mNVisibleLines - 1; i++) e->move_up();
345  break;
346  case FL_Page_Down:
347  for (i = 0; i < e->mNVisibleLines - 1; i++) e->move_down();
348  break;
349  }
351  return 1;
352 }
353 
358  kf_move(c, e);
360  char *copy = e->buffer()->selection_text();
361  if (copy) {
362  Fl::copy(copy, (int) strlen(copy), 0);
363  free(copy);
364  }
365  return 1;
366 }
367 
382  if (!e->buffer()->selected())
383  e->dragPos = e->insert_position();
384  if (c != FL_Up && c != FL_Down) {
385  e->buffer()->unselect();
386  Fl::copy("", 0, 0);
388  }
389  switch (c) {
390  case FL_Home:
391  e->insert_position(0);
392  e->scroll(0, 0);
393  break;
394  case FL_End:
395  e->insert_position(e->buffer()->length());
396  e->scroll(e->count_lines(0, e->buffer()->length(), 1), 0);
397  break;
398  case FL_Left:
399  e->previous_word();
400  break;
401  case FL_Right:
402  e->next_word();
403  break;
404  case FL_Up:
405  e->scroll(e->mTopLineNum-1, e->mHorizOffset);
406  break;
407  case FL_Down:
408  e->scroll(e->mTopLineNum+1, e->mHorizOffset);
409  break;
410  case FL_Page_Up:
411  e->insert_position(e->mLineStarts[0]);
412  break;
413  case FL_Page_Down:
415  break;
416  }
417  return 1;
418 }
419 
430  if (!e->buffer()->selected())
431  e->dragPos = e->insert_position();
432  if (c != FL_Up && c != FL_Down) {
433  e->buffer()->unselect();
434  Fl::copy("", 0, 0);
436  }
437  switch (c) {
438  case FL_Up: // top of buffer
439  e->insert_position(0);
440  e->scroll(0, 0);
441  break;
442  case FL_Down: // end of buffer
443  e->insert_position(e->buffer()->length());
444  e->scroll(e->count_lines(0, e->buffer()->length(), 1), 0);
445  break;
446  case FL_Left: // beginning of line
447  kf_move(FL_Home, e);
448  break;
449  case FL_Right: // end of line
450  kf_move(FL_End, e);
451  break;
452  }
453  return 1;
454 }
455 
460  kf_meta_move(c, e);
462  return 1;
463 }
464 
469  kf_ctrl_move(c, e);
471  return 1;
472 }
473 
479  return kf_move(FL_Home, e);
480 }
481 
487  return kf_move(FL_End, e);
488 }
489 
495  return kf_move(FL_Left, e);
496 }
497 
503  return kf_move(FL_Up, e);
504 }
505 
511  return kf_move(FL_Right, e);
512 }
513 
519  return kf_move(FL_Down, e);
520 }
521 
527  return kf_move(FL_Page_Up, e);
528 }
529 
535  return kf_move(FL_Page_Down, e);
536 }
537 
542  e->insert_mode(e->insert_mode() ? 0 : 1);
543  return 1;
544 }
545 
550  if (!e->buffer()->selected()) {
551  int p1 = e->insert_position();
552  int p2 = e->buffer()->next_char(p1);
553  e->buffer()->select(p1, p2);
554  }
555 
556  kill_selection(e);
558  e->set_changed();
559  if (e->when()&FL_WHEN_CHANGED) e->do_callback();
560  return 1;
561 }
562 
567  if (!e->buffer()->selected()) return 1;
568  const char *copy = e->buffer()->selection_text();
569  if (*copy) Fl::copy(copy, (int) strlen(copy), 1);
570  free((void*)copy);
572  return 1;
573 }
574 
579  kf_copy(c, e);
580  kill_selection(e);
581  e->set_changed();
582  if (e->when()&FL_WHEN_CHANGED) e->do_callback();
583  return 1;
584 }
585 
591  kill_selection(e);
592  Fl::paste(*e, 1);
594  e->set_changed();
595  if (e->when()&FL_WHEN_CHANGED) e->do_callback();
596  return 1;
597 }
598 
603  e->buffer()->select(0, e->buffer()->length());
604  const char *copy = e->buffer()->selection_text();
605  if (*copy) Fl::copy(copy, (int) strlen(copy), 0);
606  free((void*)copy);
607  return 1;
608 }
609 
615  e->buffer()->unselect();
616  Fl::copy("", 0, 0);
617  int crsr;
618  int ret = e->buffer()->undo(&crsr);
619  e->insert_position(crsr);
621  e->set_changed();
622  if (e->when()&FL_WHEN_CHANGED) e->do_callback();
623  return ret;
624 }
625 
628  // Call FLTK's rules to try to turn this into a printing character.
629  // This uses the right-hand ctrl key as a "compose prefix" and returns
630  // the changes that should be made to the text, as a number of
631  // bytes to delete and a string to insert:
632  int del = 0;
633  if (Fl::compose(del)) {
634  if (del) {
635  // del is a number of bytes
636  int dp = insert_position() - del;
637  if ( dp < 0 ) dp = 0;
638  buffer()->select(dp, insert_position());
639  }
640  kill_selection(this);
641  if (Fl::event_length()) {
643  else overstrike(Fl::event_text());
644  }
645 #ifdef __APPLE__
646  if (Fl::compose_state) {
647  int pos = this->insert_position();
648  this->buffer()->select(pos - Fl::compose_state, pos);
649  }
650 #endif
652  set_changed();
654  return 1;
655  }
656 
657  int key = Fl::event_key(), state = Fl::event_state(), c = Fl::event_text()[0];
658  state &= FL_SHIFT|FL_CTRL|FL_ALT|FL_META; // only care about these states
659  Key_Func f;
662  if (f) return f(key, this);
663  if (default_key_function_ && !state) return default_key_function_(c, this);
664  return 0;
665 }
666 
669 // printf("Fl_Text_Editor::maybe_do_callback()\n");
670 // printf("changed()=%d, when()=%x\n", changed(), when());
672 }
673 
674 int Fl_Text_Editor::handle(int event) {
675  static int dndCursorPos;
676 
677  if (!buffer()) return 0;
678 
679  switch (event) {
680  case FL_FOCUS:
681  show_cursor(mCursorOn); // redraws the cursor
682  if (buffer()->selected()) redraw(); // Redraw selections...
683  Fl::focus(this);
684  return 1;
685 
686  case FL_UNFOCUS:
687  show_cursor(mCursorOn); // redraws the cursor
688 #ifdef __APPLE__
689  if (buffer()->selected() && Fl::compose_state) {
690  int pos = insert_position();
691  buffer()->select(pos, pos);
692  Fl::reset_marked_text();
693  }
694 #endif
695  if (buffer()->selected()) redraw(); // Redraw selections...
696  case FL_HIDE:
698  return 1;
699 
700  case FL_KEYBOARD:
701  if (active_r() && window() && this == Fl::belowmouse())
703  return handle_key();
704 
705  case FL_PASTE:
706  if (!Fl::event_text()) {
707  fl_beep();
708  return 1;
709  }
712  else overstrike(Fl::event_text());
714  set_changed();
716  return 1;
717 
718  case FL_ENTER:
719 // MRS: WIN32 only? Need to test!
720 // case FL_MOVE:
722  return 1;
723 
724  case FL_PUSH:
725  if (Fl::event_button() == 2) {
726  // don't let the text_display see this event
727  if (Fl_Group::handle(event)) return 1;
729  if(buffer()->selected()) {
730  buffer()->unselect();
731  }
733  insert_position(pos);
734  Fl::paste(*this, 0);
735  Fl::focus(this);
736  set_changed();
738  return 1;
739  }
740  break;
741 
742  case FL_SHORTCUT:
744  return 0;
745  if (Fl::visible_focus() && handle(FL_FOCUS)) {
746  Fl::focus(this);
747  return 1;
748  }
749  break;
750 
751  // Handle drag'n'drop attempt by the user. This is a simplified
752  // implementation which allows dnd operations onto the scroll bars.
753  case FL_DND_ENTER: // save the current cursor position
755  Fl::focus(this);
757  dndCursorPos = insert_position();
758  /* fall through */
759  case FL_DND_DRAG: // show a temporary insertion cursor
761  return 1;
762  case FL_DND_LEAVE: // restore original cursor
763  insert_position(dndCursorPos);
764  return 1;
765  case FL_DND_RELEASE: // keep insertion cursor and wait for the FL_PASTE event
766  if (!dragging) buffer()->unselect(); // FL_PASTE must not destroy current selection if drag comes from outside
767  return 1;
768  }
769 
770  return Fl_Text_Display::handle(event);
771 }
772 
773 #if FLTK_ABI_VERSION >= 10304
774 
796 void Fl_Text_Editor::tab_nav(int val) {
797  if ( val )
799  else
801 }
802 
819 int Fl_Text_Editor::tab_nav() const {
820  return (bound_key_function(FL_Tab,0)==kf_ignore) ? 1 : 0;
821 }
822 #endif
823 
824 //
825 // End of "$Id$".
826 //
Fl_Text_Editor::kf_c_s_move
static int kf_c_s_move(int c, Fl_Text_Editor *e)
Definition: Fl_Text_Editor.cxx:468
Fl_Text_Display::buffer
void buffer(Fl_Text_Buffer *buf)
Definition: Fl_Text_Display.cxx:384
Fl_Text_Display::xy_to_position
int xy_to_position(int x, int y, int PosType=CHARACTER_POS) const
Translate a pixel position into a character index.
Definition: Fl_Text_Display.cxx:2509
FL_Up
#define FL_Up
The up arrow key.
Definition: Enumerations.H:481
Fl_Text_Display::dragPos
int dragPos
Definition: Fl_Text_Display.H:515
FL_Enter
#define FL_Enter
The enter key.
Definition: Enumerations.H:471
Fl_Text_Editor::kf_end
static int kf_end(int c, Fl_Text_Editor *e)
Definition: Fl_Text_Editor.cxx:486
Fl.H
FL_HIDE
Definition: Enumerations.H:369
FL_DND_ENTER
Definition: Enumerations.H:401
FL_BackSpace
#define FL_BackSpace
The backspace key.
Definition: Enumerations.H:468
FL_META
#define FL_META
One of the meta/Windows keys is down.
Definition: Enumerations.H:563
idle_cb::next
idle_cb * next
Definition: Fl_add_idle.cxx:27
FL_UNFOCUS
Definition: Enumerations.H:288
Fl_Text_Editor::kf_left
static int kf_left(int c, Fl_Text_Editor *e)
Definition: Fl_Text_Editor.cxx:494
FL_DND_RELEASE
Definition: Enumerations.H:417
Fl_Text_Display::next_word
void next_word(void)
Moves the current insert position right one word.
Definition: Fl_Text_Display.cxx:1592
Fl_Text_Editor::insert_mode
int insert_mode()
Definition: Fl_Text_Editor.H:67
Fl_Text_Editor::kf_down
static int kf_down(int c, Fl_Text_Editor *e)
Definition: Fl_Text_Editor.cxx:518
Fl::event_state
static int event_state()
Definition: Fl.H:704
Fl_Text_Display::CURSOR_POS
Definition: Fl_Text_Display.H:104
fl_ask.H
Fl_Text_Display::mNVisibleLines
int mNVisibleLines
Definition: Fl_Text_Display.H:459
FL_WHEN_NOT_CHANGED
Do the callback whenever the user interacts with the widget.
Definition: Enumerations.H:442
state
int state
Definition: Fl_Text_Editor.cxx:92
Fl::event_button
static int event_button()
Definition: Fl.H:678
Fl_Widget::window
Fl_Window * window() const
Definition: Fl_Window.cxx:118
Fl_Text_Display::mHorizOffset
int mHorizOffset
Definition: Fl_Text_Display.H:481
FL_WHEN_RELEASE
Do the callback when the button or key is released and the value changes.
Definition: Enumerations.H:443
FL_SHIFT
#define FL_SHIFT
One of the shift keys is down.
Definition: Enumerations.H:557
FL_Page_Down
#define FL_Page_Down
The page-down key.
Definition: Enumerations.H:485
Fl_Text_Display::move_down
int move_down()
Moves the current insert position down one line.
Definition: Fl_Text_Display.cxx:1363
Fl_Text_Display::overstrike
void overstrike(const char *text)
Replaces text at the current insert position.
Definition: Fl_Text_Display.cxx:1005
Fl::event_text
static const char * event_text()
Definition: Fl.H:792
Fl_Text_Editor::Key_Binding::key
int key
the key pressed
Definition: Fl_Text_Editor.H:47
Fl_Widget::changed
unsigned int changed() const
Definition: Fl_Widget.H:781
free
void free()
H
static int H
Definition: Fl_Tooltip.cxx:76
FL_KP_Enter
#define FL_KP_Enter
The enter key on the keypad, same as Fl_KP+'\r'.
Definition: Enumerations.H:493
Fl::paste
static void paste(Fl_Widget &receiver, int source, const char *type)
Definition: Fl_win32.cxx:704
Fl_Text_Display::DRAG_NONE
Definition: Fl_Text_Display.H:114
Fl_Text_Display::previous_word
void previous_word(void)
Moves the current insert position left one word.
Definition: Fl_Text_Display.cxx:1611
Fl_Widget::set_flag
void set_flag(unsigned int c)
Definition: Fl_Widget.H:149
FL_PASTE
Definition: Enumerations.H:383
Fl::compose
static int compose(int &del)
Definition: Fl_compose.cxx:79
Fl_Text_Display::show_cursor
void show_cursor(int b=1)
Shows the text cursor. This function may trigger a redraw.
Definition: Fl_Text_Display.cxx:878
Fl_Text_Editor::insert_mode
void insert_mode(int b)
Definition: Fl_Text_Editor.H:61
Fl_Text_Editor::insert_mode_
int insert_mode_
Definition: Fl_Text_Editor.H:134
Fl_Text_Display::handle
virtual int handle(int e)
Event handling.
Definition: Fl_Text_Display.cxx:3887
Fl_Widget::when
Fl_When when() const
Definition: Fl_Widget.H:621
Fl_Widget::do_callback
void do_callback()
Definition: Fl_Widget.H:861
Fl_Text_Editor::kf_up
static int kf_up(int c, Fl_Text_Editor *e)
Definition: Fl_Text_Editor.cxx:502
Fl_Text_Editor::kf_backspace
static int kf_backspace(int c, Fl_Text_Editor *e)
Definition: Fl_Text_Editor.cxx:278
Fl_Text_Editor::kf_delete
static int kf_delete(int c, Fl_Text_Editor *e)
Definition: Fl_Text_Editor.cxx:549
Fl::event_key
static int event_key()
Definition: Fl.H:723
Fl_Text_Display::insert_position
void insert_position(int newPos)
Sets the position of the text insertion cursor for text display. Move the insertion cursor in front o...
Definition: Fl_Text_Display.cxx:851
Fl_Text_Editor::global_key_bindings
static Key_Binding * global_key_bindings
Definition: Fl_Text_Editor.H:145
key
int key
Definition: Fl_Text_Editor.cxx:91
Fl_Text_Display::mCursorOn
int mCursorOn
Definition: Fl_Text_Display.H:452
Fl::event_x
static int event_x()
Definition: Fl.H:598
FL_Page_Up
#define FL_Page_Up
The page-up key.
Definition: Enumerations.H:484
Fl_Text_Display::scroll
void scroll(int topLineNum, int horizOffset)
Scrolls the current buffer to start at the specified line and column.
Definition: Fl_Text_Display.cxx:2830
FL_Down
#define FL_Down
The down arrow key.
Definition: Enumerations.H:483
default_key_bindings
static struct @44 default_key_bindings[]
Fl_Text_Editor::Key_Binding::state
int state
the state of key modifiers
Definition: Fl_Text_Editor.H:48
Fl::belowmouse
static Fl_Widget * belowmouse()
Definition: Fl.H:833
Fl_Window.H
FL_DND_LEAVE
Definition: Enumerations.H:411
Fl_Text_Editor::maybe_do_callback
void maybe_do_callback()
Definition: Fl_Text_Editor.cxx:668
Fl::test_shortcut
static int test_shortcut(Fl_Shortcut)
Definition: fl_shortcut.cxx:54
FL_End
#define FL_End
The end key.
Definition: Enumerations.H:486
Fl_Text_Display::count_lines
int count_lines(int start, int end, bool start_pos_is_line_start) const
Count the number of lines between two positions.
Definition: Fl_Text_Display.cxx:1407
FL_DND_DRAG
Definition: Enumerations.H:407
Fl_Text_Display::buffer
Fl_Text_Buffer * buffer() const
Definition: Fl_Text_Display.H:174
FL_WHEN_CHANGED
Do the callback only when the widget value changes.
Definition: Enumerations.H:441
FL_Left
#define FL_Left
The left arrow key.
Definition: Enumerations.H:480
FL_Right
#define FL_Right
The right arrow key.
Definition: Enumerations.H:482
Fl_Text_Editor::remove_key_binding
void remove_key_binding(int key, int state, Key_Binding **list)
Definition: Fl_Text_Editor.cxx:209
FL_Tab
#define FL_Tab
The tab key.
Definition: Enumerations.H:469
FL_ALT
#define FL_ALT
One of the alt keys is down.
Definition: Enumerations.H:560
Fl_Text_Editor::key_bindings
Key_Binding * key_bindings
Definition: Fl_Text_Editor.H:135
last
static idle_cb * last
Definition: Fl_add_idle.cxx:34
FL_Home
#define FL_Home
The home key.
Definition: Enumerations.H:479
Fl_Text_Editor::handle_key
int handle_key()
Definition: Fl_Text_Editor.cxx:627
fl_text_drag_me
void fl_text_drag_me(int pos, Fl_Text_Display *d)
Definition: Fl_Text_Display.cxx:3817
Fl_Widget::active_r
int active_r() const
Definition: Fl_Widget.cxx:265
FL_COMMAND
#define FL_COMMAND
An alias for FL_CTRL on WIN32 and X11, or FL_META on MacOS X.
Definition: Enumerations.H:580
FL_FOCUS
Definition: Enumerations.H:283
Fl_Text_Display::insert_position
int insert_position() const
Definition: Fl_Text_Display.H:186
fl_beep
void fl_beep(int type=FL_BEEP_DEFAULT)
Definition: fl_ask.cxx:283
Fl_Text_Display::dragging
int dragging
Definition: Fl_Text_Display.H:515
FL_TEXT_EDITOR_ANY_STATE
#define FL_TEXT_EDITOR_ANY_STATE
Definition: Fl_Text_Editor.H:31
FL_PUSH
Definition: Enumerations.H:236
Fl_Text_Display::move_left
int move_left()
Moves the current insert position left one character.
Definition: Fl_Text_Display.cxx:1303
Fl_Widget::test_shortcut
int test_shortcut()
Definition: fl_shortcut.cxx:494
Fl_Text_Display::shortcut
int shortcut() const
Definition: Fl_Text_Display.H:277
Fl::event_length
static int event_length()
Definition: Fl.H:799
Fl_Widget::redraw
void redraw()
Definition: Fl.cxx:1782
kill_selection
static void kill_selection(Fl_Text_Editor *e)
Definition: Fl_Text_Editor.cxx:238
Fl::focus
static Fl_Widget * focus()
Definition: Fl.H:840
Fl_Text_Display::show_insert_position
void show_insert_position()
Scrolls the text buffer to show the current insert position. This function triggers a complete recalc...
Definition: Fl_Text_Display.cxx:1274
Fl_Text_Editor::kf_shift_move
static int kf_shift_move(int c, Fl_Text_Editor *e)
Definition: Fl_Text_Editor.cxx:357
Fl_Text_Display::move_up
int move_up()
Moves the current insert position up one line.
Definition: Fl_Text_Display.cxx:1318
Fl::event_y
static int event_y()
Definition: Fl.H:603
Fl_Text_Buffer::select
void select(int start, int end)
Definition: Fl_Text_Buffer.cxx:485
FL_KEYBOARD
Definition: Enumerations.H:315
Fl::copy
static void copy(const char *stuff, int len, int destination, const char *type)
Definition: Fl_win32.cxx:680
Fl_Text_Editor::kf_meta_move
static int kf_meta_move(int c, Fl_Text_Editor *e)
Definition: Fl_Text_Editor.cxx:429
Fl_Text_Editor::Key_Func
int(* Key_Func)(int key, Fl_Text_Editor *editor)
Definition: Fl_Text_Editor.H:43
Fl_Text_Editor::default_key_function
void default_key_function(Key_Func f)
Definition: Fl_Text_Editor.H:100
Fl_Text_Editor::Key_Binding
Definition: Fl_Text_Editor.H:46
func
Fl_Text_Editor::Key_Func func
Definition: Fl_Text_Editor.cxx:93
Fl_Text_Editor::kf_undo
static int kf_undo(int c, Fl_Text_Editor *e)
Definition: Fl_Text_Editor.cxx:614
Fl_Text_Editor::remove_all_key_bindings
void remove_all_key_bindings()
Definition: Fl_Text_Editor.H:84
Fl_Text_Display::insert
void insert(const char *text)
Inserts "text" at the current cursor location.
Definition: Fl_Text_Display.cxx:986
Fl_Widget::set_changed
void set_changed()
Definition: Fl_Widget.H:786
Fl_Text_Editor::kf_page_up
static int kf_page_up(int c, Fl_Text_Editor *e)
Definition: Fl_Text_Editor.cxx:526
Fl_Widget::MAC_USE_ACCENTS_MENU
On the Mac OS platform, pressing and holding a key on the keyboard opens an accented-character menu w...
Definition: Fl_Widget.H:175
Fl_Group::handle
int handle(int)
Definition: Fl_Group.cxx:147
Fl_Text_Editor::Key_Binding::next
Key_Binding * next
next key binding in the list
Definition: Fl_Text_Editor.H:50
Fl_Window::cursor
void cursor(Fl_Cursor)
Definition: fl_cursor.cxx:111
Fl_Text_Display::move_right
int move_right()
Moves the current insert position right one character.
Definition: Fl_Text_Display.cxx:1288
Fl_Text_Display
Rich text display widget.
Definition: Fl_Text_Display.H:82
Fl_Text_Editor::add_key_binding
void add_key_binding(int key, int state, Key_Func f, Key_Binding **list)
Definition: Fl_Text_Editor.cxx:226
Fl_Text_Editor::kf_copy
static int kf_copy(int c, Fl_Text_Editor *e)
Definition: Fl_Text_Editor.cxx:566
FL_CURSOR_NONE
Definition: Enumerations.H:1072
Fl_Text_Editor::kf_default
static int kf_default(int c, Fl_Text_Editor *e)
Definition: Fl_Text_Editor.cxx:248
FL_SHORTCUT
Definition: Enumerations.H:349
Fl::visible_focus
static int visible_focus()
Definition: Fl.H:1197
Fl_Text_Editor::handle
virtual int handle(int e)
Event handling.
Definition: Fl_Text_Editor.cxx:674
Fl_Text_Editor::kf_m_s_move
static int kf_m_s_move(int c, Fl_Text_Editor *e)
Definition: Fl_Text_Editor.cxx:459
Fl_Text_Editor::kf_select_all
static int kf_select_all(int c, Fl_Text_Editor *e)
Definition: Fl_Text_Editor.cxx:602
Fl_Text_Editor::kf_page_down
static int kf_page_down(int c, Fl_Text_Editor *e)
Definition: Fl_Text_Editor.cxx:534
Fl_Text_Display::dragType
int dragType
Definition: Fl_Text_Display.H:515
Fl_Text_Buffer::unselect
void unselect()
Definition: Fl_Text_Buffer.cxx:500
Fl_Text_Editor::Key_Binding::function
Key_Func function
associated function
Definition: Fl_Text_Editor.H:49
f
Fl_Box_Draw_F * f
Definition: fl_boxtype.cxx:285
Fl_Text_Editor::Fl_Text_Editor
Fl_Text_Editor(int X, int Y, int W, int H, const char *l=0)
Definition: Fl_Text_Editor.cxx:71
Fl_Text_Display::fl_text_drag_me
friend void fl_text_drag_me(int pos, Fl_Text_Display *d)
Definition: Fl_Text_Display.cxx:3817
Fl_Text_Buffer::remove_selection
void remove_selection()
Definition: Fl_Text_Buffer.cxx:530
Y
static int Y
Definition: Fl_Tooltip.cxx:76
flstring.h
Fl::compose_state
static int compose_state
Definition: Fl.H:166
Fl_Text_Editor::kf_right
static int kf_right(int c, Fl_Text_Editor *e)
Definition: Fl_Text_Editor.cxx:510
FL_Insert
#define FL_Insert
The insert key.
Definition: Enumerations.H:488
Fl_Text_Editor::kf_insert
static int kf_insert(int c, Fl_Text_Editor *e)
Definition: Fl_Text_Editor.cxx:541
Fl_Text_Editor.H
Fl_Text_Editor::kf_ctrl_move
static int kf_ctrl_move(int c, Fl_Text_Editor *e)
Definition: Fl_Text_Editor.cxx:381
Fl_Text_Display::mTopLineNum
int mTopLineNum
Definition: Fl_Text_Display.H:472
Fl_Text_Editor::kf_move
static int kf_move(int c, Fl_Text_Editor *e)
Definition: Fl_Text_Editor.cxx:317
FL_CTRL
#define FL_CTRL
One of the ctrl keys is down.
Definition: Enumerations.H:559
FL_Delete
#define FL_Delete
The delete key.
Definition: Enumerations.H:506
Fl_Text_Editor::kf_enter
static int kf_enter(int c, Fl_Text_Editor *e)
Definition: Fl_Text_Editor.cxx:294
Fl_Text_Editor::kf_ignore
static int kf_ignore(int c, Fl_Text_Editor *e)
Definition: Fl_Text_Editor.cxx:269
Fl_Text_Editor::bound_key_function
Key_Func bound_key_function(int key, int state, Key_Binding *list)
Definition: Fl_Text_Editor.cxx:177
Fl_Text_Display::mLineStarts
int * mLineStarts
Definition: Fl_Text_Display.H:471
FL_ENTER
Definition: Enumerations.H:253
FL_Escape
#define FL_Escape
The escape key.
Definition: Enumerations.H:474
Fl_Text_Editor::kf_cut
static int kf_cut(int c, Fl_Text_Editor *e)
Definition: Fl_Text_Editor.cxx:578
Fl_Text_Editor::kf_paste
static int kf_paste(int c, Fl_Text_Editor *e)
Definition: Fl_Text_Editor.cxx:590
Fl_Text_Editor::default_key_function_
Key_Func default_key_function_
Definition: Fl_Text_Editor.H:148
Fl_Text_Editor::kf_home
static int kf_home(int, Fl_Text_Editor *e)
Definition: Fl_Text_Editor.cxx:478
Fl_Text_Editor::add_default_key_bindings
void add_default_key_bindings(Key_Binding **list)
Definition: Fl_Text_Editor.cxx:165
Fl_Text_Editor
Definition: Fl_Text_Editor.H:40