70 lines
1.9 KiB
C
70 lines
1.9 KiB
C
/*
|
|
* Copyright Luka Jankovic 2025
|
|
*
|
|
* This file is part of Kubo.
|
|
*
|
|
* Kubo 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.
|
|
*
|
|
* Kubo 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
|
|
* Kubo. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef KUBO_CONTEXT_H
|
|
#define KUBO_CONTEXT_H
|
|
|
|
#include <stdbool.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#include "kubo_dynarray.h"
|
|
#include "kubo_wall.h"
|
|
|
|
KUBO_DYNARRAY_REGISTER(kubo_wall_arr, struct kubo_wall *)
|
|
|
|
enum kubo_context_state {
|
|
KUBO_CONTEXT_NORMAL,
|
|
KUBO_CONTEXT_COMMAND,
|
|
KUBO_CONTEXT_WALL_NEW,
|
|
KUBO_CONTEXT_WALL_SELECT,
|
|
};
|
|
|
|
struct kubo_context_state_data {
|
|
enum kubo_context_state id;
|
|
char *label;
|
|
Color color;
|
|
};
|
|
|
|
struct kubo_context {
|
|
char *file_name;
|
|
|
|
bool exit_pending;
|
|
struct kubo_wall_arr walls;
|
|
struct kubo_context_state_data state;
|
|
|
|
// KUBO_CONTEXT_WALL_SELECT
|
|
size_t wall_select_index;
|
|
};
|
|
|
|
void kubo_context_init(struct kubo_context *context);
|
|
void kubo_context_cleanup(struct kubo_context *context);
|
|
|
|
void kubo_context_set_state(struct kubo_context *context,
|
|
enum kubo_context_state state);
|
|
|
|
void kubo_context_accept_cmd(struct kubo_context *context);
|
|
|
|
struct kubo_wall *kubo_context_get_pending_wall(struct kubo_context *context);
|
|
void kubo_context_delete_wall(struct kubo_context *context);
|
|
|
|
void kubo_context_select_next_wall(struct kubo_context *context);
|
|
void kubo_context_select_prev_wall(struct kubo_context *context);
|
|
|
|
#endif
|