add first code
This commit is contained in:
parent
f207af2c4a
commit
8bf49928e5
5 changed files with 181 additions and 1 deletions
66
inc/col.h
Normal file
66
inc/col.h
Normal file
|
@ -0,0 +1,66 @@
|
|||
|
||||
class Node;
|
||||
typedef void (*drawfun_t)(int offset, int size, Node*);
|
||||
|
||||
|
||||
|
||||
void draw_menu(int, int, Node*);
|
||||
|
||||
class Drawable{
|
||||
public:
|
||||
const int minsize;
|
||||
const int maxsize;
|
||||
drawfun_t render;
|
||||
Drawable(drawfun_t fun, int min = 0, int max=~0): minsize(min), maxsize(max), render(fun){
|
||||
}
|
||||
};
|
||||
|
||||
class Node{
|
||||
private:
|
||||
Node* parent_ = 0;
|
||||
Node* child_ = 0;
|
||||
Node* next_ = 0;
|
||||
void addNodes(bool b){
|
||||
}
|
||||
template<class ...Us>
|
||||
void addNodes(bool b, Node* n, Us ... ns){
|
||||
next_ = n;
|
||||
next_->parent_ = parent_;
|
||||
next_->addNodes(!b,ns...);
|
||||
}
|
||||
public:
|
||||
Drawable view;
|
||||
const char* title_ = 0;
|
||||
Node(): next_(nullptr), child_(nullptr), parent_(nullptr), view(nullptr){
|
||||
}
|
||||
Node(const char* t, drawfun_t fun=draw_menu) : title_(t), view(fun), next_(nullptr), child_(nullptr), parent_(nullptr){
|
||||
}
|
||||
|
||||
template<typename ... Args>
|
||||
Node(const char* t, Node* n, Args ... ns) : title_(t), view(nullptr){
|
||||
child_ = n;
|
||||
n->parent_=this;
|
||||
child_->addNodes(true,ns...);
|
||||
}
|
||||
|
||||
void p(int i);
|
||||
};
|
||||
|
||||
class Value: public Node{
|
||||
public:
|
||||
const char* header;
|
||||
int state;
|
||||
Value(const char* t, int val, drawfun_t fun): Node(t, fun), header(t), state(val){
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
class Layout{
|
||||
private:
|
||||
int menuthrs_;
|
||||
public:
|
||||
Layout(int max) : menuthrs_(max){
|
||||
|
||||
}
|
||||
//slots
|
||||
};
|
11
inc/hal.h
Normal file
11
inc/hal.h
Normal file
|
@ -0,0 +1,11 @@
|
|||
|
||||
|
||||
void print(const char* str);
|
||||
void print(int str);
|
||||
|
||||
#ifndef LINUX
|
||||
|
||||
void * operator new(unsigned int size);
|
||||
void operator delete(void * ptr);
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue