00001 /*-------------------------------------------------------------------- 00002 * vwidget.h 00003 * 00004 * The "vwidget" is a base widget class. All other widgets are derived 00005 * from this class. A widget is a basic window component, it corresponds 00006 * roughly to a tcl/tk widget. 00007 * 00008 * The "win" method returns the current window that contains the widget. 00009 * 00010 */ 00011 00012 #ifndef VWIDGET_H 00013 #define VWIDGET_H 00014 00015 //#include <sty.h> 00016 #include "vdefs.h" 00017 00018 00019 class vnode; 00020 class vprop; 00021 class window; 00022 00023 enum wstates { 00024 W_NORMAL, 00025 W_DESTROYED 00026 }; 00027 00028 enum { 00029 WIDGET_NULL = 0, 00030 WIDGET_TOPLEVEL, 00031 WIDGET_FRAME, 00032 WIDGET_MENU, 00033 WIDGET_TTY, 00034 WIDGET_TEXT, 00035 WIDGET_MESSAGE, 00036 WIDGET_GRAPH, 00037 WIDGET_LISTBOX, 00038 WIDGET_FORM, 00039 WIDGET_HTML, 00040 WIDGET_BUTTONBAR 00041 }; 00042 00043 // this is a virtual base class 00044 00045 class vwidget { 00046 00047 protected: 00048 char wpath[MAX_PATH_LEN]; // widget pathname 00049 vwidget *parent; 00050 00051 int state; // state of the widget 00052 00053 public: 00054 vwidget(vwidget *par) { 00055 parent = par; 00056 state = W_NORMAL; 00057 wpath[0] = '\0'; 00058 } 00059 virtual ~vwidget(void) {} 00060 virtual void destroy(void) {} 00061 virtual int kind(void) { return WIDGET_NULL; } 00062 00063 char *path(void) { return wpath; } 00064 window *win(void); 00065 bool is_alive(void) { return (state == W_NORMAL); } 00066 00067 virtual vnode *get_selection(void) { return 0; } 00068 }; 00069 00070 #endif