1 #include "testwindow.h"
2 // c++ -g -I../guicast testwindow.C ../guicast/x86_64/libguicast.a \
3 // -DHAVE_GL -DHAVE_XFT -I/usr/include/freetype2 -lGL -lX11 -lXext \
4 // -lXinerama -lXv -lpng -lfontconfig -lfreetype -lXft -pthread
8 : BC_Window("test", 100,100, 100,100, 100,100)
10 in_motion = 0; last_x = last_y = -1;
12 clear_box(0,0,get_w(),get_h());
14 tx = get_text_ascent(MEDIUMFONT);
15 ty = tx + get_text_height(MEDIUMFONT);
23 int TestWindowGUI::button_press_event()
25 if( !is_event_win() ) return 0;
26 if( !cursor_inside() ) return 0;
27 if( get_buttonpress() != 1 ) return 0;
29 last_x = get_abs_cursor_x(0);
30 last_y = get_abs_cursor_y(0);
34 int TestWindowGUI::button_release_event()
40 int TestWindowGUI::cursor_motion_event()
42 if( !in_motion ) return 1;
43 char position[BCSTRLEN];
44 int cx = get_abs_cursor_x(0), dx = cx-last_x; last_x = cx;
45 int cy = get_abs_cursor_y(0), dy = cy-last_y; last_y = cy;
46 reposition_window_relative(dx, dy);
47 snprintf(position,sizeof(position),"%d,%d",get_x(),get_y());
48 clear_box(0,0,get_w(),get_h());
50 draw_text(tx,ty, position);
59 int main(int ac, char **av)
63 TestWindow test_window;