diff --git a/CHANGES b/CHANGES index 0d609f8d7..8d47a7ff7 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,6 @@ CHANGES IN FLTK 1.1.10 + - improved test/subwindow.cxx (STR #2079) - Fixed RGB colors for round box (STR #2097) - Fixed documentation (added missing COMCTRL32.LIB dependency) diff --git a/test/subwindow.cxx b/test/subwindow.cxx index a9fc7f45b..8171b0e85 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();