Blender  V2.59
wm_event_system.h
Go to the documentation of this file.
00001 /*
00002  * $Id: wm_event_system.h 36242 2011-04-20 11:15:58Z ton $
00003  *
00004  * ***** BEGIN GPL LICENSE BLOCK *****
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version. 
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software Foundation,
00018  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  *
00020  * The Original Code is Copyright (C) 2007 Blender Foundation.
00021  * All rights reserved.
00022  *
00023  * 
00024  * Contributor(s): Blender Foundation
00025  *
00026  * ***** END GPL LICENSE BLOCK *****
00027  */
00028 
00033 #ifndef WM_EVENT_SYSTEM_H
00034 #define WM_EVENT_SYSTEM_H
00035 
00036 /* return value of handler-operator call */
00037 #define WM_HANDLER_CONTINUE     0
00038 #define WM_HANDLER_BREAK        1
00039 #define WM_HANDLER_HANDLED      2
00040 #define WM_HANDLER_MODAL        4 /* MODAL|BREAK means unhandled */
00041 
00042 struct ScrArea;
00043 struct ARegion;
00044 
00045 /* wmKeyMap is in DNA_windowmanager.h, it's savable */
00046 
00047 typedef struct wmEventHandler {
00048         struct wmEventHandler *next, *prev;
00049         
00050         int type, flag;                         /* type default=0, rest is custom */
00051         
00052         /* keymap handler */
00053         wmKeyMap *keymap;                       /* pointer to builtin/custom keymaps */
00054         rcti *bblocal, *bbwin;          /* optional local and windowspace bb */
00055         
00056         /* modal operator handler */
00057         wmOperator *op;                                         /* for derived/modal handlers */
00058         struct ScrArea *op_area;                        /* for derived/modal handlers */
00059         struct ARegion *op_region;                      /* for derived/modal handlers */
00060 
00061         /* ui handler */
00062         wmUIHandlerFunc ui_handle;              /* callback receiving events */
00063         wmUIHandlerRemoveFunc ui_remove;        /* callback when handler is removed */
00064         void *ui_userdata;                                      /* user data pointer */
00065         struct ScrArea *ui_area;                        /* for derived/modal handlers */
00066         struct ARegion *ui_region;                      /* for derived/modal handlers */
00067         struct ARegion *ui_menu;                        /* for derived/modal handlers */
00068         
00069         /* fileselect handler re-uses modal operator data */
00070         struct bScreen *filescreen;                     /* screen it started in, to validate exec */
00071         
00072         /* drop box handler */
00073         ListBase *dropboxes;
00074         
00075 } wmEventHandler;
00076 
00077 
00078 /* handler flag */
00079                 /* after this handler all others are ignored */
00080 #define WM_HANDLER_BLOCKING             1
00081                 /* handler tagged to be freed in wm_handlers_do() */
00082 #define WM_HANDLER_DO_FREE              2
00083 
00084 
00085 
00086 /* custom types for handlers, for signalling, freeing */
00087 enum {
00088         WM_HANDLER_DEFAULT,
00089         WM_HANDLER_FILESELECT
00090 };
00091 
00092 
00093 /* wm_event_system.c */
00094 void            wm_event_free_all               (wmWindow *win);
00095 void            wm_event_free                   (wmEvent *event);
00096 void            wm_event_free_handler   (wmEventHandler *handler);
00097 
00098                         /* goes over entire hierarchy:  events -> window -> screen -> area -> region */
00099 void            wm_event_do_handlers    (bContext *C);
00100 
00101 void            wm_event_add_ghostevent (wmWindowManager *wm, wmWindow *win, int type, int time, void *customdata);
00102 
00103 void            wm_event_do_notifiers   (bContext *C);
00104 
00105 /* wm_keymap.c */
00106 
00107 /* wm_dropbox.c */
00108 void            wm_dropbox_free(void);
00109 void            wm_drags_check_ops(bContext *C, wmEvent *event);
00110 void            wm_drags_draw(bContext *C, wmWindow *win, rcti *rect);
00111 
00112 #endif /* WM_EVENT_SYSTEM_H */
00113