graphs/include/selection.h

60 lines
1.8 KiB
C
Raw Normal View History

2024-07-29 14:01:07 -04:00
#pragma once
/*
* Copyright (C) 2024 Brett Terpstra
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef GRAPHS_SELECTION_H
#define GRAPHS_SELECTION_H
#include <config.h>
class selector_t
{
public:
2024-07-29 22:05:18 -04:00
explicit selector_t(graph_t& graph): graph(graph)
{}
2024-07-29 14:01:07 -04:00
// called inside the info panel block, used for adding more information
2024-07-29 22:05:18 -04:00
void draw_gui(blt::i32 width, blt::i32 height);
2024-07-29 14:01:07 -04:00
// called once per frame, for rendering animations
2024-07-29 22:05:18 -04:00
void render(blt::i32 width, blt::i32 height);
2024-07-29 14:01:07 -04:00
// called once per frame assuming imgui doesn't want the mouse
2024-07-29 22:05:18 -04:00
void process_mouse(blt::i32 width, blt::i32 height);
void process_keyboard(blt::i32 width, blt::i32 height);
2024-07-29 14:01:07 -04:00
private:
void set_primary_selection(blt::i64 n);
2024-07-29 22:05:18 -04:00
2024-07-29 14:01:07 -04:00
void set_drag_selection(blt::i64 n);
2024-07-29 22:05:18 -04:00
2024-07-29 14:01:07 -04:00
void set_secondary_selection(blt::i64 n);
2024-07-29 22:05:18 -04:00
void create_placement_node(const blt::vec2& pos);
void destroy_node(blt::i64 node);
2024-07-29 14:01:07 -04:00
private:
blt::i64 drag_selection = -1;
blt::i64 primary_selection = -1;
blt::i64 secondary_selection = -1;
2024-07-29 22:05:18 -04:00
bool placement = false;
graph_t& graph;
2024-07-29 14:01:07 -04:00
};
#endif //GRAPHS_SELECTION_H