~om26er/ubuntu/oneiric/unity/sru-778256

« back to all changes in this revision

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

  • Committer: Didier Roche
  • Date: 2011-07-21 16:17:59 UTC
  • mfrom: (55.813.3 upstream)
  • Revision ID: didier.roche@canonical.com-20110721161759-osmh94x428t2bf2b
* New upstream release.
* debian/control:
  - build-dep on libnotify-dev
  - bump libnux-1.0-dev dep for ABI break

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
#define ANCHOR_WIDTH         10.0f
42
42
#define ANCHOR_HEIGHT        18.0f
43
43
#define HIGH_LIGHT_Y         -30.0f
44
 
#define HIGH_LIGHT_MIN_WIDTH 200.0f 
 
44
#define HIGH_LIGHT_MIN_WIDTH 200.0f
45
45
#define RADIUS               5.0f
46
46
#define BLUR_INTENSITY       8
47
47
#define LINE_WIDTH           1.0f
51
51
#define FONT_FACE            "Ubuntu 13"
52
52
 
53
53
class QuicklistMenuItem;
54
 
  
 
54
 
55
55
namespace nux
56
56
{
57
 
  class VLayout;
58
 
  class HLayout;
59
 
  class SpaceLayout;
60
 
 
61
 
  class Tooltip : public BaseWindow, public Introspectable
62
 
  {
63
 
    NUX_DECLARE_OBJECT_TYPE (Tooltip, BaseWindow);
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
 
 
81
 
    void ShowTooltipWithTipAt (int anchor_tip_x, int anchor_tip_y);
82
 
    
83
 
    // Introspection
84
 
    const gchar* GetName ();
85
 
    void AddProperties (GVariantBuilder *builder);
86
 
  
87
 
  private:
88
 
    void RecvCairoTextChanged (StaticCairoText* cairo_text);
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;
108
 
    int                   _top_size; // size of the segment from point 13 to 14. See figure in _compute_full_mask_path.
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 ();
130
 
    
131
 
    // Introspection
132
 
    gchar *_name;
133
 
 
134
 
    sigc::connection _on_text_changed_connection;
135
 
    sigc::connection _on_font_changed_connection;
136
 
  };
 
57
class VLayout;
 
58
class HLayout;
 
59
class SpaceLayout;
 
60
 
 
61
class Tooltip : public BaseWindow, public unity::Introspectable
 
62
{
 
63
  NUX_DECLARE_OBJECT_TYPE(Tooltip, BaseWindow);
 
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
 
 
81
  void ShowTooltipWithTipAt(int anchor_tip_x, int anchor_tip_y);
 
82
 
 
83
  // Introspection
 
84
  const gchar* GetName();
 
85
  void AddProperties(GVariantBuilder* builder);
 
86
 
 
87
private:
 
88
  void RecvCairoTextChanged(StaticCairoText* cairo_text);
 
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;
 
108
  int                   _top_size; // size of the segment from point 13 to 14. See figure in _compute_full_mask_path.
 
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();
 
130
 
 
131
  // Introspection
 
132
  gchar* _name;
 
133
};
137
134
}
138
135
 
139
136
#endif // TOOLTIP_H