home *** CD-ROM | disk | FTP | other *** search
-
- /* low-level.h.tboxevent
- *
- * Dreamscape - C++ class library for RISC OS
- * Copyright (c) 1996 Mark Seaborn <mseaborn@argonet.co.uk>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- * See the Dreamscape documentation for more information.
- */
-
- #ifndef dreamscape_tboxevent_H
- #define dreamscape_tboxevent_H
-
- #include "bool.h"
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- typedef void (dscape_tboxevent_s_handler)(const struct toolbox_action *event,
- const struct toolbox_block *ids);
- typedef bool (dscape_tboxevent_handler)(const struct toolbox_action *event,
- const struct toolbox_block *ids, void *handle);
- #define dscape_tboxevent_any_object ((struct toolbox_o_ *) 0)
- #define dscape_tboxevent_any_component ((int) -1)
- #define dscape_tboxevent_match_self (1<<0)
- #define dscape_tboxevent_match_parent (1<<1)
- #define dscape_tboxevent_match_ancestor (1<<2)
-
- void dscape_tboxevent_dispatch_event(const struct toolbox_action *event,
- const struct toolbox_block *ids);
-
- /* simple handlers, registered on an event */
- void dscape_tboxevent_register_s_handler(int id,
- dscape_tboxevent_s_handler *function);
- void dscape_tboxevent_deregister_s_handler(int id,
- dscape_tboxevent_s_handler *function);
-
- /* object handlers, registered on an event and an object */
- void dscape_tboxevent_register_o_handler(int id, struct toolbox_o_ *object,
- unsigned object_matches, dscape_tboxevent_handler *function,
- void *handle);
- void dscape_tboxevent_deregister_o_handler(int id, struct toolbox_o_ *object,
- unsigned object_matches, dscape_tboxevent_handler *function,
- void *handle);
-
- /* gadget handlers, registered on an event, an object and a component */
- void dscape_tboxevent_register_c_handler(int id, struct toolbox_o_ *object,
- unsigned object_matches, int component, unsigned component_matches,
- dscape_tboxevent_handler *function, void *handle);
- void dscape_tboxevent_deregister_c_handler(int id, struct toolbox_o_ *object,
- unsigned object_matches, int component, unsigned component_matches,
- dscape_tboxevent_handler *function, void *handle);
-
- #ifdef __cplusplus
- }
-
- typedef struct toolbox_o_ *toolbox_o;
- struct toolbox_action;
- struct toolbox_block;
-
- class ToolboxEventHandler {
- public:
- typedef dscape_tboxevent_s_handler SHandler;
- typedef dscape_tboxevent_handler Handler;
- enum { any_object = 0, any_component = -1,
- match_object = 1<<0, match_parent = 1<<1, match_ancestor = 1<<2 };
-
- static void dispatch_event(const toolbox_action *event,
- const toolbox_block *ids)
- { dscape_tboxevent_dispatch_event(event, ids); }
-
- static void register_handler(int id, SHandler *function)
- { dscape_tboxevent_register_s_handler(id, function); }
- static void deregister_handler(int id, SHandler *function)
- { dscape_tboxevent_deregister_s_handler(id, function); }
-
- static void register_handler(int id, toolbox_o object,
- unsigned object_matches, Handler *function, void *handle)
- { dscape_tboxevent_register_o_handler(id, object, object_matches,
- function, handle); }
- static void deregister_handler(int id, toolbox_o object,
- unsigned object_matches, Handler *function, void *handle)
- { dscape_tboxevent_deregister_o_handler(id, object, object_matches,
- function, handle); }
-
- static void register_handler(int id, toolbox_o object,
- unsigned object_matches, int component,
- unsigned component_matches, Handler *function, void *handle)
- { dscape_tboxevent_register_c_handler(id, object, object_matches,
- component, component_matches, function, handle); }
- static void deregister_handler(int id, toolbox_o object,
- unsigned object_matches, int component,
- unsigned component_matches, Handler *function, void *handle)
- { dscape_tboxevent_deregister_c_handler(id, object, object_matches,
- component, component_matches, function, handle); }
- };
-
- #endif
-
- #endif
-