Ignore:
Timestamp:
Mar 17, 2008, 3:25:09 AM (12 years ago)
Author:
Sam Hocevar
Message:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • abuse/trunk/src/imlib/jwindow.cpp

    r119 r120  
    3939
    4040 // true if a window lies in this area
    41 int window_manager::window_in_area(int x1, int y1, int x2, int y2)
    42 {
    43   for (jwindow *f=first;f;f=f->next)
     41int WindowManager::window_in_area(int x1, int y1, int x2, int y2)
     42{
     43  for (Jwindow *f=first;f;f=f->next)
    4444    if (f->x<=x2 && f->y<=y2 && f->x+f->l-1>=x1 && f->y+f->h-1>=y1)
    4545      return 1;
     
    4747}
    4848
    49 void window_manager::grab_focus(jwindow *j)
     49void WindowManager::grab_focus(Jwindow *j)
    5050{ grab=j; }
    5151
    52 void window_manager::release_focus()
     52void WindowManager::release_focus()
    5353{ grab=NULL; }
    5454
    5555
    56 void window_manager::close_window(jwindow *j)
     56void WindowManager::close_window(Jwindow *j)
    5757{
    5858    delete j;
    5959}
    6060
    61 void window_manager::hide_windows()
    62 {
    63   jwindow *p;
     61void WindowManager::hide_windows()
     62{
     63  Jwindow *p;
    6464  for (p=first;p;p=p->next)
    6565  {
     
    7272}
    7373
    74 void window_manager::show_windows()
    75 {
    76   jwindow *p;
     74void WindowManager::show_windows()
     75{
     76  Jwindow *p;
    7777  for (p=first;p;p=p->next)
    7878    if (p->is_hidden())
     
    8080}
    8181
    82 void window_manager::hide_window(jwindow *j)
    83 {
    84   jwindow *k;
     82void WindowManager::hide_window(Jwindow *j)
     83{
     84  Jwindow *k;
    8585  if (j==first)
    8686    first=first->next;
     
    9898}
    9999
    100 void window_manager::show_window(jwindow *j)
     100void WindowManager::show_window(Jwindow *j)
    101101{
    102102  if (j->is_hidden())
     
    107107}
    108108
    109 void window_manager::get_event(event &ev)
    110 {
    111   jwindow *j;
     109void WindowManager::get_event(event &ev)
     110{
     111  Jwindow *j;
    112112  eh->get_event(ev);
    113113  if (ev.type==EV_KEY)
     
    156156        else
    157157        {
    158           jwindow *last=first;
     158          Jwindow *last=first;
    159159          for (;last->next!=ev.window;last=last->next);
    160160          if (ev.window->next)
     
    166166        else
    167167        {
    168           jwindow *last=first;
     168          Jwindow *last=first;
    169169          for (;last->next;last=last->next);
    170170          last->next=ev.window;
     
    173173        if (red)
    174174        {
    175           jwindow *j=ev.window;
     175          Jwindow *j=ev.window;
    176176/*        screen->add_dirty(j->x,j->y,j->x+j->l-1,j->y+j->h-1);
    177177          for (p=first;p!=j;p=p->next)
     
    216216}
    217217
    218 void jwindow::resize(int L, int H)
     218void Jwindow::resize(int L, int H)
    219219{
    220220  screen->change_size(L,H);
     
    222222}
    223223
    224 void window_manager::resize_window(jwindow *j, int l, int h)
    225 {
    226   jwindow *p;
     224void WindowManager::resize_window(Jwindow *j, int l, int h)
     225{
     226  Jwindow *p;
    227227  screen->add_dirty(j->x,j->y,j->x+j->l-1,j->y+j->h-1);
    228228  for (p=first;p!=j;p=p->next)
     
    233233}
    234234
    235 void window_manager::move_window(jwindow *j, int x, int y)
     235void WindowManager::move_window(Jwindow *j, int x, int y)
    236236{
    237237    screen->add_dirty(j->x, j->y, j->x + j->l - 1, j->y + j->h - 1);
    238     for(jwindow *p = first; p != j; p = p->next)
     238    for(Jwindow *p = first; p != j; p = p->next)
    239239        p->screen->add_dirty(j->x - p->x, j->y - p->y, j->x + j->l - 1 - p->x,
    240240                             j->y + j->h - 1 - p->y);
     
    244244}
    245245
    246 window_manager::window_manager(image *Screen, palette *Pal, int Hi,
    247                                int Med, int Low, JCFont *Font)
     246WindowManager::WindowManager(image *Screen, palette *Pal, int Hi,
     247                              int Med, int Low, JCFont *Font)
    248248{
    249249    wm = this;
     
    257257}
    258258
    259 window_manager::~window_manager()
     259WindowManager::~WindowManager()
    260260{
    261261    delete eh;
     
    265265}
    266266
    267 void window_manager::add_window(jwindow *win)
     267void WindowManager::add_window(Jwindow *win)
    268268{
    269269    if(!first)
     
    271271    else
    272272    {
    273         jwindow *tmp = first;
     273        Jwindow *tmp = first;
    274274        while(tmp->next)
    275275            tmp = tmp->next;
     
    279279}
    280280
    281 void window_manager::remove_window(jwindow *win)
     281void WindowManager::remove_window(Jwindow *win)
    282282{
    283283    if(grab == win)
     
    292292    else
    293293    {
    294         jwindow * search;
     294        Jwindow * search;
    295295        for(search = first; search->next != win; search = search->next)
    296296            search->screen->add_dirty(win->x - search->x,
     
    308308}
    309309
    310 jwindow * window_manager::new_window(int x, int y, int l, int h,
     310Jwindow * WindowManager::new_window(int x, int y, int l, int h,
    311311                                     ifield * fields, char const *name)
    312312{
     
    316316        y = screen->height () - 10;
    317317 
    318     jwindow * j = new jwindow (x, y, l, h, fields, name);
     318    Jwindow * j = new Jwindow (x, y, l, h, fields, name);
    319319    j->show();
    320320
     
    322322}
    323323
    324 void window_manager::flush_screen()
    325 {
    326   jwindow *p,*q;
     324void WindowManager::flush_screen()
     325{
     326  Jwindow *p,*q;
    327327
    328328  int mx=0,my=0;
     
    377377}
    378378
    379 jwindow::jwindow(char const *name)
     379Jwindow::Jwindow(char const *name)
    380380{
    381381    _x1 = left_border();
     
    387387    // property.flags = JWINDOW_NOAUTOHIDE_FLAG;
    388388
    389     inm = new input_manager(this, NULL);
     389    inm = new InputManager(this, NULL);
    390390    reconfigure();
    391391
     
    396396    if(name)
    397397        _name = strcpy((char *)jmalloc(strlen(name) + 1,
    398                                        "jwindow::window name"), name);
     398                                       "Jwindow::window name"), name);
    399399    wm->add_window(this);
    400400}
    401401
    402 jwindow::jwindow(int X, int Y, int L, int H, ifield *f, char const *name)
     402Jwindow::Jwindow(int X, int Y, int L, int H, ifield *f, char const *name)
    403403{
    404404    l = 0;
     
    411411
    412412    screen = NULL;
    413     inm = new input_manager(screen, f);
     413    inm = new InputManager(screen, f);
    414414    reconfigure(); /* FIXME: TODO */
    415415
     
    443443    if(name)
    444444        _name = strcpy((char *)jmalloc(strlen(name) + 1,
    445                                        "jwindow::window name"), name);
     445                                       "Jwindow::window name"), name);
    446446
    447447    wm->add_window(this);
     
    450450}
    451451
    452 jwindow::~jwindow()
     452Jwindow::~Jwindow()
    453453{
    454454    wm->remove_window(this);
     
    461461}
    462462
    463 void jwindow::reconfigure()
     463void Jwindow::reconfigure()
    464464{
    465465    int x1, y1, x2, y2;
     
    478478}
    479479
    480 void jwindow::local_close()
     480void Jwindow::local_close()
    481481{
    482482    ;
    483483}
    484484
    485 void jwindow::redraw()
     485void Jwindow::redraw()
    486486{
    487487    int hi = wm->bright_color ();
     
    537537}
    538538
    539 int jwindow::left_border()
     539int Jwindow::left_border()
    540540{
    541541    return frame_left();
    542542}
    543543
    544 int jwindow::right_border()
     544int Jwindow::right_border()
    545545{
    546546    return frame_right();
    547547}
    548548
    549 int jwindow::top_border()
     549int Jwindow::top_border()
    550550{
    551551    return wm->font()->height() + frame_top();
    552552}
    553553
    554 int jwindow::bottom_border()
     554int Jwindow::bottom_border()
    555555{
    556556    return frame_bottom();
     
    558558
    559559
    560 ifield *input_manager::unlink(int id)     // unlinks ID from fields list and return the pointer to it
     560ifield *InputManager::unlink(int id)     // unlinks ID from fields list and return the pointer to it
    561561{
    562562  for (ifield *i=first,*last=NULL;i;i=i->next)
     
    579579}
    580580
    581 input_manager::~input_manager()
     581InputManager::~InputManager()
    582582{ ifield *i;
    583583  while (first)
     
    588588}
    589589
    590 void input_manager::clear_current()
     590void InputManager::clear_current()
    591591{
    592592    if(owner)
     
    597597}
    598598
    599 void input_manager::handle_event(event &ev, jwindow *j)
     599void InputManager::handle_event(event &ev, Jwindow *j)
    600600{
    601601  ifield *i,*in_area=NULL;
     
    670670}
    671671
    672 void input_manager::allow_no_selections()
     672void InputManager::allow_no_selections()
    673673{
    674674  no_selections_allowed=1;
    675675}
    676676
    677 void input_manager::redraw()
     677void InputManager::redraw()
    678678{
    679679    ifield *i;
     
    686686}
    687687
    688 input_manager::input_manager(image *Screen, ifield *First)
     688InputManager::InputManager(image *Screen, ifield *First)
    689689{
    690690    no_selections_allowed = 0;
     
    700700}
    701701
    702 input_manager::input_manager(jwindow *Owner, ifield *First)
     702InputManager::InputManager(Jwindow *Owner, ifield *First)
    703703{
    704704    no_selections_allowed = 0;
     
    712712}
    713713
    714 void input_manager::grab_focus(ifield *i)
     714void InputManager::grab_focus(ifield *i)
    715715{ grab=i;
    716716  if (cur)
     
    718718}
    719719
    720 void input_manager::release_focus()
     720void InputManager::release_focus()
    721721{ grab=NULL;
    722722  if (cur)
     
    724724}
    725725
    726 void input_manager::remap(filter *f)
     726void InputManager::remap(filter *f)
    727727{
    728728  for (ifield *i=first;i;i=i->next)
     
    731731}
    732732
    733 void input_manager::add(ifield *i)
     733void InputManager::add(ifield *i)
    734734{ ifield *f=first;
    735735  if (i->selectable())
     
    745745}
    746746
    747 ifield *input_manager::get(int id)
     747ifield *InputManager::get(int id)
    748748{
    749749  ifield *f;
     
    771771
    772772/* re-position the control with respect to the "client" area of the window */
    773 void ifield::set_owner(jwindow * newowner)
     773void ifield::set_owner(Jwindow * newowner)
    774774{
    775775    if(owner)
Note: See TracChangeset for help on using the changeset viewer.