midday-commander
Loading...
Searching...
No Matches
Interface.h
Go to the documentation of this file.
1//
2// Created by Vojtěch Pašek on 11.05.2023.
3//
4
5#ifndef MIDDAY_COMMANDER_INTERFACE_H
6#define MIDDAY_COMMANDER_INTERFACE_H
7
8#include <map>
9#include "ncurses.h"
10
11#include "../FileView.h"
12#include "../State.h"
13#include "../action/Action.h"
14#include "Theme.h"
15#include "Color.h"
16
17#define KEY_RETURN '\n'// ncurses provides only KEY_ENTER, which is the numpad one
18
22class Interface {
23public:
24 [[nodiscard]] const std::shared_ptr<Action>& promptAction() const;
25 Interface& addHotkey(int key, const Action& action);
27
31 void initialize() const;
32
36 void render(FileView&, State&);
37
41 void stop();
42private:
43 std::map<int, std::shared_ptr<Action>> actions;
45
46 void generateColorPairs() const;
47};
48
49
50#endif //MIDDAY_COMMANDER_INTERFACE_H
An abstract class representing a general operation in the program.
Definition: Action.h:17
Represents a file view of the Application.
Definition: FileView.h:16
Represents the main interface of the Application.
Definition: Interface.h:22
const std::shared_ptr< Action > & promptAction() const
Definition: Interface.cpp:15
void generateColorPairs() const
Definition: Interface.cpp:59
Interface & setTheme(Theme)
Definition: Interface.cpp:54
void stop()
Stops ncurses
Definition: Interface.cpp:35
std::map< int, std::shared_ptr< Action > > actions
Definition: Interface.h:43
void initialize() const
Initializes ncurses and prepares.
Definition: Interface.cpp:23
Theme theme
Definition: Interface.h:44
Interface & addHotkey(int key, const Action &action)
Definition: Interface.cpp:10
void render(FileView &, State &)
Shows the file view.
Definition: Interface.cpp:39
Holds the global state of the Application.
Definition: State.h:16
Represents a set of colors used by Interface.
Definition: Theme.h:15