PowerToys/src/modules/powerrename/PowerRenameUILib/UIUpdates.cpp
Stefan Markovic 5cfbd72fa8
[PowerRename] Fluent UX (#13678)
* PowerRename new UI

* Add scrollviewer

* Don't deploy PowerRenameUI_new

* Visual updates

* Visual updates

* Updates

* Update Resources.resw

* Added docs button

* Update MainWindow.xaml

* Wire Docs button

* RegEx -> regular expressions

* Update Show only renamed list on search/replace text changed

* Update Show only renamed list on search/replace text changed - proper fix
Set searchTerm to NULL when cleared - fix Show only renamed files on clear searchTerm

* Files/folders input error handling

* Fix renaming with keeping UI window opened

After renaming folder, all of it's children need path update.
Without path update, further renaming of children items would
fail.

* Update only children, not all items with greater depth

* Fix dictionary false positives

* Remove .NET dep

* Rename PowerRenameUI_new to PowerRenameUILib
Rename executable PowerRenameUIHost to PowerRename

Co-authored-by: Laute <Niels.Laute@philips.com>
2021-10-25 14:40:19 +01:00

91 lines
2.2 KiB
C++

#include "pch.h"
#include "UIUpdates.h"
#include "UIUpdates.g.cpp"
namespace winrt::PowerRenameUILib::implementation
{
UIUpdates::UIUpdates() :
m_showAll{ true }, m_changedItemId{ -1 }, m_checked{ true }, m_closeUIWindow{ false }, m_buttonRenameEnabled{ false }
{
}
bool UIUpdates::ShowAll()
{
return m_showAll;
}
void UIUpdates::ShowAll(bool value)
{
if (m_showAll != value)
{
m_showAll = value;
m_propertyChanged(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"ShowAll" });
}
}
int32_t UIUpdates::ChangedExplorerItemId()
{
return m_changedItemId;
}
void UIUpdates::ChangedExplorerItemId(int32_t value)
{
m_changedItemId = value;
m_propertyChanged(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"ChangedItemId" });
}
bool UIUpdates::Checked()
{
return m_checked;
}
void UIUpdates::Checked(bool value)
{
m_checked = value;
}
winrt::event_token UIUpdates::PropertyChanged(winrt::Windows::UI::Xaml::Data::PropertyChangedEventHandler const& handler)
{
return m_propertyChanged.add(handler);
}
void UIUpdates::PropertyChanged(winrt::event_token const& token) noexcept
{
m_propertyChanged.remove(token);
}
void UIUpdates::ToggleAll()
{
m_propertyChanged(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"ToggleAll" });
}
void UIUpdates::Rename()
{
m_propertyChanged(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"Rename" });
}
bool UIUpdates::CloseUIWindow()
{
return m_closeUIWindow;
}
void UIUpdates::CloseUIWindow(bool closeUIWindow)
{
m_closeUIWindow = closeUIWindow;
}
bool UIUpdates::ButtonRenameEnabled()
{
return m_buttonRenameEnabled;
}
void UIUpdates::ButtonRenameEnabled(bool value)
{
if (m_buttonRenameEnabled != value)
{
m_buttonRenameEnabled = value;
m_propertyChanged(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"ButtonRenameEnabled" });
}
}
}