bool operator!=(const wxRect& rect) const { return !(*this == rect); }
// return true if the point is (not strcitly) inside the rect
- bool Inside(int x, int y) const;
- bool Inside(const wxPoint& pt) const { return Inside(pt.x, pt.y); }
+ bool Contains(int x, int y) const;
+ bool Contains(const wxPoint& pt) const { return Contains(pt.x, pt.y); }
// return true if the rectangle is (not strcitly) inside the rect
- bool Inside(const wxRect& rect) const;
+ bool Contains(const wxRect& rect) const;
+
+#if WXWIN_COMPATIBILITY_2_6
+ // use Contains() instead
+ wxDEPRECATED( bool Inside(int x, int y) const );
+ wxDEPRECATED( bool Inside(const wxPoint& pt) const );
+ wxDEPRECATED( bool Inside(const wxRect& rect) const );
+#endif // WXWIN_COMPATIBILITY_2_6
// return true if the rectangles have a non empty intersection
bool Intersects(const wxRect& rect) const;
int x, y, width, height;
};
+#if WXWIN_COMPATIBILITY_2_6
+inline bool wxRect::Inside(int x, int y) const { return Contains(x, y); }
+inline bool wxRect::Inside(const wxPoint& pt) const { return Contains(pt); }
+inline bool wxRect::Inside(const wxRect& rect) const { return Contains(rect); }
+#endif // WXWIN_COMPATIBILITY_2_6
+
+
// ---------------------------------------------------------------------------
// Management of pens, brushes and fonts
// ---------------------------------------------------------------------------
// true if a tab was hit, otherwise false
bool wxAuiTabContainer::TabHitTest(int x, int y, wxWindow** hit) const
{
- if (!m_rect.Inside(x,y))
+ if (!m_rect.Contains(x,y))
return false;
size_t i, page_count = m_pages.GetCount();
for (i = 0; i < page_count; ++i)
{
wxAuiNotebookPage& page = m_pages.Item(i);
- if (page.rect.Inside(x,y))
+ if (page.rect.Contains(x,y))
{
*hit = page.window;
return true;
bool wxAuiTabContainer::ButtonHitTest(int x, int y,
wxAuiTabContainerButton** hit) const
{
- if (!m_rect.Inside(x,y))
+ if (!m_rect.Contains(x,y))
return false;
size_t i, button_count = m_buttons.GetCount();
for (i = 0; i < button_count; ++i)
{
wxAuiTabContainerButton& button = m_buttons.Item(i);
- if (button.rect.Inside(x,y))
+ if (button.rect.Contains(x,y))
{
*hit = &button;
return true;
continue;
wxTabFrame* tabframe = (wxTabFrame*)all_panes.Item(i).window;
- if (tabframe->m_tab_rect.Inside(pt))
+ if (tabframe->m_tab_rect.Contains(pt))
return tabframe->m_tabs;
}
continue;
// if the point is inside the rectangle, we have a hit
- if (item->rect.Inside(x,y))
+ if (item->rect.Contains(x,y))
result = item;
}
// should float if being dragged over center pane windows
if (!part->dock->fixed || part->dock->dock_direction == wxAUI_DOCK_CENTER)
{
- if (m_last_rect.IsEmpty() || m_last_rect.Inside(pt.x, pt.y ))
+ if (m_last_rect.IsEmpty() || m_last_rect.Contains(pt.x, pt.y ))
{
m_skipping = true;
}
// If cursor not on dropdown button, then clear its state
// (technically not required by all ports, but do it for all just in case)
- if ( !m_btnArea.Inside(ScreenToClient(::wxGetMousePosition())) )
+ if ( !m_btnArea.Contains(ScreenToClient(::wxGetMousePosition())) )
m_btnState = 0;
// Return parent's tab traversal flag.
wxGBSizerItem* item = (wxGBSizerItem*)node->GetData();
wxRect rect(item->GetPosition(), item->GetSize());
rect.Inflate(m_hgap, m_vgap);
- if ( rect.Inside(pt) )
+ if ( rect.Contains(pt) )
return item;
node = node->GetNext();
}
return *this;
}
-bool wxRect::Inside(int cx, int cy) const
+bool wxRect::Contains(int cx, int cy) const
{
return ( (cx >= x) && (cy >= y)
&& ((cy - y) < height)
);
}
-bool wxRect::Inside(const wxRect& rect) const
+bool wxRect::Contains(const wxRect& rect) const
{
- return Inside(rect.GetTopLeft()) && Inside(rect.GetBottomRight());
+ return Contains(rect.GetTopLeft()) && Contains(rect.GetBottomRight());
}
wxRect& wxRect::Intersect(const wxRect& rect)
}
else
{
- wxCHECK_RET( imageRect.Inside(rect.GetTopLeft()) &&
- imageRect.Inside(rect.GetBottomRight()),
+ wxCHECK_RET( imageRect.Contains(rect.GetTopLeft()) &&
+ imageRect.Contains(rect.GetBottomRight()),
wxT("invalid bounding rectangle") );
}
wxPoint pos = ScreenToClient(wxGetMousePosition());
wxRect rect(GetSize());
- if ( rect.Inside(pos) )
+ if ( rect.Contains(pos) )
{
if ( m_child->HasCapture() )
{
// 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 ( !rectDisplay.Inside(rectParent.GetTopLeft()) &&
- !rectParent.Inside(rectParent.GetBottomRight()) )
+ if ( !rectDisplay.Contains(rectParent.GetTopLeft()) &&
+ !rectParent.Contains(rectParent.GetBottomRight()) )
{
// this is enough to make IsEmpty() test below pass
rectParent.width = 0;
// 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.Inside(rect.GetTopLeft()) )
+ if ( rectDisplay.Contains(rect.GetTopLeft()) )
{
- if ( !rectDisplay.Inside(rect.GetBottomRight()) )
+ if ( !rectDisplay.Contains(rect.GetBottomRight()) )
{
// check if we can move the window so that the bottom right corner
// is visible without hiding the top left one
}
wxRect rect(pos, sz);
- if (rect.Inside(pt))
+ if (rect.Contains(pt))
return win;
return NULL;
wxRect clientRect(GetClientRect());
// only send wxNcPaintEvent if drawing at least part of nonclient area:
- if ( !clientRect.Inside(rect) )
+ if ( !clientRect.Contains(rect) )
{
wxNcPaintEvent eventNc(GetId());
eventNc.SetEventObject(this);
void wxGenericComboControl::OnMouseEvent( wxMouseEvent& event )
{
- bool isOnButtonArea = m_btnArea.Inside(event.m_x,event.m_y);
+ bool isOnButtonArea = m_btnArea.Contains(event.m_x,event.m_y);
int handlerFlags = isOnButtonArea ? wxCC_MF_ON_BUTTON : 0;
// Preprocessing fabricates double-clicks and prevents
void wxHyperlinkCtrl::OnLeftDown(wxMouseEvent& event)
{
// the left click must start from the hyperlink rect
- m_clicking = GetLabelRect().Inside(event.GetPosition());
+ m_clicking = GetLabelRect().Contains(event.GetPosition());
}
void wxHyperlinkCtrl::OnLeftUp(wxMouseEvent& event)
{
// the click must be started and ended in the hyperlink rect
- if (!m_clicking || !GetLabelRect().Inside(event.GetPosition()))
+ if (!m_clicking || !GetLabelRect().Contains(event.GetPosition()))
return;
SetForegroundColour(m_visitedColour);
void wxHyperlinkCtrl::OnRightUp(wxMouseEvent& event)
{
if( GetWindowStyle() & wxHL_CONTEXTMENU )
- if ( GetLabelRect().Inside(event.GetPosition()) )
+ if ( GetLabelRect().Contains(event.GetPosition()) )
DoContextMenu(wxPoint(event.m_x, event.m_y));
}
{
wxRect textrc = GetLabelRect();
- if (textrc.Inside(event.GetPosition()))
+ if (textrc.Contains(event.GetPosition()))
{
SetCursor(wxCursor(wxCURSOR_HAND));
SetForegroundColour(m_hoverColour);
const wxPoint listPt = list->ScreenToClient(ClientToScreen(pt));
// is the point inside list control?
- if ( wxRect(list->GetSize()).Inside(listPt) )
+ if ( wxRect(list->GetSize()).Contains(listPt) )
{
int flagsList;
pagePos = list->HitTest(listPt, flagsList);
}
else // not over list control at all
{
- if ( flags && GetPageRect().Inside(pt) )
+ if ( flags && GetPageRect().Contains(pt) )
*flags |= wxBK_HITTEST_ONPAGE;
}
{
wxCHECK_MSG( m_rect, false, _T("can't be called in this mode") );
- return wxRect(GetX(), GetY(), GetWidth(), GetHeight()).Inside(x, y);
+ return wxRect(GetX(), GetY(), GetWidth(), GetHeight()).Contains(x, y);
}
int wxListItemData::GetX() const
wxListLineData *ld = GetLine(line);
- if ( ld->HasImage() && GetLineIconRect(line).Inside(x, y) )
+ if ( ld->HasImage() && GetLineIconRect(line).Contains(x, y) )
return wxLIST_HITTEST_ONITEMICON;
// VS: Testing for "ld->HasText() || InReportView()" instead of
wxRect rect = InReportView() ? GetLineRect(line)
: GetLineLabelRect(line);
- if ( rect.Inside(x, y) )
+ if ( rect.Contains(x, y) )
return wxLIST_HITTEST_ONITEMLABEL;
}
const wxRect& rectBound = m_parent->m_rectBound;
if ( rectBound.width &&
- !rectBound.Inside(ClientToScreen(event.GetPosition())) )
+ !rectBound.Contains(ClientToScreen(event.GetPosition())) )
{
// mouse left the bounding rect, disappear
m_parent->Close();
const wxPoint tbarPt = tbar->ScreenToClient(ClientToScreen(pt));
// is the point over the toolbar?
- if ( wxRect(tbar->GetSize()).Inside(tbarPt) )
+ if ( wxRect(tbar->GetSize()).Contains(tbarPt) )
{
const wxToolBarToolBase * const
tool = tbar->FindToolForPosition(tbarPt.x, tbarPt.y);
}
else // not over the toolbar
{
- if ( flags && GetPageRect().Inside(pt) )
+ if ( flags && GetPageRect().Contains(pt) )
*flags |= wxBK_HITTEST_ONPAGE;
}
const wxPoint treePt = tree->ScreenToClient(ClientToScreen(pt));
// is it over the tree?
- if ( wxRect(tree->GetSize()).Inside(treePt) )
+ if ( wxRect(tree->GetSize()).Contains(treePt) )
{
int flagsTree;
wxTreeItemId id = tree->HitTest(treePt, flagsTree);
}
else // not over the tree
{
- if ( flags && GetPageRect().Inside( pt ) )
+ if ( flags && GetPageRect().Contains( pt ) )
*flags |= wxBK_HITTEST_ONPAGE;
}
{
// gtk_tree_view_get_path_at_pos() also gets items that are not visible and
// we only want visible items we need to check for it manually here
- if ( !GetClientRect().Inside(point) )
+ if ( !GetClientRect().Contains(point) )
return wxNOT_FOUND;
// need to translate from master window since it is in client coords
wxPoint pos = GetPosition();
rect.x -= pos.x;
rect.y -= pos.y;
- if ( rect.Inside( pt ) )
+ if ( rect.Contains( pt ) )
*flags |= wxBK_HITTEST_ONPAGE;
}
}
for ( wxRadioBoxButtonsInfoList::compatibility_iterator
node = m_buttonsInfo.GetFirst(); node; node = node->GetNext(), n++ )
{
- if ( m_buttonsInfo[n]->rect.Inside(pt) )
+ if ( m_buttonsInfo[n]->rect.Contains(pt) )
return n;
}
void wxComboCtrl::OnMouseEvent( wxMouseEvent& event )
{
- bool isOnButtonArea = m_btnArea.Inside(event.m_x,event.m_y);
+ bool isOnButtonArea = m_btnArea.Contains(event.m_x,event.m_y);
int handlerFlags = isOnButtonArea ? wxCC_MF_ON_BUTTON : 0;
// Preprocessing fabricates double-clicks and prevents
*flags |= wxBK_HITTEST_ONICON;
if ((hitTestInfo.flags & TCHT_ONITEMLABEL) == TCHT_ONITEMLABEL)
*flags |= wxBK_HITTEST_ONLABEL;
- if ( item == wxNOT_FOUND && GetPageSize().Inside(pt) )
+ if ( item == wxNOT_FOUND && GetPageSize().Contains(pt) )
*flags |= wxBK_HITTEST_ONPAGE;
}
GetBoundingRect(event.m_item, ItemRect, false);
// If the point is inside the bounding rectangle, use it as the click position.
// This should be the case for WM_CONTEXTMENU as the result of a right-click
- if (ItemRect.Inside(MenuPoint))
+ if (ItemRect.Contains(MenuPoint))
{
event.m_pointDrag = MenuPoint;
}
vLibRect.SetTop(vRect.yTop);
vLibRect.SetRight(vRect.xRight);
vLibRect.SetBottom(vRect.yBottom);
- if (vLibRect.Inside(rPoint))
+ if (vLibRect.Contains(rPoint))
return pRecord->m_ulItemId;
for (i = lStart + 1; i < vCnrInfo.cRecords; i++)
vLibRect.SetTop(vRect.yTop);
vLibRect.SetRight(vRect.xRight);
vLibRect.SetBottom(vRect.yBottom);
- if (vLibRect.Inside(rPoint))
+ if (vLibRect.Contains(rPoint))
return pRecord->m_ulItemId;
}
return -1L;
vWxRectContainer.SetTop(vRectContainer.yTop);
vWxRectContainer.SetRight(vRectContainer.xRight);
vWxRectContainer.SetBottom(vRectContainer.yBottom);
- return (vWxRectContainer.Inside(wxPoint(vWxRectRecord.x, vWxRectRecord.y)));
+ return (vWxRectContainer.Contains(wxPoint(vWxRectRecord.x, vWxRectRecord.y)));
} // end of wxTreeCtrl::IsVisible
bool wxTreeCtrl::ItemHasChildren (
*flags = wxBK_HITTEST_NOWHERE;
// first check that it is in this window at all
- if ( !GetClientRect().Inside(pt) )
+ if ( !GetClientRect().Contains(pt) )
{
return -1;
}
{
GetTabSize(n, &rectTabs.width, &rectTabs.height);
- if ( rectTabs.Inside(pt) )
+ if ( rectTabs.Contains(pt) )
{
if ( flags )
{
CalcThumbRect(&rectShaft, &rectThumb, NULL);
// check for possible shaft or thumb hit
- if (!rectShaft.Inside(pt) && !rectThumb.Inside(pt))
+ if (!rectShaft.Contains(pt) && !rectThumb.Contains(pt))
{
return wxScrollThumb::Shaft_None;
}
wxRect rectArrow1, rectArrow2;
CalcArrowRects(&rectArrow1, &rectArrow2);
- if ( rectArrow1.Inside(pt) )
+ if ( rectArrow1.Contains(pt) )
return wxScrollArrows::Arrow_First;
- else if ( rectArrow2.Inside(pt) )
+ else if ( rectArrow2.Contains(pt) )
return wxScrollArrows::Arrow_Second;
else
return wxScrollArrows::Arrow_None;
{
wxRect client = GetFrameClientArea(rect, flags);
- if ( client.Inside(pt) )
+ if ( client.Contains(pt) )
return wxHT_TOPLEVEL_CLIENT_AREA;
if ( flags & wxTOPLEVEL_TITLEBAR )
if ( flags & wxTOPLEVEL_ICON )
{
- if ( wxRect(client.GetPosition(), GetFrameIconSize()).Inside(pt) )
+ if ( wxRect(client.GetPosition(), GetFrameIconSize()).Contains(pt) )
return wxHT_TOPLEVEL_ICON;
}
if ( flags & wxTOPLEVEL_BUTTON_CLOSE )
{
- if ( btnRect.Inside(pt) )
+ if ( btnRect.Contains(pt) )
return wxHT_TOPLEVEL_BUTTON_CLOSE;
btnRect.x -= FRAME_BUTTON_WIDTH + 2;
}
if ( flags & wxTOPLEVEL_BUTTON_MAXIMIZE )
{
- if ( btnRect.Inside(pt) )
+ if ( btnRect.Contains(pt) )
return wxHT_TOPLEVEL_BUTTON_MAXIMIZE;
btnRect.x -= FRAME_BUTTON_WIDTH;
}
if ( flags & wxTOPLEVEL_BUTTON_RESTORE )
{
- if ( btnRect.Inside(pt) )
+ if ( btnRect.Contains(pt) )
return wxHT_TOPLEVEL_BUTTON_RESTORE;
btnRect.x -= FRAME_BUTTON_WIDTH;
}
if ( flags & wxTOPLEVEL_BUTTON_ICONIZE )
{
- if ( btnRect.Inside(pt) )
+ if ( btnRect.Contains(pt) )
return wxHT_TOPLEVEL_BUTTON_ICONIZE;
btnRect.x -= FRAME_BUTTON_WIDTH;
}
if ( flags & wxTOPLEVEL_BUTTON_HELP )
{
- if ( btnRect.Inside(pt) )
+ if ( btnRect.Contains(pt) )
return wxHT_TOPLEVEL_BUTTON_HELP;
btnRect.x -= FRAME_BUTTON_WIDTH;
}