1
1
// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
3
* Copyright (C) 2010 Canonical Ltd
3
* Copyright (C) 2010-2012 Canonical Ltd
5
5
* This program is free software: you can redistribute it and/or modify
6
6
* it under the terms of the GNU General Public License version 3 as
15
15
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
* Authored by: Jay Taoko <jay.taoko@canonical.com>
18
* Authored by: Mirco Müller <mirco.mueller@canonical.com
18
* Mirco Müller <mirco.mueller@canonical.com
19
* Marco Trevisan (Treviño) <3v1n0@ubuntu.com>
25
25
#include <Nux/Nux.h>
26
26
#include <Nux/BaseWindow.h>
27
#include <NuxGraphics/GraphicsEngine.h>
28
#include <Nux/TextureArea.h>
29
#include <NuxImage/CairoGraphics.h>
27
#include <Nux/HLayout.h>
28
#include <Nux/VLayout.h>
30
#include "CairoBaseWindow.h"
30
31
#include "StaticCairoText.h"
32
#include <pango/pango.h>
33
#include <pango/pangocairo.h>
35
32
#include "Introspectable.h"
37
#if defined(NUX_OS_LINUX)
41
#define ANCHOR_WIDTH 10.0f
42
#define ANCHOR_HEIGHT 18.0f
43
#define HIGH_LIGHT_Y -30.0f
44
#define HIGH_LIGHT_MIN_WIDTH 200.0f
46
#define BLUR_INTENSITY 8
47
#define LINE_WIDTH 1.0f
48
#define PADDING_SIZE 1
51
#define FONT_FACE "Ubuntu 13"
53
class QuicklistMenuItem;
61
class Tooltip : public BaseWindow, public unity::debug::Introspectable
63
NUX_DECLARE_OBJECT_TYPE(Tooltip, BaseWindow);
36
class Tooltip : public CairoBaseWindow, public debug::Introspectable
38
NUX_DECLARE_OBJECT_TYPE(Tooltip, CairoBaseWindow);
69
void Draw(GraphicsEngine& gfxContext,
72
void DrawContent(GraphicsEngine& gfxContext,
75
void SetText(NString text);
42
void Draw(nux::GraphicsEngine& gfxContext, bool forceDraw);
43
void DrawContent(nux::GraphicsEngine& gfxContext, bool forceDraw);
45
void SetText(std::string const& text);
77
47
void ShowTooltipWithTipAt(int anchor_tip_x, int anchor_tip_y);
80
50
std::string GetName() const;
81
51
void AddProperties(GVariantBuilder* builder);
83
virtual Area* FindAreaUnderMouse(const Point& mouse_position, NuxEventType event_type);
53
virtual nux::Area* FindAreaUnderMouse(const nux::Point& mouse_position, nux::NuxEventType event_type);
86
void RecvCairoTextChanged(StaticCairoText* cairo_text);
56
void RecvCairoTextChanged(nux::StaticCairoText* cairo_text);
88
58
void PreLayoutManagement();
97
67
void NotifyConfigurationChange(int width,
100
//nux::CairoGraphics* _cairo_graphics;
103
nux::NString _labelText;
104
int _top_size; // size of the segment from point 13 to 14. See figure in _compute_full_mask_path.
106
nux::StaticCairoText* _tooltip_text;
107
nux::BaseTexture* _texture_bg;
108
nux::BaseTexture* _texture_mask;
109
nux::BaseTexture* _texture_outline;
112
float _anchor_height;
113
float _corner_radius;
72
std::string _labelText;
74
nux::ObjectPtr<nux::StaticCairoText> _tooltip_text;
115
76
nux::HLayout* _hlayout;
77
nux::VLayout* _vlayout;
117
78
nux::SpaceLayout* _left_space; //!< Space from the left of the widget to the left of the text.
118
79
nux::SpaceLayout* _right_space; //!< Space from the right of the text to the right of the widget.
119
80
nux::SpaceLayout* _top_space; //!< Space from the left of the widget to the left of the text.