File: tools.c

package info (click to toggle)
abuse 2.00-11
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 12,708 kB
  • ctags: 15,389
  • sloc: ansic: 115,852; cpp: 6,792; lisp: 2,066; sh: 1,734; makefile: 1,601; asm: 264
file content (46 lines) | stat: -rw-r--r-- 1,163 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "tools.hpp"



tool_picker::~tool_picker() 
{ delete old_pal; 
  delete map; 
  for (int i=0;i<total_icons;i++)
    delete icons[i];                   // delete visual object, which should be a "shell"  
}

void tool_picker::remap(palette *pal, window_manager *wm, image *screen)
{
  delete map;
  map=new filter(old_pal,pal);
  draw_first(screen,wm);
}

tool_picker::tool_picker(int X, int Y, int ID, 
	      int show_h, visual_object **Icons, int *Ids, int total_ic, 
			 palette *icon_palette, palette *pal, window_manager *wm, ifield *Next) :
  spicker(X,Y,ID,show_h,1,1,0,Next)
{
  iw=ih=0;
  icons=Icons;
  ids=Ids;
  total_icons=total_ic;
  for (int i=0;i<total_ic;i++)
  {
    if (icons[i]->width(wm)>iw) iw=icons[i]->width(wm);
    if (icons[i]->height(wm)>ih) ih=icons[i]->height(wm);
  }
  map=new filter(icon_palette,pal);
  old_pal=icon_palette->copy();
  reconfigure();
}

void tool_picker::draw_item(window_manager *wm, image *screen, int x, int y, int num, int active)
{
  if (!active)
    screen->bar(x,y,x+iw-1,y+ih-1,wm->black());
  else
    screen->bar(x,y,x+iw-1,y+ih-1,wm->bright_color());
  icons[num]->draw(screen,x,y,wm,map);
}