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