diff options
| author | Mitja Felicijan <mitja.felicijan@gmail.com> | 2023-11-09 23:19:53 +0100 |
|---|---|---|
| committer | Mitja Felicijan <mitja.felicijan@gmail.com> | 2023-11-09 23:19:53 +0100 |
| commit | 1566b6faa8534118c3566188181367cd0868468f (patch) | |
| tree | 1de8d4b369efb5e592685a31088f798a6b63ffa1 /examples/dte/frame.h | |
| parent | 349991bf6efe473ab9a5cbdae0a8114d72b997e3 (diff) | |
| download | crep-1566b6faa8534118c3566188181367cd0868468f.tar.gz | |
Added partial matching and introduced threads
Diffstat (limited to 'examples/dte/frame.h')
| -rw-r--r-- | examples/dte/frame.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/examples/dte/frame.h b/examples/dte/frame.h new file mode 100644 index 0000000..022cf2b --- /dev/null +++ b/examples/dte/frame.h @@ -0,0 +1,48 @@ +#ifndef FRAME_H +#define FRAME_H + +#include <stdbool.h> +#include <stddef.h> +#include "util/macros.h" +#include "util/ptr-array.h" +#include "util/string.h" + +// A container for other Frames or Windows. Frames and Windows form +// a tree structure, wherein Windows are the terminal (leaf) nodes. +typedef struct Frame { + struct Frame *parent; + // Every frame contains either one window or multiple subframes + PointerArray frames; + struct Window *window; + int w; // Width + int h; // Height + bool vertical; + bool equal_size; +} Frame; + +typedef enum { + RESIZE_DIRECTION_AUTO, + RESIZE_DIRECTION_HORIZONTAL, + RESIZE_DIRECTION_VERTICAL, +} ResizeDirection; + +struct EditorState; + +Frame *new_root_frame(struct Window *window); +void set_frame_size(Frame *frame, int w, int h); +void equalize_frame_sizes(Frame *parent); +void add_to_frame_size(Frame *frame, ResizeDirection dir, int amount); +void resize_frame(Frame *frame, ResizeDirection dir, int size); +void update_window_coordinates(Frame *frame); +Frame *split_frame(struct Window *window, bool vertical, bool before); +Frame *split_root_frame(struct EditorState *e, bool vertical, bool before); +void remove_frame(struct EditorState *e, Frame *frame); +void dump_frame(const Frame *frame, size_t level, String *str); + +#if DEBUG >= 1 + void debug_frame(const Frame *frame); +#else + static inline void debug_frame(const Frame* UNUSED_ARG(frame)) {} +#endif + +#endif |
