1
// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
3
* Copyright 2011 Canonical Ltd.
5
* This program is free software: you can redistribute it and/or modify it
6
* under the terms of the GNU Lesser 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, but
10
* WITHOUT ANY WARRANTY; without even the implied warranties of
11
* MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
12
* PURPOSE. See the applicable version of the GNU Lesser General Public
13
* License for more details.
15
* You should have received a copy of both the GNU Lesser General Public
16
* License version 3 along with this program. If not, see
17
* <http://www.gnu.org/licenses/>
19
* Authored by: Nick Dedekind <nick.dedekind@canonical.com>
23
#ifndef ACTIONBUTTON_H
24
#define ACTIONBUTTON_H
27
#include <Nux/CairoWrapper.h>
28
#include <Nux/AbstractButton.h>
32
class StaticCairoText;
42
class ActionButton : public nux::AbstractButton
45
ActionButton(std::string const& label, std::string const& icon_hint, NUX_FILE_LINE_PROTO);
48
sigc::signal<void, ActionButton*> click;
50
void SetFont(std::string const& font_hint);
56
virtual long ComputeContentSize();
57
virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
58
virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw) {}
59
virtual void RecvClick(int x, int y, unsigned long button_flags, unsigned long key_flags);
63
void RedrawTheme(nux::Geometry const& geom, cairo_t* cr, nux::ButtonVisualState faked_state);
64
void RedrawFocusOverlay(nux::Geometry const& geom, cairo_t* cr);
66
void BuildLayout(std::string const& label, std::string const& icon_hint);
69
typedef std::unique_ptr<nux::CairoWrapper> NuxCairoPtr;
71
NuxCairoPtr cr_prelight_;
72
NuxCairoPtr cr_active_;
73
NuxCairoPtr cr_normal_;
74
NuxCairoPtr cr_focus_;
76
nux::Geometry cached_geometry_;
78
std::string icon_hint_;
79
std::string font_hint_;
81
nux::ObjectPtr<IconTexture> image_;
82
nux::ObjectPtr<nux::StaticCairoText> static_text_;
88
#endif // ACTIONBUTTON_H