A native macOS / windows / Linux database IDE built with Swift and AppKit. Connect to PostgreSQL, MySQL, SQLite, and Redis from a single app with a fast, keyboard-driven interface.
C++
feat(windows): grid context menu + regroup top-right toolbar
DangHuynhc44bb26bf831
diff --git a/windows/Gridex/DataGridView.cpp b/windows/Gridex/DataGridView.cppindex 42d2985..ba2ccd0 100644--- a/windows/Gridex/DataGridView.cpp+++ b/windows/Gridex/DataGridView.cpp@@ -58,6 +58,47 @@ namespace winrt::Gridex::implementation{Grid_KeyDown(sender, e);});++ // Right-click context menu. Host wires OnRefreshRequested /+ // OnDeleteRequested in WorkspacePage; unset = no-op. Delete is+ // disabled for read-only grids (e.g. Redis projections) and when+ // no row is selected.+ {+ muxc::MenuFlyout contextMenu;++ muxc::MenuFlyoutItem refreshItem;+ refreshItem.Text(L"Refresh");+ muxc::FontIcon refreshIcon;+ refreshIcon.Glyph(L"\xE72C");+ refreshItem.Icon(refreshIcon);+ refreshItem.Click([this](auto&&, auto&&)+ {+ if (OnRefreshRequested) OnRefreshRequested();+ });+ contextMenu.Items().Append(refreshItem);++ contextMenu.Items().Append(muxc::MenuFlyoutSeparator{});++ muxc::MenuFlyoutItem deleteItem;+ deleteItem.Text(L"Delete Row");+ muxc::FontIcon deleteIcon;+ deleteIcon.Glyph(L"\xE74D");+ deleteItem.Icon(deleteIcon);+ deleteItem.Click([this](auto&&, auto&&)+ {+ if (OnDeleteRequested) OnDeleteRequested();+ });+ contextMenu.Items().Append(deleteItem);++ // Gate Delete on read-only mode + row selection at open time so+ // the menu reflects the grid's actual state each right-click.+ contextMenu.Opening([this, deleteItem](auto&&, auto&&)+ {+ deleteItem.IsEnabled(!readOnly_ && selectedRow_ >= 0);+ });++ this->ContextFlyout(contextMenu);+ }this->Loaded([this](winrt::Windows::Foundation::IInspectable const&, mux::RoutedEventArgs const&){DataScroller().ViewChanged(diff --git a/windows/Gridex/DataGridView.h b/windows/Gridex/DataGridView.hindex 20dad22..4f26a4a 100644--- a/windows/Gridex/DataGridView.h+++ b/windows/Gridex/DataGridView.h@@ -33,6 +33,10 @@ namespace winrt::Gridex::implementation// deleted (pending commit). Host routes this to DeleteSelectedRow.std::function<void()> OnDeleteRequested;+ // Callback when user picks "Refresh" from the grid context menu —+ // host re-runs the current tab's query to pull fresh rows.+ std::function<void()> OnRefreshRequested;+// Get selected row data for copyconst DBModels::TableRow* GetSelectedRow() const;diff --git a/windows/Gridex/WorkspacePage.cpp b/windows/Gridex/WorkspacePage.cppindex 901eed7..db8696a 100644--- a/windows/Gridex/WorkspacePage.cpp+++ b/windows/Gridex/WorkspacePage.cpp@@ -173,6 +173,12 @@ namespace winrt::Gridex::implementationDeleteSelectedRow();};+ // Right-click → Refresh: re-run the active tab's query.+ DataGrid().as<DataGridView>()->OnRefreshRequested = [this]()+ {+ ReloadCurrentTable();+ };+// Wire structure view ALTER applyStructure().as<StructureView>()->OnApplyAlter = [this](const std::vector<std::wstring>& sqls){@@ -760,18 +766,9 @@ namespace winrt::Gridex::implementationSidebarToggleBtn().Click([this](winrt::Windows::Foundation::IInspectable const&, mux::RoutedEventArgs const&){ ToggleSidebar_Click({}, {}); });- DeleteBtn().Click([this](winrt::Windows::Foundation::IInspectable const&, mux::RoutedEventArgs const&)- { DeleteSelectedRow(); });-- CommitToolbarBtn().Click([this](winrt::Windows::Foundation::IInspectable const&, mux::RoutedEventArgs const&)- { CommitChanges(); });-DetailsToggleBtn().Click([this](winrt::Windows::Foundation::IInspectable const&, mux::RoutedEventArgs const&){ ToggleDetails_Click({}, {}); });- AiToggleBtn().Click([this](winrt::Windows::Foundation::IInspectable const&, mux::RoutedEventArgs const&)- { ToggleAI_Click({}, {}); });-DumpBtn().Click([this](winrt::Windows::Foundation::IInspectable const&, mux::RoutedEventArgs const&){ DumpDatabaseAsync(); });diff --git a/windows/Gridex/WorkspacePage.xaml b/windows/Gridex/WorkspacePage.xamlindex edd09b0..caa60d6 100644--- a/windows/Gridex/WorkspacePage.xaml+++ b/windows/Gridex/WorkspacePage.xaml@@ -61,8 +61,9 @@Foreground="{ThemeResource TextFillColorTertiaryBrush}" /></StackPanel>- <!-- Right: Delete + Commit | Details + AI -->+ <!-- Right toolbar, grouped: [Backup] | [Schema] | [App] --><StackPanel Grid.Column="3" Orientation="Horizontal" Spacing="4">+ <!-- Group 1: Backup / Restore --><Button x:Name="DumpBtn" Width="32" Height="32" Padding="0"Background="Transparent" BorderThickness="0"ToolTipService.ToolTip="Dump Database">@@ -73,33 +74,26 @@ToolTipService.ToolTip="Restore Database"><FontIcon Glyph="" FontSize="14" /></Button>++ <Border Width="1" Height="20" Margin="4,0"+ Background="{ThemeResource DividerStrokeColorDefaultBrush}" />++ <!-- Group 2: Schema visualization --><Button x:Name="ERDiagramBtn" Width="32" Height="32" Padding="0"Background="Transparent" BorderThickness="0"ToolTipService.ToolTip="ER Diagram (current schema)"><FontIcon Glyph="" FontSize="14" /></Button>- <Button x:Name="DeleteBtn" Width="32" Height="32" Padding="0"- Background="Transparent" BorderThickness="0"- ToolTipService.ToolTip="Delete Selected Rows">- <FontIcon Glyph="" FontSize="14" />- </Button>- <Button x:Name="CommitToolbarBtn" Width="32" Height="32" Padding="0"- Background="Transparent" BorderThickness="0"- ToolTipService.ToolTip="Commit Changes">- <FontIcon Glyph="" FontSize="14" />- </Button>+<Border Width="1" Height="20" Margin="4,0"Background="{ThemeResource DividerStrokeColorDefaultBrush}" />++ <!-- Group 3: UI toggles + app settings --><Button x:Name="DetailsToggleBtn" Width="32" Height="32" Padding="0"Background="Transparent" BorderThickness="0"ToolTipService.ToolTip="Toggle Details Panel"><FontIcon Glyph="" FontSize="14" /></Button>- <Button x:Name="AiToggleBtn" Width="32" Height="32" Padding="0"- Background="Transparent" BorderThickness="0"- ToolTipService.ToolTip="Toggle AI Assistant">- <FontIcon Glyph="" FontSize="14" />- </Button><Button x:Name="SettingsBtn" Width="32" Height="32" Padding="0"Background="Transparent" BorderThickness="0"ToolTipService.ToolTip="Settings (Ctrl+Shift+P)">