1 /* 2 Copyright 2012-2020 David Robillard <d@drobilla.net> 3 4 Permission to use, copy, modify, and/or distribute this software for any 5 purpose with or without fee is hereby granted, provided that the above 6 copyright notice and this permission notice appear in all copies. 7 8 THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 */ 16 17 #ifndef PUGL_IMPLEMENTATION_H 18 #define PUGL_IMPLEMENTATION_H 19 20 #include "types.h" 21 22 #include "pugl/pugl.h" 23 24 #include <stddef.h> 25 #include <stdint.h> 26 27 PUGL_BEGIN_DECLS 28 29 /// Set `blob` to `data` with length `len`, reallocating if necessary 30 void 31 puglSetBlob(PuglBlob* dest, const void* data, size_t len); 32 33 /// Reallocate and set `*dest` to `string` 34 void 35 puglSetString(char** dest, const char* string); 36 37 /// Allocate and initialise world internals (implemented once per platform) 38 PuglWorldInternals* 39 puglInitWorldInternals(PuglWorldType type, PuglWorldFlags flags); 40 41 /// Destroy and free world internals (implemented once per platform) 42 void 43 puglFreeWorldInternals(PuglWorld* world); 44 45 /// Allocate and initialise view internals (implemented once per platform) 46 PuglInternals* 47 puglInitViewInternals(void); 48 49 /// Destroy and free view internals (implemented once per platform) 50 void 51 puglFreeViewInternals(PuglView* view); 52 53 /// Return the Unicode code point for `buf` or the replacement character 54 uint32_t 55 puglDecodeUTF8(const uint8_t* buf); 56 57 /// Dispatch an event with a simple `type` to `view` 58 void 59 puglDispatchSimpleEvent(PuglView* view, PuglEventType type); 60 61 /// Dispatch `event` to `view` while already in the graphics context 62 void 63 puglDispatchEventInContext(PuglView* view, const PuglEvent* event); 64 65 /// Dispatch `event` to `view`, entering graphics context if necessary 66 void 67 puglDispatchEvent(PuglView* view, const PuglEvent* event); 68 69 /// Set internal (stored in view) clipboard contents 70 const void* 71 puglGetInternalClipboard(const PuglView* view, const char** type, size_t* len); 72 73 /// Set internal (stored in view) clipboard contents 74 PuglStatus 75 puglSetInternalClipboard(PuglView* view, 76 const char* type, 77 const void* data, 78 size_t len); 79 80 PUGL_END_DECLS 81 82 #endif // PUGL_IMPLEMENTATION_H 83