release-1.10release-1.7release-1.8release-1.9
Last change
on this file since 010a951 was
4a41f16,
checked in by David Benjamin <davidben@mit.edu>, 14 years ago
|
Pass deactivate_cb as argument to owl_editcontext_new
|
-
Property mode set to
100644
|
File size:
880 bytes
|
Line | |
---|
1 | #include "owl.h" |
---|
2 | |
---|
3 | #include <assert.h> |
---|
4 | |
---|
5 | bool owl_is_editcontext(const owl_context *ctx) |
---|
6 | { |
---|
7 | return owl_context_matches(ctx, OWL_CTX_TYPWIN); |
---|
8 | } |
---|
9 | |
---|
10 | owl_context *owl_editcontext_new(int mode, owl_editwin *e, const char *keymap, void (*deactivate_cb)(owl_context*), void *cbdata) |
---|
11 | { |
---|
12 | owl_context *ctx = owl_context_new(mode, owl_editwin_ref(e), keymap, |
---|
13 | owl_editwin_get_window(e)); |
---|
14 | ctx->deactivate_cb = deactivate_cb; |
---|
15 | ctx->delete_cb = owl_editcontext_delete_cb; |
---|
16 | ctx->cbdata = cbdata; |
---|
17 | /* TODO: the flags are really screwy. */ |
---|
18 | assert(owl_is_editcontext(ctx)); |
---|
19 | return ctx; |
---|
20 | } |
---|
21 | |
---|
22 | owl_editwin *owl_editcontext_get_editwin(const owl_context *ctx) |
---|
23 | { |
---|
24 | if (!owl_is_editcontext(ctx)) return NULL; |
---|
25 | return ctx->data; |
---|
26 | } |
---|
27 | |
---|
28 | void owl_editcontext_delete_cb(owl_context *ctx) |
---|
29 | { |
---|
30 | if (owl_is_editcontext(ctx) && ctx->data) { |
---|
31 | owl_editwin_unref(ctx->data); |
---|
32 | ctx->data = NULL; |
---|
33 | } |
---|
34 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.