Welcome to mirror list, hosted at ThFree Co, Russian Federation.

WM_keymap.h « windowmanager « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 28a8340cd922a2b71f3ed581aaf9d077a7f3282a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/*
 * ***** BEGIN GPL LICENSE BLOCK *****
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version. 
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 * The Original Code is Copyright (C) 2007 Blender Foundation.
 * All rights reserved.
 * 
 * Contributor(s): Blender Foundation
 *
 * ***** END GPL LICENSE BLOCK *****
 */

#ifndef __WM_KEYMAP_H__
#define __WM_KEYMAP_H__

/** \file WM_keymap.h
 *  \ingroup wm
 */

/* dna-savable wmStructs here */
#include "DNA_windowmanager_types.h"
#include "BLI_utildefines.h"

#ifdef __cplusplus
extern "C" {
#endif

struct EnumPropertyItem;

/* Key Configuration */

wmKeyConfig *WM_keyconfig_new	(struct wmWindowManager *wm, const char *idname);
wmKeyConfig *WM_keyconfig_new_user(struct wmWindowManager *wm, const char *idname);
bool        WM_keyconfig_remove	(struct wmWindowManager *wm, struct wmKeyConfig *keyconf);
void 		WM_keyconfig_free	(struct wmKeyConfig *keyconf);

void		WM_keyconfig_set_active(struct wmWindowManager *wm, const char *idname);

void		WM_keyconfig_update(struct wmWindowManager *wm);
void		WM_keyconfig_update_tag(struct wmKeyMap *keymap, struct wmKeyMapItem *kmi);
void        WM_keyconfig_update_operatortype(void);

/* Keymap */

void		WM_keymap_init		(struct bContext *C);
void		WM_keymap_free		(struct wmKeyMap *keymap);

wmKeyMapItem *WM_keymap_verify_item(struct wmKeyMap *keymap, const char *idname, int type, 
                                    int val, int modifier, int keymodifier);
wmKeyMapItem *WM_keymap_add_item(struct wmKeyMap *keymap, const char *idname, int type, 
                                 int val, int modifier, int keymodifier);
wmKeyMapItem *WM_keymap_add_menu(struct wmKeyMap *keymap, const char *idname, int type,
                                 int val, int modifier, int keymodifier);
wmKeyMapItem *WM_keymap_add_menu_pie(struct wmKeyMap *keymap, const char *idname, int type,
                                     int val, int modifier, int keymodifier);

bool        WM_keymap_remove_item(struct wmKeyMap *keymap, struct wmKeyMapItem *kmi);
int         WM_keymap_item_to_string(wmKeyMapItem *kmi, const bool compact, const int len, char *r_str);

wmKeyMap	*WM_keymap_list_find(ListBase *lb, const char *idname, int spaceid, int regionid);
wmKeyMap	*WM_keymap_find(struct wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid);
wmKeyMap	*WM_keymap_find_all(const struct bContext *C, const char *idname, int spaceid, int regionid);
wmKeyMap	*WM_keymap_active(struct wmWindowManager *wm, struct wmKeyMap *keymap);
wmKeyMap	*WM_keymap_guess_opname(const struct bContext *C, const char *opname);
bool		 WM_keymap_remove(struct wmKeyConfig *keyconfig, struct wmKeyMap *keymap);

wmKeyMapItem *WM_keymap_item_find_id(struct wmKeyMap *keymap, int id);
int			WM_keymap_item_compare(struct wmKeyMapItem *k1, struct wmKeyMapItem *k2);

/* Modal Keymap */

int WM_modalkeymap_items_to_string(
        struct wmKeyMap *km, const int propvalue, const bool compact, const int len, char *r_str);
int WM_modalkeymap_operator_items_to_string(
        struct wmOperatorType *ot, const int propvalue, const bool compact, const int len, char *r_str);
char *WM_modalkeymap_operator_items_to_string_buf(
        struct wmOperatorType *ot, const int propvalue, const bool compact,
        const int max_len, int *r_available_len, char **r_str);

wmKeyMap	*WM_modalkeymap_add(struct wmKeyConfig *keyconf, const char *idname, struct EnumPropertyItem *items);
wmKeyMap	*WM_modalkeymap_get(struct wmKeyConfig *keyconf, const char *idname);
wmKeyMapItem *WM_modalkeymap_add_item(struct wmKeyMap *km, int type, int val, int modifier, int keymodifier, int value);
wmKeyMapItem *WM_modalkeymap_add_item_str(struct wmKeyMap *km, int type, int val, int modifier, int keymodifier, const char *value);
wmKeyMapItem *WM_modalkeymap_find_propvalue(wmKeyMap *km, const int propvalue);
void		WM_modalkeymap_assign(struct wmKeyMap *km, const char *opname);

/* Keymap Editor */

void		WM_keymap_restore_to_default(struct wmKeyMap *keymap, struct bContext *C);
void		WM_keymap_properties_reset(struct wmKeyMapItem *kmi, struct IDProperty *properties);
void		WM_keymap_restore_item_to_default(struct bContext *C, struct wmKeyMap *keymap, struct wmKeyMapItem *kmi);
int			WM_keymap_map_type_get(struct wmKeyMapItem *kmi);

/* Key Event */

const char *WM_key_event_string(const short type, const bool compact);
int WM_keymap_item_raw_to_string(
        const short shift, const short ctrl, const short alt, const short oskey, const short keymodifier,
        const short val, const short type, const bool compact, const int len, char *r_str);
int         WM_key_event_operator_id(
        const struct bContext *C, const char *opname, int opcontext,
        struct IDProperty *properties, const bool is_hotkey,
        struct wmKeyMap **r_keymap);
char       *WM_key_event_operator_string(
        const struct bContext *C, const char *opname, int opcontext,
        struct IDProperty *properties, const bool is_strict, int len, char *r_str);

const char *WM_bool_as_string(bool test);

#ifdef __cplusplus
}
#endif

#endif /* __WM_KEYMAP_H__ */