Skip to content

Commit

Permalink
Add XTD_KEEP_CLONED_CONTROLS option and set by default to false
Browse files Browse the repository at this point in the history
  • Loading branch information
gammasoft71 committed Apr 18, 2024
1 parent 47bda4c commit 813911b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ option(XTD_ENABLE_RUN_DEVELOPPER_REFERENCE_GUIDE "Add run Developper Reference G
option(XTD_ENABLE_RUN_REFERENCE_GUIDE "Add run Reference Guide generator command" ON)
option(XTD_INSTALL_EXAMPLES "Install examples" ON)
option(XTD_INSTALL_RESOURCES "Install resources" ON)
option(XTD_KEEP_CLONED_CONTROLS "Keep cloned controls by default (Only for debugging)" OFF)
option(XTD_SET_COMPILER_OPTION_WARNINGS_TO_ALL "Enable compiler option warnings to all" ON)
option(XTD_SET_COMPILER_OPTION_WARNINGS_AS_ERRORS "Enable compiler option warnings as errors" OFF)
option(XTD_USE_SYSTEM_CONTROLS "Use by default system controls instead standard controls" OFF)
option(XTD_USE_SYSTEM_CONTROLS "Use by default system controls instead standard controls (Only for debugging)" OFF)
add_definitions(-D__XTD_INSTALL_PATH__="${CMAKE_INSTALL_PREFIX}")
add_definitions(-D__XTD_LOCALE_PATH__="${CMAKE_INSTALL_PREFIX}/share/xtd/locale")
add_definitions(-D__XTD_REFERENCE_GUIDE_PATH__="${CMAKE_INSTALL_PREFIX}/share/xtd/reference_guide")
Expand All @@ -44,6 +45,11 @@ if (XTD_BUILD_WITH_CONTINUOUS_INTEGRATION_SYSTEM)
add_definitions(-D__XTD_BUILD_WITH_CONTINUOUS_INTEGRATION_SYSTEM__)
endif ()

if (XTD_KEEP_CLONED_CONTROLS)
message(WARNING "The XTD_KEEP_CLONED_CONTROLS option can only be used for debugging.\nUse xtd::application::keep_cloned_controls() instead.\nSee https://gammasoft71.github.io/xtd/reference_guides/latest/classxtd_1_1forms_1_1application.html#a28ad4db693e3bf228e5f0902fdf5882a for more information")
add_definitions(-D__ XTD_KEEP_CLONED_CONTROLS__)
endif ()

if (XTD_USE_SYSTEM_CONTROLS)
message(WARNING "The XTD_USE_SYSTEM_CONTROLS option can only be used for debugging.\nUse xtd::application::enable_system_controls() instead.\nSee https://gammasoft71.github.io/xtd/reference_guides/latest/classxtd_1_1forms_1_1application.html#a28ad4db693e3bf228e5f0902fdf5882a for more information")
add_definitions(-D__XTD_USE_SYSTEM_CONTROLS__)
Expand Down
4 changes: 2 additions & 2 deletions src/xtd.forms/include/xtd/forms/application.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,13 @@ namespace xtd {

/// @brief Gets a value indicating whether the xtd framework keep cloned control is enabled.
/// @return true if xtd framework keep cloned control is enabled; otherwise false.
/// @remarks By default the value is true.
/// @remarks By default the value is false.
static bool keep_cloned_controls() noexcept;

/// @brief Sets a value indicating whether the xtd framework keep cloned control is enabled.
/// @param value true if xtd framework keep cloned control is enabled; otherwise false.
/// @exception xtd::invalid_operation_exception If this method is called after xtd::forms::application::run.
/// @remarks By default the value is true.
/// @remarks By default the value is false.
static void keep_cloned_controls(bool value);

/// @brief Gets a value indicating whether light mode is enabled for the application.
Expand Down
4 changes: 4 additions & 0 deletions src/xtd.forms/src/xtd/forms/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ namespace {
xtd::forms::application_context application::internal_context_;
xtd::forms::application_context* application::context_ = &application::internal_context_;
bool application::button_images_ = true;
#if defined(__XTD_KEEP_CLONED_CONTROLS__)
bool application::keep_cloned_controls_ = true;
#else
bool application::keep_cloned_controls_ = false;
#endif
bool application::font_size_correction_ = true;
bool application::light_mode_ = false;
bool application::menu_images_ = true;
Expand Down

0 comments on commit 813911b

Please sign in to comment.