Coding to support IntelliSense

I'm working on a larger project to make Allegro5 simpler to use for myself. What I want to do is be able to setup a "palette" of colors that I can use with IntelliSense throughout my projects (i.e. type 'clr.' and a list appears of color constants), but at the same time, NOT be able to create new palettes.

My compiler is Microsoft Visual C++ 2010.

For example..

What I can do now...
1
2
3
4
5
6
 int main()
{
   window.BGColor(clr.RED);
   //..other code...
   return 0;
}


But I DON'T want to be able to do this...

1
2
3
4
5
6
7
 int main()
{
   colors new_palette;
   window.BGColor(new_palette.RED);
   //..other code...
   return 0;
}


This is what I have so far (the struct at the bottom is the important part)...

What I'm thinking is I need a way to make a private class instead of using the structure - not just the members of the class, but straight up - a class that can't be declared somewhere else. I'm pretty sure that's not possible, so I'm looking for other ideas/approaches??

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
	ALLEGRO_COLOR color(int r=0, int g=0, int b=0, int a=255) 
        { return al_map_rgba(r,g,b,a); }

	bool operator==(ALLEGRO_COLOR clr1, ALLEGRO_COLOR clr2)
	{
		return	clr1.r == clr2.r &&
			clr1.g == clr2.g &&
			clr1.b == clr2.b &&
			clr1.a == clr2.a;
	}
	bool operator!=(ALLEGRO_COLOR clr1, ALLEGRO_COLOR clr2) 
        { return !(clr1==clr2);	}

	struct colors{
		colors():RED(al_map_rgb(255,0,0)),
			GREEN(al_map_rgb(0,255,0)) {};
						
		ALLEGRO_COLOR RED;
		ALLEGRO_COLOR GREEN;
	}clr;
Why not use a 3rd party plugin like Visual Assist X ? VS 2010 default IntelliSense is crap compared to that.
VAX does look nice; hardly worth the price tag though. Either way, that doesn't really address my question.
Topic archived. No new replies allowed.