Changeset 109 for abuse/trunk/src/imlib/jwindow.hpp
- Timestamp:
- Mar 15, 2008, 10:19:47 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
abuse/trunk/src/imlib/jwindow.hpp
r106 r109 33 33 #define WINDOW_FRAME_RIGHT frame_right() 34 34 35 36 35 class input_manager 37 36 { 37 friend class jwindow; 38 39 private: 38 40 image *screen; 39 ifield *first, *active,*grab;40 jwindow *cur ;41 ifield *first, *active, *grab; 42 jwindow *cur, *owner; 41 43 int no_selections_allowed; 42 public : 44 45 public: 43 46 input_manager(image *Screen, ifield *First); 47 input_manager(jwindow *owner, ifield *First); 44 48 void handle_event(event &ev, jwindow *j); 45 49 ifield *get(int id); … … 58 62 class ifield 59 63 { 64 friend class jwindow; 65 friend class input_manager; 66 67 protected: 68 jwindow *owner; 69 60 70 public : 61 int x,y; 71 ifield(); 72 int x, y; 62 73 63 int id; 64 ifield *next; 65 virtual void area(int &x1, int &y1, int &x2, int &y2) = 0; 66 virtual void draw_first(image *screen) = 0; 67 virtual void draw(int active, image *screen) = 0; 68 virtual void handle_event(event &ev, image *screen, input_manager *im) = 0; 69 virtual int selectable() { return 1; } 70 virtual void remap(filter *f) { ; } 71 virtual char *read() = 0; 72 virtual ifield *find(int search_id) { if (id==search_id) return this; else return NULL; } 73 virtual ifield *unlink(int id) { return NULL; } 74 virtual ~ifield(); 74 int id; 75 ifield *next; 76 virtual void set_owner(jwindow *owner); 77 virtual void move(int newx, int newy) { x = newx; y = newy; } 78 virtual void area(int &x1, int &y1, int &x2, int &y2) = 0; 79 virtual void draw_first(image *screen) = 0; 80 virtual void draw(int active, image *screen) = 0; 81 virtual void handle_event(event &ev, image *screen, input_manager *im) = 0; 82 virtual int selectable() { return 1; } 83 virtual void remap(filter *f) { ; } 84 virtual char *read() = 0; 85 virtual ifield *find(int search_id) { if (id==search_id) return this; else return NULL; } 86 virtual ifield *unlink(int id) { return NULL; } 87 virtual ~ifield(); 75 88 } ; 76 89 77 90 struct jwindow_properties 78 91 { 79 uint8_t moveable, 80 hidden; 81 } ; 82 92 bool moveable, hidden; 93 }; 83 94 84 95 class jwindow 85 96 { 86 public : 87 jwindow_properties property; 88 jwindow *next; 89 char *name; 90 int x,y,l,h,backg; 91 image *screen; 92 input_manager *inm; 93 void *local_info; // pointer to info block for local system (may support windows) 94 jwindow(int X, int Y, int L, int H, ifield *fields, char const *Name=NULL); 95 void redraw(int hi, int med, int low, JCFont *fnt); 96 void resize(int L, int H); 97 void clear(int color=0) { screen->bar(x1(),y1(),x2(),y2(),color); } 98 int x1() { return WINDOW_FRAME_LEFT; } 99 int y1() { return WINDOW_FRAME_TOP; } 100 int x2() { return l-WINDOW_FRAME_RIGHT-1; } 101 int y2() { return h-WINDOW_FRAME_BOTTOM-1; } 102 void clip_in() { screen->set_clip(x1(),y1(),x2(),y2()); } 103 void clip_out() { screen->set_clip(0,0,l-1,h-1); } 104 char *read(int id) { return inm->get(id)->read(); } 105 void local_close(); 106 void set_moveability(int x); 107 ~jwindow() { local_close(); delete screen; delete inm; jfree(name); } 97 friend class input_manager; 98 99 private: 100 bool hidden; 101 bool moveable; 102 103 protected: 104 jwindow *owner; 105 106 public: 107 jwindow *next; 108 char *name; 109 int x, y, l, h, backg; 110 image *screen; 111 input_manager *inm; 112 void *local_info; // pointer to info block for local system (may support windows) 113 jwindow(int X, int Y, int L, int H, ifield *fields, char const *Name = NULL); 114 void redraw(int hi, int med, int low, JCFont *fnt); 115 void resize(int L, int H); 116 void clear(int color = 0) { screen->bar(x1(), y1(), x2(), y2(), color); } 117 void show() { hidden = false; } 118 void hide() { hidden = true; } 119 bool is_hidden() { return hidden; } 120 void freeze() { moveable = false; } 121 void thaw() { moveable = true; } 122 bool is_moveable() { return moveable; } 123 int x1() { return WINDOW_FRAME_LEFT; } 124 int y1() { return WINDOW_FRAME_TOP; } 125 int x2() { return l-WINDOW_FRAME_RIGHT-1; } 126 int y2() { return h-WINDOW_FRAME_BOTTOM-1; } 127 void clip_in() { screen->set_clip(x1(),y1(),x2(),y2()); } 128 void clip_out() { screen->set_clip(0,0,l-1,h-1); } 129 char *read(int id) { return inm->get(id)->read(); } 130 void local_close(); 131 ~jwindow() { local_close(); delete screen; delete inm; jfree(name); } 108 132 } ; 109 133 110 134 class window_manager 111 135 { 112 public : 136 friend class jwindow; 137 138 public: 113 139 event_handler *eh; 114 140 jwindow *first,*grab;
Note: See TracChangeset
for help on using the changeset viewer.