View

PUGL_NUM_POSITION_HINTS

2U

The number of PuglPositionHint values.

PUGL_NUM_SIZE_HINTS

7U

The number of PuglSizeHint values.

PUGL_NUM_VIEW_HINTS

21U

The number of PuglViewHint values.

typedef PuglStatus (*PuglEventFunc)(PuglView *view, const PuglEvent *event)

A function called when an event occurs.

typedef uintptr_t PuglNativeView

A native view handle.

A “native view” is a system-specific handle for a view (or “window”). A PuglView is itself a native view, which may be embedded in another. Like the native world handle, this serves as a common denominator between this and other APIs.

X11: This is a Window.

MacOS: This is a pointer to an NSView*.

Windows: This is a HWND.

typedef struct PuglViewImpl PuglView

A drawable region that receives events.

A view can be thought of as a window, but doesn’t necessarily correspond to a top-level window in a desktop environment. For example, a view can be embedded in another, or represent a simple embedded system with no concept of windows at all.

enum PuglPositionHint

A hint for configuring or constraining the position of a view.

The system will attempt to make the view adhere to these, but they are suggestions, not hard constraints. Applications should handle any view position gracefully.

An unset position has INT16_MIN (-32768) for both x and y. In practice, set positions should be between -16000 and 16000 for portability. Usually, the origin is the top left of the display, although negative coordinates are possible, particularly on multi-display systems.

enumerator PUGL_DEFAULT_POSITION

Default position.

This is used as the initial position if no other position is specified. It isn’t necessary to set a default position (unlike the default size, which is required). If not even a default position is set, then the window will be placed somewhere reasonable according to platform conventions. Applications must not make assumptions about the initial position, which is implementation-defined, platform-specific, and for embedded views, may become invalid if the parent’s size is adjusted.

enumerator PUGL_CURRENT_POSITION

Current position.

This reflects the current position of the view, which may be different from the default position if the view has been moved by the user, window manager, or for any other reason. It overrides the default position.

enum PuglSizeHint

A hint for configuring/constraining the size of a view.

The system will attempt to make the view adhere to these, but they are suggestions, not hard constraints. Applications should handle any view size gracefully.

enumerator PUGL_DEFAULT_SIZE

Default size.

This is used as the size during window creation as a default, if no other size is specified.

enumerator PUGL_CURRENT_SIZE

Current size.

This reflects the current size of the view, which may be different from the default size if the view is resizable. It overrides the default size.

enumerator PUGL_MIN_SIZE

Minimum size.

If set, the view should be at least this large.

enumerator PUGL_MAX_SIZE

Maximum size.

If set, the view should be at most this large.

enumerator PUGL_FIXED_ASPECT

Fixed aspect ratio.

If set, the view should have this aspect ratio. Mutually exclusive with PuglSizeHint.PUGL_MIN_ASPECT and PuglSizeHint.PUGL_MAX_ASPECT.

enumerator PUGL_MIN_ASPECT

Minimum aspect ratio.

If set, the view should have an aspect ratio no lower than this. Mutually exclusive with PuglSizeHint.PUGL_FIXED_ASPECT.

enumerator PUGL_MAX_ASPECT

Maximum aspect ratio.

If set, the view should have an aspect ratio no higher than this. Mutually exclusive with PuglSizeHint.PUGL_FIXED_ASPECT.

enum PuglViewHint

An integer hint for configuring a view.

enumerator PUGL_CONTEXT_API

OpenGL render API (GL/GLES)

enumerator PUGL_CONTEXT_VERSION_MAJOR

OpenGL context major version.

enumerator PUGL_CONTEXT_VERSION_MINOR

OpenGL context minor version.

enumerator PUGL_CONTEXT_PROFILE

OpenGL context profile (core/compatibility)

enumerator PUGL_CONTEXT_DEBUG

OpenGL context debugging enabled.

enumerator PUGL_RED_BITS

Number of bits for red channel.

enumerator PUGL_GREEN_BITS

Number of bits for green channel.

enumerator PUGL_BLUE_BITS

Number of bits for blue channel.

enumerator PUGL_ALPHA_BITS

Number of bits for alpha channel.

enumerator PUGL_DEPTH_BITS

Number of bits for depth buffer.

enumerator PUGL_STENCIL_BITS

Number of bits for stencil buffer.

enumerator PUGL_SAMPLE_BUFFERS

Number of sample buffers (AA)

enumerator PUGL_SAMPLES

Number of samples per pixel (AA)

enumerator PUGL_DOUBLE_BUFFER

True if double buffering should be used.

enumerator PUGL_SWAP_INTERVAL

Number of frames between buffer swaps.

enumerator PUGL_RESIZABLE

True if view should be resizable.

enumerator PUGL_IGNORE_KEY_REPEAT

True if key repeat events are ignored.

enumerator PUGL_REFRESH_RATE

Refresh rate in Hz.

enumerator PUGL_VIEW_TYPE

View type (a PuglViewType)

enumerator PUGL_DARK_FRAME

True if window frame should be dark.

enumerator PUGL_ACCEPT_DROP

True if view accepts dropped data.

enum PuglViewHintValue

A special view hint value.

enumerator PUGL_DONT_CARE

Generic trinary: unset.

enumerator PUGL_FALSE

Generic trinary: false.

enumerator PUGL_TRUE

Generic trinary: true.

enumerator PUGL_OPENGL_API

For PuglViewHint.PUGL_CONTEXT_API.

enumerator PUGL_OPENGL_ES_API

For PuglViewHint.PUGL_CONTEXT_API.

enumerator PUGL_OPENGL_CORE_PROFILE

For PuglViewHint.PUGL_CONTEXT_PROFILE.

enumerator PUGL_OPENGL_COMPATIBILITY_PROFILE

For PuglViewHint.PUGL_CONTEXT_PROFILE.

enum PuglViewType

View type.

enumerator PUGL_VIEW_TYPE_NORMAL

A normal top-level window.

enumerator PUGL_VIEW_TYPE_UTILITY

A utility window like a palette or toolbox.

enumerator PUGL_VIEW_TYPE_DIALOG

A dialog window.