Update test/hello.cxx and related image

Improve CMP compatibility and use a better (anti-aliased) image for
the docs.
This commit is contained in:
Albrecht Schlosser 2021-01-13 15:12:26 +01:00
parent fba4d58509
commit 7ef23153df
3 changed files with 10 additions and 11 deletions

View File

@ -19,10 +19,10 @@ World!" program that uses FLTK to display the window.
#include <FL/Fl_Box.H> #include <FL/Fl_Box.H>
int main(int argc, char **argv) { int main(int argc, char **argv) {
Fl_Window *window = new Fl_Window(340,180); Fl_Window *window = new Fl_Window(340, 180);
Fl_Box *box = new Fl_Box(20,40,300,100,"Hello, World!"); Fl_Box *box = new Fl_Box(20, 40, 300, 100, "Hello, World!");
box->box(FL_UP_BOX); box->box(FL_UP_BOX);
box->labelfont(FL_BOLD+FL_ITALIC); box->labelfont(FL_BOLD + FL_ITALIC);
box->labelsize(36); box->labelsize(36);
box->labeltype(FL_SHADOW_LABEL); box->labeltype(FL_SHADOW_LABEL);
window->end(); window->end();
@ -37,21 +37,21 @@ After including the required header files, the program then creates a
window. All following widgets will automatically be children of this window. window. All following widgets will automatically be children of this window.
\code \code
Fl_Window *window = new Fl_Window(340,180); Fl_Window *window = new Fl_Window(340, 180);
\endcode \endcode
Then we create a box with the "Hello, World!" string in it. FLTK automatically Then we create a box with the "Hello, World!" string in it. FLTK automatically
adds the new box to \p window, the current grouping widget. adds the new box to \p window, the current grouping widget.
\code \code
Fl_Box *box = new Fl_Box(20,40,300,100,"Hello, World!"); Fl_Box *box = new Fl_Box(20, 40, 300, 100, "Hello, World!");
\endcode \endcode
Next, we set the type of box and the font, size, and style of the label: Next, we set the type of box and the font, size, and style of the label:
\code \code
box->box(FL_UP_BOX); box->box(FL_UP_BOX);
box->labelfont(FL_BOLD+FL_ITALIC); box->labelfont(FL_BOLD + FL_ITALIC);
box->labelsize(36); box->labelsize(36);
box->labeltype(FL_SHADOW_LABEL); box->labeltype(FL_SHADOW_LABEL);
\endcode \endcode

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -1,7 +1,7 @@
// //
// Hello, World! program for the Fast Light Tool Kit (FLTK). // Hello, World! program for the Fast Light Tool Kit (FLTK).
// //
// Copyright 1998-2010 by Bill Spitzak and others. // Copyright 1998-2021 by Bill Spitzak and others.
// //
// This library is free software. Distribution and use rights are outlined in // This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this // the file "COPYING" which should have been included with this file. If this
@ -19,14 +19,13 @@
#include <FL/Fl_Box.H> #include <FL/Fl_Box.H>
int main(int argc, char **argv) { int main(int argc, char **argv) {
Fl_Window *window = new Fl_Window(340,180); Fl_Window *window = new Fl_Window(340, 180);
Fl_Box *box = new Fl_Box(20,40,300,100,"Hello, World!"); Fl_Box *box = new Fl_Box(20, 40, 300, 100, "Hello, World!");
box->box(FL_UP_BOX); box->box(FL_UP_BOX);
box->labelfont(FL_BOLD+FL_ITALIC); box->labelfont(FL_BOLD + FL_ITALIC);
box->labelsize(36); box->labelsize(36);
box->labeltype(FL_SHADOW_LABEL); box->labeltype(FL_SHADOW_LABEL);
window->end(); window->end();
window->show(argc, argv); window->show(argc, argv);
return Fl::run(); return Fl::run();
} }