mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 17:56:44 +02:00
Add identation
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
namespace winrt::PowerRenameUILib::implementation
|
||||
{
|
||||
ExplorerItem::ExplorerItem(int32_t id, hstring const& original, hstring const& renamed, int32_t type, uint32_t depth, bool checked) :
|
||||
m_id{ id }, m_idStr{ std::to_wstring(id) }, m_original{ original }, m_renamed{ renamed }, m_type{ type }, m_depth{ depth }, m_checked{ checked }
|
||||
m_id{ id }, m_idStr{ std::to_wstring(id) }, m_original{ original }, m_renamed{ renamed }, m_type{ type }, m_indentation{ depth * 20 }, m_checked{ checked }
|
||||
{
|
||||
if (m_type == static_cast<UINT>(ExplorerItemType::Folder))
|
||||
{
|
||||
@@ -51,8 +51,8 @@ namespace winrt::PowerRenameUILib::implementation
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t ExplorerItem::Depth() {
|
||||
return m_depth;
|
||||
double ExplorerItem::Indentation() {
|
||||
return m_indentation;
|
||||
}
|
||||
|
||||
int32_t ExplorerItem::Type()
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace winrt::PowerRenameUILib::implementation
|
||||
void Original(hstring const& value);
|
||||
hstring Renamed();
|
||||
void Renamed(hstring const& value);
|
||||
uint32_t Depth();
|
||||
double Indentation();
|
||||
int32_t Type();
|
||||
void Type(int32_t value);
|
||||
bool Checked();
|
||||
@@ -35,7 +35,7 @@ namespace winrt::PowerRenameUILib::implementation
|
||||
hstring m_idStr;
|
||||
winrt::hstring m_original;
|
||||
winrt::hstring m_renamed;
|
||||
uint32_t m_depth;
|
||||
uint32_t m_indentation;
|
||||
winrt::Windows::Foundation::Collections::IObservableVector<PowerRenameUILib::ExplorerItem> m_children;
|
||||
int32_t m_type;
|
||||
bool m_checked;
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace PowerRenameUILib
|
||||
String IdStr { get; };
|
||||
String Original;
|
||||
String Renamed;
|
||||
UInt32 Depth { get; };
|
||||
Double Indentation { get; };
|
||||
Int32 Type;
|
||||
Boolean Checked;
|
||||
Windows.Foundation.Collections.IObservableVector<ExplorerItem> Children;
|
||||
|
||||
@@ -206,10 +206,7 @@ namespace winrt::PowerRenameUILib::implementation
|
||||
|
||||
void MainWindow::ToggleAll(bool checked)
|
||||
{
|
||||
for (auto item : m_explorerItems)
|
||||
{
|
||||
item.Checked(checked);
|
||||
}
|
||||
std::for_each(m_explorerItems.begin(), m_explorerItems.end(), [checked](auto item) { item.Checked(checked); });
|
||||
}
|
||||
|
||||
void MainWindow::Checked_ids(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const&)
|
||||
@@ -217,7 +214,7 @@ namespace winrt::PowerRenameUILib::implementation
|
||||
auto checkbox = sender.as<Windows::UI::Xaml::Controls::CheckBox>();
|
||||
auto id = std::stoi(std::wstring{ checkbox.Name() });
|
||||
auto item = FindById(id);
|
||||
if (checkbox.IsChecked().GetBoolean() != item.Checked())
|
||||
if (item != NULL && checkbox.IsChecked().GetBoolean() != item.Checked())
|
||||
{
|
||||
m_uiUpdatesItem.Checked(checkbox.IsChecked().GetBoolean());
|
||||
m_uiUpdatesItem.ChangedExplorerItemId(id);
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Grid.Column="0">
|
||||
<StackPanel MinWidth="{x:Bind Indentation}"/>
|
||||
<CheckBox TabIndex="0"
|
||||
MinWidth="36"
|
||||
XYFocusKeyboardNavigation="Enabled"
|
||||
@@ -43,6 +44,7 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Grid.Column="0">
|
||||
<StackPanel MinWidth="{x:Bind Indentation}"/>
|
||||
<CheckBox TabIndex="0"
|
||||
IsTabStop="True"
|
||||
XYFocusKeyboardNavigation="Enabled"
|
||||
|
||||
Reference in New Issue
Block a user