Files
rrr.v2/src/rrr/content/content.hpp
2023-03-13 13:29:59 +03:00

55 lines
1.6 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
#include <vector>
#include "navigation/navigation.hpp"
#include "history/history.hpp"
#include "preview/preview.hpp"
namespace rrr
{
enum class TYPE_WIN
{
HISTORY, NAVIGATION, PREVIEW
};
using files = std::vector<file>;
// Именно этот класс работает с данными
// вычисляет для каждых данных позиции курсора. какие нужно сейчас отрисовать
// и т.п. Отсюда забираются данные для вывода н экран
class content
{
public:
content() = default;
~content() = default;
public:
void set_pwd(std::filesystem::path);
void fill();
files* get(TYPE_WIN);
int get_cursor_position(TYPE_WIN);
void increment_position(int);
void navigation_right();
void navigation_left();
private:
content_type::navigation nav;
content_type::history his;
content_type::preview prev;
// текущая виртуальная дирректория расположения пользователя,
// она может отличается от его расположения в терминале по факту
std::filesystem::path PWD;
// чтобы не устанавливалась стрелка изначально
// полезно при первом открытии окна prev
int cursor_position = 0;
private:
int get_history_cursor_position() const;
int get_preview_cursor_position();
void check_cursor_position();
};
}