~albyrock87/synapse-project/synapse-0.3.0

« back to all changes in this revision

Viewing changes to src/ui/gtk3-utils.vala

  • Committer: Alberto
  • Date: 2011-09-28 14:56:48 UTC
  • Revision ID: albyrock87+dev@gmail.com-20110928145648-hxx9d3a228pb2og7
SmartLabel, now smarter than before and gtk3 compliant

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
 
2
2
namespace Synapse.Gui.Utils
3
3
{
 
4
  public static void get_draw_position (out int x, out int y,
 
5
                                        out int width, out int height,
 
6
                                        Pango.Layout layout, bool rtl,
 
7
                                        int area_width, int area_height,
 
8
                                        float xalign, float yalign)
 
9
  {
 
10
    if (rtl) xalign = 1.0f - xalign;
 
11
 
 
12
    Pango.Rectangle logical_rect;
 
13
    layout.get_pixel_extents (null, out logical_rect);
 
14
    
 
15
    layout.get_pixel_size (out width, out height);
 
16
    
 
17
    y = (int) (yalign * (area_height - height));
 
18
    x = (int) (xalign * (area_width - width));
 
19
    
 
20
    if (rtl)
 
21
      x = int.min (x, area_width);
 
22
    else
 
23
      x = int.max (x, 0);
 
24
    x -= logical_rect.x;
 
25
  }
4
26
/*
5
27
  public static bool is_point_in_mask (Gtk.Widget w, int x, int y)
6
28
  {