diff options
| author | Duncan Gibson <engelsman@users.noreply.github.com> | 2020-07-15 01:11:31 +0200 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2020-07-20 14:08:47 +0200 |
| commit | c132ac564ed46464c05de0a70e2afc3822916a67 (patch) | |
| tree | 16af9684fa1f05e6cd20cfe0b376e7924108ae63 /test/resize-arrows.cxx | |
| parent | 4858882e1e4af51cbe7125752f83216c273eed7c (diff) | |
add resize examples as per STR3433
add example code for creating images for resize.dox
based on Article #415: How does resizing work?
https://www.fltk.org/articles.php?L415
see also https://www.fltk.org/str.php?L3433
Diffstat (limited to 'test/resize-arrows.cxx')
| -rw-r--r-- | test/resize-arrows.cxx | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/test/resize-arrows.cxx b/test/resize-arrows.cxx new file mode 100644 index 000000000..5d48f1cec --- /dev/null +++ b/test/resize-arrows.cxx @@ -0,0 +1,59 @@ +// +// Resize example for use in the Fast Light Tool Kit (FLTK) documentation. +// +// See Article #415: How does resizing work? +// https://www.fltk.org/articles.php?L415 +// +// Copyright 1998-2020 by Bill Spitzak and others. +// +// 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 +// file is missing or damaged, see the license at: +// +// https://www.fltk.org/COPYING.php +// +// Please see the following page on how to report bugs and issues: +// +// https://www.fltk.org/bugs.php +// + +#include "resize-arrows.h" +#include <FL/fl_draw.H> + +Harrow::Harrow(int X, int Y, int W, int H, const char *T) + : Fl_Box(X, Y, W, H, T) { + align(FL_ALIGN_BOTTOM); + box(FL_NO_BOX); + color(FL_WHITE); +} + +void Harrow::draw() { + Fl_Color old = fl_color(); + int dx = 5, dy = 4; + int my = y() + h() / 2; + fl_rectf(x(), y(), w(), h(), FL_WHITE); + fl_color(FL_BLACK); + fl_polygon(x(), my, x() + dx, my - dy, x() + dx, my + dy); + fl_line(x() + dx, my, x() + w() - dx, my); + fl_polygon(x() + w(), my, x() + w() - dx, my + dy, x() + w() - dx, my - dy); + fl_color(old); +} + +Varrow::Varrow(int X, int Y, int W, int H, const char *T) + : Fl_Box(X, Y, W, H, T) { + align(FL_ALIGN_RIGHT); + box(FL_NO_BOX); + color(FL_WHITE); +} + +void Varrow::draw() { + Fl_Color old = fl_color(); + int dx = 4, dy = 5; + int mx = x() + w() / 2; + fl_rectf(x(), y(), w(), h(), FL_WHITE); + fl_color(FL_BLACK); + fl_polygon(mx - dx, y() + dy, mx, y(), mx + dx, y() + dy); + fl_line(mx, y() + dy, mx, y() + h() - dy); + fl_polygon(mx - dx, y() + h() - dy, mx + dx, y() + h() - dy, mx, y() + h()); + fl_color(old); +} |
