41 lines
712 B
C++
41 lines
712 B
C++
#ifndef WINDOW_H
|
|
#define WINDOW_H
|
|
|
|
#include <SDL.h>
|
|
#include "TextProgram.h"
|
|
#include "Font.h"
|
|
#include "Buffer.h"
|
|
|
|
class Window
|
|
{
|
|
public:
|
|
bool create(std::shared_ptr<Buffer> buffer);
|
|
void run_event_loop();
|
|
|
|
protected:
|
|
void resize();
|
|
void redraw();
|
|
void handle_event(SDL_Event & event);
|
|
void handle_key(uint32_t scancode, uint32_t mod);
|
|
void scroll_down();
|
|
void scroll_up();
|
|
|
|
SDL_Window * m_window;
|
|
bool m_exit_requested;
|
|
int m_width;
|
|
int m_height;
|
|
struct
|
|
{
|
|
std::shared_ptr<TextProgram> text;
|
|
} m_programs;
|
|
|
|
Font m_font;
|
|
int m_columns;
|
|
|
|
std::shared_ptr<Buffer> m_buffer;
|
|
|
|
PieceTable::PieceDescriptor * m_start_piece;
|
|
};
|
|
|
|
#endif
|