struct CCL::IUserInterface

Overview

UI management interface - Access singleton instance via System::GetGUI(). More…

#include <iuserinterface.h>

struct IUserInterface: public CCL::IUnknown
{
    // enums

    enum ActivityMode;
    enum ActivityType;
    enum ApplicationType;

    // structs

    struct InputStats;

    // methods

    virtual tbool CCL_API startup (
        ModuleRef module = nullptr,
        IApplicationProvider* appProvider = nullptr
    ) = 0;

    virtual void CCL_API shutdown () = 0;
    virtual ApplicationType CCL_API getApplicationType () const = 0;
    virtual tbool CCL_API isApplicationActive () const = 0;
    virtual tbool CCL_API activateApplication (tbool startupMode, ArgsRef args) = 0;
    virtual int CCL_API runEventLoop () = 0;
    virtual tbool CCL_API flushUpdates (tbool wait = true) = 0;
    virtual tbool CCL_API flushWindowEvents (IWindow* window) = 0;
    virtual void CCL_API quit (int exitCode = 0) = 0;
    virtual tbool CCL_API isQuitting (int* exitCode = nullptr) const = 0;
    virtual void CCL_API addHandler (IUIEventHandler* handler) = 0;
    virtual void CCL_API removeHandler (IUIEventHandler* handler) = 0;
    virtual double CCL_API getLastEventTime () = 0;
    virtual tresult CCL_API simulateEvent (const GUIEvent& event) = 0;
    virtual void CCL_API getInputStats (InputStats& stats) const = 0;
    virtual void CCL_API getKeyState (KeyState& keys) const = 0;
    virtual const KeyState&CCL_API getLastKeyState () const = 0;
    virtual tresult CCL_API detectKeyPressed (VirtualKey vkey, uchar character) const = 0;
    virtual Point&CCL_API getMousePosition (Point& pos) const = 0;
    virtual void CCL_API setMousePosition (const Point& pos) = 0;
    virtual double CCL_API getDoubleClickDelay () const = 0;
    virtual void CCL_API setWaitCursor (tbool state) = 0;
    virtual tbool CCL_API isWaitCursor () const = 0;
    virtual double CCL_API getLastUserActivity () const = 0;
    virtual void CCL_API updateUserActivity (int flags = 0) = 0;
    virtual tbool CCL_API isDragActive () const = 0;
    virtual ITimer*CCL_API createTimer (unsigned int period) const = 0;
    virtual void CCL_API addIdleTask (ITimerTask* task) = 0;
    virtual void CCL_API removeIdleTask (ITimerTask* task) = 0;

    virtual tresult CCL_API setActivityMode (
        ActivityMode mode,
        ActivityType type = ActivityType::kBasic,
        int64 timeout = 0
    ) = 0;

    virtual void CCL_API hideTooltip () = 0;
    virtual void CCL_API retriggerTooltip (IView* view) = 0;
    virtual OrientationType CCL_API getInterfaceOrientation () const = 0;
    virtual void CCL_API setInterfaceOrientation (OrientationType orientation) = 0;
    virtual tbool CCL_API isAllowedInterfaceOrientation (OrientationType orientation) const = 0;
    virtual void CCL_API setAllowedInterfaceOrientations (OrientationTypeFlags orientations) = 0;
    virtual tbool CCL_API getPlatformStyle (Variant& value, PlatformStyleID styleId) const = 0;
    IUserInterface bool isKeyPressed (VirtualKey vkey) const;
};

Inherited Members

public:
    // methods

    virtual tresult CCL_API queryInterface (UIDRef iid, void** ptr) = 0;
    virtual unsigned int CCL_API retain () = 0;
    virtual unsigned int CCL_API release () = 0;

Detailed Documentation

UI management interface - Access singleton instance via System::GetGUI().

Methods

virtual tbool CCL_API startup (
    ModuleRef module = nullptr,
    IApplicationProvider* appProvider = nullptr
) = 0

Startup GUI (allocates system resources, etc.).

Applications have to pass their module reference, plug-ins and services sharing CCL with the host application have to pass null.

virtual void CCL_API shutdown () = 0

Shutdown GUI.

virtual ApplicationType CCL_API getApplicationType () const = 0

Get application type (desktop or mobile), can be defined in cclgui.config.

virtual tbool CCL_API isApplicationActive () const = 0

Return application activation state.

virtual tbool CCL_API activateApplication (tbool startupMode, ArgsRef args) = 0

Give control to existing instance of same application or bring application into foreground.

virtual int CCL_API runEventLoop () = 0

Run event loop, returns ExitCode.

virtual tbool CCL_API flushUpdates (tbool wait = true) = 0

Handle graphical updates, timers, etc.

with optional wait.

virtual tbool CCL_API flushWindowEvents (IWindow* window) = 0

Handle mouse events for given window.

virtual void CCL_API quit (int exitCode = 0) = 0

Close all windows and quit event loop.

If event loop is not yet running, this call sets the exit code.

virtual tbool CCL_API isQuitting (int* exitCode = nullptr) const = 0

Check if event loop is about to quit.

virtual void CCL_API addHandler (IUIEventHandler* handler) = 0

Add global event handler.

virtual void CCL_API removeHandler (IUIEventHandler* handler) = 0

Remove global event handler.

virtual double CCL_API getLastEventTime () = 0

Return time of the last event processed (in seconds).

virtual tresult CCL_API simulateEvent (const GUIEvent& event) = 0

Simulate event on system level.

virtual void CCL_API getInputStats (InputStats& stats) const = 0

Get user input statistics (events since application start).

virtual void CCL_API getKeyState (KeyState& keys) const = 0

Get current keystate.

virtual const KeyState&CCL_API getLastKeyState () const = 0

Get most recent keystate as retrieved from event.

virtual tresult CCL_API detectKeyPressed (VirtualKey vkey, uchar character) const = 0

Detect current state of a key asynchronously.

Returns kResultTrue, kResultFalse or an error code.

virtual Point&CCL_API getMousePosition (Point& pos) const = 0

Get mouse position in screen coordinates.

virtual void CCL_API setMousePosition (const Point& pos) = 0

Set mouse position in screen coordinates.

virtual double CCL_API getDoubleClickDelay () const = 0

Get maximum time between the clicks of a double click in seconds.

virtual void CCL_API setWaitCursor (tbool state) = 0

Establish / remove the wait cursor.

virtual tbool CCL_API isWaitCursor () const = 0

Check if the wait cursor is active.

virtual double CCL_API getLastUserActivity () const = 0

Get time (in seconds) of the last user activity (mouse moves, commands, etc.).

virtual void CCL_API updateUserActivity (int flags = 0) = 0

Tell the system that user input happened other than mouse or keyboard.

virtual tbool CCL_API isDragActive () const = 0

Check if a drag & drop session is currently active.

virtual ITimer*CCL_API createTimer (unsigned int period) const = 0

Create timer with given period in milliseconds.

virtual void CCL_API addIdleTask (ITimerTask* task) = 0

Add task to idle timer.

virtual void CCL_API removeIdleTask (ITimerTask* task) = 0

Remove task from idle timer.

virtual tresult CCL_API setActivityMode (
    ActivityMode mode,
    ActivityType type = ActivityType::kBasic,
    int64 timeout = 0
) = 0

Set application activity mode.

Implementation depends on underlying operating system. The optional timeout (only supported for ActivityType::kBasic) schedules an automatic reset to the previous mode.

virtual void CCL_API hideTooltip () = 0

Hide the global tooltip popup.

virtual void CCL_API retriggerTooltip (IView* view) = 0

Show or update the tooltip for this view now.

virtual OrientationType CCL_API getInterfaceOrientation () const = 0

Current GUI orientation, landscape or portrait.

virtual void CCL_API setInterfaceOrientation (OrientationType orientation) = 0

Set current GUI orientation.

virtual tbool CCL_API isAllowedInterfaceOrientation (OrientationType orientation) const = 0

Check if a GUI orientation is allowed.

virtual void CCL_API setAllowedInterfaceOrientations (OrientationTypeFlags orientations) = 0

Contrain GUI orientation to landscape or portrait only.

virtual tbool CCL_API getPlatformStyle (Variant& value, PlatformStyleID styleId) const = 0

Get platform style property.

IUserInterface bool isKeyPressed (VirtualKey vkey) const

Shortcut to check if (virtual) key is currently pressed.