vrfileman

diff 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/layout.h	Tue Feb 03 15:42:03 2015 +0200
     1.3 @@ -0,0 +1,46 @@
     1.4 +#ifndef LAYOUT_H_
     1.5 +#define LAYOUT_H_
     1.6 +
     1.7 +#include <map>
     1.8 +#include <vmath/vmath.h>
     1.9 +#include "fs.h"
    1.10 +
    1.11 +struct LayoutData {};
    1.12 +
    1.13 +class Layout {
    1.14 +protected:
    1.15 +	FSNode *tree;
    1.16 +	std::map<FSNode*, LayoutData*> node_data;
    1.17 +
    1.18 +public:
    1.19 +	Layout();
    1.20 +	virtual ~Layout();
    1.21 +
    1.22 +	virtual bool init();
    1.23 +	virtual void destroy();
    1.24 +	virtual void clear();
    1.25 +
    1.26 +	virtual void set_root(FSNode *root);
    1.27 +
    1.28 +	virtual void layout() = 0;
    1.29 +
    1.30 +	virtual Vector3 get_local_pos(const FSNode *node) const;
    1.31 +	virtual Vector3 get_world_pos(const FSNode *node) const;
    1.32 +};
    1.33 +
    1.34 +struct PlanarLayoutData {
    1.35 +	Vector2 pos; /* local pos, relative to parent */
    1.36 +	float width, height;
    1.37 +	float sub_width, sub_height;
    1.38 +};
    1.39 +
    1.40 +class PlanarLayout : public Layout {
    1.41 +private:
    1.42 +	void layout_tree(FSNode *tree);
    1.43 +
    1.44 +public:
    1.45 +	void layout();
    1.46 +};
    1.47 +
    1.48 +
    1.49 +#endif	// LAYOUT_H_