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


C++ wxDisplaySize函数代码示例

本文整理汇总了C++中wxDisplaySize函数的典型用法代码示例。如果您正苦于以下问题:C++ wxDisplaySize函数的具体用法?C++ wxDisplaySize怎么用?C++ wxDisplaySize使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: wxClientDisplayRect

void wxClientDisplayRect(int *x, int *y, int *width, int *height)
{
    // return desktop dimensions minus any panels, menus, trays:
    if (x) *x = 0;
    if (y) *y = 0;
    wxDisplaySize(width, height);
}
开发者ID:BauerBox,项目名称:wxWidgets,代码行数:7,代码来源:utils.cpp

示例2: wxBitmap

bool MyApp::OnInit()
{
#if wxUSE_LIBPNG
    wxImage::AddHandler( new wxPNGHandler );
#endif

    wxImage image;
    if (image.LoadFile(_T("backgrnd.png"), wxBITMAP_TYPE_PNG))
    {
        m_background = wxBitmap(image);
    }

    MyFrame *frame = new MyFrame();

    wxString rootName(_T("shape0"));

    int i;
    for (i = 1; i < 4; i++)
    {
        wxString filename;
        filename.Printf(wxT("%s%d.png"), (const wxChar*)rootName, i);
    /* For some reason under wxX11, the 2nd LoadFile in this loop fails, with
       a BadMatch inside CreateFromImage (inside ConvertToBitmap). This happens even if you copy
       the first file over the second file. */
        if (image.LoadFile(filename, wxBITMAP_TYPE_PNG))
        {
            DragShape* newShape = new DragShape(wxBitmap(image));
            newShape->SetPosition(wxPoint(i*50, i*50));

            if (i == 2)
                newShape->SetDragMethod(SHAPE_DRAG_TEXT);
            else if (i == 3)
                newShape->SetDragMethod(SHAPE_DRAG_ICON);
            else
                newShape->SetDragMethod(SHAPE_DRAG_BITMAP);
            frame->GetCanvas()->GetDisplayList().Append(newShape);
        }
    }

#if 0
    // Under Motif or GTK, this demonstrates that
    // wxScreenDC only gets the root window content.
    // We need to be able to copy the overall content
    // for full-screen dragging to work.
    int w, h;
    wxDisplaySize(& w, & h);
    wxBitmap bitmap(w, h);

    wxScreenDC dc;
    wxMemoryDC memDC;
    memDC.SelectObject(bitmap);
    memDC.Blit(0, 0, w, h, & dc, 0, 0);
    memDC.SelectObject(wxNullBitmap);
    m_background = bitmap;
#endif

    frame->Show( true );

    return true;
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:60,代码来源:dragimag.cpp

示例3: wxWindowDCImpl

// Create a DC representing the whole screen
wxScreenDCImpl::wxScreenDCImpl( wxDC *owner ) :
   wxWindowDCImpl( owner )
{
#if wxOSX_USE_COCOA_OR_CARBON
    CGRect cgbounds ;
    cgbounds = CGDisplayBounds(CGMainDisplayID());
    m_width = (wxCoord)cgbounds.size.width;
    m_height = (wxCoord)cgbounds.size.height;
#else
    wxDisplaySize( &m_width, &m_height );
#endif
#if wxOSX_USE_COCOA_OR_IPHONE
    SetGraphicsContext( wxGraphicsContext::Create() );
#else
    Rect bounds;
    bounds.top = (short)cgbounds.origin.y;
    bounds.left = (short)cgbounds.origin.x;
    bounds.bottom = bounds.top + (short)cgbounds.size.height;
    bounds.right = bounds.left  + (short)cgbounds.size.width;
    WindowAttributes overlayAttributes  = kWindowIgnoreClicksAttribute;
    CreateNewWindow( kOverlayWindowClass, overlayAttributes, &bounds, (WindowRef*) &m_overlayWindow );
    ShowWindow((WindowRef)m_overlayWindow);
    SetGraphicsContext( wxGraphicsContext::CreateFromNativeWindow( m_overlayWindow ) );
#endif
    m_ok = true ;
}
开发者ID:erwincoumans,项目名称:wxWidgets,代码行数:27,代码来源:dcscreen.cpp

示例4: wxGetTopLevelParent

wxTopLevelWindow *ScreenshotCommand::GetFrontWindow(AudacityProject *project)
{
   wxWindow *front = NULL;
   wxWindow *proj = wxGetTopLevelParent(project);

   // This is kind of an odd hack.  There's no method to enumerate all
   // possible windows, so we search the whole screen for any windows
   // that are not this one and not the given Audacity project and
   // if we find anything, we assume that's the dialog the user wants
   // to capture.

   int width, height, x, y;
   wxDisplaySize(&width, &height);
   for (x = 0; x < width; x += 50) {
      for (y = 0; y < height; y += 50) {
         wxWindow *win = wxFindWindowAtPoint(wxPoint(x, y));
         if (win) {
            win = wxGetTopLevelParent(win);
            if (win != mIgnore && win != proj) {
               front = win;
               break;
            }
         }
      }
   }

   if (!front || !front->IsTopLevel()) {
      return (wxTopLevelWindow *)proj;
   }

   return (wxTopLevelWindow *)front;
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:32,代码来源:ScreenshotCommand.cpp

示例5: GetPageSizePixels

void MunkHtmlPrintout::OnPreparePrinting()
{
    int pageWidth, pageHeight, mm_w, mm_h, scr_w, scr_h, dc_w, dc_h;
    float ppmm_h, ppmm_v;

    GetPageSizePixels(&pageWidth, &pageHeight);
    GetPageSizeMM(&mm_w, &mm_h);
    ppmm_h = (float)pageWidth / mm_w;
    ppmm_v = (float)pageHeight / mm_h;

    int ppiPrinterX, ppiPrinterY;
    GetPPIPrinter(&ppiPrinterX, &ppiPrinterY);
    int ppiScreenX, ppiScreenY;
    GetPPIScreen(&ppiScreenX, &ppiScreenY);

    wxDisplaySize(&scr_w, &scr_h);
    GetDC()->GetSize(&dc_w, &dc_h);

    GetDC()->SetUserScale((double)dc_w / (double)pageWidth,
                          (double)dc_h / (double)pageHeight);

    /* prepare headers/footers renderer: */

    m_RendererHdr->SetDC(GetDC(), (double)ppiPrinterY / (double)ppiScreenY);
    m_RendererHdr->SetSize((int) (ppmm_h * (mm_w - m_MarginLeft - m_MarginRight)),
                          (int) (ppmm_v * (mm_h - m_MarginTop - m_MarginBottom)));
    if (m_Headers[0] != wxEmptyString)
    {
        m_RendererHdr->SetHtmlText(TranslateHeader(m_Headers[0], 1));
        m_HeaderHeight = m_RendererHdr->GetTotalHeight();
    }
    else if (m_Headers[1] != wxEmptyString)
    {
        m_RendererHdr->SetHtmlText(TranslateHeader(m_Headers[1], 1));
        m_HeaderHeight = m_RendererHdr->GetTotalHeight();
    }
    if (m_Footers[0] != wxEmptyString)
    {
        m_RendererHdr->SetHtmlText(TranslateHeader(m_Footers[0], 1));
        m_FooterHeight = m_RendererHdr->GetTotalHeight();
    }
    else if (m_Footers[1] != wxEmptyString)
    {
        m_RendererHdr->SetHtmlText(TranslateHeader(m_Footers[1], 1));
        m_FooterHeight = m_RendererHdr->GetTotalHeight();
    }

    /* prepare main renderer: */
    m_Renderer->SetDC(GetDC(), (double)ppiPrinterY / (double)ppiScreenY);
    m_Renderer->SetSize((int) (ppmm_h * (mm_w - m_MarginLeft - m_MarginRight)),
                          (int) (ppmm_v * (mm_h - m_MarginTop - m_MarginBottom) -
                          m_FooterHeight - m_HeaderHeight -
                          ((m_HeaderHeight == 0) ? 0 : m_MarginSpace * ppmm_v) -
                          ((m_FooterHeight == 0) ? 0 : m_MarginSpace * ppmm_v)
                          ));
    m_Renderer->SetHtmlText(m_Document, m_BasePath, m_BasePathIsDir);
    CountPages();
}
开发者ID:emg,项目名称:wxMunkHTML,代码行数:58,代码来源:munkhtmlprint.cpp

示例6: wxDisplaySize

void MyApp::NewWindow(wxString file,bool batchmode)
{
  int x = 40, y = 40, h = 650, w = 950, m = 0;
  int rs = 0;
  int display_width = 1024, display_height = 768;
  bool have_pos;

  wxConfig *config = (wxConfig *)wxConfig::Get();

  wxDisplaySize(&display_width, &display_height);

  have_pos = config->Read(wxT("pos-x"), &x);
  config->Read(wxT("pos-y"), &y);
  config->Read(wxT("pos-h"), &h);
  config->Read(wxT("pos-w"), &w);
  config->Read(wxT("pos-max"), &m);
  config->Read(wxT("pos-restore"), &rs);

  if (rs == 0)
    have_pos = false;
  if (!have_pos || m == 1 || x > display_width || y > display_height || x < 0 || y < 0)
  {
    x = 40;
    y = 40;
    h = 650;
    w = 950;
  }

#if defined __WXMAC__
  x += topLevelWindows.GetCount()*20;
  y += topLevelWindows.GetCount()*20;
#endif

  m_frame = new wxMaxima((wxFrame *)NULL, -1, _("wxMaxima"),
                                 wxPoint(x, y), wxSize(w, h));

  m_frame->Move(wxPoint(x, y));
  m_frame->SetSize(wxSize(w, h));
  if (m == 1)
    m_frame->Maximize(true);

  if (file.Length() > 0 && wxFileExists(file)) {
    m_frame->SetOpenFile(file);
  }

  m_frame->SetBatchMode(batchmode);
#if defined __WXMAC__
  topLevelWindows.Append(m_frame);
  if (topLevelWindows.GetCount()>1)
    m_frame->SetTitle(wxString::Format(_("untitled %d"), ++window_counter));
#endif

  SetTopWindow(m_frame);
  m_frame->Show(true);
  m_frame->InitSession();
  m_frame->ShowTip(false);
}
开发者ID:minoki,项目名称:wxmaxima,代码行数:57,代码来源:main.cpp

示例7: wxDisplaySize

void wxMDIParentFrame::GetRectForTopLevelChildren(int *x, int *y, int *w, int *h)
{
    if (x)
        *x = 0;
    if (y)
        *y = 0;

    wxDisplaySize(w, h);
}
开发者ID:beanhome,项目名称:dev,代码行数:9,代码来源:mdi.cpp

示例8: WXUNUSED

int wxSystemSettingsNative::GetMetric(wxSystemMetric index,
                                      wxWindow* WXUNUSED(win))
{
    int val;

    switch (index)
    {
        case wxSYS_SCREEN_X:
            wxDisplaySize(&val, NULL);
            return val;
        case wxSYS_SCREEN_Y:
            wxDisplaySize(NULL, &val);
            return val;

        default:
            return -1;
    }
}
开发者ID:vdm113,项目名称:wxWidgets-ICC-patch,代码行数:18,代码来源:settings.cpp

示例9: wxDisplaySize

ODSelect::ODSelect()
{
    pSelectList = new SelectableItemList;
    pixelRadius = 8;
    int w,h;
    wxDisplaySize( &w, &h );
    if( h > 800 ) pixelRadius = 10;
    if( h > 1024 ) pixelRadius = 12;
    
}
开发者ID:Hakansv,项目名称:ocpn_draw_pi,代码行数:10,代码来源:ODSelect.cpp

示例10: wxDisplaySize

bool wxUIActionSimulator::MouseMove(long x, long y)
{
    // Because MOUSEEVENTF_ABSOLUTE takes measurements scaled between 0 & 65535
    // we need to scale our input too
    int displayx, displayy, scaledx, scaledy;
    wxDisplaySize(&displayx, &displayy);
    scaledx = ((float)x / displayx) * 65535;
    scaledy = ((float)y / displayy) * 65535;
    mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE, scaledx, scaledy, 0, 0);
    return true;
}
开发者ID:NullNoname,项目名称:dolphin,代码行数:11,代码来源:uiaction.cpp

示例11: wxDisplaySizeMM

void wxDisplaySizeMM(int *width, int *height)
{
    wxDisplaySize(width, height);
    // on mac 72 is fixed (at least now;-)
    double cvPt2Mm = 25.4 / 72;

    if (width != NULL)
        *width = int( *width * cvPt2Mm );

    if (height != NULL)
        *height = int( *height * cvPt2Mm );
}
开发者ID:Kaoswerk,项目名称:newton-dynamics,代码行数:12,代码来源:utils_osx.cpp

示例12: wxDisplaySize

int wxDisplayFactorySingle::GetFromPoint(const wxPoint& pt)
{
    if ( pt.x >= 0 && pt.y >= 0 )
    {
        int w, h;
        wxDisplaySize(&w, &h);

        if ( pt.x < w && pt.y < h )
            return 0;
    }

    // the point is outside of the screen
    return wxNOT_FOUND;
}
开发者ID:252525fb,项目名称:rpcs3,代码行数:14,代码来源:dpycmn.cpp

示例13: wxDisplaySizeMM

void wxDisplaySizeMM(int *width, int *height)
{
    // FIXME: there's no way to get physical resolution using the DirectDB
    //        API, we hardcode a commonly used value of 72dpi
    #define DPI          72.0
    #define PX_TO_MM(x)  (int(((x) / DPI) * inches2mm))

    wxDisplaySize(width, height);
    if ( width ) *width = PX_TO_MM(*width);
    if ( height ) *height = PX_TO_MM(*height);

    #undef DPI
    #undef PX_TO_MM
}
开发者ID:BauerBox,项目名称:wxWidgets,代码行数:14,代码来源:utils.cpp

示例14: GetNextItem

void CUnitPane::OnRClick(wxListEvent& event)
{
    wxMenu       menu;
    long         idx   = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
    CUnit      * pUnit = GetUnit(idx);
    int          x=0,y;

    int          width, height;

    int nItems = GetSelectedItemCount();


    wxDisplaySize(&width, &height);
    y = event.GetPoint().y;
    ClientToScreen(&x, &y);
    if (height-y < 150)
        y = height-150;
    ScreenToClient(&x, &y);

    if (nItems>1)
    {
        // multiple units
        menu.Append(menu_Popup_IssueOrders     , wxT("Issue orders"));
        menu.Append(menu_Popup_UnitFlags       , wxT("Set custom flags")    );
        menu.Append(menu_Popup_AddToTracking   , wxT("Add to a tracking group"));

        PopupMenu( &menu, event.GetPoint().x, y);
    }
    else
        if (pUnit)
        {
            // single unit
            if (pUnit->IsOurs)
            {
                menu.Append(menu_Popup_ShareSilv     , wxT("Share SILV")        );
                menu.Append(menu_Popup_Teach         , wxT("Teach")             );
                menu.Append(menu_Popup_Split         , wxT("Split")             );
                menu.Append(menu_Popup_DiscardJunk   , wxT("Discard junk items"));
                menu.Append(menu_Popup_GiveEverything, wxT("Give everything")   );
                menu.Append(menu_Popup_DetectSpies   , wxT("Detect spies")      );
            }

            menu.Append(menu_Popup_UnitFlags       , wxT("Set custom flags")    );
            menu.Append(menu_Popup_AddToTracking   , wxT("Add to a tracking group"));


            PopupMenu( &menu, event.GetPoint().x, y);
        }
}
开发者ID:ennorehling,项目名称:alh,代码行数:49,代码来源:unitpane.cpp

示例15: wxDisplaySize

void wxWindowDFB::WarpPointer(int x, int y)
{
    int w, h;
    wxDisplaySize(&w, &h);

    ClientToScreen(&x, &y);
    if ( x < 0 ) x = 0;
    if ( y < 0 ) y = 0;
    if ( x >= w ) x = w-1;
    if ( y >= h ) y = h-1;

    wxIDirectFBDisplayLayerPtr layer(wxIDirectFB::Get()->GetDisplayLayer());
    wxCHECK_RET( layer, "no display layer" );

    layer->WarpCursor(x, y);
}
开发者ID:beanhome,项目名称:dev,代码行数:16,代码来源:window.cpp


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