IApplication



Describes minimum required functionality of application object. The main goal of IApplication instance is to control all windows and forms, store global helper interfaces allowing to access commonly used values like mouse pointer position or style list, store platform related functionality either directly or through interfaces(like IKeyboard).

You can find more information in comments below.

class IApplication
{
public:
    void(*OnIdle)(); // Idle event callback. Called each time when application do nothing

    virtual int getWindowCount() = 0; // Return count of registered windows in application
    virtual IWindow *getWindow(const int index) = 0; // Return window by index
    virtual IForm *getWindowForm(const int index) = 0; // Return form of window specified by index
    virtual IForm *getMainForm() = 0; // Return main form
    virtual IKeyboard *getKeyboard() = 0; // Return keyboard interface
    virtual IMouse *getMouse() = 0; // Return mouse interface
    virtual ITranslate *getTranslate() = 0; // Return translation interface
    virtual IStyles *getStyles() = 0; // Return styles interface
    virtual IScreen *getScreen() = 0; // Return screen interface
    virtual ISystem *getSystem() = 0; // Return system interface
    virtual IPicture *getPicture() = 0; // Return picture interface
    virtual IDialogs *getDialogs() = 0; // Return system dialogs interface
    virtual IFileSystem *getFileSystem() = 0; // Return interface for working with file system
    virtual const String &getApplicationFileName() const = 0; // Return application file name without path. Use to get *.exe file name
    virtual const String &getApplicationDirectory() const = 0; // Return application directory name with directory separator at the end. Use to get *.exe directory name    // Since 5.0.0
    virtual INetwork *getNetwork() = 0; // Return interfaces for working with network connections
    // Since 7.0.0
    virtual const String &getModuleFileName() const = 0; // Return module file name without path. Use to get *.dll(if application is created in dll) or *.exe file name
    virtual const String &getModuleDirectory() const = 0; // Return module directory name with directory separator at the end. Use to get *.dll(if application is created in dll) or *.exe directory name
    // Since 8.0.0
    virtual IEditor *getEditor() = 0; // Return editor. Return nullptr almost always. Return instance of editor when the code is running under Form Builder
    // Since 9.0.0
    virtual bool isUseDialogBoxes() = 0; // Return true if application should try to use forms in form of dialog boxes if possible. All forms from standard packages can do it. By default return false which means standard standalone forms will be used
    virtual bool isGlobal() = 0; //  Return whether this application object controls entire application. By default true, which means application be be closed automatically when last form/window is closed. False should be returned only if the application is actually a part of bigger one and is used to show/manage as build-in interface of that bigger application. The example where application returns FALSE is integration of Form Builder with Visual Studio

    virtual bool setMainForm(IForm *value) = 0; // Set main form

    virtual int Run() = 0; // Run application. Return exit code(use it to return from WinMain)
    virtual void ProcessMessages() = 0; // Receive and process all available for application messages from system
    virtual void RepaintAll() = 0; // Repaint all visible forms
    virtual IApplicationService *QueryService() = 0; // Return service
    // Since 5.0.0
    virtual IThread *CreateThread(const bool paused, IThreadListener *listener) = 0; // Create thread. Return nullptr if failed

    template<class TForm> void CreateForm(TForm **var); // Create a form
};

extern IApplication *Application; // Global variable filled when application instance is created or by GetPackage function in package. Only one instance should exists in entire application.
Namespace: nitisa
Include: Nitisa/Interfaces/IApplication.h