2
* Copyright (C) 2010 Canonical Ltd
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 3 as
6
* published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Authored by: Jay Taoko <jay.taoko@canonical.com>
17
* Authored by: Mirco Müller <mirco.mueller@canonical.com
25
#include "Nux/BaseWindow.h"
26
#include "NuxGraphics/GraphicsEngine.h"
27
#include "Nux/TextureArea.h"
28
#include "NuxImage/CairoGraphics.h"
29
#include "StaticCairoText.h"
31
#include <pango/pango.h>
32
#include <pango/pangocairo.h>
34
#if defined(NUX_OS_LINUX)
38
#define ANCHOR_WIDTH 10.0f
39
#define ANCHOR_HEIGHT 18.0f
40
#define HIGH_LIGHT_Y -30.0f
41
#define HIGH_LIGHT_MIN_WIDTH 200.0f
43
#define BLUR_INTENSITY 8
44
#define LINE_WIDTH 1.0f
45
#define PADDING_SIZE 1
48
#define FONT_FACE "Ubuntu 13"
56
class Tooltip : public BaseWindow
58
NUX_DECLARE_OBJECT_TYPE (Tooltip, BaseWindow);
64
long ProcessEvent (IEvent& iEvent,
66
long processEventInfo);
68
void Draw (GraphicsEngine& gfxContext,
71
void DrawContent (GraphicsEngine& gfxContext,
74
void SetText (NString text);
77
void RecvCairoTextChanged (StaticCairoText& cairo_text);
79
void PreLayoutManagement ();
81
long PostLayoutManagement (long layoutResult);
83
void PositionChildLayout (float offsetX,
86
void LayoutWindowElements ();
88
void NotifyConfigurationChange (int width,
91
//nux::CairoGraphics* _cairo_graphics;
94
nux::NString _labelText;
98
cairo_font_options_t* _fontOpts;
100
nux::StaticCairoText* _tooltip_text;
101
nux::BaseTexture* _texture_bg;
102
nux::BaseTexture* _texture_mask;
103
nux::BaseTexture* _texture_outline;
106
float _anchor_height;
107
float _corner_radius;
109
nux::HLayout *_hlayout;
111
nux::SpaceLayout *_left_space; //!< Space from the left of the widget to the left of the text.
112
nux::SpaceLayout *_right_space; //!< Space from the right of the text to the right of the widget.
113
nux::SpaceLayout *_top_space; //!< Space from the left of the widget to the left of the text.
114
nux::SpaceLayout *_bottom_space; //!< Space from the right of the text to the right of the widget.
116
bool _cairo_text_has_changed;
117
void UpdateTexture ();