Home » U++ Library support » Slider&ProgressIndicator » Please, add SetColor function to ProgressIndicator
Re: Please, add SetColor function to ProgressIndicator [message #12356 is a reply to message #12278] |
Fri, 26 October 2007 11:07 |
spidertp
Messages: 16 Registered: October 2007 Location: Poland
|
Promising Member |
|
|
So, I changed a little bit the ProgressIndicator class to change the color even in Xp Style.
The changes are?
1) in Progress.h
1a) added two more variables in protected:
Style XPstyle;
Image img;
1b) i made only the declaration of SetColor
void SetColor(Color& color);
1c) added two more functions in protected
void ChangeVChunk(Color& color);
void ChangeHChunk(Color& color);
2) in Progress.cpp
2a) added definition of SetColor:
if(GUI_GlobalStyle() >= GUISTYLE_XP && !percent) {
Size sz = GetSize();
if(sz.cy > sz.cx) {
ChangeVChunk(color);
}
else {
ChangeHChunk(color);
}
SetStyle(XPstyle);
}
else {
SColor = color;
}
2b) added definition of ChangeVChunk
void ProgressIndicator::ChangeVChunk(Color& color)
{
ImageBuffer ib(11,8);
// draw points in an ImageBuffer with specified color
for(int y=0; y<8; y++)
{
RGBA *l = ib[y];
for(int x=0; x<11; x++)
{
// the first and the last row must be white
if(y == 0 || y == 7)
{
*l = SWhite();
}
else if(x == 0 || x == 10) // the first and the last column must have alfa = 150
{
*l = color;
l->a = 150;
}
else // everything else must be set to user color with alfa = 200
{
*l = color;
l->a = 200;
}
l++;
}
}
// HotSpots - coordinates best for me
ib.SetHotSpot(Point(0,7));
ib.Set2ndSpot(Point(10,0));
// changing vchunk
Premultiply(ib);
img = ib;
XPstyle = ProgressIndicator::StyleDefault();
XPstyle.vchunk = img;
}
2c) added definition of ChangeHChunk
void ProgressIndicator::ChangeHChunk(Color& color)
{
ImageBuffer ib(8,11);
// draw points in an ImageBuffer with specified color
for(int y=0; y<11; y++)
{
RGBA *l = ib[y];
for(int x=0; x<8; x++)
{
// the first and the last row must be white
if(x == 0 || x == 7)
{
*l = SWhite();
}
else if(y == 0 || y == 10) // the first and the last column must have alfa = 150
{
*l = color;
l->a = 150;
}
else // everything else must be set to user color with alfa = 200
{
*l = color;
l->a = 200;
}
l++;
}
}
// HotSpots - coordinates best for me
ib.SetHotSpot(Point(7,0));
ib.Set2ndSpot(Point(0,10));
// changing hchunk
Premultiply(ib);
img = ib;
XPstyle = ProgressIndicator::StyleDefault();
XPstyle.hchunk = img;
}
The only thing is that bars are still too thin for me. Also, differences between ChangeVChunk and ChangeHChunk are very small and they can be merged.
What do you think?
Best regards,
Tomek
[Updated on: Fri, 26 October 2007 11:35] Report message to a moderator
|
|
|
|
|
Please, add SetColor function to ProgressIndicator
By: spidertp on Tue, 23 October 2007 13:09
|
|
|
Re: Please, add SetColor function to ProgressIndicator
By: mirek on Tue, 23 October 2007 18:16
|
|
|
Re: Please, add SetColor function to ProgressIndicator
By: spidertp on Tue, 23 October 2007 20:08
|
|
|
Re: Please, add SetColor function to ProgressIndicator
By: mirek on Tue, 23 October 2007 21:29
|
|
|
Re: Please, add SetColor function to ProgressIndicator
By: spidertp on Wed, 24 October 2007 07:41
|
|
|
Re: Please, add SetColor function to ProgressIndicator
By: mirek on Wed, 24 October 2007 13:29
|
|
|
Re: Please, add SetColor function to ProgressIndicator
By: mirek on Wed, 24 October 2007 13:50
|
|
|
Re: Please, add SetColor function to ProgressIndicator
By: spidertp on Wed, 24 October 2007 14:04
|
|
|
Re: Please, add SetColor function to ProgressIndicator
By: mrjt on Wed, 24 October 2007 16:37
|
|
|
Re: Please, add SetColor function to ProgressIndicator
By: spidertp on Thu, 25 October 2007 08:16
|
|
|
Re: Please, add SetColor function to ProgressIndicator
By: spidertp on Thu, 25 October 2007 08:24
|
|
|
Re: Please, add SetColor function to ProgressIndicator
By: spidertp on Fri, 26 October 2007 11:07
|
|
|
Re: Please, add SetColor function to ProgressIndicator
By: mirek on Fri, 26 October 2007 13:07
|
|
|
Re: Please, add SetColor function to ProgressIndicator
By: spidertp on Fri, 26 October 2007 13:19
|
|
|
Re: Please, add SetColor function to ProgressIndicator
By: mirek on Fri, 26 October 2007 14:18
|
|
|
Re: Please, add SetColor function to ProgressIndicator
By: piratalp on Fri, 26 October 2007 17:54
|
|
|
Re: Please, add SetColor function to ProgressIndicator
By: mirek on Sat, 27 October 2007 15:14
|
Goto Forum:
Current Time: Tue May 21 09:22:14 CEST 2024
Total time taken to generate the page: 0.02055 seconds
|