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
This commit is contained in:
parent
0906d230ed
commit
e907ce4a11
13
CHANGES
13
CHANGES
@ -1,8 +1,8 @@
|
|||||||
CHANGES IN FLTK 1.3.0
|
CHANGES IN FLTK 1.3.0
|
||||||
|
|
||||||
- Fixed documentation (added missing COMCTRL32.LIB
|
- Improved test/subwindow.cxx (STR #2079)
|
||||||
dependency)
|
- Fixed documentation (added missing COMCTRL32.LIB dependency)
|
||||||
- Fixed menu positon close to screen border (STR #2057)
|
- Fixed menu position close to screen border (STR #2057)
|
||||||
- Improved stability of fl_read_image (STR #2021)
|
- Improved stability of fl_read_image (STR #2021)
|
||||||
- Fixed adding an idle handler during
|
- Fixed adding an idle handler during
|
||||||
a draw() call (STR #1950)
|
a draw() call (STR #1950)
|
||||||
@ -17,11 +17,10 @@ CHANGES IN FLTK 1.3.0
|
|||||||
resizing their children (STR #2032)
|
resizing their children (STR #2032)
|
||||||
- "fltk-config --post foo" now creates an application
|
- "fltk-config --post foo" now creates an application
|
||||||
bundle rather than attaching a resource fork.
|
bundle rather than attaching a resource fork.
|
||||||
- Added scroll_to() to Fl_Scroll, replacing position()
|
- Added scroll_to(int,int) to Fl_Scroll, replacing
|
||||||
which now behaves as it should (STR #1303)
|
position(int,int) which now behaves as it should (STR #1303)
|
||||||
- Fixed Fl_Scroll inside Fl_Scroll (STR #265)
|
- Fixed Fl_Scroll inside Fl_Scroll (STR #265)
|
||||||
- Hardcoded 1.1 references in src/Makefile to 1.3
|
- Hardcoded 1.1 references in src/Makefile to 1.3 (STR #1922)
|
||||||
(STR #1922)
|
|
||||||
- Changed font index to 32 bit
|
- Changed font index to 32 bit
|
||||||
- Changed font size to 32 bit
|
- Changed font size to 32 bit
|
||||||
- Changed widget coordinates to 32 bit
|
- Changed widget coordinates to 32 bit
|
||||||
|
@ -39,6 +39,21 @@
|
|||||||
#include <FL/Fl_Box.H>
|
#include <FL/Fl_Box.H>
|
||||||
#include <FL/Fl_Input.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 {
|
class EnterExit : public Fl_Box {
|
||||||
int handle(int);
|
int handle(int);
|
||||||
public:
|
public:
|
||||||
@ -51,30 +66,6 @@ int EnterExit::handle(int e) {
|
|||||||
else return 0;
|
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 {
|
class testwindow : public Fl_Window {
|
||||||
int handle(int);
|
int handle(int);
|
||||||
void draw();
|
void draw();
|
||||||
@ -88,19 +79,19 @@ public:
|
|||||||
void use_cursor(Fl_Cursor c) { crsr = c; }
|
void use_cursor(Fl_Cursor c) { crsr = c; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#include <FL/fl_draw.H>
|
|
||||||
|
|
||||||
void testwindow::draw() {
|
void testwindow::draw() {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("%s : draw\n",label());
|
printf("%s : draw\n",label());
|
||||||
#endif
|
#endif
|
||||||
Fl_Window::draw();
|
Fl_Window::draw();
|
||||||
|
#ifdef DEBUG_POS
|
||||||
if (key) fl_draw(&key, 1, cx, cy);
|
if (key) fl_draw(&key, 1, cx, cy);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int testwindow::handle(int e) {
|
int testwindow::handle(int e) {
|
||||||
#ifdef DEBUG
|
#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
|
#endif
|
||||||
if (crsr!=FL_CURSOR_DEFAULT) {
|
if (crsr!=FL_CURSOR_DEFAULT) {
|
||||||
if (e == FL_ENTER)
|
if (e == FL_ENTER)
|
||||||
@ -166,14 +157,16 @@ int main(int argc, char **argv) {
|
|||||||
new testwindow(FL_UP_BOX,400,400,"outer");
|
new testwindow(FL_UP_BOX,400,400,"outer");
|
||||||
new Fl_Toggle_Button(310,310,80,80,"&outer");
|
new Fl_Toggle_Button(310,310,80,80,"&outer");
|
||||||
new EnterExit(10,310,80,80,"enterexit");
|
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);
|
(new Fl_Menu_Button(5,150,80,25,"menu&1"))->add(bigmess);
|
||||||
testwindow *subwindow =
|
testwindow *subwindow =
|
||||||
new testwindow(FL_DOWN_BOX,100,100,200,200,"inner");
|
new testwindow(FL_DOWN_BOX,100,100,200,200,"inner");
|
||||||
new Fl_Toggle_Button(110,110,80,80,"&inner");
|
new Fl_Toggle_Button(110,110,80,80,"&inner");
|
||||||
new EnterExit(10,110,80,80,"enterexit");
|
new EnterExit(10,110,80,80,"enterexit");
|
||||||
(new Fl_Menu_Button(50,50,80,25,"menu&2"))->add(bigmess);
|
(new Fl_Menu_Button(50,20,80,25,"menu&2"))->add(bigmess);
|
||||||
new Fl_Input(45,80,150,25,"input:");
|
new Fl_Input(55,50,140,25,"input1:");
|
||||||
|
new Fl_Input(55,80,140,25,"input2:");
|
||||||
subwindow->resizable(subwindow);
|
subwindow->resizable(subwindow);
|
||||||
window->resizable(subwindow);
|
window->resizable(subwindow);
|
||||||
subwindow->end();
|
subwindow->end();
|
||||||
|
Loading…
Reference in New Issue
Block a user