Editor API
UnigineEditor public API
Editor::EngineGuiWindow Class Reference

This class is used to represent a window widget to which an image can be rendered by the Engine with inputs handling by the Engine GUI. For example, to create a curve or a node graph editor of your own. By default EngineGuiWindow creates a Controls exclusive context to process mouse and keyboard events for this window exclusively, without sending them to the common Editor's Controls handling system. More...

#include <EngineGuiWindow.h>

Inheritance diagram for Editor::EngineGuiWindow:
Editor::RenderWindow

Public Member Functions

 EngineGuiWindow (QWidget *parent=nullptr)
 
 ~EngineGuiWindow () override
 
Unigine::GuiPtr getGui () const
 Returns the current Engine GUI for the window. You can use it to manage UI and user inputs. More...
 
const char * getControlsExclusiveContextId () const
 Returns the ID of the Controls exclusive context for the Engine GUI window. By default EngineGuiWindow creates a Controls exclusive context to process mouse and keyboard events for this window exclusively, without sending them to the common Editor's Controls handling system. More...
 
bool createControlsExclusiveContext (const char *context_id)
 Creates a new Controls exclusive context for the Engine GUI window. This context is used to process mouse and keyboard events for this window exclusively, without sending them to the common Editor's Controls handling system. More...
 
bool removeControlsExclusiveContext ()
 Removes the Controls exclusive context from the window. This context is used to process mouse and keyboard events for this window exclusively, without sending them to the common Editor's Controls handling system. More...
 
bool hasControlsExclusiveContext () const
 Returns a value indicating if the window has its own Controls exclusive context. This context is used to process mouse and keyboard events for this window exclusively, without sending them to the common Editor's Controls handling system. More...
 
- Public Member Functions inherited from Editor::RenderWindow
 RenderWindow (QWidget *parent=nullptr)
 
 ~RenderWindow () override
 
CallbackId addUpdateCallback (Unigine::CallbackBase *update_func)
 Adds a callback to be fired for the Render Window on Engine::update(). As an alternative you can inherit your class from the RenderWindow and override the onUpdate() method. More...
 
CallbackId addRenderCallback (Unigine::CallbackBase *render_func)
 Adds a callback to be fired for the Render Window on Engine::render(). As an alternative you can inherit your class from the RenderWindow and override the onRender() method. More...
 
CallbackId addSwapCallback (Unigine::CallbackBase *swap_func)
 Adds a callback to be fired for the Render Window on Engine::swap(). As an alternative you can inherit your class from the RenderWindow and override the onSwap() method. More...
 
CallbackId addFocusChangedCallback (Unigine::CallbackBase *focus_changed_func)
 Adds a callback to be fired when the focus of the Render Window changes. More...
 
CallbackId addFocusInChangedCallback (Unigine::CallbackBase *focus_in_func)
 Adds a callback to be fired when the focus of the Render Window becomes focused. As an alternative you can inherit your class from the RenderWindow and override the focusInEvent() method. More...
 
CallbackId addFocusOutChangedCallback (Unigine::CallbackBase *focus_out_func)
 Adds a callback to be fired when the Render Window loses focus. As an alternative you can inherit your class from the RenderWindow and override the focusOutEvent() method. More...
 
CallbackId addDragEnterCallback (Unigine::CallbackBase1< QDragEnterEvent * > *drag_enter_func)
 Adds a callback to be fired when something is dragged into the Render Window. The callback function receives a QDragEnterEvent instance. For more details please refer to Qt documentation. As an alternative you can inherit your class from the RenderWindow and override the dragEnterEvent() method. More...
 
CallbackId addDragMoveCallback (Unigine::CallbackBase1< QDragMoveEvent * > *drag_move_func)
 Adds a callback to be fired when something is dragged within the Render Window. The callback function receives a QDragMoveEvent instance. For more details please refer to Qt documentation. As an alternative you can inherit your class from the RenderWindow and override the dragMoveEvent() method. More...
 
CallbackId addDragLeaveCallback (Unigine::CallbackBase1< QDragLeaveEvent * > *drag_leave_func)
 Adds a callback to be fired when something is dragged out of the Render Window. The callback function receives a QDragLeaveEvent instance. For more details please refer to Qt documentation. As an alternative you can inherit your class from the RenderWindow and override the dragLeaveEvent() method. More...
 
CallbackId addDropCallback (Unigine::CallbackBase1< QDropEvent * > *drop_func)
 Adds a callback to be fired when the user drops something within the Render Window. The callback function receives a QDropEvent instance, that contains a proposed action, available from proposedAction(), for the widget to either accept or ignore. If the action can be handled by the widget, you should call the acceptProposedAction() function. Since the proposed action can be a combination of Qt::DropAction values, it may be useful to either select one of these values as a default action or ask the user to select their preferred action. If the proposed drop action is not suitable, perhaps because your custom widget does not support that action, you can replace it with any of the possible drop actions by calling setDropAction() with your preferred action. If you set a value that is not present in the bitwise OR combination of values returned by possibleActions(), the default copy action will be used. Once a replacement drop action has been set, call accept() instead of acceptProposedAction() to complete the drop operation. For more details please refer to Qt documentation. As an alternative you can inherit your class from the RenderWindow and override the dropEvent() method. More...
 
bool removeCallback (CallbackId callback_id)
 Removes a callback with the specified ID. More...
 
void clearCallbacks ()
 Removes all callbacks. More...
 
void setRenderingPolicy (RENDERING_POLICY rendering_policy)
 Sets rendering policy for the Render Window. This policy defines when the window should be rendered depending on its visibility and focus status. More...
 
RENDERING_POLICY getRenderingPolicy () const
 Returns the current rendering policy for the Render Window. This policy defines when the window should be rendered depending on its visibility and focus status (See RENDERING_POLICY). More...
 
QPaintEngine * paintEngine () const final override
 

Protected Member Functions

void onUpdate () override
 You can inherit your class from EngineGuiWindow and override this method to define your custom actions to be performed on Engine::update(). More...
 
void onRender () override
 You can inherit your class from EngineGuiWindow and override this method to define your custom actions to be performed on Engine::render(). More...
 
- Protected Member Functions inherited from Editor::RenderWindow
virtual void onSwap ()
 You can inherit your class from RenderWindow and override this method to define your custom actions to be performed on Engine::swap(). As an alternative to overriding this method you can use the Swap callback (addSwapCallback). More...
 
bool event (QEvent *event) override
 You can inherit your class from RenderWindow and override this method to define your custom actions to be performed on receiving various events (QEvent). As an alternative to overriding this method you can use the Update callback (addUpdateCallback). More...
 
void paintEvent (QPaintEvent *) final override
 
void resizeEvent (QResizeEvent *event) override
 You can inherit your class from RenderWindow and override this method to define actions to be performed on receiving a resize event (QResizeEvent). Resize events are sent to widgets that have been resized. For more details please refer to Qt documentation. As an alternative to overriding this method you can use the Update callback (addUpdateCallback). More...
 
void focusInEvent (QFocusEvent *event) override
 You can inherit your class from RenderWindow and override this method to define actions to be performed on getting focus, i.e., receiving the corresponding focus event (QFocusEvent). Focus events are sent to widgets when the keyboard input focus changes. Focus events occur due to mouse actions, key presses (such as Tab or Backtab), the window system, popup menus, keyboard shortcuts, or other application-specific reasons. The reason for a particular focus event is returned by reason() in the appropriate event handler. For more details please refer to Qt documentation. As an alternative to overriding this method you can use the FocusIn callback (addFocusInChangedCallback). More...
 
void focusOutEvent (QFocusEvent *event) override
 You can inherit your class from RenderWindow and override this method to define actions to be performed on losing focus, i.e., receiving the corresponding focus event (QFocusEvent). Focus events are sent to widgets when the keyboard input focus changes. Focus events occur due to mouse actions, key presses (such as Tab or Backtab), the window system, popup menus, keyboard shortcuts, or other application-specific reasons. The reason for a particular focus event is returned by reason() in the appropriate event handler. For more details please refer to Qt documentation. As an alternative to overriding this method you can use the FocusOut callback (addFocusOutChangedCallback). More...
 
void dragEnterEvent (QDragEnterEvent *event) override
 You can inherit your class from RenderWindow and override this method to define actions to be performed when a drag-and-drop action enters the Render Window (QDragEnterEvent). The drag enter event is always immediately followed by a drag move event. For more details please refer to Qt documentation. As an alternative to overriding this method you can use the addDragEnterCallback callback. More...
 
void dragMoveEvent (QDragMoveEvent *event) override
 You can inherit your class from RenderWindow and override this method to define actions to be performed when a drag-and-drop action is in progress (QDragMoveEvent). The drag move event always immediately follows a drag enter event. For more details please refer to Qt documentation. As an alternative to overriding this method you can use the addDragMoveCallback callback. More...
 
void dragLeaveEvent (QDragLeaveEvent *event) override
 You can inherit your class from RenderWindow and override this method to define actions to be performed when a drag-and-drop action leaves the Render Window (QDragLeaveEvent). For more details please refer to Qt documentation. As an alternative to overriding this method you can use the addDragLeaveCallback callback. More...
 
void dropEvent (QDropEvent *event) override
 You can inherit your class from RenderWindow and override this method to define actions to be performed when a drag-and-drop action is completed (QDropEvent). For more details please refer to Qt documentation. As an alternative to overriding this method you can use the addDropCallback callback. More...
 

Additional Inherited Members

- Public Types inherited from Editor::RenderWindow
enum  RENDERING_POLICY { RENDERING_POLICY_WINDOW_VISIBLE = 0, RENDERING_POLICY_WINDOW_VISIBLE_AND_FOCUSED, RENDERING_POLICY_ALWAYS }
 Rendering policy for the window that defines when it should be rendered depending on its visibility and focus status. More...
 
using CallbackId = Callback *
 
- Signals inherited from Editor::RenderWindow
void focusChanged ()
 This signal is emitted when the focus has changed because the user pressed the tab-key, clicked into a widget or changed the active window. More...
 

Detailed Description

This class is used to represent a window widget to which an image can be rendered by the Engine with inputs handling by the Engine GUI. For example, to create a curve or a node graph editor of your own. By default EngineGuiWindow creates a Controls exclusive context to process mouse and keyboard events for this window exclusively, without sending them to the common Editor's Controls handling system.

Constructor & Destructor Documentation

◆ EngineGuiWindow()

Editor::EngineGuiWindow::EngineGuiWindow ( QWidget *  parent = nullptr)
explicit

◆ ~EngineGuiWindow()

Editor::EngineGuiWindow::~EngineGuiWindow ( )
override

Member Function Documentation

◆ createControlsExclusiveContext()

bool Editor::EngineGuiWindow::createControlsExclusiveContext ( const char *  context_id)

Creates a new Controls exclusive context for the Engine GUI window. This context is used to process mouse and keyboard events for this window exclusively, without sending them to the common Editor's Controls handling system.

Returns
true if the context is created successfully; otherwise, false.

◆ getControlsExclusiveContextId()

const char* Editor::EngineGuiWindow::getControlsExclusiveContextId ( ) const

Returns the ID of the Controls exclusive context for the Engine GUI window. By default EngineGuiWindow creates a Controls exclusive context to process mouse and keyboard events for this window exclusively, without sending them to the common Editor's Controls handling system.

◆ getGui()

Unigine::GuiPtr Editor::EngineGuiWindow::getGui ( ) const

Returns the current Engine GUI for the window. You can use it to manage UI and user inputs.

◆ hasControlsExclusiveContext()

bool Editor::EngineGuiWindow::hasControlsExclusiveContext ( ) const

Returns a value indicating if the window has its own Controls exclusive context. This context is used to process mouse and keyboard events for this window exclusively, without sending them to the common Editor's Controls handling system.

Returns
true if the window has its own Controls exclusive context; otherwise, false.

◆ onRender()

void Editor::EngineGuiWindow::onRender ( )
overrideprotectedvirtual

You can inherit your class from EngineGuiWindow and override this method to define your custom actions to be performed on Engine::render().

Reimplemented from Editor::RenderWindow.

◆ onUpdate()

void Editor::EngineGuiWindow::onUpdate ( )
overrideprotectedvirtual

You can inherit your class from EngineGuiWindow and override this method to define your custom actions to be performed on Engine::update().

Reimplemented from Editor::RenderWindow.

◆ removeControlsExclusiveContext()

bool Editor::EngineGuiWindow::removeControlsExclusiveContext ( )

Removes the Controls exclusive context from the window. This context is used to process mouse and keyboard events for this window exclusively, without sending them to the common Editor's Controls handling system.

Returns
true if the context is removed successfully; otherwise, false.