~3v1n0/unity/overlay-border-scale

« back to all changes in this revision

Viewing changes to plugins/unityshell/src/HudButton.h

  • Committer: Daniel van Vugt
  • Date: 2012-03-14 06:24:18 UTC
  • mfrom: (2108 unity)
  • mto: This revision was merged to the branch mainline in revision 2146.
  • Revision ID: daniel.van.vugt@canonical.com-20120314062418-nprucpbr0m7qky5e
MergedĀ latestĀ lp:unity

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2011 Canonical Ltd.
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify it
 
5
 * under the terms of the GNU Lesser General Public License version 3, as
 
6
 * published by the  Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful, but
 
9
 * WITHOUT ANY WARRANTY; without even the implied warranties of
 
10
 * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
 
11
 * PURPOSE.  See the applicable version of the GNU Lesser General Public
 
12
 * License for more details.
 
13
 *
 
14
 * You should have received a copy of both the GNU Lesser General Public
 
15
 * License version 3 along with this program.  If not, see
 
16
 * <http://www.gnu.org/licenses/>
 
17
 *
 
18
 * Authored by: Gordon Allott <gord.allott@canonical.com>
 
19
 *
 
20
 */
 
21
 
 
22
 
 
23
 
 
24
#ifndef FILTERBASICBUTTON_H
 
25
#define FILTERBASICBUTTON_H
 
26
 
 
27
#include <Nux/Nux.h>
 
28
#include <Nux/CairoWrapper.h>
 
29
#include <Nux/Button.h>
 
30
#include <Nux/TextureArea.h>
 
31
#include <UnityCore/Hud.h>
 
32
#include "Introspectable.h"
 
33
 
 
34
namespace unity {
 
35
namespace hud {
 
36
class HudButton : public nux::Button, public unity::debug::Introspectable 
 
37
{
 
38
  typedef nux::ObjectPtr<nux::BaseTexture> BaseTexturePtr;
 
39
public:
 
40
  typedef nux::ObjectPtr<HudButton> Ptr;
 
41
  HudButton (nux::TextureArea *image, NUX_FILE_LINE_PROTO);
 
42
  HudButton (const std::string label, NUX_FILE_LINE_PROTO);
 
43
  HudButton (const std::string label, nux::TextureArea *image, NUX_FILE_LINE_PROTO);
 
44
  HudButton (NUX_FILE_LINE_PROTO);
 
45
  virtual ~HudButton();
 
46
  
 
47
  void SetQuery(Query::Ptr query);
 
48
  std::shared_ptr<Query> GetQuery();
 
49
 
 
50
  nux::Property<std::string> label;
 
51
  nux::Property<std::string> hint;
 
52
  nux::Property<bool> is_rounded;
 
53
  nux::Property<bool> fake_focused;
 
54
protected:
 
55
 
 
56
  virtual bool AcceptKeyNavFocus();
 
57
  virtual long ComputeContentSize();
 
58
  virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
 
59
  virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
 
60
  virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw);
 
61
 
 
62
  std::string GetName() const;
 
63
  void AddProperties(GVariantBuilder* builder);
 
64
 
 
65
  void Init();
 
66
  void InitTheme ();
 
67
  void RedrawTheme(nux::Geometry const& geom, cairo_t* cr, nux::ButtonVisualState faked_state);
 
68
  typedef std::unique_ptr<nux::CairoWrapper> NuxCairoPtr;
 
69
 
 
70
  NuxCairoPtr prelight_;
 
71
  NuxCairoPtr active_;
 
72
  NuxCairoPtr normal_;
 
73
 
 
74
private:
 
75
  std::string label_;
 
76
 
 
77
  Query::Ptr query_;
 
78
  nux::Geometry cached_geometry_;
 
79
  bool is_focused_;
 
80
};
 
81
}
 
82
}
 
83
#endif // FILTERBASICBUTTON_H