Skip to content

Commit

Permalink
Merge pull request #122 from NuiCpp/feat/emplace_element
Browse files Browse the repository at this point in the history
Standalone Elements And Range Performance Rework
  • Loading branch information
5cript authored Aug 2, 2024
2 parents 7034674 + 8ceaabe commit d85e29e
Show file tree
Hide file tree
Showing 37 changed files with 3,765 additions and 635 deletions.
4 changes: 2 additions & 2 deletions cmake/dependencies/interval_tree.cmake
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
option(NUI_FETCH_INTERVAL_TREE "Fetch interval tree" ON)
set(NUI_INTERVAL_TREE_GIT_REPOSITORY "https://github.com/5cript/interval-tree.git" CACHE STRING "interval tree git repository")
set(NUI_INTERVAL_TREE_GIT_TAG "309b9c725191d4bb1d134f28a8a32ad2f68a8ffa" CACHE STRING "interval tree git tag")
set(NUI_INTERVAL_TREE_GIT_TAG "v2.2.4" CACHE STRING "interval tree git tag")

if(NUI_FETCH_INTERVAL_TREE)
include(FetchContent)
FetchContent_Declare(
interval-tree
GIT_REPOSITORY ${NUI_INTERVAL_TREE_GIT_REPOSITORY}
GIT_TAG ${NUI_INTERVAL_TREE_GIT_TAG}
GIT_TAG ${NUI_INTERVAL_TREE_GIT_TAG}
)

FetchContent_MakeAvailable(interval-tree)
Expand Down
9 changes: 9 additions & 0 deletions nui/include/nui/backend/filesystem/special_paths.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ namespace Nui
* %appdata% Linux: home. Windows: CSIDL_APPDATA
* %localappdata% Linux: home. Windows: CSIDL_APPDATA_LOCAL
* %temp% Linux: /tmp. Windows: ${USER}\AppData\Local\Temp
* %config_home% Linux: $XDG_CONFIG_HOME. Windows: CSIDL_APPDATA
* %config_home2% Linux: $XDG_CONFIG_HOME. Windows: CSIDL_MYDOCUMENTS
* %config_home3% Linux: $XDG_CONFIG_HOME. Windows: home
* %state_home% Linux: $XDG_CONFIG_HOME. Windows: CSIDL_APPDATA
* %state_home2% Linux: $XDG_CONFIG_HOME. Windows: CSIDL_MYDOCUMENTS
* %state_home3% Linux: $XDG_CONFIG_HOME. Windows: home
* %data_home% Linux: $XDG_DATA_HOME. Windows: CSIDL_APPDATA
* %data_home2% Linux: $XDG_DATA_HOME. Windows: CSIDL_MYDOCUMENTS
* %data_home3% Linux: $XDG_DATA_HOME. Windows: home
*
*
* @param path
Expand Down
11 changes: 10 additions & 1 deletion nui/include/nui/event_system/event_context.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <nui/frontend/event_system/event_registry.hpp>
#include <nui/event_system/event_registry.hpp>

#include <memory>

Expand Down Expand Up @@ -38,6 +38,7 @@ namespace Nui
{
public:
using EventIdType = EventRegistry::EventIdType;
constexpr static auto invalidEventId = EventRegistry::invalidEventId;

EventContext()
: impl_{std::make_shared<DefaultEventEngine>()}
Expand All @@ -56,6 +57,10 @@ namespace Nui
{
return impl_->eventRegistry().activateEvent(id);
}
auto activateAfterEffect(EventIdType id)
{
return impl_->eventRegistry().activateAfterEffect(id);
}
void executeActiveEventsImmediately()
{
impl_->eventRegistry().executeActiveEvents();
Expand All @@ -72,6 +77,10 @@ namespace Nui
{
impl_->eventRegistry().cleanInvalidEvents();
}
void removeAfterEffect(EventIdType id)
{
impl_->eventRegistry().removeAfterEffect(id);
}
void reset()
{
impl_->eventRegistry().clear();
Expand Down
23 changes: 23 additions & 0 deletions nui/include/nui/event_system/event_registry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,24 @@ namespace Nui
return registry_.select(id);
}

/**
* @brief Activate an after effect.
*
* @param id
* @return RegistryType::SelectionResult
*/
RegistryType::SelectionResult activateAfterEffect(EventIdType id)
{
return afterEffects_.select(id);
}

/**
* @brief After effects are used to cause something to happen after all other events have been processed.
* After effects are executed in indeterminate order.
*
* @param event
* @return EventIdType
*/
EventIdType registerAfterEffect(Event event)
{
return afterEffects_.append(std::move(event));
Expand Down Expand Up @@ -85,6 +103,11 @@ namespace Nui
registry_.erase(id);
}

void removeAfterEffect(EventIdType id)
{
afterEffects_.erase(id);
}

void clear()
{
registry_.clear();
Expand Down
Loading

0 comments on commit d85e29e

Please sign in to comment.