source: golgotha/src/i4/menu/boxmenu.cc @ 608

Last change on this file since 608 was 80, checked in by Sam Hocevar, 15 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 2.1 KB
RevLine 
[80]1/********************************************************************** <BR>
2  This file is part of Crack dot Com's free source code release of
3  Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
4  information about compiling & licensing issues visit this URL</a>
5  <PRE> If that doesn't help, contact Jonathan Clark at
6  golgotha_source@usa.net (Subject should have "GOLG" in it)
7***********************************************************************/
8
9#include "menu/boxmenu.hh"
10#include "image/image.hh"
11#include "window/style.hh"
12
13void i4_box_menu_class::show(i4_parent_window_class *show_on, i4_coord _x, i4_coord _y)
14{
15  if (parent)
16    i4_error("show called twice");
17
18  win_iter m=children.begin();
19  w16 hi=0,wi=0;
20  i4_coord dy=2,dx=2;
21
22  for (;m!=children.end();++m)
23  {
24    hi+=m->height();
25    if (m->width()>wi)
26      wi=m->width();
27
28    m->private_move(dx-(m->x()-x()),dy-(m->y()-y()));
29    dy+=m->height();
30  }
31   
32  for (m=children.begin(); m!=children.end(); ++m)
33    m->private_resize(wi, m->height());
34
35
36  resize(wi+4,hi+4);
37
38  show_on->add_child(_x,_y,this);
39}
40
41void i4_box_menu_class::hide()
42{
43  if (!parent)
44    return ;
45 
46  parent->remove_child(this);
47  parent=0;
48}
49
50
51void i4_box_menu_class::parent_draw(i4_draw_context_class &context)
52{
53  local_image->add_dirty(0,0,width()-1,height()-1,context);
54   
55  i4_color_hint_class::bevel *color;
56
57  color=&style->color_hint->window.passive;
58   
59  i4_color b,d,m=color->medium;
60  b=color->bright;
61  d=color->dark;
62
63
64  local_image->bar(0,0,width()-1,0,b,context);
65  local_image->bar(0,0,0,height()-1,b,context);   
66  local_image->bar(1,1,width()-2,1,m,context);
67  local_image->bar(1,1,1,height()-2,m,context);
68
69  local_image->bar(2,height()-2,width()-2,height()-2,d,context);
70  local_image->bar(width()-2,2,width()-2,height()-2,d,context);
71  local_image->bar(0,height()-1,width()-1,height()-1,style->color_hint->black,context);
72  local_image->bar(width()-1,0,width()-1,height()-1,style->color_hint->black,context);
73
74  local_image->bar(2,2,width()-3,height()-3,color->medium,context); 
75}
Note: See TracBrowser for help on using the repository browser.