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

« back to all changes in this revision

Viewing changes to src/PanelView.cpp

  • Committer: Michael Terry
  • Date: 2010-12-17 14:07:11 UTC
  • mfrom: (724 unity)
  • mto: This revision was merged to the branch mainline in revision 743.
  • Revision ID: mike@mterry.name-20101217140711-qlij3bxdjuq1xoph
mergeĀ fromĀ upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
   // Home button
48
48
   _home_button = new PanelHomeButton ();
49
49
   _layout->AddView (_home_button, 0, nux::eCenter, nux::eFull);
50
 
 
51
50
   AddChild (_home_button);
52
51
 
 
52
   _menu_view = new PanelMenuView ();
 
53
   _layout->AddView (_menu_view, 1, nux::eCenter, nux::eFull);
 
54
   AddChild (_menu_view);
 
55
 
53
56
  _remote = new IndicatorObjectFactoryRemote ();
54
57
  _remote->OnObjectAdded.connect (sigc::mem_fun (this, &PanelView::OnObjectAdded));
55
58
  _remote->OnMenuPointerMoved.connect (sigc::mem_fun (this, &PanelView::OnMenuPointerMoved));
56
59
  _remote->OnEntryActivateRequest.connect (sigc::mem_fun (this, &PanelView::OnEntryActivateRequest));
 
60
  _remote->IndicatorObjectFactory::OnEntryActivated.connect (sigc::mem_fun (this, &PanelView::OnEntryActivated));
57
61
}
58
62
 
59
63
PanelView::~PanelView ()
205
209
 
206
210
  // Appmenu is treated differently as it needs to expand
207
211
  // We could do this in a more special way, but who has the time for special?
208
 
  _layout->AddView (view, (g_strstr_len (proxy->GetName ().c_str (), -1, "appmenu") != NULL), nux::eCenter, nux::eFull);
 
212
  if (g_strstr_len (proxy->GetName ().c_str (), -1, "appmenu") != NULL)
 
213
    _menu_view->SetProxy (proxy);
 
214
  else
 
215
    _layout->AddView (view, 0, nux::eCenter, nux::eFull);
 
216
 
209
217
  _layout->SetContentDistribution (nux::eStackLeft);
210
218
  
211
219
  AddChild (view);
225
233
  
226
234
  if (x >= geo.x && x <= (geo.x + geo.width)
227
235
      && y >= geo.y && y <= (geo.y + geo.height))
 
236
  {
 
237
    std::list<Area *>::iterator it;
 
238
 
 
239
    std::list<Area *> my_children = _layout->GetChildren ();
 
240
    for (it = my_children.begin(); it != my_children.end(); it++)
228
241
    {
229
 
      std::list<Area *>::iterator it;
 
242
      PanelIndicatorObjectView *view = static_cast<PanelIndicatorObjectView *> (*it);
 
243
      
 
244
      if (view->_layout == NULL)
 
245
        continue;
230
246
 
231
 
      std::list<Area *> my_children = _layout->GetChildren ();
232
 
      for (it = my_children.begin(); it != my_children.end(); it++)
 
247
      geo = view->GetGeometry ();
 
248
      if (x >= geo.x && x <= (geo.x + geo.width)
 
249
          && y >= geo.y && y <= (geo.y + geo.height))
233
250
      {
234
 
        PanelIndicatorObjectView *view = static_cast<PanelIndicatorObjectView *> (*it);
235
 
        
236
 
        if (view->_layout == NULL)
237
 
          continue;
238
 
 
239
 
        geo = view->GetGeometry ();
240
 
        if (x >= geo.x && x <= (geo.x + geo.width)
241
 
            && y >= geo.y && y <= (geo.y + geo.height))
 
251
        std::list<Area *>::iterator it2;
 
252
 
 
253
        std::list<Area *> its_children = view->_layout->GetChildren ();
 
254
        for (it2 = its_children.begin(); it2 != its_children.end(); it2++)
 
255
        {
 
256
          PanelIndicatorObjectEntryView *entry = static_cast<PanelIndicatorObjectEntryView *> (*it2);
 
257
 
 
258
          geo = entry->GetGeometry ();
 
259
          if (x >= geo.x && x <= (geo.x + geo.width)
 
260
              && y >= geo.y && y <= (geo.y + geo.height))
242
261
          {
243
 
            std::list<Area *>::iterator it2;
244
 
 
245
 
            std::list<Area *> its_children = view->_layout->GetChildren ();
246
 
            for (it2 = its_children.begin(); it2 != its_children.end(); it2++)
247
 
            {
248
 
              PanelIndicatorObjectEntryView *entry = static_cast<PanelIndicatorObjectEntryView *> (*it2);
249
 
 
250
 
              geo = entry->GetGeometry ();
251
 
              if (x >= geo.x && x <= (geo.x + geo.width)
252
 
                  && y >= geo.y && y <= (geo.y + geo.height))
253
 
                {
254
 
                  entry->OnMouseDown (x, y, 0, 0);
255
 
                  break;
256
 
                }
257
 
            }
 
262
            entry->OnMouseDown (x, y, 0, 0);
258
263
            break;
259
264
          }
 
265
        }
 
266
        break;
260
267
      }
261
268
    }
 
269
  }
262
270
}
263
271
 
264
272
void
282
290
      PanelIndicatorObjectEntryView *entry = static_cast<PanelIndicatorObjectEntryView *> (*it2);
283
291
 
284
292
      if (g_strcmp0 (entry->GetName (), entry_id) == 0)
285
 
        {
286
 
          entry->Activate ();
287
 
          break;
288
 
        }
 
293
      {
 
294
        g_debug ("%s: Activating: %s", G_STRFUNC, entry_id);
 
295
        entry->Activate ();
 
296
        break;
 
297
      }
289
298
    }
290
299
  }
291
300
}
 
301
 
 
302
void
 
303
PanelView::OnEntryActivated (const char *entry_id)
 
304
{
 
305
  if (g_strcmp0 (entry_id, "") == 0)
 
306
    _menu_view->AllMenusClosed ();
 
307
}