Changeset 120 for abuse/trunk/src/imlib/jwindow.cpp
- Timestamp:
- Mar 17, 2008, 3:25:09 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
abuse/trunk/src/imlib/jwindow.cpp
r119 r120 39 39 40 40 // 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)41 int WindowManager::window_in_area(int x1, int y1, int x2, int y2) 42 { 43 for (Jwindow *f=first;f;f=f->next) 44 44 if (f->x<=x2 && f->y<=y2 && f->x+f->l-1>=x1 && f->y+f->h-1>=y1) 45 45 return 1; … … 47 47 } 48 48 49 void window_manager::grab_focus(jwindow *j)49 void WindowManager::grab_focus(Jwindow *j) 50 50 { grab=j; } 51 51 52 void window_manager::release_focus()52 void WindowManager::release_focus() 53 53 { grab=NULL; } 54 54 55 55 56 void window_manager::close_window(jwindow *j)56 void WindowManager::close_window(Jwindow *j) 57 57 { 58 58 delete j; 59 59 } 60 60 61 void window_manager::hide_windows()62 { 63 jwindow *p;61 void WindowManager::hide_windows() 62 { 63 Jwindow *p; 64 64 for (p=first;p;p=p->next) 65 65 { … … 72 72 } 73 73 74 void window_manager::show_windows()75 { 76 jwindow *p;74 void WindowManager::show_windows() 75 { 76 Jwindow *p; 77 77 for (p=first;p;p=p->next) 78 78 if (p->is_hidden()) … … 80 80 } 81 81 82 void window_manager::hide_window(jwindow *j)83 { 84 jwindow *k;82 void WindowManager::hide_window(Jwindow *j) 83 { 84 Jwindow *k; 85 85 if (j==first) 86 86 first=first->next; … … 98 98 } 99 99 100 void window_manager::show_window(jwindow *j)100 void WindowManager::show_window(Jwindow *j) 101 101 { 102 102 if (j->is_hidden()) … … 107 107 } 108 108 109 void window_manager::get_event(event &ev)110 { 111 jwindow *j;109 void WindowManager::get_event(event &ev) 110 { 111 Jwindow *j; 112 112 eh->get_event(ev); 113 113 if (ev.type==EV_KEY) … … 156 156 else 157 157 { 158 jwindow *last=first;158 Jwindow *last=first; 159 159 for (;last->next!=ev.window;last=last->next); 160 160 if (ev.window->next) … … 166 166 else 167 167 { 168 jwindow *last=first;168 Jwindow *last=first; 169 169 for (;last->next;last=last->next); 170 170 last->next=ev.window; … … 173 173 if (red) 174 174 { 175 jwindow *j=ev.window;175 Jwindow *j=ev.window; 176 176 /* screen->add_dirty(j->x,j->y,j->x+j->l-1,j->y+j->h-1); 177 177 for (p=first;p!=j;p=p->next) … … 216 216 } 217 217 218 void jwindow::resize(int L, int H)218 void Jwindow::resize(int L, int H) 219 219 { 220 220 screen->change_size(L,H); … … 222 222 } 223 223 224 void window_manager::resize_window(jwindow *j, int l, int h)225 { 226 jwindow *p;224 void WindowManager::resize_window(Jwindow *j, int l, int h) 225 { 226 Jwindow *p; 227 227 screen->add_dirty(j->x,j->y,j->x+j->l-1,j->y+j->h-1); 228 228 for (p=first;p!=j;p=p->next) … … 233 233 } 234 234 235 void window_manager::move_window(jwindow *j, int x, int y)235 void WindowManager::move_window(Jwindow *j, int x, int y) 236 236 { 237 237 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) 239 239 p->screen->add_dirty(j->x - p->x, j->y - p->y, j->x + j->l - 1 - p->x, 240 240 j->y + j->h - 1 - p->y); … … 244 244 } 245 245 246 window_manager::window_manager(image *Screen, palette *Pal, int Hi,247 246 WindowManager::WindowManager(image *Screen, palette *Pal, int Hi, 247 int Med, int Low, JCFont *Font) 248 248 { 249 249 wm = this; … … 257 257 } 258 258 259 window_manager::~window_manager()259 WindowManager::~WindowManager() 260 260 { 261 261 delete eh; … … 265 265 } 266 266 267 void window_manager::add_window(jwindow *win)267 void WindowManager::add_window(Jwindow *win) 268 268 { 269 269 if(!first) … … 271 271 else 272 272 { 273 jwindow *tmp = first;273 Jwindow *tmp = first; 274 274 while(tmp->next) 275 275 tmp = tmp->next; … … 279 279 } 280 280 281 void window_manager::remove_window(jwindow *win)281 void WindowManager::remove_window(Jwindow *win) 282 282 { 283 283 if(grab == win) … … 292 292 else 293 293 { 294 jwindow * search;294 Jwindow * search; 295 295 for(search = first; search->next != win; search = search->next) 296 296 search->screen->add_dirty(win->x - search->x, … … 308 308 } 309 309 310 jwindow * window_manager::new_window(int x, int y, int l, int h,310 Jwindow * WindowManager::new_window(int x, int y, int l, int h, 311 311 ifield * fields, char const *name) 312 312 { … … 316 316 y = screen->height () - 10; 317 317 318 jwindow * j = new jwindow (x, y, l, h, fields, name);318 Jwindow * j = new Jwindow (x, y, l, h, fields, name); 319 319 j->show(); 320 320 … … 322 322 } 323 323 324 void window_manager::flush_screen()325 { 326 jwindow *p,*q;324 void WindowManager::flush_screen() 325 { 326 Jwindow *p,*q; 327 327 328 328 int mx=0,my=0; … … 377 377 } 378 378 379 jwindow::jwindow(char const *name)379 Jwindow::Jwindow(char const *name) 380 380 { 381 381 _x1 = left_border(); … … 387 387 // property.flags = JWINDOW_NOAUTOHIDE_FLAG; 388 388 389 inm = new input_manager(this, NULL);389 inm = new InputManager(this, NULL); 390 390 reconfigure(); 391 391 … … 396 396 if(name) 397 397 _name = strcpy((char *)jmalloc(strlen(name) + 1, 398 " jwindow::window name"), name);398 "Jwindow::window name"), name); 399 399 wm->add_window(this); 400 400 } 401 401 402 jwindow::jwindow(int X, int Y, int L, int H, ifield *f, char const *name)402 Jwindow::Jwindow(int X, int Y, int L, int H, ifield *f, char const *name) 403 403 { 404 404 l = 0; … … 411 411 412 412 screen = NULL; 413 inm = new input_manager(screen, f);413 inm = new InputManager(screen, f); 414 414 reconfigure(); /* FIXME: TODO */ 415 415 … … 443 443 if(name) 444 444 _name = strcpy((char *)jmalloc(strlen(name) + 1, 445 " jwindow::window name"), name);445 "Jwindow::window name"), name); 446 446 447 447 wm->add_window(this); … … 450 450 } 451 451 452 jwindow::~jwindow()452 Jwindow::~Jwindow() 453 453 { 454 454 wm->remove_window(this); … … 461 461 } 462 462 463 void jwindow::reconfigure()463 void Jwindow::reconfigure() 464 464 { 465 465 int x1, y1, x2, y2; … … 478 478 } 479 479 480 void jwindow::local_close()480 void Jwindow::local_close() 481 481 { 482 482 ; 483 483 } 484 484 485 void jwindow::redraw()485 void Jwindow::redraw() 486 486 { 487 487 int hi = wm->bright_color (); … … 537 537 } 538 538 539 int jwindow::left_border()539 int Jwindow::left_border() 540 540 { 541 541 return frame_left(); 542 542 } 543 543 544 int jwindow::right_border()544 int Jwindow::right_border() 545 545 { 546 546 return frame_right(); 547 547 } 548 548 549 int jwindow::top_border()549 int Jwindow::top_border() 550 550 { 551 551 return wm->font()->height() + frame_top(); 552 552 } 553 553 554 int jwindow::bottom_border()554 int Jwindow::bottom_border() 555 555 { 556 556 return frame_bottom(); … … 558 558 559 559 560 ifield * input_manager::unlink(int id) // unlinks ID from fields list and return the pointer to it560 ifield *InputManager::unlink(int id) // unlinks ID from fields list and return the pointer to it 561 561 { 562 562 for (ifield *i=first,*last=NULL;i;i=i->next) … … 579 579 } 580 580 581 input_manager::~input_manager()581 InputManager::~InputManager() 582 582 { ifield *i; 583 583 while (first) … … 588 588 } 589 589 590 void input_manager::clear_current()590 void InputManager::clear_current() 591 591 { 592 592 if(owner) … … 597 597 } 598 598 599 void input_manager::handle_event(event &ev, jwindow *j)599 void InputManager::handle_event(event &ev, Jwindow *j) 600 600 { 601 601 ifield *i,*in_area=NULL; … … 670 670 } 671 671 672 void input_manager::allow_no_selections()672 void InputManager::allow_no_selections() 673 673 { 674 674 no_selections_allowed=1; 675 675 } 676 676 677 void input_manager::redraw()677 void InputManager::redraw() 678 678 { 679 679 ifield *i; … … 686 686 } 687 687 688 input_manager::input_manager(image *Screen, ifield *First)688 InputManager::InputManager(image *Screen, ifield *First) 689 689 { 690 690 no_selections_allowed = 0; … … 700 700 } 701 701 702 input_manager::input_manager(jwindow *Owner, ifield *First)702 InputManager::InputManager(Jwindow *Owner, ifield *First) 703 703 { 704 704 no_selections_allowed = 0; … … 712 712 } 713 713 714 void input_manager::grab_focus(ifield *i)714 void InputManager::grab_focus(ifield *i) 715 715 { grab=i; 716 716 if (cur) … … 718 718 } 719 719 720 void input_manager::release_focus()720 void InputManager::release_focus() 721 721 { grab=NULL; 722 722 if (cur) … … 724 724 } 725 725 726 void input_manager::remap(filter *f)726 void InputManager::remap(filter *f) 727 727 { 728 728 for (ifield *i=first;i;i=i->next) … … 731 731 } 732 732 733 void input_manager::add(ifield *i)733 void InputManager::add(ifield *i) 734 734 { ifield *f=first; 735 735 if (i->selectable()) … … 745 745 } 746 746 747 ifield * input_manager::get(int id)747 ifield *InputManager::get(int id) 748 748 { 749 749 ifield *f; … … 771 771 772 772 /* re-position the control with respect to the "client" area of the window */ 773 void ifield::set_owner( jwindow * newowner)773 void ifield::set_owner(Jwindow * newowner) 774 774 { 775 775 if(owner)
Note: See TracChangeset
for help on using the changeset viewer.