android/GlueIOIOPort: fix spurious errors after IOIO baud rate change
[xcsoar.git] / src / Renderer / ButtonRenderer.cpp
blob3e633fb2b925954cdb757b6ed2d8b75d04cf0331
1 /*
2 Copyright_License {
4 XCSoar Glide Computer - http://www.xcsoar.org/
5 Copyright (C) 2000-2013 The XCSoar Project
6 A detailed list of copyright holders can be found in the file "AUTHORS".
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #include "ButtonRenderer.hpp"
25 #include "Screen/Color.hpp"
26 #include "Screen/Canvas.hpp"
27 #include "Screen/Pen.hpp"
28 #include "Look/ButtonLook.hpp"
30 void
31 ButtonRenderer::DrawButton(Canvas &canvas, PixelRect rc, bool focused,
32 bool pressed)
34 const ButtonLook::StateLook &_look = focused ? look.focused : look.standard;
36 canvas.DrawFilledRectangle(rc, _look.background_color);
38 canvas.Select(pressed ? _look.dark_border_pen : _look.light_border_pen);
39 canvas.DrawTwoLines(rc.left, rc.bottom - 2, rc.left, rc.top, rc.right - 2,
40 rc.top);
41 canvas.DrawTwoLines(rc.left + 1, rc.bottom - 3, rc.left + 1, rc.top + 1,
42 rc.right - 3, rc.top + 1);
44 canvas.Select(pressed ? _look.light_border_pen : _look.dark_border_pen);
45 canvas.DrawTwoLines(rc.left + 1, rc.bottom - 1, rc.right - 1, rc.bottom - 1,
46 rc.right - 1, rc.top + 1);
47 canvas.DrawTwoLines(rc.left + 2, rc.bottom - 2, rc.right - 2, rc.bottom - 2,
48 rc.right - 2, rc.top + 2);
51 PixelRect
52 ButtonRenderer::GetDrawingRect(PixelRect rc, bool pressed)
54 rc.Grow(-2);
55 if (pressed)
56 rc.Offset(1, 1);
58 return rc;