Tweak themes for more color consistency.
[ntk.git] / examples / texteditor-simple.cxx
blob8a033b37cd7f98f9dee047c096655811247782b0
1 //
2 // "$Id: texteditor-simple.cxx 8183 2011-01-04 17:31:56Z AlbrechtS $"
3 //
4 // A simple example of Fl_Text_Editor
5 //
6 // Fl_Text_Editor is unlike other FLTK widgets in that
7 // to work correctly, it must be assigned to an instance of an
8 // Fl_Text_Buffer. The below shows using buffer() to connect
9 // the two classes together.
11 // Note that the example can also be used to demonstrate
12 // Fl_Text_Display; just replace all instances of
13 // Fl_Text_Editor with Fl_Text_Display and rebuild.
15 // Copyright 2010 Greg Ercolano.
16 // Copyright 1998-2010 by Bill Spitzak and others.
18 // This library is free software; you can redistribute it and/or
19 // modify it under the terms of the GNU Library General Public
20 // License as published by the Free Software Foundation; either
21 // version 2 of the License, or (at your option) any later version.
23 // This library is distributed in the hope that it will be useful,
24 // but WITHOUT ANY WARRANTY; without even the implied warranty of
25 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26 // Library General Public License for more details.
28 // You should have received a copy of the GNU Library General Public
29 // License along with this library; if not, write to the Free Software
30 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
31 // USA.
33 // Please report all bugs and problems on the following page:
35 // http://www.fltk.org/str.php
38 #include <FL/Fl.H>
39 #include <FL/Fl_Double_Window.H>
40 #include <FL/Fl_Text_Editor.H>
42 int main() {
43 Fl_Double_Window *win = new Fl_Double_Window(640, 480, "Simple Fl_Text_Editor");
44 Fl_Text_Buffer *buff = new Fl_Text_Buffer();
45 Fl_Text_Editor *edit = new Fl_Text_Editor(20, 20, 640-40, 480-40);
46 edit->buffer(buff); // attach the text buffer to our editor widget
47 win->resizable(*edit);
48 win->show();
49 buff->text("line 0\nline 1\nline 2\n"
50 "line 3\nline 4\nline 5\n"
51 "line 6\nline 7\nline 8\n"
52 "line 9\nline 10\nline 11\n"
53 "line 12\nline 13\nline 14\n"
54 "line 15\nline 16\nline 17\n"
55 "line 18\nline 19\nline 20\n"
56 "line 21\nline 22\nline 23\n");
57 return(Fl::run());
61 // End of "$Id: texteditor-simple.cxx 8183 2011-01-04 17:31:56Z AlbrechtS $".