Blender V2.61 - r43446

wm_event_system.h

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