Blender V2.61 - r43446

WM_keymap.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  * Contributor(s): Blender Foundation
00022  *
00023  * ***** END GPL LICENSE BLOCK *****
00024  */
00025 
00026 #ifndef WM_KEYMAP_H
00027 #define WM_KEYMAP_H
00028 
00033 /* dna-savable wmStructs here */
00034 #include "DNA_windowmanager_types.h"
00035 
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039 
00040 struct EnumPropertyItem;
00041 
00042 /* Key Configuration */
00043 
00044 wmKeyConfig *WM_keyconfig_new   (struct wmWindowManager *wm, const char *idname);
00045 wmKeyConfig *WM_keyconfig_new_user(struct wmWindowManager *wm, const char *idname);
00046 void        WM_keyconfig_remove (struct wmWindowManager *wm, struct wmKeyConfig *keyconf);
00047 void        WM_keyconfig_free   (struct wmKeyConfig *keyconf);
00048 
00049 void        WM_keyconfig_set_active(struct wmWindowManager *wm, const char *idname);
00050 
00051 void        WM_keyconfig_update(struct wmWindowManager *wm);
00052 void        WM_keyconfig_update_tag(struct wmKeyMap *keymap, struct wmKeyMapItem *kmi);
00053 
00054 /* Keymap */
00055 
00056 void        WM_keymap_init      (struct bContext *C);
00057 void        WM_keymap_free      (struct wmKeyMap *keymap);
00058 
00059 wmKeyMapItem *WM_keymap_verify_item(struct wmKeyMap *keymap, const char *idname, int type, 
00060                                  int val, int modifier, int keymodifier);
00061 wmKeyMapItem *WM_keymap_add_item(struct wmKeyMap *keymap, const char *idname, int type, 
00062                                  int val, int modifier, int keymodifier);
00063 wmKeyMapItem *WM_keymap_add_menu(struct wmKeyMap *keymap, const char *idname, int type,
00064                                  int val, int modifier, int keymodifier);
00065 
00066 void        WM_keymap_remove_item(struct wmKeyMap *keymap, struct wmKeyMapItem *kmi);
00067 char         *WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, int len);
00068 
00069 wmKeyMap    *WM_keymap_list_find(ListBase *lb, const char *idname, int spaceid, int regionid);
00070 wmKeyMap    *WM_keymap_find(struct wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid);
00071 wmKeyMap    *WM_keymap_find_all(const struct bContext *C, const char *idname, int spaceid, int regionid);
00072 wmKeyMap    *WM_keymap_active(struct wmWindowManager *wm, struct wmKeyMap *keymap);
00073 wmKeyMap    *WM_keymap_guess_opname(const struct bContext *C, const char *opname);
00074 
00075 wmKeyMapItem *WM_keymap_item_find_id(struct wmKeyMap *keymap, int id);
00076 int         WM_keymap_item_compare(struct wmKeyMapItem *k1, struct wmKeyMapItem *k2);
00077 
00078 /* Modal Keymap */
00079 
00080 wmKeyMap    *WM_modalkeymap_add(struct wmKeyConfig *keyconf, const char *idname, struct EnumPropertyItem *items);
00081 wmKeyMap    *WM_modalkeymap_get(struct wmKeyConfig *keyconf, const char *idname);
00082 wmKeyMapItem *WM_modalkeymap_add_item(struct wmKeyMap *km, int type, int val, int modifier, int keymodifier, int value);
00083 void        WM_modalkeymap_assign(struct wmKeyMap *km, const char *opname);
00084 
00085 /* Keymap Editor */
00086 
00087 void        WM_keymap_restore_to_default(struct wmKeyMap *keymap, struct bContext *C);
00088 void        WM_keymap_properties_reset(struct wmKeyMapItem *kmi, struct IDProperty *properties);
00089 void        WM_keymap_restore_item_to_default(struct bContext *C, struct wmKeyMap *keymap, struct wmKeyMapItem *kmi);
00090 
00091 /* Key Event */
00092 
00093 const char  *WM_key_event_string(short type);
00094 int         WM_key_event_operator_id(const struct bContext *C, const char *opname, int opcontext, struct IDProperty *properties, int hotkey, struct wmKeyMap **keymap_r);
00095 char        *WM_key_event_operator_string(const struct bContext *C, const char *opname, int opcontext, struct IDProperty *properties, const short sloppy, char *str, int len);
00096 
00097 #ifdef __cplusplus
00098 }
00099 #endif
00100 
00101 #endif /* WM_KEYMAP_H */
00102