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_Help_Dialog.cxx
Go to the documentation of this file.
1 //
2 // "$Id$"
3 //
4 // Fl_Help_Dialog dialog for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2015 by Bill Spitzak and others.
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 // DO NOT EDIT FL/Fl_Help_Dialog.H and src/Fl_Help_Dialog.cxx !!!
20 // ========================================================================
21 // Please use fluid to change src/Fl_Help_Dialog.fl interactively
22 // and then use fluid to "write code" or edit and use fluid -c .
23 // ========================================================================
24 //
25 
26 // generated by Fast Light User Interface Designer (fluid) version 1.0305
27 
28 #include "../FL/Fl_Help_Dialog.H"
29 #include "flstring.h"
30 #include <FL/fl_ask.H>
31 
33  if (index_ > 0)
34  index_ --;
35 
36 if (index_ == 0)
37  back_->deactivate();
38 
40 
41 int l = line_[index_];
42 
43 if (strcmp(view_->filename(), file_[index_]) != 0)
45 
46 view_->topline(l);
47 }
49  ((Fl_Help_Dialog*)(o->parent()->parent()->user_data()))->cb_back__i(o,v);
50 }
51 
53  if (index_ < max_)
54  index_ ++;
55 
56 if (index_ >= max_)
58 
59 back_->activate();
60 
61 int l = view_->topline();
62 
63 if (strcmp(view_->filename(), file_[index_]) != 0)
65 
66 view_->topline(l);
67 }
69  ((Fl_Help_Dialog*)(o->parent()->parent()->user_data()))->cb_forward__i(o,v);
70 }
71 
73  if (view_->textsize() > 8)
74  view_->textsize(view_->textsize() - 2);
75 
76 if (view_->textsize() <= 8)
78 larger_->activate();
79 }
81  ((Fl_Help_Dialog*)(o->parent()->parent()->user_data()))->cb_smaller__i(o,v);
82 }
83 
85  if (view_->textsize() < 18)
86  view_->textsize(view_->textsize() + 2);
87 
88 if (view_->textsize() >= 18)
91 }
93  ((Fl_Help_Dialog*)(o->parent()->parent()->user_data()))->cb_larger__i(o,v);
94 }
95 
98 }
100  ((Fl_Help_Dialog*)(o->parent()->parent()->parent()->user_data()))->cb_find__i(o,v);
101 }
102 
104  if (view_->filename())
105 {
106  if (view_->changed())
107  {
108  index_ ++;
109 
110  if (index_ >= 100)
111  {
112  memmove(line_, line_ + 10, sizeof(line_[0]) * 90);
113  memmove(file_, file_ + 10, sizeof(file_[0]) * 90);
114  index_ -= 10;
115  }
116 
117  max_ = index_;
118 
119  strlcpy(file_[index_], view_->filename(),sizeof(file_[0]));
120  line_[index_] = view_->topline();
121 
122  if (index_ > 0)
123  back_->activate();
124  else
125  back_->deactivate();
126 
127  forward_->deactivate();
128  window_->label(view_->title());
129  }
130  else // if ! view_->changed()
131  {
132  strlcpy(file_[index_], view_->filename(), sizeof(file_[0]));
133  line_[index_] = view_->topline();
134  }
135 } else { // if ! view_->filename()
136  index_ = 0; // hitting an internal page will disable the back/fwd buffer
137  file_[index_][0] = 0; // unnamed internal page
138  line_[index_] = view_->topline();
139  back_->deactivate();
140  forward_->deactivate();
141 };
142 }
144  ((Fl_Help_Dialog*)(o->parent()->user_data()))->cb_view__i(o,v);
145 }
146 
148  { window_ = new Fl_Double_Window(530, 385, "Help Dialog");
149  window_->user_data((void*)(this));
150  { Fl_Group* o = new Fl_Group(10, 10, 511, 25);
151  { back_ = new Fl_Button(10, 10, 25, 25, "@<-");
152  back_->tooltip("Show the previous help page.");
153  back_->shortcut(0xff51);
156  } // Fl_Button* back_
157  { forward_ = new Fl_Button(45, 10, 25, 25, "@->");
158  forward_->tooltip("Show the next help page.");
159  forward_->shortcut(0xff53);
162  } // Fl_Button* forward_
163  { smaller_ = new Fl_Button(80, 10, 25, 25, "F");
164  smaller_->tooltip("Make the help text smaller.");
165  smaller_->labelfont(1);
166  smaller_->labelsize(10);
168  } // Fl_Button* smaller_
169  { larger_ = new Fl_Button(115, 10, 25, 25, "F");
170  larger_->tooltip("Make the help text larger.");
171  larger_->labelfont(1);
172  larger_->labelsize(16);
174  } // Fl_Button* larger_
175  { Fl_Group* o = new Fl_Group(350, 10, 171, 25);
176  o->box(FL_DOWN_BOX);
178  { find_ = new Fl_Input(375, 12, 143, 21, "@search");
179  find_->tooltip("find text in document");
181  find_->labelsize(13);
182  find_->textfont(4);
185  } // Fl_Input* find_
186  o->end();
187  } // Fl_Group* o
188  { Fl_Box* o = new Fl_Box(150, 10, 190, 25);
190  } // Fl_Box* o
191  o->end();
192  } // Fl_Group* o
193  { view_ = new Fl_Help_View(10, 45, 510, 330);
197  } // Fl_Help_View* view_
198  window_->size_range(260, 150);
199  window_->end();
200  } // Fl_Double_Window* window_
201  back_->deactivate();
202  forward_->deactivate();
203 
204  index_ = -1;
205  max_ = 0;
206  find_pos_ = 0;
207 
209 }
210 
212  delete window_;
213 }
214 
216  return (window_->h());
217 }
218 
220  window_->hide();
221 }
222 
223 void Fl_Help_Dialog::load(const char *f) {
224  view_->set_changed();
225  view_->load(f);
226  window_->label(view_->title());
227 }
228 
229 void Fl_Help_Dialog::position(int xx, int yy) {
230  window_->position(xx, yy);
231 }
232 
233 void Fl_Help_Dialog::resize(int xx, int yy, int ww, int hh) {
234  window_->resize(xx, yy, ww, hh);
235 }
236 
238  window_->show();
239 }
240 
241 void Fl_Help_Dialog::show(int argc, char **argv) {
242  window_->show(argc, argv);
243 }
244 
246  view_->textsize(s);
247 
248  if (s <= 8)
249  smaller_->deactivate();
250  else
251  smaller_->activate();
252 
253  if (s >= 18)
254  larger_->deactivate();
255  else
256  larger_->activate();
257 }
258 
260  return (view_->textsize());
261 }
262 
263 void Fl_Help_Dialog::topline(const char *n) {
264  view_->topline(n);
265 }
266 
268  view_->topline(n);
269 }
270 
271 void Fl_Help_Dialog::value(const char *f) {
272  view_->set_changed();
273  view_->value(f);
274  window_->label(view_->title());
275 }
276 
277 const char * Fl_Help_Dialog::value() const {
278  return view_->value();
279 }
280 
282  return (window_->visible());
283 }
284 
286  return (window_->w());
287 }
288 
290  return (window_->x());
291 }
292 
294  return (window_->y());
295 }
296 
297 //
298 // End of "$Id$".
299 //
Fl_Help_Dialog::show
void show()
Definition: Fl_Help_Dialog.cxx:237
Fl_Help_View::load
int load(const char *f)
Definition: Fl_Help_View.cxx:3293
Fl_Widget::activate
void activate()
Definition: Fl_Widget.cxx:241
Fl_Help_Dialog::cb_back_
static void cb_back_(Fl_Button *, void *)
Definition: Fl_Help_Dialog.cxx:48
Fl_Help_Dialog::y
int y()
Definition: Fl_Help_Dialog.cxx:293
Fl_Help_Dialog::topline
void topline(const char *n)
Definition: Fl_Help_Dialog.cxx:263
Fl_Help_Dialog::find_pos_
int find_pos_
Definition: Fl_Help_Dialog.H:43
Fl_Color
unsigned int Fl_Color
Definition: Enumerations.H:934
Fl_Group::end
void end()
Definition: Fl_Group.cxx:75
Fl_Help_Dialog::position
void position(int xx, int yy)
Definition: Fl_Help_Dialog.cxx:229
Fl_Help_Dialog::forward_
Fl_Button * forward_
Definition: Fl_Help_Dialog.H:51
Fl_Help_Dialog
Definition: Fl_Help_Dialog.H:38
Fl_Widget::labelcolor
Fl_Color labelcolor() const
Definition: Fl_Widget.H:472
fl_ask.H
Fl_Button::shortcut
int shortcut() const
Definition: Fl_Button.H:125
Fl_Input_::value
int value(const char *)
Definition: Fl_Input_.cxx:1284
Fl_Help_Dialog::cb_find_
static void cb_find_(Fl_Input *, void *)
Definition: Fl_Help_Dialog.cxx:99
Fl_Button
Buttons generate callbacks when they are clicked by the user.
Definition: Fl_Button.H:79
Fl_Help_Dialog::value
const char * value() const
Definition: Fl_Help_Dialog.cxx:277
Fl_Help_Dialog::smaller_
Fl_Button * smaller_
Definition: Fl_Help_Dialog.H:54
Fl_Help_Dialog::find_
Fl_Input * find_
Definition: Fl_Help_Dialog.H:60
Fl_Help_Dialog::x
int x()
Definition: Fl_Help_Dialog.cxx:289
Fl_Double_Window::resize
void resize(int, int, int, int)
Definition: Fl_Double_Window.cxx:483
Fl_Widget::labelfont
Fl_Font labelfont() const
Definition: Fl_Widget.H:487
Fl_Help_Dialog::window_
Fl_Double_Window * window_
Definition: Fl_Help_Dialog.H:47
Fl_Help_Dialog::resize
void resize(int xx, int yy, int ww, int hh)
Definition: Fl_Help_Dialog.cxx:233
Fl_Widget::changed
unsigned int changed() const
Definition: Fl_Widget.H:781
Fl_Help_Dialog::h
int h()
Definition: Fl_Help_Dialog.cxx:215
Fl_Help_Dialog::w
int w()
Definition: Fl_Help_Dialog.cxx:285
Fl_Help_Dialog::textsize
Fl_Fontsize textsize()
Definition: Fl_Help_Dialog.cxx:259
Fl_Widget::when
Fl_When when() const
Definition: Fl_Widget.H:621
Fl_Widget::user_data
void * user_data() const
Definition: Fl_Widget.H:593
Fl_Callback
void() Fl_Callback(Fl_Widget *, void *)
Definition: Fl_Widget.H:49
Fl_Help_Dialog::cb_larger_
static void cb_larger_(Fl_Button *, void *)
Definition: Fl_Help_Dialog.cxx:92
Fl_Help_Dialog::cb_smaller__i
void cb_smaller__i(Fl_Button *, void *)
Definition: Fl_Help_Dialog.cxx:72
fl_register_images
void fl_register_images()
Register the image formats.
Definition: fl_images_core.cxx:54
Fl_Widget::color
Fl_Color color() const
Definition: Fl_Widget.H:378
Fl_Widget::position
void position(int X, int Y)
Definition: Fl_Widget.H:332
Fl_Widget::w
void w(int v)
Definition: Fl_Widget.H:143
Fl_Help_Dialog::cb_smaller_
static void cb_smaller_(Fl_Button *, void *)
Definition: Fl_Help_Dialog.cxx:80
Fl_Widget::x
void x(int v)
Definition: Fl_Widget.H:139
Fl_Help_Dialog::Fl_Help_Dialog
Fl_Help_Dialog()
Definition: Fl_Help_Dialog.cxx:147
FL_FLAT_BOX
a flat box
Definition: Enumerations.H:606
Fl_Help_View::filename
const char * filename() const
Definition: Fl_Help_View.H:302
FL_DOWN_BOX
see figure 1
Definition: Enumerations.H:608
Fl_Help_Dialog::cb_view__i
void cb_view__i(Fl_Help_View *, void *)
Definition: Fl_Help_Dialog.cxx:103
FL_WHEN_ENTER_KEY_ALWAYS
Do the callback when the user presses the ENTER key, even if the value doesn't change.
Definition: Enumerations.H:446
strlcpy
#define strlcpy
Definition: flstring.h:84
Fl_Help_Dialog::back_
Fl_Button * back_
Definition: Fl_Help_Dialog.H:48
Fl_Window::size_range
void size_range(int minw, int minh, int maxw=0, int maxh=0, int dw=0, int dh=0, int aspect=0)
Definition: Fl_Window.H:438
Fl_Widget::visible
unsigned int visible() const
Definition: Fl_Widget.H:660
Fl_Help_View::find
int find(const char *s, int p=0)
Definition: Fl_Help_View.cxx:1193
Fl_Double_Window::hide
void hide()
Definition: Fl_Double_Window.cxx:505
Fl_Help_Dialog::~Fl_Help_Dialog
~Fl_Help_Dialog()
Definition: Fl_Help_Dialog.cxx:211
Fl_Input
Definition: Fl_Input.H:222
Fl_Fontsize
int Fl_Fontsize
Definition: Enumerations.H:906
Fl_Help_Dialog::cb_forward__i
void cb_forward__i(Fl_Button *, void *)
Definition: Fl_Help_Dialog.cxx:52
Fl_Widget::deactivate
void deactivate()
Definition: Fl_Widget.cxx:253
Fl_Group
Definition: Fl_Group.H:41
Fl_Group::current
static Fl_Group * current()
Definition: Fl_Group.cxx:84
Fl_Widget::box
Fl_Boxtype box() const
Definition: Fl_Widget.H:363
Fl_Input_::textfont
Fl_Font textfont() const
Definition: Fl_Input_.H:386
Fl_Help_Dialog::index_
int index_
Definition: Fl_Help_Dialog.H:39
Fl_Widget::h
void h(int v)
Definition: Fl_Widget.H:145
Fl_Help_Dialog::load
void load(const char *f)
Definition: Fl_Help_Dialog.cxx:223
Fl_Window::label
const char * label() const
Definition: Fl_Window.H:450
Fl_Widget::y
void y(int v)
Definition: Fl_Widget.H:141
Fl_Help_View::title
const char * title()
Definition: Fl_Help_View.H:346
Fl_Box
Definition: Fl_Box.H:34
Fl_Widget::set_changed
void set_changed()
Definition: Fl_Widget.H:786
Fl_Help_View::value
void value(const char *val)
Definition: Fl_Help_View.cxx:3527
Fl_Help_Dialog::cb_larger__i
void cb_larger__i(Fl_Button *, void *)
Definition: Fl_Help_Dialog.cxx:84
Fl_Help_View::textsize
void textsize(Fl_Fontsize s)
Definition: Fl_Help_View.H:342
Fl_Widget::callback
Fl_Callback_p callback() const
Definition: Fl_Widget.H:561
FL_BACKGROUND2_COLOR
const Fl_Color FL_BACKGROUND2_COLOR
the default background color for text, list, and valuator widgets
Definition: Enumerations.H:938
Fl_Help_Dialog::max_
int max_
Definition: Fl_Help_Dialog.H:40
Fl_Double_Window
Definition: Fl_Double_Window.H:40
Fl_Help_Dialog::larger_
Fl_Button * larger_
Definition: Fl_Help_Dialog.H:57
Fl_Widget::tooltip
const char * tooltip() const
Definition: Fl_Widget.H:552
Fl_Help_Dialog::hide
void hide()
Definition: Fl_Help_Dialog.cxx:219
Fl_Help_View
Definition: Fl_Help_View.H:200
Fl_Help_Dialog::view_
Fl_Help_View * view_
Definition: Fl_Help_Dialog.H:63
f
Fl_Box_Draw_F * f
Definition: fl_boxtype.cxx:285
Fl_Widget::parent
Fl_Group * parent() const
Definition: Fl_Widget.H:254
flstring.h
Fl_Double_Window::show
void show()
Definition: Fl_Double_Window.cxx:79
Fl_Widget::labelsize
Fl_Fontsize labelsize() const
Definition: Fl_Widget.H:502
Fl_Help_Dialog::cb_forward_
static void cb_forward_(Fl_Button *, void *)
Definition: Fl_Help_Dialog.cxx:68
Fl_Help_Dialog::file_
char file_[100][2048]
Definition: Fl_Help_Dialog.H:42
Fl_Help_Dialog::visible
int visible()
Definition: Fl_Help_Dialog.cxx:281
Fl_Help_View::topline
void topline(const char *n)
Definition: Fl_Help_View.cxx:3444
Fl_Help_Dialog::cb_back__i
void cb_back__i(Fl_Button *, void *)
Definition: Fl_Help_Dialog.cxx:32
Fl_Help_Dialog::cb_find__i
void cb_find__i(Fl_Input *, void *)
Definition: Fl_Help_Dialog.cxx:96
Fl_Group::resizable
void resizable(Fl_Widget &o)
Definition: Fl_Group.H:117
Fl_Help_Dialog::line_
int line_[100]
Definition: Fl_Help_Dialog.H:41
Fl_Help_Dialog::cb_view_
static void cb_view_(Fl_Help_View *, void *)
Definition: Fl_Help_Dialog.cxx:143