~didrocks/unity/fixes-natty-finale

702.3.1 by Michael Terry
add modelines and fix up some inconsistent tabbings
1
// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
572.5.2 by Jay Taoko
* Adding license to files
2
/*
3
 * Copyright (C) 2010 Canonical Ltd
4
 *
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.
8
 *
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.
13
 *
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/>.
16
 *
17
 * Authored by: Jay Taoko <jay.taoko@canonical.com>
18
 * Authored by: Mirco Müller <mirco.mueller@canonical.com
19
 */
20
572.1.11 by Neil Jagdish Patel
Import the work done so far with Compiz
21
#ifndef TOOLTIP_H
22
#define TOOLTIP_H
23
572.1.44 by jassmith at gmail
- Darken background of launcher
24
572.1.11 by Neil Jagdish Patel
Import the work done so far with Compiz
25
#include "Nux/Nux.h"
26
#include "Nux/BaseWindow.h"
572.1.26 by Didier Roche
build in distcheck (with system path) and with latest nux
27
#include "NuxGraphics/GraphicsEngine.h"
572.1.11 by Neil Jagdish Patel
Import the work done so far with Compiz
28
#include "Nux/TextureArea.h"
29
#include "NuxImage/CairoGraphics.h"
572.1.44 by jassmith at gmail
- Darken background of launcher
30
#include "StaticCairoText.h"
572.1.11 by Neil Jagdish Patel
Import the work done so far with Compiz
31
32
#include <pango/pango.h>
33
#include <pango/pangocairo.h>
34
652.2.1 by Jay Taoko
* Added introspection to Quiclist, tooltip and Launcher Icon
35
#include "Introspectable.h"
36
572.1.11 by Neil Jagdish Patel
Import the work done so far with Compiz
37
#if defined(NUX_OS_LINUX)
38
#include <X11/Xlib.h>
39
#endif
40
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 
45
#define RADIUS               5.0f
46
#define BLUR_INTENSITY       8
47
#define LINE_WIDTH           1.0f
48
#define PADDING_SIZE         1
49
#define H_MARGIN             30
50
#define V_MARGIN             4
51
#define FONT_FACE            "Ubuntu 13"
52
613.1.4 by Jay Taoko
* Using QuicklistMenuItemLabel instead of StaticCairoText in Quicklistview
53
class QuicklistMenuItem;
54
  
572.1.11 by Neil Jagdish Patel
Import the work done so far with Compiz
55
namespace nux
56
{
572.4.1 by Jay Taoko
* Added StaticCairoText files
57
  class VLayout;
58
  class HLayout;
59
  class SpaceLayout;
613.1.4 by Jay Taoko
* Using QuicklistMenuItemLabel instead of StaticCairoText in Quicklistview
60
652.2.1 by Jay Taoko
* Added introspection to Quiclist, tooltip and Launcher Icon
61
  class Tooltip : public BaseWindow, public Introspectable
572.1.11 by Neil Jagdish Patel
Import the work done so far with Compiz
62
  {
63
    NUX_DECLARE_OBJECT_TYPE (Tooltip, BaseWindow);
572.4.1 by Jay Taoko
* Added StaticCairoText files
64
  public:
65
    Tooltip ();
66
67
    ~Tooltip ();
68
69
    long ProcessEvent (IEvent& iEvent,
70
      long    traverseInfo,
71
      long    processEventInfo);
72
73
    void Draw (GraphicsEngine& gfxContext,
74
      bool             forceDraw);
75
76
    void DrawContent (GraphicsEngine& gfxContext,
77
      bool             forceDraw);
78
79
    void SetText (NString text);
80
605.1.1 by Jay Taoko
* Support for Quicklist
81
    void ShowTooltipWithTipAt (int anchor_tip_x, int anchor_tip_y);
652.2.1 by Jay Taoko
* Added introspection to Quiclist, tooltip and Launcher Icon
82
    
83
    // Introspection
84
    const gchar* GetName ();
85
    void AddProperties (GVariantBuilder *builder);
86
  
572.4.1 by Jay Taoko
* Added StaticCairoText files
87
  private:
613.1.2 by Jay Taoko
* TextRendering in QuicklistMenuItemLabel
88
    void RecvCairoTextChanged (StaticCairoText* cairo_text);
572.4.1 by Jay Taoko
* Added StaticCairoText files
89
90
    void PreLayoutManagement ();
91
92
    long PostLayoutManagement (long layoutResult);
93
94
    void PositionChildLayout (float offsetX,
95
      float offsetY);
96
97
    void LayoutWindowElements ();
98
99
    void NotifyConfigurationChange (int width,
100
      int height);
101
102
    //nux::CairoGraphics*   _cairo_graphics;
103
    int                   _anchorX;
104
    int                   _anchorY;
105
    nux::NString          _labelText;
106
    int                   _dpiX;
107
    int                   _dpiY;
605.1.1 by Jay Taoko
* Support for Quicklist
108
    int                   _top_size; // size of the segment from point 13 to 14. See figure in _compute_full_mask_path.
572.4.1 by Jay Taoko
* Added StaticCairoText files
109
110
    cairo_font_options_t* _fontOpts;
111
112
    nux::StaticCairoText* _tooltip_text;
113
    nux::BaseTexture*     _texture_bg;
114
    nux::BaseTexture*     _texture_mask;
115
    nux::BaseTexture*     _texture_outline;
116
117
    float _anchor_width;
118
    float _anchor_height;
119
    float _corner_radius;
120
    float _padding;
121
    nux::HLayout *_hlayout;
122
    VLayout *_vlayout;
123
    nux::SpaceLayout *_left_space;  //!< Space from the left of the widget to the left of the text.
124
    nux::SpaceLayout *_right_space; //!< Space from the right of the text to the right of the widget.
125
    nux::SpaceLayout *_top_space;  //!< Space from the left of the widget to the left of the text.
126
    nux::SpaceLayout *_bottom_space; //!< Space from the right of the text to the right of the widget.
127
128
    bool _cairo_text_has_changed;
129
    void UpdateTexture ();
652.2.1 by Jay Taoko
* Added introspection to Quiclist, tooltip and Launcher Icon
130
    
131
    // Introspection
132
    gchar *_name;
572.1.11 by Neil Jagdish Patel
Import the work done so far with Compiz
133
  };
134
}
135
136
#endif // TOOLTIP_H
137