#include "GL/Panel.h"
#include "GL/Font.h"
#include "GL/ImmediateMode.h"
BEGIN_NAMESPACE
Panel::Panel(int a_x, int a_y, int a_w, int a_h, const char* a_name)
: highlighted(false), x(a_x), y(a_y), w(a_w), h(a_h), name(a_name), background(0xd0f0f0f0)
{
}
void Panel::drawPanel()
{
const int shadowWidth = 8;
const int radius = 25;
for (int i = 0; i < shadowWidth; ++i)
glDrawFillRoundedRect((float)x-i, (float)y+20-i, (float)x+w+i, (float)y+h+i, (float)radius+i*2, 0x10000000);
glDrawFillRoundedRect((float)x, (float)y, (float)x+w, (float)y+h, (float)radius, background);
glDrawFillTitleBar((float)x, (float)y, (float)x+w, (float)y+radius+3, (float)radius, 0x20100820);
glDrawLine((float)x, (float)y+radius+3, (float)x+w, (float)y+radius+3, 0x20000000);
glDrawRoundedRect((float)x, (float)y, (float)x+w, (float)y+h, (float)radius, (highlighted) ? 0xc0ff901a : 0xa0202020);
glDrawShadowText(x+radius-6, y+radius-6, name);
}
void Panel::GetTitleBarArea(int &a_x, int &a_y, int &a_w, int &a_h)
{
a_x = x;
a_y = y;
a_w = w;
a_h = 26;
}
END_NAMESPACE