Color backColor = background;
int isDefault = this.isDefault;
Font font;
+ int tw = 0, th = 0;
+ int bw = 0, bh = 0;
font = fontObject;
+ surface.TextFont(font);
+ if(text)
+ surface.TextExtent(text, strlen(text),&tw, &th);
if(bevelOver && checked)
offset = 1;
if(!isEnabled)
+ {
+ if(bitmaps[disabled]) buttonBitmap = bitmaps[disabled].bitmap;
state = disabled;
+ }
+
+ if(buttonBitmap && buttonStyle.bevelOver && !buttonStyle.checkBox && !buttonStyle.radio && text)
+ isDefault = 0;
// Background
- if((bevel || bevelOver) && opacity && backColor)
+ if((bevel /*|| bevelOver*/) && opacity && backColor)
{
if(!scaleBitmap || !buttonBitmap)
{
}
else
{
- if(bevel || offset)
- surface.Blit(buttonBitmap,
- (clientSize.w-buttonBitmap.width) /2 + offset,
- (clientSize.h-buttonBitmap.height)/2 + offset,
- 0,0,buttonBitmap.width,buttonBitmap.height);
+ int x, y;
+ bw = buttonBitmap.width;
+ bh = buttonBitmap.height;
+
+ if(bitmapAlignment == left || bitmapAlignment == right)
+ {
+ if(bitmapAlignment == left)
+ x = 2;
+ else
+ x = clientSize.w-bw-2;
+ y = (clientSize.h-bh)/2;
+ }
+ else if(bitmapAlignment == top || bitmapAlignment == bottom)
+ {
+ x = (clientSize.w-bw)/2;
+ if(bitmapAlignment == top)
+ y = 2;
+ else
+ y = clientSize.h-bh-2;
+ }
else
- surface.Blit(buttonBitmap,
- (clientSize.w-buttonBitmap.width)/2,
- (clientSize.h-buttonBitmap.height)/2,
- 0,0,buttonBitmap.width,buttonBitmap.height);
+ {
+ x = (clientSize.w-bw)/2;
+ y = (clientSize.h-bh - (int)(buttonStyle.bevelOver && text) * th)/2;
+ }
+ if(buttonStyle.bevel || buttonStyle.offset)
+ {
+ x += offset;
+ y += offset;
+ }
+ surface.Blit(buttonBitmap, x,y, 0,0, bw,bh);
}
}
}
// Text
surface.TextOpacity(false);
- surface.TextFont(font);
surface.SetForeground(foreground);
if(text)
{
{
int x, y = (clientSize.h - th - 1)/2 + offset;
+ if(buttonStyle.bevelOver && buttonBitmap && !buttonStyle.checkBox && !buttonStyle.radio)
+ {
+ if(bitmapAlignment == top)
+ y = (clientSize.h - bh - 4 - th - 5)/2 + offset + bh + 4;
+ else if(bitmapAlignment == bottom)
+ y = (clientSize.h - bh - 4 - th - 5)/2 + offset;
+ else//if(bitmapAlignment == left || bitmapAlignment == right)
+ y = clientSize.h - th - 5 + offset;
+ }
+ else
+ y = (clientSize.h - th - 1)/2 + offset;
+
if(ellipsis)
{
int width = clientSize.w - 2*6;
{
int width = clientSize.w - 2 * 6;
x = 6 + offset;
- if(isCheckbox || ((isRadio || bevelOver) && buttonBitmap))
+ if(bitmapAlignment == left || bitmapAlignment == right)
+ {
+ if(bitmapAlignment == left)
+ x += bw + 4;
+ width -= bw + 4;
+ }
+ if(isCheckbox || ((isRadio /*|| bevelOver*/) && buttonBitmap))
{
x += CAPTION_DISTANCE + 3;
}