vrfileman

view src/layout.h @ 6:b041bc1c38ad

layout
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 03 Feb 2015 15:42:03 +0200
parents
children
line source
1 #ifndef LAYOUT_H_
2 #define LAYOUT_H_
4 #include <map>
5 #include <vmath/vmath.h>
6 #include "fs.h"
8 struct LayoutData {};
10 class Layout {
11 protected:
12 FSNode *tree;
13 std::map<FSNode*, LayoutData*> node_data;
15 public:
16 Layout();
17 virtual ~Layout();
19 virtual bool init();
20 virtual void destroy();
21 virtual void clear();
23 virtual void set_root(FSNode *root);
25 virtual void layout() = 0;
27 virtual Vector3 get_local_pos(const FSNode *node) const;
28 virtual Vector3 get_world_pos(const FSNode *node) const;
29 };
31 struct PlanarLayoutData {
32 Vector2 pos; /* local pos, relative to parent */
33 float width, height;
34 float sub_width, sub_height;
35 };
37 class PlanarLayout : public Layout {
38 private:
39 void layout_tree(FSNode *tree);
41 public:
42 void layout();
43 };
46 #endif // LAYOUT_H_