当前位置: 首页>>代码示例>>C++>>正文


C++ wxRect::SetPosition方法代码示例

本文整理汇总了C++中wxRect::SetPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ wxRect::SetPosition方法的具体用法?C++ wxRect::SetPosition怎么用?C++ wxRect::SetPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wxRect的用法示例。


在下文中一共展示了wxRect::SetPosition方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetLocation

// Returns the rectangle for this object (id = 0) or a child element (id > 0).
wxAccStatus SplitterWindowAccessible::GetLocation(wxRect& rect, int elementId)
{
    wxSplitterWindow* splitter = wxDynamicCast(GetWindow(), wxSplitterWindow);
    if (splitter && elementId == 2 && splitter->IsSplit())
    {
        wxSize clientSize = splitter->GetClientSize();
        if (splitter->GetSplitMode() == wxSPLIT_VERTICAL)
        {
            rect.x = splitter->GetSashPosition();
            rect.y = 0;
            rect.SetPosition(splitter->ClientToScreen(rect.GetPosition()));
            rect.width = splitter->GetSashSize();
            rect.height = clientSize.y;
        }
        else
        {
            rect.x = 0;
            rect.y = splitter->GetSashPosition();
            rect.SetPosition(splitter->ClientToScreen(rect.GetPosition()));
            rect.width = clientSize.x;
            rect.height = splitter->GetSashSize();
        }
        return wxACC_OK;
    }
    // Let the framework handle the other cases.
    return wxACC_NOT_IMPLEMENTED;
}
开发者ID:ruifig,项目名称:nutcracker,代码行数:28,代码来源:accesstest.cpp

示例2:

// Returns the rectangle for this object (id = 0) or a child element (id > 0).
// rect is in screen coordinates.
wxAccStatus
KeyViewAx::GetLocation(wxRect & rect, int elementId)
{
   int line;

   if (IdToLine(elementId, line))
   {
      wxRect rectLine;

      rectLine.width = mView->GetClientSize().GetWidth();

      // iterate over all visible lines
      for (int i = 0; i < line; i++)
      {
         wxCoord hLine = mView->GetLineHeight(i);

         rectLine.height = hLine;

         rect = rectLine;
         wxPoint margins = mView->GetMargins();
         rect.Deflate(margins.x, margins.y);
         rectLine.y += hLine;
      }

      rect.SetPosition(mView->ClientToScreen(rect.GetPosition()));
   }
   else
   {
      rect = mView->GetRect();
      rect.SetPosition(mView->GetParent()->ClientToScreen(rect.GetPosition()));
   }

   return wxACC_OK;
}
开发者ID:tuanmasterit,项目名称:audacity,代码行数:36,代码来源:KeyView.cpp

示例3: GetLocation

// Returns the rectangle for this object (id = 0) or a child element (id > 0).
wxAccStatus CProjectListCtrlAccessible::GetLocation(wxRect& rect, int elementId)
{
    CProjectListCtrl* pCtrl = wxDynamicCast(GetWindow(), CProjectListCtrl);
    if (pCtrl && (0 == elementId))
    {
        // List control
        rect.SetPosition(pCtrl->GetScreenPosition());
        rect.SetWidth(pCtrl->GetSize().GetWidth());
        rect.SetHeight(pCtrl->GetSize().GetHeight());
        return wxACC_OK;
    }
    else if (pCtrl && (0 != elementId))
    {
        // List item
        wxSize cCtrlSize = pCtrl->GetClientSize();

        // Set the initial control postition to the absolute coords of the upper
        //   left hand position of the control
        rect.SetPosition(pCtrl->GetScreenPosition());
        rect.width = cCtrlSize.GetWidth() - 1;
        rect.height = pCtrl->GetItemHeight(elementId - 1) - 1;

        // Items can have different heights
        int    firstVisibleItem = (int)pCtrl->GetFirstVisibleLine();
        int    yOffset = 0;
        for (int i=firstVisibleItem; i<(elementId - 1); ++i) {
            yOffset += pCtrl->GetItemHeight((size_t)i);
        }
        rect.SetTop(rect.GetTop() + yOffset);
        rect.height -= 1;
        return wxACC_OK;
    }
    // Let the framework handle the other cases.
    return wxACC_FALSE;
}
开发者ID:FpgaAtHome,项目名称:seti_fpga,代码行数:36,代码来源:ProjectListCtrl.cpp

示例4: OnInit

bool MyApp::OnInit() {
    Aux::logsStr("", wxT("Wherbarium [" + wxDateTime::Now().Format(wxT("%Y-%m-%d %H:%M:%S")) + "] - IN"), logPut);
    try {
        // setting divers
        wxInitAllImageHandlers(); // évite les problèmes de handlers d'images
        SetExitOnFrameDelete(false); // évite la fermeture de l'application sur un close quelconque !!!
        
        // variables de dimensionnement
        ecranRectGbl.SetPosition(wxPoint(0, 0));
        ecranRectGbl.SetSize(wxSize(wxSystemSettings::GetMetric(wxSYS_SCREEN_X), wxSystemSettings::GetMetric(wxSYS_SCREEN_Y)));
        
        wxDisplay *display = new wxDisplay();
        clientRectGbl = display->GetClientArea();

        gapGbl = 16;
        winRectGbl.SetPosition(wxPoint(clientRectGbl.GetX()+gapGbl, clientRectGbl.GetY()+gapGbl));
        winRectGbl.SetSize(wxSize(clientRectGbl.width-2*gapGbl, clientRectGbl.height-2*gapGbl));
        win3RectGbl = winRectGbl;
        win3RectGbl.SetWidth(winRectGbl.GetWidth()/3);
        
        wxSystemSettings sysSet;
        dimScrollXGbl = sysSet.GetMetric(wxSYS_VSCROLL_X, NULL);
        dimScrollYGbl = sysSet.GetMetric(wxSYS_HSCROLL_Y, NULL);
        
        Aux::logsPoint("MyApp::OnInit::ecranRectGbl", ecranRectGbl.GetPosition(), logNop);
        Aux::logsSize("MyApp::OnInit::ecranRectGbl", ecranRectGbl.GetSize(), logNop);
        Aux::logsPoint("MyApp::OnInit::clientRectGbl", clientRectGbl.GetPosition(), logNop);
        Aux::logsSize("MyApp::OnInit::clientRectGbl", clientRectGbl.GetSize(), logNop);
        Aux::logsPoint("MyApp::OnInit::winRectGbl", winRectGbl.GetPosition(), logNop);
        Aux::logsSize("MyApp::OnInit::winRectGbl", winRectGbl.GetSize(), logNop);
        Aux::logsPoint("MyApp::OnInit::win3RectGbl", win3RectGbl.GetPosition(), logNop);
        Aux::logsSize("MyApp::OnInit::win3RectGbl", win3RectGbl.GetSize(), logNop);
        
        wxString dbDir = "/Users/" + wxGetUserId() + "/Pictures/Wherbarium/Connect/";
        if (! wxDir::Exists(dbDir)) {
            wxDir::Make(dbDir);
        }
        wxArrayString *files = new wxArrayString();
        wxDir::GetAllFiles(dbDir, files);
        wxString dbFile = dbDir + "Wherbarium.db";
        wxFile *fileConnect;
        if (files->size() == 0) {
            fileConnect = new wxFile();
            fileConnect->Create(dbFile, false, wxS_DEFAULT);
        } else if (files->size() != 1) {
            Exit();
        }
        
        string tableName = "tblConnParams";
        sqlite = new SQLite(string(dbFile), tableName);
        sqliteStatement = sqlite->ptrTableConnParams();
        
        // début des opérations de l'application
        InitApp *initApp = new InitApp();
        initApp->nop();
        
    } catch (const exception &e) { Aux::logsStr("", e.what(), logPut); }
    return true;
}
开发者ID:Nadot,项目名称:Wherbarium,代码行数:59,代码来源:main.cpp

示例5: GetLocation

// Returns the rectangle for this object (id = 0) or a child element (id > 0).
// rect is in screen coordinates.
wxAccStatus GridAx::GetLocation(wxRect & rect, int elementId)
{
    wxRect r;
    int row;
    int col;

    if (GetRowCol(elementId, row, col)) {
        rect = mGrid->CellToRect(row, col);
        rect.SetPosition(mGrid->GetGridWindow()->ClientToScreen(rect.GetPosition()));
    }
    else {
        rect = mGrid->GetRect();
        rect.SetPosition(mGrid->GetParent()->ClientToScreen(rect.GetPosition()));
    }

    return wxACC_OK;
}
开发者ID:ducknoir,项目名称:audacity,代码行数:19,代码来源:Grid.cpp

示例6: GetLocation

// Returns the rectangle for this object (id = 0) or a child element (id > 0).
// rect is in screen coordinates.
wxAccStatus ASliderAx::GetLocation( wxRect& rect, int WXUNUSED(elementId) )
{
   ASlider *as = wxDynamicCast( GetWindow(), ASlider );

   rect = as->GetRect();
   rect.SetPosition( as->GetParent()->ClientToScreen( rect.GetPosition() ) );

   return wxACC_OK;
}
开发者ID:Cactuslegs,项目名称:audacity-of-nope,代码行数:11,代码来源:ASlider.cpp

示例7: GetLocation

// Returns the rectangle for this object (id = 0) or a child element (id > 0).
// rect is in screen coordinates.
wxAccStatus AButtonAx::GetLocation( wxRect& rect, int WXUNUSED(elementId) )
{
    AButton *ab = wxDynamicCast( GetWindow(), AButton );

    rect = ab->GetRect();
    rect.SetPosition( ab->GetParent()->ClientToScreen( rect.GetPosition() ) );

    return wxACC_OK;
}
开发者ID:jeevithag,项目名称:audacity,代码行数:11,代码来源:AButton.cpp

示例8: GetLocation

// Returns the rectangle for this object (id = 0) or a child element (id > 0).
// rect is in screen coordinates.
wxAccStatus HtmlWindowAx::GetLocation( wxRect& rect, int WXUNUSED(elementId) )
{
   HtmlWindow *hw = wxDynamicCast( GetWindow(), HtmlWindow );

   rect = hw->GetRect();
   rect.SetPosition( hw->GetParent()->ClientToScreen( rect.GetPosition() ) );

   return wxACC_OK;
}
开发者ID:Cactuslegs,项目名称:audacity-of-nope,代码行数:11,代码来源:HtmlWindow.cpp

示例9: GetLocation

// Returns the rectangle for this object (id = 0) or a child element (id > 0).
// rect is in screen coordinates.
wxAccStatus TimeTextCtrlAx::GetLocation(wxRect & rect, int elementId)
{
   rect = mCtrl->GetRect();

   if (elementId != wxACC_SELF) {
//      rect.x += mCtrl->mFields[elementId - 1].fieldX;
//      rect.width =  mCtrl->mFields[elementId - 1].fieldW;
        rect = mCtrl->mDigits[elementId - 1].digitBox;
   }

   rect.SetPosition(mCtrl->GetParent()->ClientToScreen(rect.GetPosition()));

   return wxACC_OK;
}
开发者ID:tuanmasterit,项目名称:audacity,代码行数:16,代码来源:TimeTextCtrl.cpp

示例10: GetLocation

// Returns the rectangle for this object (id = 0) or a child element (id > 0).
// rect is in screen coordinates.
wxAccStatus TrackPanelAx::GetLocation( wxRect& rect, int elementId )
{
   wxRect client;

   if( elementId == wxACC_SELF )
   {
      rect = mTrackPanel->GetRect();
   }
   else
   {
      Track *t = FindTrack( elementId );

      if( t == NULL )
      {
         return wxACC_FAIL;
      }

      rect = mTrackPanel->FindTrackRect( t, true );
   }

   rect.SetPosition( mTrackPanel->GetParent()->ClientToScreen( rect.GetPosition() ) );

   return wxACC_OK;
}
开发者ID:dot-Sean,项目名称:audio,代码行数:26,代码来源:TrackPanelAx.cpp

示例11: ScaleImage

wxImage ScaleImage(wxImage image, double source_scale_factor, double content_scale_factor,
                   wxSize output_size, wxRect usable_rect, LSIFlags flags,
                   const wxColour& fill_color)
{
  if (!image.IsOk())
  {
    wxFAIL_MSG("WxUtils::ScaleImage expects a valid image.");
    return image;
  }

  if (content_scale_factor != 1.0)
  {
    output_size *= content_scale_factor;
    usable_rect.SetPosition(usable_rect.GetPosition() * content_scale_factor);
    usable_rect.SetSize(usable_rect.GetSize() * content_scale_factor);
  }

  // Fix the output size if it's unset.
  wxSize img_size = image.GetSize();
  if (output_size.GetWidth() < 1)
    output_size.SetWidth(
        static_cast<int>(img_size.GetWidth() * (content_scale_factor / source_scale_factor)));
  if (output_size.GetHeight() < 1)
    output_size.SetHeight(
        static_cast<int>(img_size.GetHeight() * (content_scale_factor / source_scale_factor)));

  // Fix the usable rect. If it's empty then the whole canvas is usable.
  if (usable_rect.IsEmpty())
  {
    // Constructs a temp wxRect 0,0->output_size then move assigns it.
    usable_rect = output_size;
  }
  else if (!usable_rect.Intersects(output_size))
  {
    wxFAIL_MSG("Usable Zone Rectangle is not inside the canvas. Check the output size is correct.");
    image.Create(1, 1, false);
    image.SetRGB(0, 0, fill_color.Red(), fill_color.Green(), fill_color.Blue());
    if (fill_color.Alpha() == wxALPHA_TRANSPARENT)
      image.SetMaskColour(fill_color.Red(), fill_color.Green(), fill_color.Blue());
    usable_rect = output_size;
  }

  // Step 1: Scale the image
  if ((flags & LSI_SCALE) != LSI_SCALE_NONE)
  {
    if (flags & LSI_SCALE_NO_ASPECT)
    {
      // Stretch scale without preserving the aspect ratio.
      bool scale_width = (img_size.GetWidth() > usable_rect.GetWidth() && flags & LSI_SCALE_DOWN) ||
                         (img_size.GetWidth() < usable_rect.GetWidth() && flags & LSI_SCALE_UP);
      bool scale_height =
          (img_size.GetHeight() > usable_rect.GetHeight() && flags & LSI_SCALE_DOWN) ||
          (img_size.GetHeight() < usable_rect.GetHeight() && flags & LSI_SCALE_UP);
      if (scale_width || scale_height)
      {
        // NOTE: Using BICUBIC instead of HIGH because it's the same internally
        //   except that downscaling uses a box filter with awful obvious aliasing
        //   for non-integral scale factors.
        image.Rescale(scale_width ? usable_rect.GetWidth() : img_size.GetWidth(),
                      scale_height ? usable_rect.GetHeight() : img_size.GetHeight(),
                      wxIMAGE_QUALITY_BICUBIC);
      }
    }
    else
    {
      // Scale while preserving the aspect ratio.
      double scale = std::min(static_cast<double>(usable_rect.GetWidth()) / img_size.GetWidth(),
                              static_cast<double>(usable_rect.GetHeight()) / img_size.GetHeight());
      int target_width = static_cast<int>(img_size.GetWidth() * scale);
      int target_height = static_cast<int>(img_size.GetHeight() * scale);
      // Bilinear produces sharper images when upscaling, bicubic tends to smear/blur sharp edges.
      if (scale > 1.0 && flags & LSI_SCALE_UP)
        image.Rescale(target_width, target_height, wxIMAGE_QUALITY_BILINEAR);
      else if (scale < 1.0 && flags & LSI_SCALE_DOWN)
        image.Rescale(target_width, target_height, wxIMAGE_QUALITY_BICUBIC);
    }
    img_size = image.GetSize();
  }

  // Step 2: Resize the canvas to match the output size.
  // NOTE: If NOT using LSI_SCALE_DOWN then this will implicitly crop the image
  if (img_size != output_size || usable_rect.GetPosition() != wxPoint())
  {
    wxPoint base = usable_rect.GetPosition();
    if (flags & LSI_ALIGN_HCENTER)
      base.x += (usable_rect.GetWidth() - img_size.GetWidth()) / 2;
    else if (flags & LSI_ALIGN_RIGHT)
      base.x += usable_rect.GetWidth() - img_size.GetWidth();
    if (flags & LSI_ALIGN_VCENTER)
      base.y += (usable_rect.GetHeight() - img_size.GetHeight()) / 2;
    else if (flags & LSI_ALIGN_BOTTOM)
      base.y += usable_rect.GetHeight() - img_size.GetHeight();

    int r = -1, g = -1, b = -1;
    if (fill_color.Alpha() != wxALPHA_TRANSPARENT)
    {
      r = fill_color.Red();
      g = fill_color.Green();
      b = fill_color.Blue();
    }
//.........这里部分代码省略.........
开发者ID:DINKIN,项目名称:dolphin,代码行数:101,代码来源:WxUtils.cpp


注:本文中的wxRect::SetPosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。