AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
IPlatformAbstraction Class Referenceabstract

Platform Abstraction Layer. More...

#include <AUI/Platform/linux/IPlatformAbstraction.h>

Public Member Functions#

virtual void init ()=0
 
virtual _< ACursor::CustomcreateCustomCursor (AImageView image)=0
 
virtual void applyNativeCursor (const ACursor &cursor, AWindow *pWindow)=0
 
virtual void copyToClipboard (const AString &text)=0
 
virtual AString pasteFromClipboard ()=0
 
virtual glm::ivec2 desktopGetMousePosition ()=0
 
virtual void desktopSetMousePosition (glm::ivec2 pos)=0
 
virtual float platformGetDpiRatio ()=0
 
virtual AInput::Key inputFromNative (int k)=0
 
virtual int inputToNative (AInput::Key key)=0
 
virtual bool inputIsKeyDown (AInput::Key k)=0
 
virtual void windowSetStyle (AWindow &window, WindowStyle ws)=0
 
virtual float windowFetchDpiFromSystem (AWindow &window)=0
 
virtual void windowRestore (AWindow &window)=0
 
virtual void windowMinimize (AWindow &window)=0
 
virtual bool windowIsMinimized (AWindow &window) const =0
 
virtual bool windowIsMaximized (AWindow &window) const =0
 
virtual void windowMaximize (AWindow &window)=0
 
virtual glm::ivec2 windowGetPosition (AWindow &window) const =0
 
virtual void windowFlagRedraw (AWindow &window)=0
 
virtual void windowShow (AWindow &window)=0
 
virtual void windowSetSize (AWindow &window, glm::ivec2 size)=0
 
virtual void windowSetGeometry (AWindow &window, int x, int y, int width, int height)=0
 
virtual void windowSetIcon (AWindow &window, const AImage &image)=0
 
virtual void windowHide (AWindow &window)=0
 
virtual void windowManagerNotifyProcessMessages ()=0
 
virtual void windowManagerLoop ()=0
 
virtual void windowBlockUserInput (AWindow &window, bool blockUserInput)=0
 
virtual void windowAllowDragNDrop (AWindow &window)=0
 
virtual void windowShowTouchscreenKeyboardImpl (AWindow &window)=0
 
virtual void windowHideTouchscreenKeyboardImpl (AWindow &window)=0
 
virtual void windowMoveToCenter (AWindow &window)=0
 
virtual void windowQuit (AWindow &window)=0
 
virtual void windowAnnounceMinMaxSize (AWindow &window)=0
 
virtual void windowManagerInitNativeWindow (const IRenderingContext::Init &init)=0
 
virtual float windowGetDpiRatio (AWindow &window)
 
virtual AMessageBox::ResultButton messageBoxShow (AWindow *parent, const AString &title, const AString &message, AMessageBox::Icon icon, AMessageBox::Button b)=0
 

Static Public Member Functions#

static IPlatformAbstractioncurrent ()
 
static void setCurrentWindow (AWindowBase *window)
 
static bool & redrawFlag (AWindow &window)
 
static AWindowNativePtr & nativeHandle (AWindow &window)
 
static AWindow *& parentWindow (AWindow &window)
 
static bool & wasMaximized (AWindow &window)
 

Detailed Description#

Runtime layer for switching between multiple displaying options (i.e, Linux = X11 or Wayland).

This is a direct equivalent of Qt's Platform Abstraction.

Linux-specific
This API is available on Linux (-based desktop OSes) only. Platform Abstraction Layer is used to choose appropriate core platform UI APIs in runtime.

AUI framework is designed to be flexible and adaptable to different desktop environments and UI toolkits. This is achieved through a platform abstraction layer that isolates the core application logic from the specifics of the underlying UI implementation.

Supported UI Backends#

Currently, the framework supports the following UI backends:

  • Adwaita: modern UI toolkit based on GTK, commonly used in GNOME.
  • GTK: widely available widget toolkit.
  • X11: legacy windowing system (used as a fallback).

API Selection and Prioritization#

The framework determines the preferred UI backend based on an initializationOrder defined within APlatformAbstractionOptions. The order prioritizes backends, attempting to initialize them sequentially.

Dynamic Loading#

To minimize dependencies and enhance compatibility, the framework utilizes dynamic loading for certain UI backends. For example, the Adwaita backend loads the libadwaita-1.so library at runtime using dlopen.

The generate_dl_subs function from aui.toolbox is used to automatically generate dlsym-based function implementations based on a list of signatures (*.sigs) that need to be exported from the dynamically loaded libraries. This allows the framework to call functions within the loaded library without requiring explicit linking.