本文整理汇总了C++中wxRect::GetTop方法的典型用法代码示例。如果您正苦于以下问题:C++ wxRect::GetTop方法的具体用法?C++ wxRect::GetTop怎么用?C++ wxRect::GetTop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxRect
的用法示例。
在下文中一共展示了wxRect::GetTop方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetSubImageWithAlpha
/// Gets a rectangle from within another image, INCLUDING the alpha channel
/// \bug in wxWidgets, wxImage::GetSubImage should do this itself.
wxImage GetSubImageWithAlpha( const wxImage & Src, const wxRect &rect )
{
//First part of this code is lifted from wxImage::GetSubImage() source code.
wxImage image;
wxCHECK_MSG( Src.Ok(), image, wxT("invalid image") );
wxCHECK_MSG( (rect.GetLeft()>=0) && (rect.GetTop()>=0) && (
rect.GetRight()<=Src.GetWidth()) && (rect.GetBottom()<=Src.GetHeight()),
image, wxT("invalid subimage size") );
int subwidth=rect.GetWidth();
const int subheight=rect.GetHeight();
image.Create( subwidth, subheight, false );
unsigned char *subdata = image.GetData(), *data=Src.GetData();
wxCHECK_MSG( subdata, image, wxT("unable to create image") );
// JKC: Quick hack - don't deal with masks - need to understand macro M_IMGDATA first.
// if (Src.M_IMGDATA->m_hasMask)
// image.SetMaskColour( Src.M_IMGDATA->m_maskRed, Src.M_IMGDATA->m_maskGreen, Src.M_IMGDATA->m_maskBlue );
int subleft=3*rect.GetLeft();
int width=3*Src.GetWidth();
subwidth*=3;
data+=rect.GetTop()*width+subleft;
for (long j = 0; j < subheight; ++j)
{
memcpy( subdata, data, subwidth);
subdata+=subwidth;
data+=width;
}
// OK, so we've copied the RGB data.
// Now do the Alpha channel.
wxASSERT( Src.HasAlpha() );
image.InitAlpha();
subleft/=3;
width/=3;
subwidth/=3;
data =Src.GetAlpha();
subdata =image.GetAlpha();
data+=rect.GetTop()*width+subleft;
for (long j = 0; j < subheight; ++j)
{
memcpy( subdata, data, subwidth);
subdata+=subwidth;
data+=width;
}
return image;
}
示例2: _Draw_Get_rDiagram
//---------------------------------------------------------
wxRect CVIEW_ScatterPlot::_Draw_Get_rDiagram(wxRect r)
{
return( wxRect(
wxPoint(r.GetLeft () + 45, r.GetTop () + 20),
wxPoint(r.GetRight() - 20, r.GetBottom() - 40)
));
}
示例3: GetStats
static void GetStats(double *mean, double *stdev, const FloatImg& img, const wxRect& win)
{
// Determine the mean and standard deviation
double sum = 0.0;
double a = 0.0;
double q = 0.0;
double k = 1.0;
double km1 = 0.0;
const int width = img.Size.GetWidth();
const float *p0 = &img.px[win.GetTop() * width + win.GetLeft()];
for (int y = 0; y < win.GetHeight(); y++)
{
const float *end = p0 + win.GetWidth();
for (const float *p = p0; p < end; p++)
{
double const x = (double) *p;
sum += x;
double const a0 = a;
a += (x - a) / k;
q += (x - a0) * (x - a);
km1 = k;
k += 1.0;
}
p0 += width;
}
*mean = sum / km1;
*stdev = sqrt(q / km1);
}
示例4: DrawFocus
//
// Draws a focus rectangle (Taken directly from wxWidgets source)
//
void AColor::DrawFocus(wxDC & dc, wxRect & rect)
{
// draw the pixels manually: note that to behave in the same manner as
// DrawRect(), we must exclude the bottom and right borders from the
// rectangle
wxCoord x1 = rect.GetLeft(),
y1 = rect.GetTop(),
x2 = rect.GetRight(),
y2 = rect.GetBottom();
dc.SetPen(wxPen(wxT("MEDIUM GREY"), 0, wxSOLID));
// this seems to be closer than what Windows does than wxINVERT although
// I'm still not sure if it's correct
dc.SetLogicalFunction(wxAND_REVERSE);
wxCoord z;
for ( z = x1 + 1; z < x2; z += 2 )
dc.DrawPoint(z, y1);
wxCoord shift = z == x2 ? 0 : 1;
for ( z = y1 + shift; z < y2; z += 2 )
dc.DrawPoint(x2, z);
shift = z == y2 ? 0 : 1;
for ( z = x2 - shift; z > x1; z -= 2 )
dc.DrawPoint(z, y2);
shift = z == x1 ? 0 : 1;
for ( z = y2 - shift; z > y1; z -= 2 )
dc.DrawPoint(x1, z);
dc.SetLogicalFunction(wxCOPY);
}
示例5: 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;
}
示例6: FromRect
void PaddingStyle::FromRect(const wxRect& rect) {
Left = rect.GetLeft();
Top = rect.GetTop();
Bottom = rect.GetHeight();
Right = rect.GetWidth();
Width = Left + Right;
Height = Top + Bottom;
}
示例7: InUpdateRegion
bool MathCell::InUpdateRegion(wxRect rect)
{
return
(rect.GetRight() >= m_updateRegion.GetLeft() ) &&
(rect.GetLeft() <= m_updateRegion.GetRight() ) &&
(rect.GetBottom() >= m_updateRegion.GetTop() ) &&
(rect.GetTop() <= m_updateRegion.GetBottom());
}
示例8: DrawFrameWithoutLabel
void wxStdRenderer::DrawFrameWithoutLabel(wxDC& dc,
const wxRect& rectFrame,
const wxRect& rectLabel)
{
// draw left, bottom and right lines entirely
DrawVerticalLine(dc, rectFrame.GetLeft(),
rectFrame.GetTop(), rectFrame.GetBottom() - 2);
DrawHorizontalLine(dc, rectFrame.GetBottom() - 1,
rectFrame.GetLeft(), rectFrame.GetRight());
DrawVerticalLine(dc, rectFrame.GetRight() - 1,
rectFrame.GetTop(), rectFrame.GetBottom() - 1);
// and 2 parts of the top line
DrawHorizontalLine(dc, rectFrame.GetTop(),
rectFrame.GetLeft() + 1, rectLabel.GetLeft());
DrawHorizontalLine(dc, rectFrame.GetTop(),
rectLabel.GetRight(), rectFrame.GetRight() - 2);
}
示例9: set_bbox
void configuration_visitor::set_bbox(const wxRect& r) {
boost::shared_ptr<vector_layer_ghost> ghost = m_panel->vectorlayerghost();
if(!ghost) return;
ghost->reset<vector_layer_ghost::Rectangle>();
ghost->add_point(wxRealPoint(r.GetLeft (),r.GetTop ()));
ghost->add_point(wxRealPoint(r.GetRight(),r.GetBottom()));
ghost->m_penRectangle = wxPen(*wxRED, 2, wxDOT);
ghost->m_brushRectangle = wxBrush(*wxRED, wxTRANSPARENT);
}
示例10: DrawAquaRect
void DrawAquaRect(wxDC& dc, wxRect& rc, int radius)
{
int left = rc.GetX();
int top = rc.GetTop();
int height = rc.GetHeight();
int width = rc.GetWidth();
int right = left+width;
if(width <= radius*2)
return;
wxPen oldpen = dc.GetPen();
int border = 2;//(IsSelected() ? 2 : 1);
int edge = radius;
int endEdge = top+radius;
float rstep = 60.f / ((float)height / 3.f);
float gstep = 20.f / ((float)height / 3.f);
float r=180.f, g=190.f, b=225.f;
for(int y=top+1; y<top+height/3; y++)
{
r -= rstep;
g -= gstep;
dc.SetPen( wxPen(wxColor(r, g, b), border) );
if(y<endEdge)
{
dc.DrawLine(left+edge, y, right-edge*2, y);
edge--;
}
else
dc.DrawLine(left, y, right, y);
}
edge = 1;
int startEdge = top+height-radius;
rstep = 75.f / (((float)height / 3.f) * 2.f);
gstep = 51.f / (((float)height / 3.f) * 2.f);
r=111.f, g=161.f, b=225.f;
for(int y=top+height/3; y<top+height-1; y++)
{
r += rstep;
g += gstep;
dc.SetPen( wxPen(wxColor(r, g, b), border) );
if(y>=startEdge)
{
dc.DrawLine(left+edge, y, right-edge*2, y);
edge++;
}
else
dc.DrawLine(left, y, right, y);
}
dc.SetPen( oldpen );
}
示例11: device
wxDCOverlay::wxDCOverlay(wxOverlay &overlay, wxDC *dc) :
m_overlay(overlay)
{
const wxRect device(wxPoint(0, 0), dc->GetSize());
Init(dc,
dc->DeviceToLogicalX(device.GetLeft()),
dc->DeviceToLogicalY(device.GetTop()),
dc->DeviceToLogicalX(device.GetRight()),
dc->DeviceToLogicalY(device.GetBottom()));
}
示例12: _Draw_Regression
//---------------------------------------------------------
void CVIEW_ScatterPlot::_Draw_Regression(wxDC &dc, wxRect r)
{
wxPen oldPen = dc.GetPen();
dc.SetPen(wxPen(
m_Options("REG_COLOR")->asColor(),
m_Options("REG_SIZE" )->asInt()
));
//-----------------------------------------------------
double dx = (r.GetWidth () - 1.) / m_Trend.Get_Data_XStats().Get_Range();
double dy = (r.GetHeight() - 1.) / m_Trend.Get_Data_YStats().Get_Range();
//-----------------------------------------------------
dc.DrawCircle(
GET_DC_X(m_Trend.Get_Data_XStats().Get_Mean()),
GET_DC_Y(m_Trend.Get_Data_YStats().Get_Mean()), 2
);
double ex = m_Trend.Get_Data_XStats().Get_Range() / (double)r.GetWidth();
double x = m_Trend.Get_Data_XMin();
for(int ix=0, ay, by=0; ix<r.GetWidth(); ix++, x+=ex)
{
double y = m_Trend.Get_Value(x);
ay = by; by = r.GetBottom() - (int)(dy * (y - m_Trend.Get_Data_YMin()));
if( ix > 0 && r.GetTop() < ay && ay < r.GetBottom() && r.GetTop() < by && by < r.GetBottom() )
{
dc.DrawLine(r.GetLeft() + ix - 1, ay, r.GetLeft() + ix, by);
}
}
dc.SetPen(oldPen);
//-----------------------------------------------------
Draw_Text(dc, TEXTALIGN_BOTTOMCENTER, r.GetLeft() + r.GetWidth() / 2, r.GetTop(),
m_Trend.Get_Formula(SG_TREND_STRING_Compact).c_str()
);
}
示例13: generateRealImageset
//-----------------------------------------------------------------------
CEGUI::Imageset* EditorDocument::generateRealImageset(const wxString& pathName)
{
const String imagesetName ( CEGUIHelper::ToCEGUIString( m_imagesetName ) );
const String imageFilename ( CEGUIHelper::ToCEGUIString( pathName + m_imageFilename ) );
ImagesetManager& isMgr = ImagesetManager::getSingleton();
if ( isMgr.isImagesetPresent( imagesetName ) )
// TODO: Maybe ask user whether to continue here?
isMgr.destroyImageset( imagesetName );
// create the imageset
Imageset* imageset = isMgr.createImagesetFromImageFile( imagesetName, imageFilename );
// auto-scale options
imageset->setAutoScalingEnabled( m_autoScaled );
imageset->setNativeResolution( CEGUI::Size( m_nativeResolution.x, m_nativeResolution.y ) );
// iterate over all the elements in the class
mapNamedRegion::iterator it;
for( it = m_mapSetRectangles.begin(); it != m_mapSetRectangles.end(); ++it )
{
const String imageName = CEGUIHelper::ToCEGUIString( wxString( it->first ) );
if ( !imageset->isImageDefined( imageName ) )
{
const wxRect r( it->second );
const CEGUI::Rect newDim( ( ( r.GetLeft() > 0 ) ? r.GetLeft() : 0 ),
( ( r.GetTop() > 0 ) ? r.GetTop() : 0 ),
( ( r.GetRight() + 1 > 0 ) ? r.GetRight() + 1 : 0 ),
( ( r.GetBottom() + 1 > 0 ) ? r.GetBottom() + 1 : 0 ) );
const CEGUI::Point p ( 0.0f, 0.0f );
imageset->defineImage( imageName, newDim, p );
}
}
if ( imageset->isImageDefined ( "full_image" ) )
imageset->undefineImage( "full_image" );
return imageset;
}
示例14: Copy
bool LfnTech::Copy(
void* destBase,
const void* srcBase,
const wxPoint& destPoint,
const wxRect& srcRect,
int destStride,
int srcStride,
int bytesPerPixel)
{
bool result = false;
if (destBase && srcBase && destStride > 0 && srcStride > 0 && bytesPerPixel > 0)
{
const int srcLeft = srcRect.GetLeft();
const int srcBottom = srcRect.GetBottom();
const int bytesPerRowCopy = bytesPerPixel * srcRect.GetWidth();
if (bytesPerRowCopy == destStride && bytesPerRowCopy == srcStride)
{
wxASSERT(destPoint.x == 0);
wxASSERT(srcLeft == 0);
memcpy(
GetRowMajorPointer(destBase, destStride, bytesPerPixel, destPoint.x, destPoint.y),
GetRowMajorPointer(srcBase, srcStride, bytesPerPixel, srcLeft, srcRect.GetTop()),
bytesPerRowCopy * srcRect.GetHeight());
}
else
{
for (int srcY = srcRect.GetTop(), destY = destPoint.y; srcY <= srcBottom; ++srcY, ++destY)
{
memcpy(
GetRowMajorPointer(destBase, destStride, bytesPerPixel, destPoint.x, destY),
GetRowMajorPointer(srcBase, srcStride, bytesPerPixel, srcLeft, srcY),
bytesPerRowCopy);
}
}
result = true;
}
return result;
}
示例15: CropToUpdateRegion
wxRect MathCell::CropToUpdateRegion(wxRect rect)
{
int left =rect.GetLeft();
int top =rect.GetTop ();
int right =rect.GetRight();
int bottom=rect.GetBottom();
if (left < m_updateRegion.GetLeft()) left = m_updateRegion.GetLeft();
if (right > m_updateRegion.GetRight()) right = m_updateRegion.GetRight();
if (top < m_updateRegion.GetTop()) top = m_updateRegion.GetTop();
if (bottom > m_updateRegion.GetBottom()) bottom = m_updateRegion.GetBottom();
return wxRect(wxPoint(left,top),wxPoint(right,bottom));
}