2 This file is part of fxwt, the window system toolkit of 3dengfx.
4 Copyright (c) 2004, 2005 John Tsiombikas <nuclear@siggraph.org>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 /* main fxwt event handling and system abstraction.
23 * Author: John Tsiombikas 2004
25 * John Tsiombikas 2005
31 #include "3dengfx/3denginefx.hpp"
32 #include "common/err_msg.h"
35 #include "gfx_library.h"
40 list<void (*)()> disp_handlers;
41 list<void (*)()> idle_handlers;
42 list<void (*)(int)> keyb_handlers;
43 list<void (*)(int, int)> motion_handlers;
44 list<void (*)(int, int, int, int)> button_handlers;
55 const GraphicsInitParameters *gip = get_graphics_init_parameters();
60 void fxwt::set_display_handler(void (*handler)()) {
61 disp_handlers.push_back(handler);
64 void fxwt::set_idle_handler(void (*handler)()) {
65 idle_handlers.push_back(handler);
68 void fxwt::set_keyboard_handler(void (*handler)(int)) {
69 keyb_handlers.push_back(handler);
72 void fxwt::set_motion_handler(void (*handler)(int, int)) {
73 motion_handlers.push_back(handler);
76 void fxwt::set_button_handler(void (*handler)(int, int, int, int)) {
77 button_handlers.push_back(handler);
80 void fxwt::remove_display_handler(void (*handler)()) {
81 disp_handlers.remove(handler);
84 void fxwt::remove_idle_handler(void (*handler)()) {
85 idle_handlers.remove(handler);
88 void fxwt::remove_keyboard_handler(void (*handler)(int)) {
89 keyb_handlers.remove(handler);
92 void fxwt::remove_motion_handler(void (*handler)(int, int)) {
93 motion_handlers.remove(handler);
96 void fxwt::remove_button_handler(void (*handler)(int, int, int, int)) {
97 button_handlers.remove(handler);
100 bool fxwt::mouse_button_pressed(int bn) {
101 return button_state[bn];