From e907ce4a11e1258760eea39f4c81cce1d197d9fc Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Sat, 6 Dec 2008 13:02:49 +0000 Subject: STR 2079, part 1: Improved test/subwindow.cxx - removed confusing character output (define DEBUG_POS for testing) - included FL/names.h instead of hand-made eventnames array - added more input widgets for better dnd and focus testing git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6550 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- CHANGES | 13 ++++++------- test/subwindow.cxx | 53 +++++++++++++++++++++++------------------------------ 2 files changed, 29 insertions(+), 37 deletions(-) diff --git a/CHANGES b/CHANGES index fe6b19599..92ae10fcd 100644 --- a/CHANGES +++ b/CHANGES @@ -1,8 +1,8 @@ CHANGES IN FLTK 1.3.0 - - Fixed documentation (added missing COMCTRL32.LIB - dependency) - - Fixed menu positon close to screen border (STR #2057) + - Improved test/subwindow.cxx (STR #2079) + - Fixed documentation (added missing COMCTRL32.LIB dependency) + - Fixed menu position close to screen border (STR #2057) - Improved stability of fl_read_image (STR #2021) - Fixed adding an idle handler during a draw() call (STR #1950) @@ -17,11 +17,10 @@ CHANGES IN FLTK 1.3.0 resizing their children (STR #2032) - "fltk-config --post foo" now creates an application bundle rather than attaching a resource fork. - - Added scroll_to() to Fl_Scroll, replacing position() - which now behaves as it should (STR #1303) + - Added scroll_to(int,int) to Fl_Scroll, replacing + position(int,int) which now behaves as it should (STR #1303) - Fixed Fl_Scroll inside Fl_Scroll (STR #265) - - Hardcoded 1.1 references in src/Makefile to 1.3 - (STR #1922) + - Hardcoded 1.1 references in src/Makefile to 1.3 (STR #1922) - Changed font index to 32 bit - Changed font size to 32 bit - Changed widget coordinates to 32 bit diff --git a/test/subwindow.cxx b/test/subwindow.cxx index f8a6fcf58..e5fcb7e3b 100644 --- a/test/subwindow.cxx +++ b/test/subwindow.cxx @@ -39,6 +39,21 @@ #include #include +#ifdef DEBUG +#include +#endif + +// Define DEBUG_POS for a subwindow positioning test. This will draw +// the last typed character at the cursor position, if no input widget +// currently has the focus. +// Note: The typed character is saved in the derived testwindow class, +// regardless of the definition of DEBUG_POS. Only drawing the character +// depends on this define. + +#ifdef DEBUG_POS +#include +#endif + class EnterExit : public Fl_Box { int handle(int); public: @@ -51,30 +66,6 @@ int EnterExit::handle(int e) { else return 0; } -#ifdef DEBUG -const char *eventnames[] = { -"zero", -"FL_PUSH", -"FL_RELEASE", -"FL_ENTER", -"FL_LEAVE", -"FL_DRAG", -"FL_FOCUS", -"FL_UNFOCUS", -"FL_KEYBOARD", -"9", -"FL_MOVE", -"FL_SHORTCUT", -"12", -"FL_DEACTIVATE", -"FL_ACTIVATE", -"FL_HIDE", -"FL_SHOW", -"FL_PASTE", -"FL_SELECTIONCLEAR", -}; -#endif - class testwindow : public Fl_Window { int handle(int); void draw(); @@ -88,19 +79,19 @@ public: void use_cursor(Fl_Cursor c) { crsr = c; } }; -#include - void testwindow::draw() { #ifdef DEBUG printf("%s : draw\n",label()); #endif Fl_Window::draw(); +#ifdef DEBUG_POS if (key) fl_draw(&key, 1, cx, cy); +#endif } int testwindow::handle(int e) { #ifdef DEBUG - if (e != FL_MOVE) printf("%s : %s\n",label(),eventnames[e]); + if (e != FL_MOVE) printf("%s : %s\n",label(),fl_eventnames[e]); #endif if (crsr!=FL_CURSOR_DEFAULT) { if (e == FL_ENTER) @@ -166,14 +157,16 @@ int main(int argc, char **argv) { new testwindow(FL_UP_BOX,400,400,"outer"); new Fl_Toggle_Button(310,310,80,80,"&outer"); new EnterExit(10,310,80,80,"enterexit"); - new Fl_Input(150,310,150,25,"input:"); + new Fl_Input(160,310,140,25,"input1:"); + new Fl_Input(160,340,140,25,"input2:"); (new Fl_Menu_Button(5,150,80,25,"menu&1"))->add(bigmess); testwindow *subwindow = new testwindow(FL_DOWN_BOX,100,100,200,200,"inner"); new Fl_Toggle_Button(110,110,80,80,"&inner"); new EnterExit(10,110,80,80,"enterexit"); - (new Fl_Menu_Button(50,50,80,25,"menu&2"))->add(bigmess); - new Fl_Input(45,80,150,25,"input:"); + (new Fl_Menu_Button(50,20,80,25,"menu&2"))->add(bigmess); + new Fl_Input(55,50,140,25,"input1:"); + new Fl_Input(55,80,140,25,"input2:"); subwindow->resizable(subwindow); window->resizable(subwindow); subwindow->end(); -- cgit v1.2.3