summaryrefslogtreecommitdiff
path: root/test/symbols.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2004-07-04 06:49:34 +0000
committerMatthias Melcher <fltk@matthiasm.com>2004-07-04 06:49:34 +0000
commit47276e733d9d422ca6ac49cd4f87c2b8b712ef7c (patch)
tree584b253305e00ec1bc9ba9da57291717e3655951 /test/symbols.cxx
parent0384c8695762d4a71b2565855cb15b28facc540c (diff)
In order to make the whitte text field at the bottom left of the
Help Dialog clearer, I added a magnifying glass in front of the field sybolising "search". I made the scaleable magnifying glass available as a symbol via "@search" I added yet another symbol that draw a vectorized version of the FLTK logo. Available via "@FLTK". Lastly, I changed the 'symbol' test program to show the additional symbols, and added a slider to changae the relative symbol size. I hope the new symbols look good enough on other platforms, too. I tested only OS X. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@3479 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'test/symbols.cxx')
-rw-r--r--test/symbols.cxx65
1 files changed, 40 insertions, 25 deletions
diff --git a/test/symbols.cxx b/test/symbols.cxx
index 069e8c5c1..c3d0acf4f 100644
--- a/test/symbols.cxx
+++ b/test/symbols.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: symbols.cxx,v 1.4.2.3.2.6 2004/04/11 04:39:01 easysw Exp $"
+// "$Id: symbols.cxx,v 1.4.2.3.2.7 2004/07/04 06:49:34 matthiaswm Exp $"
//
// Symbol test program for the Fast Light Tool Kit (FLTK).
//
@@ -36,34 +36,40 @@
int N = 0;
#define W 70
#define H 70
-#define ROWS 5
-#define COLS 5
+#define ROWS 7
+#define COLS 4
Fl_Window *window;
+Fl_Value_Slider *orientation;
+Fl_Value_Slider *size;
void slider_cb(Fl_Widget *w, void *) {
static char buf[80];
- int val = (int)(((Fl_Value_Slider*)w)->value());
- Fl_Window *win = (Fl_Window*)w->parent(); // get parent window
- for (int i = win->children(); i--; ) { // all window children
- Fl_Widget *wc = win->child(i);
+ int val = (int)orientation->value();
+ int sze = (int)size->value();
+ for (int i = window->children(); i--; ) { // all window children
+ Fl_Widget *wc = window->child(i);
const char *l = wc->label();
if ( *l == '@' ) { // all children with '@'
if ( *(++l) == '@' ) { // ascii legend?
l++;
- while (isdigit(*l)) { l++; }
- if (val == 0) { sprintf(buf, "@@%s", l); }
- else { sprintf(buf, "@@%d%s", val, l); }
+ while (isdigit(*l)||*l=='+'||*l=='-') { l++; }
+ if (val&&sze) sprintf(buf, "@@%+d%d%s", sze, val, l);
+ else if (val) sprintf(buf, "@@%d%s", val, l);
+ else if (sze) sprintf(buf, "@@%+d%s", sze, l);
+ else sprintf(buf, "@@%s", l);
} else { // box with symbol
- while (isdigit(*l)) { l++; }
- if (val == 0) { sprintf(buf, "@%s", l); }
- else { sprintf(buf, "@%d%s", val, l); }
+ while (isdigit(*l)||*l=='+'||*l=='-') { l++; }
+ if (val&&sze) sprintf(buf, "@%+d%d%s", sze, val, l);
+ else if (val) sprintf(buf, "@%d%s", val, l);
+ else if (sze) sprintf(buf, "@%+d%s", sze, l);
+ else sprintf(buf, "@%s", l);
}
free((void*)(wc->label()));
wc->label(strdup(buf));
}
}
- win->redraw();
+ window->redraw();
}
void bt(const char *name) {
@@ -108,17 +114,26 @@ bt("@line");
bt("@menu");
bt("@UpArrow");
bt("@DnArrow");
+bt("@search");
+bt("@FLTK");
- Fl_Value_Slider slider((int)(window->w()*.10+.5),
- window->h()-40,
- (int)(window->w()*.80+.5),
- 16,
- "Orientation");
- slider.type(FL_HORIZONTAL);
- slider.range(0.0, 9.0);
- slider.value(0.0);
- slider.step(1);
- slider.callback(slider_cb, &slider);
+ orientation = new Fl_Value_Slider(
+ (int)(window->w()*.05+.5), window->h()-40,
+ (int)(window->w()*.42+.5), 16, "Orientation");
+ orientation->type(FL_HORIZONTAL);
+ orientation->range(0.0, 9.0);
+ orientation->value(0.0);
+ orientation->step(1);
+ orientation->callback(slider_cb, 0);
+
+ size = new Fl_Value_Slider(
+ (int)(window->w()*.53+.5), window->h()-40,
+ (int)(window->w()*.42+.5), 16, "Size");
+ size->type(FL_HORIZONTAL);
+ size->range(-3.0, 9.0);
+ size->value(0.0);
+ size->step(1);
+ size->callback(slider_cb, 0);
window->resizable(window);
window->show(argc,argv);
@@ -126,5 +141,5 @@ bt("@DnArrow");
}
//
-// End of "$Id: symbols.cxx,v 1.4.2.3.2.6 2004/04/11 04:39:01 easysw Exp $".
+// End of "$Id: symbols.cxx,v 1.4.2.3.2.7 2004/07/04 06:49:34 matthiaswm Exp $".
//