From 6ea5c9c02331d1d43e2f1870a3fbb6a34a7c3ba1 Mon Sep 17 00:00:00 2001 From: cnjinhao Date: Wed, 12 Jun 2024 01:01:26 +0800 Subject: [PATCH] fix compiler warnings --- include/nana/gui/widgets/treebox.hpp | 13 +++++-------- source/gui/programming_interface.cpp | 1 + source/gui/widgets/menu.cpp | 1 - source/gui/widgets/treebox.cpp | 9 ++++----- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/include/nana/gui/widgets/treebox.hpp b/include/nana/gui/widgets/treebox.hpp index 5b6c40bfa..8eb5fc345 100644 --- a/include/nana/gui/widgets/treebox.hpp +++ b/include/nana/gui/widgets/treebox.hpp @@ -110,21 +110,18 @@ namespace nana public: struct treebox_node_type { - treebox_node_type(); - treebox_node_type(std::string); + treebox_node_type(std::string = {}); treebox_node_type& operator=(const treebox_node_type&); ::std::string text; std::any value; - bool expanded; - bool hidden; - bool selected; - checkstate checked; + bool expanded{ false }; + bool hidden{ false }; + bool selected{ false }; + checkstate checked{ checkstate::unchecked }; ::std::string img_idstr; }; - struct pseudo_node_type{}; - using tree_cont_type = widgets::detail::tree_cont; using node_type = tree_cont_type::node_type; diff --git a/source/gui/programming_interface.cpp b/source/gui/programming_interface.cpp index 318addcd7..fe3167a31 100644 --- a/source/gui/programming_interface.cpp +++ b/source/gui/programming_interface.cpp @@ -1750,6 +1750,7 @@ namespace api return restrict::bedrock.vkeyboard().numeric(wd, padding); #else (void)wd; + (void)padding; return false; #endif } diff --git a/source/gui/widgets/menu.cpp b/source/gui/widgets/menu.cpp index cfa9f741e..1830fa5d2 100644 --- a/source/gui/widgets/menu.cpp +++ b/source/gui/widgets/menu.cpp @@ -735,7 +735,6 @@ namespace nana { nana::size size = _m_client_size(); - unsigned int two = platform_abstraction::dpi_scale(widget_->handle(), 2u); size.width += platform_abstraction::dpi_scale(widget_->handle(), detail_.border.x) * 2u; size.height += platform_abstraction::dpi_scale(widget_->handle(), detail_.border.y) * 2u; diff --git a/source/gui/widgets/treebox.cpp b/source/gui/widgets/treebox.cpp index 9a21ce1d1..72f1733eb 100644 --- a/source/gui/widgets/treebox.cpp +++ b/source/gui/widgets/treebox.cpp @@ -845,6 +845,8 @@ namespace nana bool set_selected_multi(node_type* node, bool crtl, bool shift) { + (void)shift; + if (crtl) { data.stop_drawing = true; @@ -956,7 +958,7 @@ namespace nana if(node_state.selected != node) { data.stop_drawing = true; - if (node_state.selected && single_selection || node == nullptr) + if ((node_state.selected && single_selection) || !node) { auto nodes_copy = node_state.nodes_selected; node_state.clear(); @@ -1911,12 +1913,9 @@ namespace nana //class trigger //struct treebox_node_type - trigger::treebox_node_type::treebox_node_type() - :expanded(false), hidden(false), checked(checkstate::unchecked), selected(false) - {} trigger::treebox_node_type::treebox_node_type(std::string text) - :text(std::move(text)), expanded(false), hidden(false), checked(checkstate::unchecked), selected(false) + :text(std::move(text)) {} trigger::treebox_node_type& trigger::treebox_node_type::operator=(const treebox_node_type& rhs)