00001 /* window.h */ 00002 00003 #ifndef WINDOW_H 00004 #define WINDOW_H 00005 00006 /* 00007 * A "window" class is a basic top-level window in the visual system. 00008 * The "create_window" method is used to create the window; it is a 00009 * virtual function and subclasses should override this with any 00010 * additional code. 00011 * 00012 * When the window is destroyed, the "destroyed" method is called by 00013 * tcl/tk, and the window object is then deleted. 00014 */ 00015 00016 #include "vtoplevel.h" 00017 #include "binding.h" 00018 #include "suifkernel/suifkernel_forwarders.h" 00019 00020 class event; 00021 00022 00023 /* 00024 * window 00025 */ 00026 00027 class window { 00028 protected: 00029 binding_list *bindings; 00030 vtoplevel *toplevel; 00031 00032 public: 00033 window(void); 00034 virtual ~window(void); 00035 virtual void destroy(void); 00036 virtual void create_window(void); 00037 virtual void destroyed(void); 00038 00039 /* must override this method to define the class name */ 00040 virtual char *class_name(void) { return "no-name"; } 00041 00042 /* misc */ 00043 vtoplevel *toplevel_window(void) const { return toplevel; } 00044 00045 /* display methods */ 00046 void raise(void) { if (toplevel) toplevel->raise(); } 00047 void lower(void) { if (toplevel) toplevel->lower(); } 00048 void iconify(void) { if (toplevel) toplevel->iconify(); } 00049 void deiconify(void) { if (toplevel) toplevel->deiconify(); } 00050 void withdraw(void) { if (toplevel) toplevel->withdraw(); } 00051 private: 00052 /* override stupid defaults, no implementation needed */ 00053 window &operator=(const window &); 00054 window(const window &); 00055 }; 00056 00057 00058 typedef list<window*> window_list; 00059 00060 /* 00061 * window_class 00062 */ 00063 00064 typedef window *(*window_cons_fn)(void); 00065 00066 class window_class { 00067 private: 00068 window_cons_fn cons_fn; // constructor fn 00069 LString nm; // name 00070 00071 public: 00072 window_class(char *n, window_cons_fn fn) : nm(n) { 00073 //nm = LString(n).c_str(); 00074 cons_fn = fn; 00075 } 00076 00077 const char *name(void) { return nm.c_str(); } 00078 window_cons_fn constructor(void) { return cons_fn; } 00079 }; 00080 00081 typedef list<window_class*> window_class_list; 00082 00083 #endif