Editor: tipos de aba como classes (TabClass)
Blocos, código e imagem são TabClass com hooks (init, render, click, release, motion, key, text, scroll, icon) e o traço "aceita blocos"; o editor chama o hook da aba atual em vez de testar o kind. Hook NULL = área de blocos (o padrão). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4f1f83e9c2
commit
ddd86ca570
2 files changed
+111
-44
No files matched your search
@@ -988,6 +988,27 @@ bool hit_libman_foot(Ed* ed, float mx, float my);
|
||||
|
||||
/* Abas de codigo/imagem + tooltip de metadados */
|
||||
bool tab_new_kind(Ed* ed, const char* name, bool is_composite, int kind);
|
||||
|
||||
/* == Tipos de aba como classes ===
|
||||
* Cada kind de aba (blocos, codigo, imagem) e uma TabClass: o editor chama
|
||||
* os hooks em vez de testar o kind. Hook NULL = comportamento da area de
|
||||
* blocos (o padrao do editor). */
|
||||
typedef struct TabClass {
|
||||
const char* name;
|
||||
bool blocks; /* aceita blocos (area de scripts) */
|
||||
void (*init)(Ed* ed, Tab* T); /* aba nova */
|
||||
void (*render)(Ed* ed, TinyBlocks_RenderableBlock* rb);
|
||||
void (*click)(Ed* ed, float mx, float my); /* botao esquerdo na area */
|
||||
bool (*release)(Ed* ed, float mx, float my); /* true = tratou */
|
||||
void (*motion)(Ed* ed, float mx, float my);
|
||||
bool (*key)(Ed* ed, int sc, bool ctrl); /* true = tratou */
|
||||
bool (*text)(Ed* ed, const char* typed); /* true = tratou */
|
||||
bool (*scroll)(Ed* ed, float mx, float my, double dx, double dy);
|
||||
bool (*icon)(TinyBlocks_RenderableBlock* rb, float x, float cy); /* icone na barra */
|
||||
} TabClass;
|
||||
|
||||
const TabClass* tab_class(const Tab* T);
|
||||
bool tab_has_define(const Tab* T);
|
||||
bool tab_has_define(const Tab* T);
|
||||
void tab_doc_free(Tab* T);
|
||||
void code_rehighlight(Tab* T);
|
||||
|
||||
Reference in new issue
Block a user