diff options
Diffstat (limited to 'include/pugl/pugl.h')
-rw-r--r-- | include/pugl/pugl.h | 580 |
1 files changed, 0 insertions, 580 deletions
diff --git a/include/pugl/pugl.h b/include/pugl/pugl.h index 869d0f3..2e1cdce 100644 --- a/include/pugl/pugl.h +++ b/include/pugl/pugl.h @@ -1661,586 +1661,6 @@ puglSendEvent(PuglView* view, const PuglEvent* event); /** @} -*/ - -#ifndef PUGL_DISABLE_DEPRECATED - -/** - @} - @defgroup pugl_deprecated Deprecated API - @{ -*/ - -PUGL_DEPRECATED_BY("PuglRealizeEvent") -typedef PuglRealizeEvent PuglCreateEvent; - -PUGL_DEPRECATED_BY("PuglUnrealizeEvent") -typedef PuglUnrealizeEvent PuglDestroyEvent; - -PUGL_DEPRECATED_BY("PuglRealizeEvent") -typedef PuglRealizeEvent PuglEventCreate; - -PUGL_DEPRECATED_BY("PuglUnrealizeEvent") -typedef PuglUnrealizeEvent PuglEventDestroy; - -PUGL_DEPRECATED_BY("PuglConfigureEvent") -typedef PuglConfigureEvent PuglEventConfigure; - -PUGL_DEPRECATED_BY("PuglUpdateEvent") -typedef PuglUpdateEvent PuglEventUpdate; - -PUGL_DEPRECATED_BY("PuglExposeEvent") -typedef PuglExposeEvent PuglEventExpose; - -PUGL_DEPRECATED_BY("PuglCloseEvent") -typedef PuglCloseEvent PuglEventClose; - -PUGL_DEPRECATED_BY("PuglFocusEvent") -typedef PuglFocusEvent PuglEventFocus; - -PUGL_DEPRECATED_BY("PuglKeyEvent") -typedef PuglKeyEvent PuglEventKey; - -PUGL_DEPRECATED_BY("PuglTextEvent") -typedef PuglTextEvent PuglEventText; - -PUGL_DEPRECATED_BY("PuglCrossingEvent") -typedef PuglCrossingEvent PuglEventCrossing; - -PUGL_DEPRECATED_BY("PuglButtonEvent") -typedef PuglButtonEvent PuglEventButton; - -PUGL_DEPRECATED_BY("PuglMotionEvent") -typedef PuglMotionEvent PuglEventMotion; - -PUGL_DEPRECATED_BY("PuglScrollEvent") -typedef PuglScrollEvent PuglEventScroll; - -PUGL_DEPRECATED_BY("PuglClientEvent") -typedef PuglClientEvent PuglEventClient; - -PUGL_DEPRECATED_BY("PuglTimerEvent") -typedef PuglTimerEvent PuglEventTimer; - -PUGL_DEPRECATED_BY("PuglLoopEnterEvent") -typedef PuglLoopEnterEvent PuglEventLoopEnter; - -PUGL_DEPRECATED_BY("PuglLoopLeaveEvent") -typedef PuglLoopLeaveEvent PuglEventLoopLeave; - -/** - A native window handle. - - X11: This is a `Window`. - - MacOS: This is a pointer to an `NSView*`. - - Windows: This is a `HWND`. -*/ -PUGL_DEPRECATED_BY("PuglNativeView") -typedef uintptr_t PuglNativeWindow; - -/** - Create a Pugl application and view. - - To create a window, call the various puglInit* functions as necessary, then - call puglRealize(). - - @deprecated Use puglNewApp() and puglNewView(). - - @param pargc Pointer to argument count (currently unused). - @param argv Arguments (currently unused). - @return A newly created view. -*/ -static inline PUGL_DEPRECATED_BY("puglNewView") -PuglView* -puglInit(const int* pargc, char** argv) -{ - (void)pargc; - (void)argv; - - return puglNewView(puglNewWorld(PUGL_MODULE, 0)); -} - -/** - Destroy an app and view created with `puglInit()`. - - @deprecated Use puglFreeApp() and puglFreeView(). -*/ -static inline PUGL_DEPRECATED_BY("puglFreeView") -void -puglDestroy(PuglView* view) -{ - PuglWorld* const world = puglGetWorld(view); - - puglFreeView(view); - puglFreeWorld(world); -} - -/** - Set the class name of the application. - - This is a stable identifier for the application, used as the window - class/instance name on X11 and Windows. It is not displayed to the user, - but can be used in scripts and by window managers, so it should be the same - for every instance of the application, but different from other - applications. -*/ -static inline PUGL_DEPRECATED_BY("puglSetWorldString") -PuglStatus -puglSetClassName(PuglWorld* world, const char* name) -{ - return puglSetWorldString(world, PUGL_CLASS_NAME, name); -} - -/// Get the class name of the application, or null -static inline PUGL_DEPRECATED_BY("puglGetWorldString") -const char* -puglGetClassName(const PuglWorld* world) -{ - return puglGetWorldString(world, PUGL_CLASS_NAME); -} - -/** - Set the window class name before creating a window. -*/ -static inline PUGL_DEPRECATED_BY("puglSetWorldString") -void -puglInitWindowClass(PuglView* view, const char* name) -{ - puglSetWorldString(puglGetWorld(view), PUGL_CLASS_NAME, name); -} - -/** - Set the window size before creating a window. - - @deprecated Use puglSetFrame(). -*/ -static inline PUGL_DEPRECATED_BY("puglSetFrame") -void -puglInitWindowSize(PuglView* view, int width, int height) -{ - PuglRect frame = puglGetFrame(view); - - frame.width = (PuglSpan)width; - frame.height = (PuglSpan)height; - - puglSetFrame(view, frame); -} - -/** - Set the minimum window size before creating a window. -*/ -static inline PUGL_DEPRECATED_BY("puglSetSizeHint") -void -puglInitWindowMinSize(PuglView* view, int width, int height) -{ - puglSetSizeHint(view, PUGL_MIN_SIZE, (unsigned)width, (unsigned)height); -} - -/** - Set the window aspect ratio range before creating a window. - - The x and y values here represent a ratio of width to height. To set a - fixed aspect ratio, set the minimum and maximum values to the same ratio. - - Note that setting different minimum and maximum constraints does not - currently work on MacOS (the minimum is used), so only setting a fixed - aspect ratio works properly across all platforms. -*/ -static inline PUGL_DEPRECATED_BY("puglSetSizeHint") -void -puglInitWindowAspectRatio(PuglView* view, - int minX, - int minY, - int maxX, - int maxY) -{ - puglSetSizeHint(view, PUGL_MIN_ASPECT, (unsigned)minX, (unsigned)minY); - puglSetSizeHint(view, PUGL_MAX_ASPECT, (unsigned)maxX, (unsigned)maxY); -} - -/** - Set transient parent before creating a window. - - On X11, parent must be a Window. - On OSX, parent must be an NSView*. -*/ -static inline PUGL_DEPRECATED_BY("puglSetTransientParent") -void -puglInitTransientFor(PuglView* view, uintptr_t parent) -{ - puglSetTransientParent(view, (PuglNativeView)parent); -} - -/** - Set transient parent before creating a window. - - @deprecated Use puglSetTransientParent(). -*/ -static inline PUGL_DEPRECATED_BY("puglSetTransientParent") -PuglStatus -puglSetTransientFor(PuglView* view, uintptr_t parent) -{ - return puglSetTransientParent(view, (PuglNativeView)parent); -} - -/** - Enable or disable resizing before creating a window. - - @deprecated Use puglSetViewHint() with #PUGL_RESIZABLE. -*/ -static inline PUGL_DEPRECATED_BY("puglSetViewHint") -void -puglInitResizable(PuglView* view, bool resizable) -{ - puglSetViewHint(view, PUGL_RESIZABLE, resizable); -} - -/** - Get the current size of the view. - - @deprecated Use puglGetFrame(). - -*/ -static inline PUGL_DEPRECATED_BY("puglGetFrame") -void -puglGetSize(PuglView* view, int* width, int* height) -{ - const PuglRect frame = puglGetFrame(view); - - *width = (int)frame.width; - *height = (int)frame.height; -} - -/** - Ignore synthetic repeated key events. - - @deprecated Use puglSetViewHint() with #PUGL_IGNORE_KEY_REPEAT. -*/ -static inline PUGL_DEPRECATED_BY("puglSetViewHint") -void -puglIgnoreKeyRepeat(PuglView* view, bool ignore) -{ - puglSetViewHint(view, PUGL_IGNORE_KEY_REPEAT, ignore); -} - -/** - Set a hint before creating a window. - - @deprecated Use puglSetWindowHint(). -*/ -static inline PUGL_DEPRECATED_BY("puglSetViewHint") -void -puglInitWindowHint(PuglView* view, PuglViewHint hint, int value) -{ - puglSetViewHint(view, hint, value); -} - -/** - Set the parent window before creating a window (for embedding). - - @deprecated Use puglSetWindowParent(). -*/ -static inline PUGL_DEPRECATED_BY("puglSetParent") -void -puglInitWindowParent(PuglView* view, PuglNativeView parent) -{ - puglSetParent(view, parent); -} - -/** - Set the graphics backend to use. - - @deprecated Use puglSetBackend(). -*/ -static inline PUGL_DEPRECATED_BY("puglSetBackend") -int -puglInitBackend(PuglView* view, const PuglBackend* backend) -{ - return (int)puglSetBackend(view, backend); -} - -/** - Set the title of the window. - - This only makes sense for non-embedded views that will have a corresponding - top-level window, and sets the title, typically displayed in the title bar - or in window switchers. -*/ -static inline PUGL_DEPRECATED_BY("puglSetViewString") -PuglStatus -puglSetWindowTitle(PuglView* view, const char* title) -{ - return puglSetViewString(view, PUGL_WINDOW_TITLE, title); -} - -/// Return the title of the window, or null -static inline PUGL_DEPRECATED_BY("puglGetViewString") -const char* -puglGetWindowTitle(const PuglView* view) -{ - return puglGetViewString(view, PUGL_WINDOW_TITLE); -} - -/** - Realize a view by creating a corresponding system view or window. - - The view should be fully configured using the above functions before this is - called. This function may only be called once per view. - - @deprecated Use puglRealize(), or just show the view. -*/ -static inline PUGL_DEPRECATED_BY("puglRealize") -PuglStatus -puglCreateWindow(PuglView* view, const char* title) -{ - puglSetViewString(view, PUGL_WINDOW_TITLE, title); - return puglRealize(view); -} - -/** - Block and wait for an event to be ready. - - This can be used in a loop to only process events via puglProcessEvents when - necessary. This function will block indefinitely if no events are - available, so is not appropriate for use in programs that need to perform - regular updates (e.g. animation). - - @deprecated Use puglPollEvents(). -*/ -PUGL_API -PUGL_DEPRECATED_BY("puglPollEvents") -PuglStatus -puglWaitForEvent(PuglView* view); - -/** - Process all pending window events. - - This handles input events as well as rendering, so it should be called - regularly and rapidly enough to keep the UI responsive. This function does - not block if no events are pending. - - @deprecated Use puglDispatchEvents(). -*/ -PUGL_API -PUGL_DEPRECATED_BY("puglDispatchEvents") -PuglStatus -puglProcessEvents(PuglView* view); - -/** - Poll for events that are ready to be processed. - - This polls for events that are ready for any view in the world, potentially - blocking depending on `timeout`. - - @param world The world to poll for events. - - @param timeout Maximum time to wait, in seconds. If zero, the call returns - immediately, if negative, the call blocks indefinitely. - - @return #PUGL_SUCCESS if events are read, #PUGL_FAILURE if not, or an error. - - @deprecated Use puglUpdate(). -*/ -static inline PUGL_DEPRECATED_BY("puglUpdate") -PuglStatus -puglPollEvents(PuglWorld* world, double timeout) -{ - return puglUpdate(world, timeout); -} - -/** - Dispatch any pending events to views. - - This processes all pending events, dispatching them to the appropriate - views. View event handlers will be called in the scope of this call. This - function does not block, if no events are pending then it will return - immediately. - - @deprecated Use puglUpdate(). -*/ -static inline PUGL_DEPRECATED_BY("puglUpdate") -PuglStatus -puglDispatchEvents(PuglWorld* world) -{ - return puglUpdate(world, 0.0); -} - -static inline PUGL_DEPRECATED_BY("puglShow") -PuglStatus -puglShowWindow(PuglView* view) -{ - return puglShow(view, PUGL_SHOW_RAISE); -} - -static inline PUGL_DEPRECATED_BY("puglHide") -PuglStatus -puglHideWindow(PuglView* view) -{ - return puglHide(view); -} - -/** - Set the default size of the view. - - This should be called before puglRealize() to set the default size of the - view, which will be the initial size of the window if this is a top level - view. - - @return #PUGL_UNKNOWN_ERROR on failure, but always succeeds if the view is - not yet realized. -*/ -static inline PUGL_DEPRECATED_BY("puglSetSizeHint") -PuglStatus -puglSetDefaultSize(PuglView* view, int width, int height) -{ - return puglSetSizeHint( - view, PUGL_DEFAULT_SIZE, (unsigned)width, (unsigned)height); -} - -/** - Set the minimum size of the view. - - If an initial minimum size is known, this should be called before - puglRealize() to avoid stutter, though it can be called afterwards as well. - - @return #PUGL_UNKNOWN_ERROR on failure, but always succeeds if the view is - not yet realized. -*/ -static inline PUGL_DEPRECATED_BY("puglSetSizeHint") -PuglStatus -puglSetMinSize(PuglView* view, int width, int height) -{ - return puglSetSizeHint( - view, PUGL_MIN_SIZE, (unsigned)width, (unsigned)height); -} - -/** - Set the maximum size of the view. - - If an initial maximum size is known, this should be called before - puglRealize() to avoid stutter, though it can be called afterwards as well. - - @return #PUGL_UNKNOWN_ERROR on failure, but always succeeds if the view is - not yet realized. -*/ -static inline PUGL_DEPRECATED_BY("puglSetSizeHint") -PuglStatus -puglSetMaxSize(PuglView* view, int width, int height) -{ - return puglSetSizeHint( - view, PUGL_MAX_SIZE, (unsigned)width, (unsigned)height); -} - -/** - Set the view aspect ratio range. - - The x and y values here represent a ratio of width to height. To set a - fixed aspect ratio, set the minimum and maximum values to the same ratio. - - Note that setting different minimum and maximum constraints does not - currently work on MacOS (the minimum is used), so only setting a fixed - aspect ratio works properly across all platforms. - - If an initial aspect ratio is known, this should be called before - puglRealize() to avoid stutter, though it can be called afterwards as well. - - @return #PUGL_UNKNOWN_ERROR on failure, but always succeeds if the view is - not yet realized. -*/ -static inline PUGL_DEPRECATED_BY("puglSetSizeHint") -PuglStatus -puglSetAspectRatio(PuglView* view, int minX, int minY, int maxX, int maxY) -{ - const PuglStatus st0 = - puglSetSizeHint(view, PUGL_MIN_ASPECT, (unsigned)minX, (unsigned)minY); - - const PuglStatus st1 = - puglSetSizeHint(view, PUGL_MAX_ASPECT, (unsigned)maxX, (unsigned)maxY); - - return st0 ? st0 : st1; -} - -/// Return the native window handle -static inline PUGL_DEPRECATED_BY("puglGetNativeView") -PuglNativeView -puglGetNativeWindow(PuglView* view) -{ - return puglGetNativeView(view); -} - -/** - Request user attention. - - This hints to the system that the window or application requires attention - from the user. The exact effect depends on the platform, but is usually - something like a flashing task bar entry or bouncing application icon. -*/ -static inline PUGL_DEPRECATED_BY("puglSetViewStyle") -PuglStatus -puglRequestAttention(PuglView* view) -{ - return puglSetViewStyle(view, - puglGetViewStyle(view) | PUGL_VIEW_STYLE_DEMANDING); -} - -# define PUGL_KEY_SHIFT PUGL_KEY_SHIFT_L - -# define PUGL_KEY_CTRL PUGL_KEY_CTRL_L - -# define PUGL_KEY_ALT PUGL_KEY_ALT_L - -# define PUGL_KEY_SUPER PUGL_KEY_SUPER_L - -/// Set the parent window for embedding a view in an existing window -static inline PUGL_DEPRECATED_BY("puglSetParent") -PuglStatus -puglSetParentWindow(PuglView* view, PuglNativeView parent) -{ - return puglSetParent(view, parent); -} - -/// Return the parent window this view is embedded in, or null -static inline PUGL_DEPRECATED_BY("puglGetParent") -PuglNativeView -puglGetParentWindow(PuglView* view) -{ - return puglGetParent(view); -} - -/** - Request a redisplay for the entire view. - - This will cause an expose event to be dispatched later. If called from - within the event handler, the expose should arrive at the end of the current - event loop iteration, though this is not strictly guaranteed on all - platforms. If called elsewhere, an expose will be enqueued to be processed - in the next event loop iteration. -*/ -static inline PUGL_DEPRECATED_BY("puglObscureView") -PuglStatus -puglPostRedisplay(PuglView* view) -{ - return puglObscureView(view); -} - -/** - Request a redisplay of the given rectangle within the view. - - This has the same semantics as puglPostRedisplay(), but allows giving a - precise region for redrawing only a portion of the view. -*/ -static inline PUGL_DEPRECATED_BY("puglObscureRegion") -PuglStatus -puglPostRedisplayRect(PuglView* view, PuglRect rect) -{ - return puglObscureRegion(view, rect.x, rect.y, rect.width, rect.height); -} - -#endif // PUGL_DISABLE_DEPRECATED - -/** @} @} */ |