source: abuse/trunk/src/imlib/jwindow.cpp @ 659

Last change on this file since 659 was 659, checked in by Sam Hocevar, 11 years ago

imlib: rename Jwindow's x and y members to m_pos.

File size: 18.8 KB
Line 
1/*
2 *  Abuse - dark 2D side-scrolling platform game
3 *  Copyright (c) 1995 Crack dot Com
4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
5 *
6 *  This software was released into the Public Domain. As with most public
7 *  domain software, no warranty is made or implied by Crack dot Com, by
8 *  Jonathan Clark, or by Sam Hocevar.
9 */
10
11#if defined HAVE_CONFIG_H
12#   include "config.h"
13#endif
14
15#include <string.h>
16
17#include "common.h"
18
19#include "video.h"
20#include "image.h"
21#include "input.h"
22#include "event.h"
23#include "filter.h"
24#include "jwindow.h"
25
26static int jw_left = 3, jw_right = 3, jw_top = 2, jw_bottom = 3;
27
28int frame_top() { return jw_top; }
29int frame_bottom() { return jw_bottom; }
30int frame_left() { return jw_left; }
31int frame_right() { return jw_right; }
32
33//
34//  Sets the size of the border around each window
35//
36void set_frame_size(int x)
37{
38    if(x < 1)
39        x = 1;
40    jw_left = x;
41    jw_right = x;
42    jw_top = 2;
43    jw_bottom = x;
44}
45
46 // true if a window lies in this area
47int WindowManager::window_in_area(int x1, int y1, int x2, int y2)
48{
49  for (Jwindow *f=m_first; f; f=f->next)
50    if (f->m_pos.x<=x2 && f->m_pos.y<=y2 && f->m_pos.x+f->l-1>=x1 && f->m_pos.y+f->h-1>=y1)
51      return 1;
52  return 0;
53}
54
55void WindowManager::grab_focus(Jwindow *j)
56{ m_grab=j; }
57
58void WindowManager::release_focus()
59{ m_grab=NULL; }
60
61
62void WindowManager::close_window(Jwindow *j)
63{
64    delete j;
65}
66
67void WindowManager::hide_windows()
68{
69    for (Jwindow *p = m_first; p; p = p->next)
70    {
71        if (!p->is_hidden())
72        {
73            p->hide();
74            m_surf->AddDirty(p->m_pos.x, p->m_pos.y, p->m_pos.x + p->l, p->m_pos.y + p->h);
75        }
76    }
77}
78
79void WindowManager::show_windows()
80{
81  Jwindow *p;
82  for (p=m_first; p; p=p->next)
83    if (p->is_hidden())
84      show_window(p);
85}
86
87void WindowManager::hide_window(Jwindow *j)
88{
89    if (j == m_first)
90        m_first = m_first->next;
91    else
92    {
93        Jwindow *k;
94        for (k = m_first; k->next != j; k = k->next)
95            k->m_surf->AddDirty(j->m_pos.x - k->m_pos.x, j->m_pos.y - k->m_pos.y,
96                                  j->m_pos.x + j->l - k->m_pos.x, j->m_pos.y + j->h - k->m_pos.y);
97        k->m_surf->AddDirty(j->m_pos.x - k->m_pos.x, j->m_pos.y - k->m_pos.y,
98                              j->m_pos.x + j->l - k->m_pos.x, j->m_pos.y + j->h - k->m_pos.y);
99        k->next = j->next;
100    }
101    m_surf->AddDirty(j->m_pos.x, j->m_pos.y, j->m_pos.x + j->l, j->m_pos.y + j->h);
102    j->hide();
103}
104
105void WindowManager::show_window(Jwindow *j)
106{
107    if (j->is_hidden())
108    {
109        j->show();
110        j->m_surf->AddDirty(0, 0, j->l, j->h);
111    }
112}
113
114void WindowManager::get_event(Event &ev)
115{
116  Get(ev);
117
118  if (ev.type==EV_KEY)
119    key_state[ev.key]=1;
120  else if (ev.type==EV_KEYRELEASE)
121    key_state[ev.key]=0;
122
123  if (state==inputing)
124  {
125    Jwindow *j;
126    for (ev.window=NULL,j=m_first; j; j=j->next)
127      if (!j->is_hidden() && ev.mouse_move >= j->m_pos
128                          && ev.mouse_move < j->m_pos + vec2i(j->l, j->h))
129        ev.window=j;
130
131    if (!ev.window && m_grab) ev.window=m_grab;
132
133    if (ev.window)
134    {
135      int closew=0,movew=0;
136
137      if ((ev.type==EV_MOUSE_BUTTON && ev.mouse_button==1 && ev.window &&
138       ev.mouse_move >= ev.window->m_pos &&
139       ev.mouse_move < ev.window->m_pos + vec2i(ev.window->l, ev.window->y1())))
140      {
141    if (ev.mouse_move.x-ev.window->m_pos.x < 11) closew=1;
142    else if (ev.window->is_moveable()) movew=1;
143      } else if (m_grab)
144        ev.window=m_grab;
145
146      if (ev.type==EV_KEY && ev.key==JK_ESC)
147        closew=1;
148
149
150
151      if (closew)
152        ev.type=EV_CLOSE_WINDOW;
153      else if (movew)
154      {
155    int red=0;
156    if (ev.window==m_first)       // see if we need to raise the window
157    {
158      m_first=m_first->next;
159      if (m_first)
160        red=1;
161    }
162    else
163    {
164      Jwindow *last=m_first;
165      for (; last->next!=ev.window; last=last->next);
166      if (ev.window->next)
167        red=1;
168      last->next=ev.window->next;
169    }
170    if (!m_first)
171      m_first=ev.window;
172    else
173    {
174      Jwindow *last=m_first;
175      for (; last->next; last=last->next);
176      last->next=ev.window;
177    }
178    ev.window->next=NULL;
179    if (red)
180    {
181      Jwindow *j=ev.window;
182/*      m_surf->AddDirty(j->x,j->y,j->x+j->l,j->y+j->h);
183      for (p=m_first; p!=j; p=p->next)
184        p->m_surf->AddDirty(j->x-p->x,j->y-p->y,j->x+j->l-p->x,j->y+j->h-p->y); */
185      j->m_surf->AddDirty(0, 0, j->l, j->h);
186      flush_screen();
187    }
188
189        state=dragging;
190        drag_window=ev.window;
191        drag_mousex=ev.window->m_pos.x-ev.mouse_move.x;
192        drag_mousey=ev.window->m_pos.y-ev.mouse_move.y;
193        ev.type=EV_SPURIOUS;
194      } else if (ev.window)
195        ev.window->inm->handle_event(ev,ev.window);
196    }
197  } else if (state==dragging)
198  {
199    ev.window=drag_window;
200    if (ev.type==EV_MOUSE_BUTTON && ev.mouse_button==0)  // user released the mouse
201    {
202      state=inputing;
203      ev.type=EV_SPURIOUS;
204    } else if (ev.type==EV_MOUSE_MOVE)
205    {
206       move_window(drag_window,ev.mouse_move.x+drag_mousex,ev.mouse_move.y+drag_mousey);
207       flush_screen();
208       ev.type=EV_DRAG_WINDOW;
209       ev.window_position.x=ev.mouse_move.x+drag_mousex;
210       ev.window_position.y=ev.mouse_move.y+drag_mousey;
211    }
212  }
213  if (ev.type == EV_REDRAW)
214  {
215    for (Jwindow *j = m_first; j; j = j->next)
216       j->m_surf->AddDirty(ev.redraw.x1 - j->m_pos.x, ev.redraw.y1 - j->m_pos.y,
217                             ev.redraw.x2 + 1 - j->m_pos.x, ev.redraw.y2 + 1 - j->m_pos.y);
218    m_surf->AddDirty(ev.redraw.x1, ev.redraw.y1, ev.redraw.x2 + 1, ev.redraw.y2 + 1);
219    flush_screen();
220    ev.type=EV_SPURIOUS;   // we took care of this one by ourselves.
221  }
222}
223
224void Jwindow::resize(int L, int H)
225{
226  m_surf->SetSize(vec2i(L,H));
227  l=L; h=H;
228}
229
230void WindowManager::resize_window(Jwindow *j, int l, int h)
231{
232  Jwindow *p;
233  m_surf->AddDirty(j->m_pos.x, j->m_pos.y, j->m_pos.x + j->l, j->m_pos.y + j->h);
234  for (p=m_first; p!=j; p=p->next)
235    p->m_surf->AddDirty(j->m_pos.x - p->m_pos.x, j->m_pos.y - p->m_pos.y, j->m_pos.x + j->l - p->m_pos.x, j->m_pos.y + j->h - p->m_pos.y);
236  j->resize(l,h);
237  if (!frame_suppress)
238  j->redraw();
239}
240
241void WindowManager::move_window(Jwindow *j, int x, int y)
242{
243    m_surf->AddDirty(j->m_pos.x, j->m_pos.y, j->m_pos.x + j->l, j->m_pos.y + j->h);
244    for(Jwindow *p = m_first; p != j; p = p->next)
245        p->m_surf->AddDirty(j->m_pos.x - p->m_pos.x, j->m_pos.y - p->m_pos.y,
246                              j->m_pos.x + j->l - p->m_pos.x, j->m_pos.y + j->h - p->m_pos.y);
247    j->m_pos.x = x;
248    j->m_pos.y = y;
249    j->m_surf->AddDirty(0, 0, j->l, j->h);
250}
251
252WindowManager::WindowManager(image *screen, palette *pal, int Hi,
253                             int Med, int Low, JCFont *Font)
254  : EventHandler(screen, pal)
255{
256    wm = this;
257    m_surf = screen;
258    hi = Hi; low = Low; med = Med; m_first = NULL; m_pal = pal; m_grab = NULL;
259    bk = pal->find_closest(0, 0, 0);
260    state = inputing; fnt = Font;  wframe_fnt = Font;
261    memset(key_state, 0, sizeof(key_state));
262    frame_suppress = 0;
263}
264
265WindowManager::~WindowManager()
266{
267    while(m_first)
268        close_window(m_first);
269    wm = NULL;
270}
271
272void WindowManager::add_window(Jwindow *win)
273{
274    if(!m_first)
275        m_first = win;
276    else
277    {
278        Jwindow *tmp = m_first;
279        while(tmp->next)
280            tmp = tmp->next;
281        tmp->next = win;
282        win->next = NULL;
283    }
284}
285
286void WindowManager::remove_window(Jwindow *win)
287{
288    if(m_grab == win)
289        m_grab = NULL;
290
291    // close the window we were dragging
292    if(state == dragging && win == drag_window)
293        state = inputing;
294
295    if(m_first == win)
296        m_first = m_first->next;
297    else
298    {
299        Jwindow * search;
300        for(search = m_first; search->next != win; search = search->next)
301            search->m_surf->AddDirty(win->m_pos.x - search->m_pos.x,
302                                     win->m_pos.y - search->m_pos.y,
303                                     win->m_pos.x + win->l - search->m_pos.x,
304                                     win->m_pos.y + win->h - search->m_pos.y);
305        search->m_surf->AddDirty(win->m_pos.x - search->m_pos.x,
306                                 win->m_pos.y - search->m_pos.y,
307                                 win->m_pos.x + win->l - search->m_pos.x,
308                                 win->m_pos.y + win->h - search->m_pos.y);
309        search->next = win->next;
310    }
311
312    m_surf->AddDirty(win->m_pos.x, win->m_pos.y, win->m_pos.x + win->l, win->m_pos.y + win->h);
313}
314
315Jwindow * WindowManager::new_window(int x, int y, int l, int h,
316                                     ifield * fields, char const *name)
317{
318    if(x > m_surf->Size().x - 4)
319        x = m_surf->Size().x - 25;
320    if(y > m_surf->Size().y - 4)
321        y = m_surf->Size().y - 10;
322
323    Jwindow * j = new Jwindow (vec2i(x, y), l, h, fields, name);
324    j->show();
325
326    return j;
327}
328
329void WindowManager::flush_screen()
330{
331    vec2i m1(0, 0);
332
333    if (has_mouse())
334    {
335        m1 = m_pos - m_center;
336        vec2i m2 = m1 + m_sprite->visual->Size() - vec2i(1, 1);
337
338        m_sprite->save->PutPart(m_surf, 0, 0, m1.x, m1.y, m2.x, m2.y);
339        m_surf->PutImage(m_sprite->visual, m1, 1);
340    }
341
342    for (Jwindow *p = m_first; p; p = p->next)
343        if (!p->is_hidden())
344            m_surf->delete_dirty(p->m_pos.x, p->m_pos.y, p->m_pos.x + p->l, p->m_pos.y + p->h);
345    update_dirty(m_surf);
346
347    if (has_mouse())
348        m_surf->PutImage(m_sprite->save, m1);
349
350    for (Jwindow *p = m_first; p; p = p->next)
351    {
352        if (p->is_hidden())
353            continue;
354
355        if (has_mouse())
356        {
357            m_sprite->save->PutPart(p->m_surf, 0, 0, m1.x - p->m_pos.x, m1.y - p->m_pos.y,
358                                    m1.x - p->m_pos.x + m_sprite->visual->Size().x - 1,
359                                    m1.y - p->m_pos.y + m_sprite->visual->Size().y - 1);
360            p->m_surf->PutImage(m_sprite->visual, m1 - p->m_pos, 1);
361        }
362
363//          m_surf->delete_dirty(p->m_pos.x, p->m_pos.y, p->m_pos.x+p->l, p->m_pos.y+p->h);
364        for (Jwindow *q = p->next; q; q = q->next)
365            if (!q->is_hidden())
366                p->m_surf->delete_dirty(q->m_pos.x - p->m_pos.x, q->m_pos.y - p->m_pos.y,
367                                        q->m_pos.x + q->l - p->m_pos.x,
368                                        q->m_pos.y + q->h - p->m_pos.y);
369        update_dirty(p->m_surf, p->m_pos.x, p->m_pos.y);
370        if (has_mouse())
371            p->m_surf->PutImage(m_sprite->save, m1 - p->m_pos, 0);
372    }
373}
374
375Jwindow::Jwindow(char const *name)
376{
377    _x1 = left_border();
378    _y1 = jw_top + 5;
379    _x2 = _y2 = 0;
380
381    _hidden = true;
382    _moveable = true;
383    // property.flags = JWINDOW_NOAUTOHIDE_FLAG;
384
385    inm = new InputManager(this, NULL);
386    reconfigure();
387
388    m_surf = NULL;
389    next = NULL;
390
391    _name = NULL;
392    if(name)
393        _name = strdup(name);
394    wm->add_window(this);
395}
396
397Jwindow::Jwindow(vec2i pos, int L, int H, ifield *f, char const *name)
398{
399    l = 0;
400    h = 0;
401    _hidden = false;
402    _moveable = true;
403
404    _x1 = left_border();
405    _y1 = name ? top_border() : jw_top + 5;
406
407    m_surf = NULL;
408    inm = new InputManager(m_surf, f);
409    reconfigure(); /* FIXME: TODO */
410
411    l = L >= 0 ? L + left_border() : l - L;
412    h = H >= 0 ? H + top_border() : h - H;
413    m_pos.x = pos.x >= 0 ? pos.x : xres - l + pos.x - left_border() - right_border() - 1;
414    m_pos.y = pos.y >= 0 ? pos.y : yres - h + pos.y - top_border() - bottom_border() - 1;
415
416    backg = wm->medium_color();
417
418    _x2 = l - 1;
419    _y2 = h - 1;
420    l += right_border();
421    h += bottom_border();
422
423    if(L == -1)
424        if(l < 15 + left_border() + right_border())
425            l = 15 + left_border() + right_border();
426    if(H == -1)
427        if(h < top_border() + bottom_border())
428            h = top_border() + bottom_border();
429    m_surf = new image(vec2i(l, h), NULL, 2);
430    m_surf->clear(backg);
431    // Keep this from getting destroyed when image list is cleared
432    image_list.unlink(m_surf);
433    inm->m_surf = m_surf;
434
435    next = NULL;
436
437    _name = NULL;
438    if(name)
439        _name = strdup(name);
440
441    wm->add_window(this);
442    if(!wm->frame_suppress)
443        redraw();
444}
445
446Jwindow::~Jwindow()
447{
448    wm->remove_window(this);
449    local_close();
450    delete m_surf;
451    delete inm;
452    if(_name)
453        free(_name);
454}
455
456void Jwindow::reconfigure()
457{
458    int x1, y1, x2, y2;
459    ifield *i;
460    l = 2;
461    h = 2;
462    for(i = inm->m_first; i; i = i->next)
463    {
464        i->set_owner(this);
465        i->area(x1, y1, x2, y2);
466        if ((int)y2 > (int)h)
467            h = y2;
468        if ((int)x2 > (int)l)
469            l = x2;
470    }
471}
472
473void Jwindow::local_close()
474{
475    ;
476}
477
478void Jwindow::redraw()
479{
480    int hi = wm->bright_color();
481    int med = wm->medium_color();
482    int low = wm->dark_color();
483    JCFont * fnt = wm->frame_font();
484
485    if(_name)
486    {
487        if (right_border() >= 1)
488        {
489            m_surf->WidgetBar(vec2i(0, 0), vec2i(l - 1, h - 1), hi, med, low);
490            if (right_border() >= 3)
491                m_surf->WidgetBar(vec2i(right_border() - 1, top_border() - 1),
492                                  vec2i(l - left_border(), h - bottom_border()),
493                                  low, med, hi);
494
495          else
496            m_surf->Line(vec2i(left_border() - 1, top_border() - 1),
497                         vec2i(right_border() - 1, top_border() - 1), low);
498        }
499      m_surf->Rectangle(vec2i(2, 2), vec2i(top_border() - 2, top_border() - 3),
500                        wm->black());
501      m_surf->WidgetBar(vec2i(3, 3), vec2i(top_border() - 3, top_border() - 4),
502                        hi, med, low); // draws the 'close' button
503    }
504
505  else
506    {
507      if (right_border() >= 1)
508        {
509          m_surf->WidgetBar(vec2i(0, 0), vec2i(l - 1, h - 1), hi, med, low);
510          if (right_border() >= 3)
511            m_surf->WidgetBar(vec2i(right_border() - 1, jw_top + 4),
512                              vec2i(l - left_border(), h - bottom_border()),
513                              low, med, hi);
514          else
515            m_surf->Line(vec2i(left_border() - 1, jw_top + 4),
516                         vec2i(right_border() - 1, jw_top + 4), low);
517        }
518      // Draw the 'close' button
519      m_surf->Rectangle(vec2i(1, 1), vec2i(4, 4), wm->black ());
520      m_surf->WidgetBar(vec2i(2, 2), vec2i(3, 3), hi, med, low);
521    }
522  if (_name && _name[0])
523    {
524      m_surf->Bar(vec2i(top_border(), 1),
525                  vec2i(top_border() + fnt->width() * strlen (_name) + 1,
526                        top_border() - 2),
527                  med);
528      fnt->put_string(m_surf, top_border() + 1, 1, _name, low);
529    }
530  // clear 'client' region
531  m_surf->Bar(vec2i(x1(), y1()), vec2i(x2(), y2()), backg);
532  inm->redraw ();
533}
534
535int Jwindow::left_border()
536{
537    return frame_left();
538}
539
540int Jwindow::right_border()
541{
542    return frame_right();
543}
544
545int Jwindow::top_border()
546{
547    return wm->font()->height() + frame_top();
548}
549
550int Jwindow::bottom_border()
551{
552    return frame_bottom();
553}
554
555
556ifield *InputManager::unlink(int id)     // unlinks ID from fields list and return the pointer to it
557{
558  for (ifield *i=m_first,*last=NULL; i; i=i->next)
559  {
560    if (i->id==id)
561    {
562      if (i==m_first)
563    m_first=m_first->next;
564      else
565        last->next=i->next;
566      if (m_active==i)
567        m_active=m_first;
568      return i;
569    }
570    ifield *x=i->unlink(id);
571    if (x) return x;
572    last=i;
573  }
574  return NULL;   // no such id
575}
576
577InputManager::~InputManager()
578{ ifield *i;
579  while (m_first)
580  { i=m_first;
581    m_first=m_first->next;
582    delete i;
583  }
584}
585
586void InputManager::clear_current()
587{
588    if(m_owner)
589        m_surf = m_owner->m_surf;
590    if(m_active)
591        m_active->draw(0, m_surf);
592    m_active = NULL;
593}
594
595void InputManager::handle_event(Event &ev, Jwindow *j)
596{
597  ifield *i,*in_area=NULL;
598  int x1,y1,x2,y2;
599
600  if(m_owner)
601      m_surf = m_owner->m_surf;
602
603  if (j)
604  {
605    ev.mouse_move -= j->m_pos;
606    m_cur = j;
607  }
608
609  if (!m_grab)
610  {
611    if ((ev.type==EV_MOUSE_BUTTON && ev.mouse_button==1) || ev.type==EV_MOUSE_MOVE)
612    {
613      for (i=m_first; i; i=i->next)
614      {
615    i->area(x1,y1,x2,y2);
616    if (ev.mouse_move.x>=x1 && ev.mouse_move.y>=y1 &&
617        ev.mouse_move.x<=x2 && ev.mouse_move.y<=y2)
618        in_area=i;
619      }
620      if (in_area!=m_active && (no_selections_allowed || (in_area && in_area->selectable())))
621      {
622    if (m_active)
623          m_active->draw(0,m_surf);
624
625    m_active=in_area;
626
627    if (m_active)
628      m_active->draw(1,m_surf);
629      }
630    }
631    if (ev.type==EV_KEY && ev.key==JK_TAB && m_active)
632    {
633      m_active->draw(0,m_surf);
634      do
635      {
636    m_active=m_active->next;
637    if (!m_active) m_active=m_first;
638      } while (m_active && !m_active->selectable());
639      m_active->draw(1,m_surf);
640    }
641  } else m_active=m_grab;
642
643  if (m_active)
644  {
645    if (ev.type!=EV_MOUSE_MOVE && ev.type!=EV_MOUSE_BUTTON)
646      m_active->handle_event(ev,m_surf,this);
647    else
648    {
649      m_active->area(x1,y1,x2,y2);
650      if (m_grab || (ev.mouse_move.x>=x1 && ev.mouse_move.y>=y1 &&
651          ev.mouse_move.x<=x2 && ev.mouse_move.y<=y2))
652      {
653    if (j)
654      m_active->handle_event(ev,m_surf,j->inm);
655    else m_active->handle_event(ev,m_surf,this);
656      }
657    }
658  }
659
660  if (j)
661    ev.mouse_move += j->m_pos;
662}
663
664void InputManager::allow_no_selections()
665{
666    no_selections_allowed=1;
667}
668
669void InputManager::redraw()
670{
671    ifield *i;
672    if(m_owner)
673        m_surf = m_owner->m_surf;
674    for(i = m_first; i; i = i->next)
675        i->draw_first(m_surf);
676    if(m_active)
677        m_active->draw(1, m_surf);
678}
679
680InputManager::InputManager(image *screen, ifield *first)
681{
682    no_selections_allowed = 0;
683    m_cur = NULL;
684    m_grab = NULL;
685    m_owner = NULL;
686    m_surf = screen;
687    m_active = m_first = first;
688    while(m_active && !m_active->selectable())
689        m_active = m_active->next;
690    if(m_surf)
691        redraw();
692}
693
694InputManager::InputManager(Jwindow *owner, ifield *first)
695{
696    no_selections_allowed = 0;
697    m_cur = NULL;
698    m_grab = NULL;
699    m_owner = owner;
700    m_surf = NULL;
701    m_active = m_first = first;
702    while(m_active && !m_active->selectable())
703        m_active = m_active->next;
704}
705
706void InputManager::grab_focus(ifield *i)
707{
708    m_grab = i;
709    if (m_cur)
710        wm->grab_focus(m_cur);
711}
712
713void InputManager::release_focus()
714{
715    m_grab = NULL;
716    if (m_cur)
717        wm->release_focus();
718}
719
720void InputManager::remap(Filter *f)
721{
722    for (ifield *i = m_first; i; i = i->next)
723        i->remap(f);
724    redraw();
725}
726
727void InputManager::add(ifield *i)
728{ ifield *f=m_first;
729  if (i->selectable())
730  {
731    if (!f)
732      m_first=i;
733    else
734    {
735      while (f->next) f=f->next;
736      f->next=i;
737    }
738  }
739}
740
741ifield *InputManager::get(int id)
742{
743  ifield *f;
744  for (f=m_first; f; f=f->next)
745  {
746    ifield *ret=f->find(id);
747    if (ret) return ret;
748  }
749  return NULL;
750}
751
752ifield::ifield()
753{
754    owner = NULL;
755    m_pos = vec2i(0, 0);
756    next = NULL;
757    id = 0;
758}
759
760ifield::~ifield()
761{
762    ;
763}
764
765/* re-position the control with respect to the "client" area of the window */
766void ifield::set_owner(Jwindow * newowner)
767{
768    if(owner)
769        Move(m_pos - vec2i(owner->x1(), owner->y1()));
770    owner = newowner;
771    if(owner)
772        Move(m_pos + vec2i(owner->x1(), owner->y1()));
773}
774
Note: See TracBrowser for help on using the repository browser.