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


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

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


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

示例1: IsSelectStateChanged

bool SCH_BUS_ENTRY_BASE::IsSelectStateChanged( const wxRect& aRect )
{
    bool previousState = IsSelected();

    // If either end of the bus entry is inside the selection rectangle, the entire
    // bus entry is selected.  Bus entries have a fixed length and angle.
    if( aRect.Contains( m_pos ) || aRect.Contains( m_End() ) )
        SetFlags( SELECTED );
    else
        ClearFlags( SELECTED );

    return previousState != IsSelected();
}
开发者ID:cpavlina,项目名称:kicad,代码行数:13,代码来源:sch_bus_entry.cpp

示例2: TracePixel

bool MapTerrainT::TracePixel(const wxPoint& Pixel, int Radius, const ViewWindow2DT& ViewWin) const
{
    const BoundingBox3fT BB  =GetBB();
    const wxRect         Disc=wxRect(Pixel, Pixel).Inflate(Radius, Radius);
    const wxRect         Rect=wxRect(ViewWin.WorldToWindow(BB.Min), ViewWin.WorldToWindow(BB.Max));

    // Note that the check against the Rect frame (that has a width of 2*Radius) is done in two steps:
    // First by checking if Disc is entirely outside of Rect, then below by checking if Disc is entirely inside Rect.
    if (!Rect.Intersects(Disc)) return false;
    if (Disc.Contains(ViewWin.WorldToWindow(BB.GetCenter()))) return true;
    if (Options.view2d.SelectByHandles) return false;
    return !Rect.Contains(Disc);
}
开发者ID:mark711,项目名称:Cafu,代码行数:13,代码来源:MapTerrain.cpp

示例3: IsObjectInRect

Bool CFxLine::IsObjectInRect(wxRect& Rect)
{
    vPointIter Iter;
	wxPoint CurrentPoint;
	wxPoint PrevPoint;
	for (Iter = _NodeVector.begin(); (Iter != _NodeVector.end()) && !(_NodeVector.empty()); Iter++)
	{
		(*Iter)->GetPoint(&CurrentPoint);

		if(Iter != _NodeVector.begin())
		{
            int dx=CurrentPoint.x-PrevPoint.x, dy=CurrentPoint.y-PrevPoint.y, steps, k;
            int X;
            int Y;
            float xi, yi, x=PrevPoint.x, y=PrevPoint.y;

            steps = abs(dx)>abs(dy)?abs(dx):abs(dy);
            xi=dx/(float)steps;		//Will be 1 or 1/m
            yi=dy/(float)steps;		//Will be m or 1

            for(k=0;k<steps;k++){
                X = round(x); Y = round(y);
                if( Rect.Contains(X, Y) )
                    return(TRUE);
                x += xi;
                y += yi;
            }
        }
        PrevPoint = CurrentPoint;
    }
    return FALSE;
}
开发者ID:toddyjiang,项目名称:ZX,代码行数:32,代码来源:FxLine.cpp

示例4: TestButtonHover

bool wxRibbonGallery::TestButtonHover(const wxRect& rect, wxPoint pos,
        wxRibbonGalleryButtonState* state)
{
    if(*state == wxRIBBON_GALLERY_BUTTON_DISABLED)
        return false;

    wxRibbonGalleryButtonState new_state;
    if(rect.Contains(pos))
    {
        if(m_mouse_active_rect == &rect)
            new_state = wxRIBBON_GALLERY_BUTTON_ACTIVE;
        else
            new_state = wxRIBBON_GALLERY_BUTTON_HOVERED;
    }
    else
        new_state = wxRIBBON_GALLERY_BUTTON_NORMAL;

    if(new_state != *state)
    {
        *state = new_state;
        return true;
    }
    else
    {
        return false;
    }
}
开发者ID:CustomCardsOnline,项目名称:wxWidgets,代码行数:27,代码来源:gallery.cpp

示例5: InsideRect

static bool InsideRect(const wxRect &rect, const wxPoint &pt)
{
#if wxCHECK_VERSION(2, 8, 0)
	return rect.Contains(pt);
#else
	return rect.Inside(pt);
#endif
}
开发者ID:stahta01,项目名称:codeAdapt_IDE,代码行数:8,代码来源:wxFlatNotebook.cpp

示例6: IsSelectStateChanged

bool SCH_NO_CONNECT::IsSelectStateChanged( const wxRect& aRect )
{
    bool previousState = IsSelected();

    if( aRect.Contains( m_pos ) )
        SetFlags( SELECTED );
    else
        ClearFlags( SELECTED );

    return previousState != IsSelected();
}
开发者ID:cpavlina,项目名称:kicad,代码行数:11,代码来源:sch_no_connect.cpp

示例7: IsSelectStateChanged

bool SCH_TEXT::IsSelectStateChanged( const wxRect& aRect )
{
    bool previousState = IsSelected();

    if( aRect.Contains( GetTextPos() ) )
        SetFlags( SELECTED );
    else
        ClearFlags( SELECTED );

    return previousState != IsSelected();
}
开发者ID:johnbeard,项目名称:kicad,代码行数:11,代码来源:sch_text.cpp

示例8: HitTest

wxJigsawInputParameter::wxJigsawInputParameterHitTest wxJigsawInputParameter::HitTest(
	const wxPoint & pos, const wxRect & paramRect, bool bDebug)
{
	do
	{
		if(!paramRect.Contains(pos)) break;
		if(pos.x - paramRect.GetLeft() < m_LabelSize.GetWidth())
		{
			return wxJSP_HITETST_LABEL;
		}
		if(m_Shape)
		{
			return wxJSP_HITTEST_SHAPE;
		}
		return wxJSP_HITTEST_SLOT;
	}
	while(false);
	return wxJSP_HITTEST_NONE;
}
开发者ID:cubemoon,项目名称:game-editor,代码行数:19,代码来源:wxJigsawInputParameter.cpp

示例9: HitTestRibbonButton

void wxRibbonBar::HitTestRibbonButton(const wxRect& rect, const wxPoint& position, bool &hover_flag)
{
    bool hovered = false, toggle_button_hovered = false;
    if(position.x >= 0 && position.y >= 0)
    {
        wxSize size = GetSize();
        if(position.x < size.GetWidth() && position.y < size.GetHeight())
        {
            hovered = true;
        }
    }
    if(hovered)
    {
        toggle_button_hovered = rect.Contains(position);

        if ( hovered != m_bar_hovered || toggle_button_hovered != hover_flag )
        {
            m_bar_hovered = hovered;
            hover_flag = toggle_button_hovered;
            Refresh(false);
        }
    }
}
开发者ID:CustomCardsOnline,项目名称:wxWidgets,代码行数:23,代码来源:bar.cpp

示例10: ShowValueTooltip

bool DebugInterfaceFactory::ShowValueTooltip(const cb::shared_ptr<cbWatch> &watch, const wxRect &rect)
{
    delete m_tooltip;
    m_tooltip = nullptr;

    wxPoint pt = wxGetMousePosition();
    if (!rect.Contains(pt))
        return false;
    else
    {
        m_tooltip = new ValueTooltip(watch, Manager::Get()->GetAppWindow());
#ifndef __WXMAC__
        m_tooltip->Position(pt, wxSize(0, 0));
#endif
        // hide any other tooltips
        EditorBase *base = Manager::Get()->GetEditorManager()->GetActiveEditor();
        cbEditor *ed = base && base->IsBuiltinEditor() ? static_cast<cbEditor*>(base) : nullptr;
        if (ed && ed->GetControl()->CallTipActive())
            ed->GetControl()->CallTipCancel();

        m_tooltip->Show();
        return true;
    }
}
开发者ID:WinterMute,项目名称:codeblocks_sf,代码行数:24,代码来源:debugger_interface_creator.cpp

示例11: DoCentre

void wxTopLevelWindowBase::DoCentre(int dir)
{
    // on some platforms centering top level windows is impossible
    // because they are always maximized by guidelines or limitations
    //
    // and centering a maximized window doesn't make sense as its position
    // can't change
    if ( IsAlwaysMaximized() || IsMaximized() )
        return;

    // we need the display rect anyhow so store it first: notice that we should
    // be centered on the same display as our parent window, the display of
    // this window itself is not really defined yet
    int nDisplay = wxDisplay::GetFromWindow(GetParent() ? GetParent() : this);
    wxDisplay dpy(nDisplay == wxNOT_FOUND ? 0 : nDisplay);
    const wxRect rectDisplay(dpy.GetClientArea());

    // what should we centre this window on?
    wxRect rectParent;
    if ( !(dir & wxCENTRE_ON_SCREEN) && GetParent() )
    {
        // centre on parent window: notice that we need screen coordinates for
        // positioning this TLW
        rectParent = GetParent()->GetScreenRect();

        // if the parent is entirely off screen (happens at least with MDI
        // parent frame under Mac but could happen elsewhere too if the frame
        // was hidden/moved away for some reason), don't use it as otherwise
        // this window wouldn't be visible at all
        if ( !rectParent.Intersects(rectDisplay) )
        {
            // just centre on screen then
            rectParent = rectDisplay;
        }
    }
    else
    {
        // we were explicitly asked to centre this window on the entire screen
        // or if we have no parent anyhow and so can't centre on it
        rectParent = rectDisplay;
    }

    if ( !(dir & wxBOTH) )
        dir |= wxBOTH; // if neither is specified, center in both directions

    // the new window rect candidate
    wxRect rect = GetRect().CentreIn(rectParent, dir & ~wxCENTRE_ON_SCREEN);

    // we don't want to place the window off screen if Centre() is called as
    // this is (almost?) never wanted and it would be very difficult to prevent
    // it from happening from the user code if we didn't check for it here
    if ( !rectDisplay.Contains(rect.GetTopLeft()) )
    {
        // move the window just enough to make the corner visible
        int dx = rectDisplay.GetLeft() - rect.GetLeft();
        int dy = rectDisplay.GetTop() - rect.GetTop();
        rect.Offset(dx > 0 ? dx : 0, dy > 0 ? dy : 0);
    }

    if ( !rectDisplay.Contains(rect.GetBottomRight()) )
    {
        // do the same for this corner too
        int dx = rectDisplay.GetRight() - rect.GetRight();
        int dy = rectDisplay.GetBottom() - rect.GetBottom();
        rect.Offset(dx < 0 ? dx : 0, dy < 0 ? dy : 0);
    }

    // the window top left and bottom right corner are both visible now and
    // although the window might still be not entirely on screen (with 2
    // staggered displays for example) we wouldn't be able to improve the
    // layout much in such case, so we stop here

    // -1 could be valid coordinate here if there are several displays
    SetSize(rect, wxSIZE_ALLOW_MINUS_ONE);
}
开发者ID:mark711,项目名称:Cafu,代码行数:75,代码来源:toplvcmn.cpp

示例12: ReplaceStaticWithEdit

void wxMessageDialog::ReplaceStaticWithEdit()
{
    // check if the message box fits the display
    int nDisplay = wxDisplay::GetFromWindow(this);
    if ( nDisplay == wxNOT_FOUND )
        nDisplay = 0;
    const wxRect rectDisplay = wxDisplay(nDisplay).GetClientArea();

    if ( rectDisplay.Contains(GetRect()) )
    {
        // nothing to do
        return;
    }


    // find the static control to replace: normally there are two of them, the
    // icon and the text itself so search for all of them and ignore the icon
    // ones
    HWND hwndStatic = ::FindWindowEx(GetHwnd(), NULL, wxT("STATIC"), NULL);
    if ( ::GetWindowLong(hwndStatic, GWL_STYLE) & SS_ICON )
        hwndStatic = ::FindWindowEx(GetHwnd(), hwndStatic, wxT("STATIC"), NULL);

    if ( !hwndStatic )
    {
        wxLogDebug("Failed to find the static text control in message box.");
        return;
    }

    // set the right font for GetCharHeight() call below
    wxWindowBase::SetFont(GetMessageFont());

    // put the new edit control at the same place
    RECT rc = wxGetWindowRect(hwndStatic);
    ScreenRectToClient(GetHwnd(), rc);

    // but make it less tall so that the message box fits on the screen: we try
    // to make the message box take no more than 7/8 of the screen to leave
    // some space above and below it
    const int hText = (7*rectDisplay.height)/8 -
                      (
                         2*::GetSystemMetrics(SM_CYFIXEDFRAME) +
                         ::GetSystemMetrics(SM_CYCAPTION) +
                         5*GetCharHeight() // buttons + margins
                      );
    const int dh = (rc.bottom - rc.top) - hText; // vertical space we save
    rc.bottom -= dh;

    // and it also must be wider as it needs a vertical scrollbar (in order
    // to preserve the word wrap, otherwise the number of lines would change
    // and we want the control to look as similar as possible to the original)
    //
    // NB: you would have thought that 2*SM_CXEDGE would be enough but it
    //     isn't, somehow, and the text control breaks lines differently from
    //     the static one so fudge by adding some extra space
    const int dw = ::GetSystemMetrics(SM_CXVSCROLL) +
                        4*::GetSystemMetrics(SM_CXEDGE);
    rc.right += dw;


    // chop of the trailing new line(s) from the message box text, they are
    // ignored by the static control but result in extra lines and hence extra
    // scrollbar position in the edit one
    wxString text(wxGetWindowText(hwndStatic));
    for ( wxString::reverse_iterator i = text.rbegin(); i != text.rend(); ++i )
    {
        if ( *i != '\n' )
        {
            // found last non-newline char, remove anything after it if
            // necessary and stop in any case
            if ( i != text.rbegin() )
                text.erase(i.base() + 1, text.end());
            break;
        }
    }

    // do create the new control
    HWND hwndEdit = ::CreateWindow
                      (
                        wxT("EDIT"),
                        wxTextBuffer::Translate(text).t_str(),
                        WS_CHILD | WS_VSCROLL | WS_VISIBLE |
                        ES_MULTILINE | ES_READONLY | ES_AUTOVSCROLL,
                        rc.left, rc.top,
                        rc.right - rc.left, rc.bottom - rc.top,
                        GetHwnd(),
                        NULL,
                        wxGetInstance(),
                        NULL
                      );

    if ( !hwndEdit )
    {
        wxLogDebug("Creation of replacement edit control failed in message box");
        return;
    }

    // copy the font from the original control
    LRESULT hfont = ::SendMessage(hwndStatic, WM_GETFONT, 0, 0);
    ::SendMessage(hwndEdit, WM_SETFONT, hfont, 0);

//.........这里部分代码省略.........
开发者ID:AdmiralCurtiss,项目名称:pcsx2,代码行数:101,代码来源:msgdlg.cpp

示例13: IsInside

bool wxSFShapeBase::IsInside(const wxRect& rct)
{
	// HINT: overload it for custom actions...

	return rct.Contains(this->GetBoundingBox());
}
开发者ID:BlitzMaxModules,项目名称:wx.mod,代码行数:6,代码来源:ShapeBase.cpp

示例14: InsideRect

static bool InsideRect(const wxRect &rect, const wxPoint &pt)
{
	return rect.Contains(pt);
}
开发者ID:WinterMute,项目名称:codeblocks_sf,代码行数:4,代码来源:wxFlatNotebook.cpp


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