Reformat + fix pending selection.

This commit is contained in:
ArthurSonzogni
2024-08-31 15:39:42 +02:00
parent eef0c3d677
commit b352e13253
4 changed files with 79 additions and 51 deletions

View File

@@ -27,7 +27,6 @@ using Component = std::shared_ptr<ComponentBase>;
class ScreenInteractivePrivate;
typedef struct {
uint16_t startx = 0;
uint16_t endx = 0;
uint16_t starty = 0;
@@ -76,7 +75,7 @@ class ScreenInteractive : public Screen {
void ForceHandleCtrlC(bool force);
void ForceHandleCtrlZ(bool force);
std::string getSelection(void);
std::string GetSelection();
private:
void ExitNow();
@@ -92,8 +91,8 @@ class ScreenInteractive : public Screen {
void RunOnceBlocking(Component component);
void HandleTask(Component component, Task& task);
bool selectableCatchEvent(Event event);
void refreshSelection(void);
bool HandleSelection(Event event);
void RefreshSelection();
void Draw(Component component);
void ResetCursorPosition();
@@ -138,8 +137,10 @@ class ScreenInteractive : public Screen {
bool force_handle_ctrl_c_ = true;
bool force_handle_ctrl_z_ = true;
Region selectedRegion;
std::string selectedText;
bool selection_enabled = false;
CapturedMouse selection_pending;
Region selection_region;
std::string selection_text;
// The style of the cursor to restore on exit.
int cursor_reset_shape_ = 1;

View File

@@ -52,6 +52,12 @@ class Node {
};
virtual void Check(Status* status);
// Selection.
// Propagated from Parents to Children.
virtual void Select(Box selected_area) {
// TODO: Implement this.
}
protected:
Elements children_;
Requirement requirement_;