~azzar1/nux/fix-916088

« back to all changes in this revision

Viewing changes to Nux/Area.cpp

  • Committer: Jay Taoko
  • Date: 2011-11-21 19:10:06 UTC
  • mfrom: (518.1.7 nux-fix-makecheck)
  • Revision ID: jay.taoko@canonical.com-20111121191006-cv93lu1vwk2wibkc
* Added requirement for XTest
* Fixed crash in GraphicsDisplay at program termination.
* Added Automated test Framework
* Added Testing framework
* Added empty program test
* Added Button test through XTest
* Added macros nuxOkMsg to NuxCore

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
    ,   min_size_(AREA_MIN_WIDTH, AREA_MIN_HEIGHT)
41
41
    ,   max_size_(AREA_MAX_WIDTH, AREA_MAX_HEIGHT)
42
42
  {
 
43
    window_thread_ = GetWindowThread();
43
44
    visible_ = true;
44
45
    view_enabled_ = true;
45
46
    parent_area_ = NULL;
415
416
    if (on_geometry_change_reconfigure_parent_layout_ == false)
416
417
      return;
417
418
 
418
 
    if (GetWindowThread() && GetWindowThread()->IsComputingLayout())
 
419
    if (window_thread_ && window_thread_->IsComputingLayout())
419
420
    {
420
421
      // there is no need to do the following while we are already computing the layout.
421
422
      // If we do, we will end up in an infinite loop.
441
442
        {
442
443
          // If this element is a Splitter, then we submit its child to the refresh list. We don't want to submit the
443
444
          // splitter because this will cause a redraw of all parts of the splitter(costly and unnecessary).
444
 
          GetWindowThread()->QueueObjectLayout(child);
 
445
          window_thread_->QueueObjectLayout(child);
445
446
        }
446
447
        else
447
448
        {
448
 
          GetWindowThread()->QueueObjectLayout(ic);
 
449
          window_thread_->QueueObjectLayout(ic);
449
450
        }
450
451
      }
451
452
      else if (ic->parent_area_)
452
453
        ic->parent_area_->ReconfigureParentLayout(this);
453
454
      else
454
455
      {
455
 
        GetWindowThread()->QueueObjectLayout(ic);
 
456
        window_thread_->QueueObjectLayout(ic);
456
457
      }
457
458
    }
458
459
    else if (this->Type().IsDerivedFromType(Layout::StaticObjectType))
479
480
            {
480
481
              // If the parent of this element is a splitter, then we submit its child to the refresh list. We don't want to submit the
481
482
              // splitter because this will cause a redraw of all parts of the splitter(costly and unnecessary).
482
 
              GetWindowThread()->QueueObjectLayout(this);
 
483
              window_thread_->QueueObjectLayout(this);
483
484
            }
484
485
            else
485
486
            {
486
 
              GetWindowThread()->QueueObjectLayout(ic);
 
487
              window_thread_->QueueObjectLayout(ic);
487
488
            }
488
489
          }
489
490
          else
500
501
      else
501
502
      {
502
503
        // This is possibly the Main layout or the layout of a floating object(popup for example) unless the layout is not part of the object tree.
503
 
        GetWindowThread()->QueueObjectLayout(layout);
 
504
        window_thread_->QueueObjectLayout(layout);
504
505
      }
505
506
    }
506
507
    else
681
682
 
682
683
  void Area::InnerGetAbsoluteGeometry(Geometry &geometry)
683
684
  {
684
 
    if (this->Type().IsDerivedFromType(BaseWindow::StaticObjectType) || (this == GetWindowThread()->GetMainLayout()))
 
685
    if (this->Type().IsDerivedFromType(BaseWindow::StaticObjectType) || (this == window_thread_->GetMainLayout()))
685
686
    {
686
687
      geometry.OffsetPosition(geometry_.x, geometry_.y);
687
688
      return;
698
699
  {
699
700
    if (Type().IsDerivedFromType(BaseWindow::StaticObjectType) ||
700
701
      Type().IsDerivedFromType(MenuPage::StaticObjectType) ||
701
 
      (this == GetWindowThread()->GetMainLayout()))
 
702
      (this == window_thread_->GetMainLayout()))
702
703
    {
703
704
      // Do not apply the _2D_xform matrix  to a BaseWindow or the main layout
704
705
      return geometry_;
738
739
 
739
740
  void Area::InnerGetRootGeometry(Geometry &geometry)
740
741
  {
741
 
    if (this->Type().IsDerivedFromType(BaseWindow::StaticObjectType) || (this == GetWindowThread()->GetMainLayout()))
 
742
    if (this->Type().IsDerivedFromType(BaseWindow::StaticObjectType) || (this == window_thread_->GetMainLayout()))
742
743
      return;
743
744
 
744
745
    MatrixXFormGeometry(_2d_xform, geometry);
753
754
    nux::Geometry geo = geometry_;
754
755
    MatrixXFormGeometry(_2d_xform, geo);
755
756
 
756
 
    if (Type().IsDerivedFromType(BaseWindow::StaticObjectType) || (this == GetWindowThread()->GetMainLayout()))
 
757
    if (Type().IsDerivedFromType(BaseWindow::StaticObjectType) || (this == window_thread_->GetMainLayout()))
757
758
    {
758
759
      return geo;
759
760
    }
794
795
 
795
796
  Area* Area::GetRootParent()
796
797
  {
797
 
    if (Type().IsDerivedFromType(BaseWindow::StaticObjectType) || (this == GetWindowThread()->GetMainLayout()))
 
798
    if (Type().IsDerivedFromType(BaseWindow::StaticObjectType) || (this == window_thread_->GetMainLayout()))
798
799
    {
799
800
      return this;
800
801
    }
839
840
 
840
841
  void Area::QueueRelayout()
841
842
  {
842
 
    nux::GetWindowThread()->QueueObjectLayout(this);
 
843
    window_thread_->QueueObjectLayout(this);
843
844
  }
844
845
  
845
846
  void Area::SetAcceptKeyboardEvent(bool accept_keyboard_event)