1
// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
3
* Copyright (C) 2010-2012 Canonical Ltd
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 3 as
7
* published by the Free Software Foundation.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
* Authored by: Mirco Müller <mirco.mueller@canonical.com>
18
* Jay Taoko <jay.taoko@canonical.com>
19
* Marco Trevisan <marco.trevisan@canonical.com>
22
#include "unity-shared/CairoTexture.h"
23
#include "QuicklistMenuItemLabel.h"
28
QuicklistMenuItemLabel::QuicklistMenuItemLabel(glib::Object<DbusmenuMenuitem> const& item, NUX_FILE_LINE_DECL)
29
: QuicklistMenuItem(QuicklistMenuItemType::LABEL, item, NUX_FILE_LINE_PARAM)
34
std::string QuicklistMenuItemLabel::GetDefaultText() const
39
std::string QuicklistMenuItemLabel::GetName() const
41
return "QuicklistMenuItemLabel";
44
void QuicklistMenuItemLabel::UpdateTexture()
46
int width = GetBaseWidth();
47
int height = GetBaseHeight();
49
nux::CairoGraphics cairoGraphics(CAIRO_FORMAT_ARGB32, width, height);
50
std::shared_ptr<cairo_t> cairo_context(cairoGraphics.GetContext(), cairo_destroy);
51
cairo_t* cr = cairo_context.get();
53
// draw normal, unchecked version
54
cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
57
DrawText(cairoGraphics, width, height, nux::color::White);
59
_normalTexture[0].Adopt(texture_from_cairo_graphics(cairoGraphics));
61
// draw active/prelight, unchecked version
62
cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
65
DrawPrelight(cairoGraphics, width, height, nux::color::White);
66
DrawText(cairoGraphics, width, height, nux::color::White * 0.0f);
68
_prelightTexture[0].Adopt(texture_from_cairo_graphics(cairoGraphics));