Пример #1
0
void MAS::HyperText::Draw(Bitmap &canvas) {
    // get the button state
    int state = Disabled() ? 2 : ((Selected() || (Flags() & D_PRESSED)) ? 1 : (HasFocus() ? 3 : 0));

    // get the button colors and font
    Color fg = GetFontColor(state);
    Color bg = GetShadowColor(state);
    Font f = GetFont(state);
    Color textMode = GetTextMode();

    canvas.Clear(textMode);

    switch (state) {
    case 0:
    case 2:
        f.GUITextoutEx(canvas, text, 1, 1, fg, bg, textMode, 0);
        canvas.Hline(1, h()-3, w()-2, fg);
        break;

    case 1:
        f.GUITextoutEx(canvas, text, 2, 2, fg, bg, textMode, 0);
        canvas.DrawDottedRect(1, 1, w()-1, h()-1, skin->c_font);
        canvas.Hline(1, h()-2, w()-2, fg);
        break;

    case 3:
        f.GUITextoutEx(canvas, text, 1, 1, fg, bg, textMode, 0);
        canvas.DrawDottedRect(0, 0, w()-2, h()-2, skin->c_font);
        canvas.Hline(1, h()-3, w()-2, fg);
        break;
    };
}