~canonical-dx-team/unity/unity.fix-ql-losing-focus

« back to all changes in this revision

Viewing changes to src/PlacesGroup.cpp

  • Committer: Neil Jagdish Patel
  • Date: 2011-02-09 12:24:11 UTC
  • mto: (831.4.2 unity.fix-scrolling)
  • mto: This revision was merged to the branch mainline in revision 844.
  • Revision ID: neil.patel@canonical.com-20110209122411-5bk6xej9p7xlzs83
Lots of fixes in views

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
  //~ OnMouseLeave.connect (sigc::mem_fun (this, &PlacesGroup::RecvMouseLeave));
52
52
 
53
53
  _label = new nux::StaticCairoText ("", NUX_TRACKER_LOCATION);
54
 
  _label->SinkReference ();
55
54
  _label->SetFont ("Ubuntu normal 11");
56
55
  _label->SetTextEllipsize (nux::StaticCairoText::NUX_ELLIPSIZE_END);
57
56
  _label->SetTextAlignment (nux::StaticCairoText::NUX_ALIGN_LEFT);
59
58
  _label->SetMinimumWidth (1);
60
59
 
61
60
  _title = new nux::StaticCairoText ("", NUX_TRACKER_LOCATION);
62
 
  _title->SinkReference ();
63
61
  _title->SetFont ("Ubuntu normal 11");
64
62
  _title->SetTextEllipsize (nux::StaticCairoText::NUX_ELLIPSIZE_END);
65
63
  _title->SetTextAlignment (nux::StaticCairoText::NUX_ALIGN_RIGHT);
67
65
  _title->SetMinimumWidth (1);
68
66
 
69
67
  _header_layout = new nux::HLayout ("", NUX_TRACKER_LOCATION);
70
 
  _header_layout->SinkReference ();
71
68
 
72
69
  _header_layout->AddView (_title, 0, nux::MINOR_POSITION_TOP, nux::MINOR_SIZE_FULL);
73
70
  _header_layout->AddSpace (1, 1);
76
73
  // _header_layout->AddView (_label, 0, nux::MINOR_POSITION_TOP, nux::MINOR_SIZE_FULL);
77
74
 
78
75
  _group_layout = new nux::VLayout ("", NUX_TRACKER_LOCATION);
79
 
  _group_layout->SinkReference ();
80
76
 
81
77
  _group_layout->AddLayout (_header_layout, 0, nux::MINOR_POSITION_TOP, nux::MINOR_SIZE_FULL);
82
78
 
93
89
 
94
90
PlacesGroup::~PlacesGroup ()
95
91
{
96
 
  _label->UnReference ();
97
 
  _title->UnReference ();
98
 
 
99
92
  g_free (_title_string);
100
93
 
101
94
  _group_layout->RemoveChildObject (_header_layout);
103
96
  if (_content != NULL)
104
97
  {
105
98
    _group_layout->RemoveChildObject (_content);
106
 
    _content->UnReference ();
107
99
  }
108
 
 
109
 
  _header_layout->UnReference ();
110
 
  _group_layout->UnReference ();
111
 
 
112
100
}
113
101
 
114
102
void PlacesGroup::SetTitle (const char *title)
124
112
void PlacesGroup::AddLayout (nux::Layout *layout)
125
113
{
126
114
  _content = layout;
127
 
  _content->Reference ();
128
115
 
129
116
  // By setting the stretch factor of the GridHLayout to 0, the height of the grid
130
117
  // will be forced to the height that is necessary to include all its elements.
131
118
  _group_layout->AddLayout (_content, 0);
132
 
 
133
 
  ComputeChildLayout ();
134
119
  NeedRedraw ();
135
120
}
136
121
 
219
204
void PlacesGroup::Draw (nux::GraphicsEngine& GfxContext,
220
205
                       bool                 forceDraw)
221
206
{
222
 
  // Check if the texture have been computed. If they haven't, exit the function.
223
 
  nux::Geometry base = GetGeometry ();
224
 
  nux::GetPainter ().PaintBackground (GfxContext, GetGeometry ());
225
 
 
226
 
 
227
 
  GfxContext.PushClippingRectangle (base);
228
 
 
229
 
  _group_layout->NeedRedraw ();
230
 
 
231
 
  GfxContext.PopClippingRectangle ();
232
207
}
233
208
 
234
209
void