Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

httree.h

Go to the documentation of this file.
00001 /* 
00002  *      HT Editor
00003  *      httree.h
00004  *
00005  *      Copyright (C) 1999-2002 Sebastian Biallas (sb@web-productions.de)
00006  *
00007  *      This program is free software; you can redistribute it and/or modify
00008  *      it under the terms of the GNU General Public License version 2 as
00009  *      published by the Free Software Foundation.
00010  *
00011  *      This program is distributed in the hope that it will be useful,
00012  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *      GNU General Public License for more details.
00015  *
00016  *      You should have received a copy of the GNU General Public License
00017  *      along with this program; if not, write to the Free Software
00018  *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019  */
00020 
00021 #ifndef HT_TREE
00022 #define HT_TREE
00023 
00024 #include "htdata.h"
00025 #include "htobj.h"
00026 #include "global.h"
00027 
00028 struct ht_treeview_data {
00029         DDECL_PTR(void *, selected);
00030 };
00031 
00032 class ht_treeview: public ht_view {
00033 public:
00034                 int delta_x, delta_y;
00035                 int maxsize_x, maxsize_y;
00036                 int                     foc;
00037                 void                    *selected;
00038 
00039                            void init(bounds *b, char *desc);
00040                 virtual void    done();
00041                 virtual void    adjust(void *node, bool expand) = 0;
00042                            int  create_graph(int *s, void *node, int level, int lines, int width, int endwidth, int *Chars);
00043                            void   collapse_all(void *node);
00044                 virtual int     count_children(void *node);
00045                 virtual void    draw();
00046                            void draw_r(void *node, int level, int *pos, dword lines);
00047                            void   expand_all(void *node);
00048                 virtual void   *get_child(void *node, int i) = 0;
00049                 virtual void    getdata(ht_object_stream *s);
00050                 virtual int     get_graph(int *s, void *node, int level, int lines);
00051                 virtual void    *get_next_node(void *node) = 0;
00052                            void   *get_node(int i);
00053                            void   *get_node_r(void *node, int *i);
00054                 virtual void    *get_prev_node(void *node) = 0;
00055                 virtual void    *get_root() = 0;
00056                 virtual char    *get_text(void *node) = 0;
00057                 virtual void    handlemsg(htmsg *msg);
00058                 virtual bool    has_children(void *node) = 0;
00059                 virtual void    has_focused(int i);
00060                 virtual bool    is_expanded(void *node) = 0;
00061                 virtual bool    is_selected(int i);
00062                            void scroll_to(int x, int y);
00063                 virtual void    select_node(void *node); // stub
00064                 virtual void    setdata(ht_object_stream *s);
00065                            void set_limit(int x, int y);
00066                            void update();
00067                            void update_r(void *node, int level, int *pos, int *x);
00068 private:
00069                            void   adjust_focus(int Focus);
00070 };
00071 
00072 struct static_node {
00073         static_node     *next, *prev, *child;
00074         char                    *text;
00075         bool                    expanded;
00076         Object          *data;
00077 };
00078 
00079 class ht_static_treeview: public ht_treeview {
00080 public:
00081                 static_node     *root;
00082                            void init(bounds *b, char *desc);
00083                 virtual void    done();
00084                            void *add_child(void *node, char *text, Object *Data=NULL);
00085                            void *add_node(static_node **node, char *text, Object *Data=NULL);
00086                 virtual void    adjust(void *node, bool expand);
00087                 static_node     *create_node(char *text, static_node *prev, Object *Data=NULL);
00088                 virtual void   *get_child(void *node, int i);
00089                 virtual void    *get_next_node(void *node);
00090                 virtual void    *get_prev_node(void *node);
00091                 virtual void    *get_root();
00092                 virtual char    *get_text(void *node);
00093                 virtual bool    has_children(void *node);
00094                 virtual bool    is_expanded(void *node);
00095                 virtual void    select_node(void *node);
00096 /* new */
00097                            void *get_cursor_node();
00098                            void goto_node(void *node);
00099 };
00100 
00101 #endif

Generated on Fri May 7 21:15:38 2004 by doxygen 1.3.5