summaryrefslogtreecommitdiff
path: root/test/subwindow.cxx
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2008-12-06 13:02:49 +0000
committerAlbrecht Schlosser <albrechts.fltk@online.de>2008-12-06 13:02:49 +0000
commite907ce4a11e1258760eea39f4c81cce1d197d9fc (patch)
treebbd9277a71185a49cae8da15aaa3c1fefdabaace /test/subwindow.cxx
parent0906d230edec0cc74681cb8a49f3ff1e5451f601 (diff)
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
Diffstat (limited to 'test/subwindow.cxx')
-rw-r--r--test/subwindow.cxx53
1 files changed, 23 insertions, 30 deletions
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 <FL/Fl_Box.H>
#include <FL/Fl_Input.H>
+#ifdef DEBUG
+#include <FL/names.h>
+#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 <FL/fl_draw.H>
+#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 <FL/fl_draw.H>
-
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();