File: IconBag.ec

package info (click to toggle)
ecere-sdk 0.44.15-1
  • links: PTS
  • area: main
  • in suites: sid, stretch
  • size: 97,712 kB
  • ctags: 54,695
  • sloc: ansic: 593,042; makefile: 12,250; yacc: 4,955; lex: 707; objc: 259; python: 252; xml: 102
file content (72 lines) | stat: -rw-r--r-- 1,259 bytes parent folder | download | duplicates (2)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#ifdef BUILDING_ECERE_COM
namespace gui::controls;
import "Window"
import "Array"
#else
#ifdef ECERE_STATIC
public import static "ecere"
#else
public import "ecere"
#endif
#endif

public class IconBag<class TT>
{
public:
   Window window;
   bool alphaBlend;

   Array<char *> iconNames { };
   property Container<char *> iconNames
   {
      set
      {
         iconNames.Copy((void *)value);  // TOFIX: Warning without the void * cast
      }
   }

   Array<BitmapResource> icons { };

   void Load()
   {
      int i;
      icons.RemoveAll();
      for(i = 0; i < iconNames.count; i++)
      {
         char * s = iconNames[i];
         BitmapResource br = BitmapResource { iconNames[i], alphaBlend = alphaBlend };
         //Bitmap b = br.bitmap;
         window.AddResource(br);
         //b = br.bitmap;
         icons.Add(br);
      }
   }

   void Unload()
   {
      icons.RemoveAll();
   }

   char * GetIconName(TT icon)
   {
      int i = (int)icon;
      return i <= iconNames.count ? iconNames[(int)icon] : null;
   }

   /*
   BitmapResource GetIcon(TT icon)
   {
      int i = (int)icon;
      return icons[i];
   }
   */

   /*
   ~IconBag()
   {
      //window = null;
      //icons.RemoveAll();
      //iconNames.RemoveAll();
   }
   */
}