ワンクリックで
edit-scallop-shell-ui
Add a new UI element into Scallop Shell or change an existing one
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Add a new UI element into Scallop Shell or change an existing one
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | edit-scallop-shell-ui |
| description | Add a new UI element into Scallop Shell or change an existing one |
Use this skill when the user asks to:
auto state = std::make_shared<ScallopUI::AppState>(); initializes the AppState, which contains all touchable UI elements. To add a new selectable UI element, you must add a ftxui::Component with the UI element name to the AppState struct, another enum value in Pane, and then add a case for that enum to the function ftxui::Component getPaneComponent(Pane p). All of these additions / changes need to be made in include/appstate.hpp.In the .hpp, you will use #pragma once at the top and define the new UI component in the ScallopUI namespace. You will need to include <ftxui/component/component.hpp>, <ftxui/component/screen_interactive.hpp>, and <ftxui/dom/elements.hpp> in the .hpp.
Construct the desired UI element: ask the user for specifics whereever necessary. The basic color palette is Color::CornflowerBlue, Color::Magenta, and the default color. The blue and pink are accents. Do not include any other extra colors unless the user explicitly asks you to.
Remember that you will need to allow selection when the mouse is hovering over the UI element, and if there is no event, you MUST give control back to the AppState. This is to prevent conflict with other elements which require things like keyboard input. An example from the Disassembly Display is given of proper precaution.
// Hover-to-focus
if (e.is_mouse()) {
const auto& m = e.mouse();
const bool inRenderedArea = renderedArea.Contain(m.x, m.y);
const bool inDisasmPaneBySplit = state_ ? (m.x >= state_->disasmSplitSize) : true;
if (!(inRenderedArea && inDisasmPaneBySplit)) {
return false; // Don't steal mouse events from other panes.
}
// Only handle explicit checkbox clicks; otherwise let other panes react.
// Use Released to avoid toggling twice (Pressed + Released).
if (m.button == Mouse::Left && m.motion == Mouse::Released) {
for (int i = 0; i < instructionCount &&
i < static_cast<int>(checkboxBoxes.size()); ++i) {
if (!checkboxBoxes[i].Contain(m.x, m.y)) continue;
if (i >= static_cast<int>(rowAddresses.size())) return true;
const auto address = rowAddresses[static_cast<size_t>(i)];
const bool enabled = !breakpoints.contains(address);
setBreakpoint(address, enabled);
return true;
}
}
if (Focused() && m.button == ftxui::Mouse::WheelUp) {
if (currentTopRow > 0) currentTopRow--;
follow_tail = false;
return true;
}
if (Focused() && m.button == ftxui::Mouse::WheelDown) {
int maxTopRow = std::max(0, totalLines - min_top);
if (currentTopRow < maxTopRow) currentTopRow++;
if (currentTopRow >= maxTopRow) follow_tail = true; // user came back to bottom
return true;
}
return false;
}
return ComponentBase::OnEvent(e); // forward anything else
state->cliInput = ScallopUI::InputCli();
state->assembler = ScallopUI::AssemblerDisplay(arch);
auto right_tab_container = Container::Tab({state->registers, state->assembler}, &state->selectedRightTab);
becomes
auto right_tab_container = Container::Tab({state->registers, state->assembler, state->NEW_UI_ELEMENT}, &state->selectedRightTab);