本文整理汇总了C++中wxRect::GetTopLeft方法的典型用法代码示例。如果您正苦于以下问题:C++ wxRect::GetTopLeft方法的具体用法?C++ wxRect::GetTopLeft怎么用?C++ wxRect::GetTopLeft使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxRect
的用法示例。
在下文中一共展示了wxRect::GetTopLeft方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Render
virtual bool Render(wxRect cell, wxDC *dc, int state) {
wxVariant v;
GetValue(v);
wxString str = v.GetString();
str.Trim();
wxPoint pt = cell.GetTopLeft();
wxFont f = m_font;
bool isSelected = false; //state & wxDATAVIEW_CELL_SELECTED;
if ( str.StartsWith(ERROR_MARKER, &str) ) {
if ( !isSelected ) {
dc->SetTextForeground( m_errFgColor );
}
} else if( str.StartsWith(WARNING_MARKER, &str) ) {
if ( !isSelected ) {
dc->SetTextForeground( m_warnFgColor );
}
} else if ( str.StartsWith(SUMMARY_MARKER, &str) ) {
f.SetWeight(wxFONTWEIGHT_BOLD);
} else if( str.StartsWith(wxT("----")) ) {
f.SetStyle(wxFONTSTYLE_ITALIC);
if ( !isSelected )
dc->SetTextForeground(m_greyColor);
} else if(str.Contains(wxT("Entering directory")) || str.Contains(wxT("Leaving directory"))) {
f.SetStyle(wxFONTSTYLE_ITALIC);
if ( !isSelected )
dc->SetTextForeground(m_greyColor);
}
if(str.StartsWith(SUMMARY_MARKER_ERROR, &str)) {
dc->DrawBitmap(m_errorBmp, pt);
pt.x += m_errorBmp.GetWidth() + 2;
str.Prepend(wxT(": "));
} else if( str.StartsWith(SUMMARY_MARKER_WARNING, &str)) {
dc->DrawBitmap(m_warningBmp, pt);
pt.x += m_warningBmp.GetWidth() + 2;
str.Prepend(wxT(": "));
} else if(str.StartsWith(SUMMARY_MARKER_SUCCESS, &str)) {
dc->DrawBitmap(m_successBmp, pt);
pt.x += m_successBmp.GetWidth() + 2;
str.Prepend(wxT(": "));
}
dc->SetFont(f);
if ( (str.length() * m_charWidth) > BUILD_PANE_WIDTH ) {
size_t newWidth = (BUILD_PANE_WIDTH / m_charWidth) - 1;
str = str.Mid(0, newWidth);
}
dc->DrawText(str, pt);
return true;
}
示例2: _Draw_Image
//---------------------------------------------------------
void CVIEW_ScatterPlot::_Draw_Image(wxDC &dc, wxRect r)
{
CSG_Colors *pColors = m_Options("DENSITY_PAL")->asColors();
wxImage Image(r.GetWidth(), r.GetHeight());
double dCount = (pColors->Get_Count() - 2.0) / log(1.0 + m_Count.Get_Max());
double dx = (m_Count.Get_NX() - 1.0) / (double)r.GetWidth ();
double dy = (m_Count.Get_NY() - 1.0) / (double)r.GetHeight();
//-----------------------------------------------------
#pragma omp parallel for
for(int y=Image.GetHeight()-1; y>=0; y--)
{
double Count;
double ix = 0.0;
double iy = m_Count.Get_NY() - 1 - y * dy;
for(int x=0; x<Image.GetWidth(); x++, ix+=dx)
{
int i = m_Count.Get_Value(ix, iy, Count) && Count > 0.0 ? (int)(log(1.0 + Count) * dCount) : 0;
Image.SetRGB(x, y, pColors->Get_Red(i), pColors->Get_Green(i), pColors->Get_Blue(i));
}
}
dc.DrawBitmap(wxBitmap(Image), r.GetTopLeft());
}
示例3: Render
bool Render(wxRect rect, wxDC* dc, int state) {
bool ret = true;
wxString preview = Hit.Preview;
// we want to trim the leading whitespace so that the
// preview text is aligned left; however trimming the
// leading spaces means that we need to account for the
// number of spaces we trimmed so that we split
// the before/after hit string correctly
size_t spaceCount = 0;
for (; spaceCount < preview.length(); ++spaceCount) {
if (preview[spaceCount] != ' ' && preview[spaceCount] != '\t'
&& preview[spaceCount] != '\v'
&& preview[spaceCount] != '\r' && preview[spaceCount] != '\n') {
break;
}
}
preview.Trim(false);
// break the preview into before/during/after hit.
// taking into account the spaces that were trimmed
// from the beginning of the string
wxString beforeHit = preview.Mid(0, Hit.LineOffset - spaceCount);
wxString hit = preview.Mid(Hit.LineOffset - spaceCount, Hit.MatchLength);
wxString afterHit = preview.Mid(Hit.LineOffset + Hit.MatchLength - spaceCount);
wxSize sizeBeforeHit = GetTextExtent(beforeHit);
wxSize sizeHit = GetTextExtent(hit);
wxPoint posBeforeHit = rect.GetTopLeft();
wxPoint posHit = rect.GetTopLeft();
posHit.x += sizeBeforeHit.GetWidth();
wxPoint posAfterHit = rect.GetTopLeft();
posAfterHit.x += sizeBeforeHit.GetWidth() + sizeHit.GetWidth();
dc->DrawText(beforeHit, posBeforeHit);
dc->SetBackgroundMode(wxSOLID);
dc->SetTextBackground(*wxYELLOW);
dc->DrawText(hit, posHit);
dc->SetBackgroundMode(wxTRANSPARENT);
dc->DrawText(afterHit, posAfterHit);
return ret;
}
示例4: Create
/*********************************************************************************************
> virtual BOOL CRenderWnd::Create(const wxRect& rect,
wxWindow* parent, UINT32 id)
Author: Justin_Flude (Xara Group Ltd) <[email protected]>
Created: ages ago
Inputs: Windows instance-style flags; a
rectangle describing the position of the scroller; a pointer to its
parent window; a child window numeric identifier
Outputs: -
Returns: TRUE if the window is successfully created.
Purpose: Registers a new window class with the operating system, which accepts
double clicks, is byte-aligned in video RAM and is responsible for
drawing is own backgrounds.
Errors: -
Scope: Public
SeeAlso: CCamView::OnCreate()
**********************************************************************************************/
BOOL CRenderWnd::Create(const wxRect& rect,
wxWindow *pParent, UINT32 id)
{
BOOL ok=wxWindow::Create(pParent, id, rect.GetTopLeft(), rect.GetSize(), wxNO_FULL_REPAINT_ON_RESIZE);
SetExtraStyle(wxWS_EX_PROCESS_IDLE);
#if defined(__WXGTK__)
::SetDoubleBuffer(this, m_DoubleBuffer);
#endif
return ok;
}
示例5: DrawBottomRect
void clTabRendererCurved::DrawBottomRect(
clTabInfo::Ptr_t activeTab, const wxRect& clientRect, wxDC& dc, const clTabColours& colours, size_t style)
{
#ifdef __WXOSX__
if(!IS_VERTICAL_TABS(style)) {
wxPoint pt1, pt2;
dc.SetPen(colours.activeTabBgColour);
if(style & kNotebook_BottomTabs) {
// bottom tabs
pt1 = clientRect.GetTopLeft();
pt2 = clientRect.GetTopRight();
DRAW_LINE(pt1, pt2);
} else {
// Top tabs
pt1 = clientRect.GetBottomLeft();
pt2 = clientRect.GetBottomRight();
pt1.y -= 1;
pt2.y -= 1;
DRAW_LINE(pt1, pt2);
}
}
#else
if(!IS_VERTICAL_TABS(style)) {
wxPoint pt1, pt2;
dc.SetPen(colours.activeTabPenColour);
if(style & kNotebook_BottomTabs) {
// bottom tabs
pt1 = clientRect.GetTopLeft();
pt2 = clientRect.GetTopRight();
DRAW_LINE(pt1, pt2);
} else {
// Top tabs
pt1 = clientRect.GetBottomLeft();
pt2 = clientRect.GetBottomRight();
DRAW_LINE(pt1, pt2);
}
}
#endif
}
示例6: Render
virtual bool Render(wxRect cell, wxDC* dc, int state)
{
wxVariant v;
GetValue(v);
wxString str = v.GetString();
str.Trim();
wxPoint pt = cell.GetTopLeft();
wxFont f = m_font;
dc->SetFont(f);
dc->DrawText(str, pt);
return true;
}
示例7: DoAdjustPosition
void DisplayVariableDlg::DoAdjustPosition()
{
if ( m_keepCurrentPosition ) {
// Reset the flag
m_keepCurrentPosition = false;
Move(s_Rect.GetTopLeft());
s_Rect = wxRect();
return;
}
Move( ::wxGetMousePosition() );
}
示例8: DrawFieldSeparator
void wxCustomStatusBarArt::DrawFieldSeparator(wxDC& dc, const wxRect& fieldRect)
{
// draw border line
dc.SetPen(GetPenColour());
wxPoint bottomPt, topPt;
topPt = fieldRect.GetTopLeft();
topPt.y += 2;
bottomPt = fieldRect.GetBottomLeft();
bottomPt.y += 1;
dc.DrawLine(topPt, bottomPt);
}
示例9: Stroke
void SkinRegion::Stroke(wxDC& dc, wxGraphicsContext* gc, const wxRect& rect, int /*n*/)
{
if (!has_border)
return;
int penw = border.GetWidth() / 2.0f;
wxRect r(rect);
r.Deflate(penw, penw);
//border.SetCap(wxCAP_PROJECTING);
if (rounded) {
bool needsDelete = false;
if (!gc) {
gc = wxGraphicsContext::Create((wxWindowDC&)dc);
needsDelete = true;
}
gc->SetBrush(*wxTRANSPARENT_BRUSH);
gc->SetPen(border);
gc->DrawRoundedRectangle(rect.x, rect.y, rect.width, rect.height, rounded * .97);
rect.Inflate(penw, penw);
if (needsDelete)
delete gc;
} else {
dc.SetPen(border);
int offset = (int)(border.GetWidth() % 2 == 0);
wxPoint x(offset, 0);
wxPoint y(0, offset);
dc.DrawLine(rect.GetTopLeft(), rect.GetBottomLeft() + y);
dc.DrawLine(rect.GetBottomLeft() + y, rect.GetBottomRight() + y + x);
dc.DrawLine(rect.GetBottomRight() + y + x, rect.GetTopRight() + x);
dc.DrawLine(rect.GetTopRight() + x, rect.GetTopLeft());
}
}
示例10: GetInvalidatedIconRange
wxSize CDragBar::GetInvalidatedIconRange(const wxRect& rect)
{
switch(m_orientation) {
case wxHORIZONTAL:
{
int first = FindToolFromCoords(rect.GetTopLeft());
if (first == -1)
first = FindToolFromCoords(rect.GetTopLeft() + wxSize(m_margins.GetWidth(), 0));
int last = FindToolFromCoords(rect.GetTopRight());
if (last == -1) {
last = FindToolFromCoords(rect.GetTopRight() - wxSize(m_margins.GetWidth(), 0));
if (last == -1)
last = static_cast<int>(m_items.size() - 1);
}
return wxSize(first, last);
}
case wxVERTICAL:
{
int first = FindToolFromCoords(rect.GetTopLeft());
if (first == -1)
first = FindToolFromCoords(rect.GetTopLeft() + wxSize(0, m_margins.GetHeight()));
int last = FindToolFromCoords(rect.GetBottomLeft());
if (last == -1) {
last = FindToolFromCoords(rect.GetBottomLeft() - wxSize(0, m_margins.GetHeight()));
if (last == -1)
last = static_cast<int>(m_items.size() - 1);
}
return wxSize(first, last);
}
default:
wxFAIL_MSG(wxT("m_orientation not initialized correctly"));
return wxSize(0, 0);
}
}
示例11: overdraw_rectangle
void Canvas::overdraw_rectangle(wxRect rect, wxDC *dc)
{
wxRect edges[4];
wxSize hor(rect.GetWidth(), 1), ver(1, rect.GetHeight());
edges[0] = wxRect( rect.GetTopLeft(), hor );
edges[1] = wxRect( rect.GetTopLeft(), ver );
edges[2] = wxRect( rect.GetTopRight(), ver );
edges[3] = wxRect( rect.GetBottomLeft(), hor );
for (int i = 0; i < 4; i++) {
dc->DrawBitmap( zoomed_bitmap_for_canvas_region( edges[i] ),
edges[i].GetTopLeft() );
}
}
示例12: GetWindowOriginSoThatItFits
wxPoint GetWindowOriginSoThatItFits(int display, const wxRect& windowRect)
{
wxPoint pos = windowRect.GetTopLeft();
wxRect desktop = wxDisplay(display).GetClientArea();
if (!desktop.Contains(windowRect))
{
if (pos.x < desktop.x)
pos.x = desktop.x;
if (pos.y < desktop.y)
pos.y = desktop.y;
wxPoint bottomRightDiff = windowRect.GetBottomRight() - desktop.GetBottomRight();
if (bottomRightDiff.x > 0)
pos.x -= bottomRightDiff.x;
if (bottomRightDiff.y > 0)
pos.y -= bottomRightDiff.y;
}
return pos;
}
示例13: FinaliseBackground
void clTabRendererClassic::FinaliseBackground(wxWindow* parent, wxDC& dc, const wxRect& clientRect,
const clTabColours& colours, size_t style)
{
wxUnusedVar(parent);
clTabColours c = colours;
if(DrawingUtils::IsDark(c.activeTabBgColour)) {
InitDarkColours(c, c.activeTabBgColour);
} else {
InitLightColours(c, c.activeTabBgColour);
}
dc.SetPen(c.activeTabPenColour);
if(style & kNotebook_BottomTabs) {
dc.DrawLine(clientRect.GetTopLeft(), clientRect.GetTopRight());
} else {
dc.DrawLine(clientRect.GetBottomLeft(), clientRect.GetBottomRight());
}
}
示例14: Create
BOOL CScrollerCorner::Create(LPCTSTR, LPCTSTR, DWORD style, const wxRect& rect,
wxWindow* pParent, UINT32 id)
{
return wxWindow::Create( pParent, id, rect.GetTopLeft(), rect.GetSize(), style );
/*
return CWnd::Create(AfxRegisterWndClass(
CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS,
0,
HBRUSH(COLOR_SCROLLBAR + 1),
0),
"",
style | WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE,
rect,
parent,
id,
ctxt);
*/
}
示例15: zoom_to
void Canvas::zoom_to( wxRect rect )
{
wxSize window_size = wxWindow::GetClientSize();
float ratio =
std::max( float(rect.GetWidth()) / window_size.GetWidth(),
float(rect.GetHeight()) / window_size.GetHeight() );
int zoom;
if ( ratio < 1 ) {
/* Zoom in. */
zoom = round( 1 / ratio ) - 1;
} else {
/* Zoom out. */
zoom = - round( ratio );
}
zoom = std::max( -16, std::min( zoom, 16 ) );
wxPoint sumPoint = (rect.GetTopLeft() + rect.GetBottomRight());
wxPoint centerPoint( sumPoint.x/2, sumPoint.y/2);
set_zoom( zoom, centerPoint );
}