2 * Simulator of microcontrollers (view.cc)
4 * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
6 * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
10 /* This file is part of microcontroller simulator: ucsim.
12 UCSIM is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
17 UCSIM is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with UCSIM; see the file COPYING. If not, write to the Free
24 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
40 cl_box::cl_box(int ix, int iy, int iw, int ih):
50 cl_box::set(int ix, int iy, int iw, int ih)
59 cl_box::move_rel(int dx, int dy)
66 cl_box::grow(int dw, int dh)
74 * Astbract of a viewer
75 ******************************************************************************
78 cl_view::cl_view(class cl_box *ipos, char *iname, class cl_app *iapp):
81 pos= new cl_box(ipos->x,ipos->y, ipos->w,ipos->h);
82 if ((window= newwin(pos->h,pos->w, pos->y,pos->x)))
84 leaveok(window, TRUE);
85 panel= new_panel(window);
97 options= OF_SELECTABLE;
101 name= (char*)malloc(100);
102 sprintf(name, "view%p", this);
108 cl_view::cl_view(char *iname, class cl_app *iapp):
117 options= OF_SELECTABLE;
121 name= (char*)malloc(100);
122 sprintf(name, "view%p", this);
128 cl_view::~cl_view(void)
144 palette= mk_palette();
150 cl_view::mk_input(void)
156 cl_view::mk_palette(void)
164 return(window && panel);
169 * Make output into the view
177 color= get_color(palette?0:C_WIN_NORMAL);
179 wattrset(window, color);
180 for (y= 0; y < pos->h; y++)
181 for (x= 0; x < pos->w; x++)
182 mvwaddch(window, y,x, ' ');
189 cl_view::update(void)
198 cl_view::get_color(int color)
215 cl_view::get_palette(void)
226 cl_view::get_event(struct t_event *event)
229 return(parent->get_event(event));
231 return(input->get_event(event));
236 cl_view::handle_event(struct t_event *event)
242 cl_view::unhandled(struct t_event *event)
248 cl_view::mk_event(struct t_event *event, FILE *f, int key)
251 event->event.key= key;
268 cl_view::prev_view(void)
271 parent->first() == this)
279 cl_view::select(void)
283 if (!(options & OF_SELECTABLE))
285 if (state & SF_SELECTED)
292 v= parent->current_sub_view();
296 parent->set_current(this);
298 change_state(SF_FOCUSED, 1);
299 change_state(SF_SELECTED, 1);
302 if (options & OF_SELECTABLE)
304 parent->set_current(this);
309 cl_view::unselect(void)
311 class cl_view *csv= current_sub_view();
315 if (!terminal_view())
316 change_state(SF_FOCUSED, 0);
317 change_state(SF_SELECTED, 0);
323 cl_view::current_sub_view(void)
329 cl_view::terminal_view(void)
335 cl_view::change_state(unsigned int what, int enable)
347 /*message(parent, EV_BROADCAST,
348 (enable)?CM_RECEIVED_FOCUS:CM_RELEASED_FOCUS, this);*/
356 /* End of gui.src/view.cc */