• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ wxRect类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: 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());
    }
}
开发者ID:eranif,项目名称:codelite,代码行数:18,代码来源:clTabRendererClassic.cpp


示例2: wxColour

void wxGD::Draw::GlossyGradient( wxDC &dc, wxRect &rect, wxColour &topStart,
                                 wxColour &bottomStart,  wxColour &bottomEnd,
                                 wxColour &colour, bool hover )
{
    wxColour topEnd = colour;

    int r = colour.Red()   + 45;
    if( r > 255 ) r = 225;
    int g = colour.Green() + 45;
    if( g > 255 ) g = 225;
    int b = colour.Blue()  + 45;
    if( b > 255)  b = 225;

    topStart = wxColour( (unsigned char)r, (unsigned char)g, (unsigned char)b );

    r = colour.Red()   - 75;
    if( r < 0 ) r = 15;
    g = colour.Green() - 75;
    if( g < 0 ) g = 15;
    b = colour.Blue()  - 75;
    if( b < 0 ) b = 15;

    bottomStart = wxColour( (unsigned char)r, (unsigned char)g, (unsigned char)b );

    r = colour.Red()   - 15;
    if( r < 0 ) r = 30;
    g = colour.Green() - 15;
    if( g < 0 ) g = 30;
    b = colour.Blue()  - 15;
    if( b < 0 ) b = 30;

    bottomEnd =  wxColour( (unsigned char)r, (unsigned char)g, (unsigned char)b );

    rect.SetHeight( rect.GetHeight() / 2 );

    dc.GradientFillLinear( rect, topStart, topEnd, wxSOUTH );

    rect.Offset( 0, rect.GetHeight() );

    if( hover )
        dc.GradientFillLinear( rect, bottomStart, topStart, wxSOUTH );
    else
        dc.GradientFillLinear( rect, bottomStart, topEnd, wxSOUTH );
}
开发者ID:wxguidesigner,项目名称:wxGUIDesigner,代码行数:44,代码来源:glossybutton.cpp


示例3: GetClientRect

void CViewHeader::OnSize(wxSizeEvent& event)
{
	const wxRect client_rect = GetClientRect();

	wxRect rect = client_rect;
	rect.SetWidth(rect.GetWidth() - m_cbOffset + 2);
	rect.SetX(m_cbOffset);
	rect.Deflate(0, border_offset / 2);
	rect.SetWidth(rect.GetWidth() - border_offset / 2);
	m_pComboBox->SetSize(rect);

	rect.SetX(5);
	rect.SetWidth(m_cbOffset - 5);
	rect.SetY((client_rect.GetHeight() - m_labelHeight) / 2 - 1);
	rect.SetHeight(m_labelHeight);
	m_pLabel->SetSize(rect);

	Refresh();
}
开发者ID:AbelTian,项目名称:filezilla,代码行数:19,代码来源:viewheader.cpp


示例4: WXUNUSED

void MainGLCanvas::OnPaint(wxPaintEvent& WXUNUSED(event))
{
    // This is required even though dc is not used otherwise.
    wxPaintDC dc(this);

    // Set the OpenGL viewport according to the client size of this canvas.
    // This is done here rather than in a wxSizeEvent handler because our
    // OpenGL rendering context (and thus viewport setting) is used with
    // multiple canvases: If we updated the viewport in the wxSizeEvent
    // handler, changing the size of one canvas causes a viewport setting that
    // is wrong when next another canvas is repainted.
    const wxRect rect = GetRect();

    wxGetApp().GetContext(this).RedrawScene(rect.GetWidth(), rect.GetHeight());

    wxString viewport;
    viewport << _("(") << rect.GetWidth() << _(",") << rect.GetHeight() << _(")");
    wxLogStatus(viewport);
}
开发者ID:kmachnicki,项目名称:opengl-work,代码行数:19,代码来源:wx_labyrinth.cpp


示例5: CombineRectangles

// Calculate the area that contains both rectangles
static wxRect CombineRectangles(const wxRect & rect1, const wxRect & rect2)
{
    wxRect rect;

    int right1 = rect1.GetRight();
    int bottom1 = rect1.GetBottom();
    int right2 = rect2.GetRight();
    int bottom2 = rect2.GetBottom();

    wxPoint topLeft = wxPoint(wxMin(rect1.x, rect2.x), wxMin(rect1.y, rect2.y));
    wxPoint bottomRight = wxPoint(wxMax(right1, right2), wxMax(bottom1, bottom2));

    rect.x = topLeft.x;
    rect.y = topLeft.y;
    rect.SetRight(bottomRight.x);
    rect.SetBottom(bottomRight.y);

    return rect;
}
开发者ID:MaurodeLyon,项目名称:Embedded-Software-Ontwikkeling,代码行数:20,代码来源:scrolledtree.cpp


示例6: 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


示例7:

CStatusLineCtrl::CStatusLineCtrl(CQueueView* pParent, const t_EngineData* const pEngineData, const wxRect& initialPosition)
	: m_pParent(pParent)
	, m_pEngineData(pEngineData)
{
	wxASSERT(pEngineData);

	Create(pParent->GetMainWindow(), wxID_ANY, initialPosition.GetPosition(), initialPosition.GetSize());

	SetOwnFont(pParent->GetFont());
	SetForegroundColour(pParent->GetForegroundColour());
	SetBackgroundStyle(wxBG_STYLE_CUSTOM);
	SetBackgroundColour(pParent->GetBackgroundColour());

	m_transferStatusTimer.SetOwner(this);

	InitFieldOffsets();

	ClearTransferStatus();
}
开发者ID:zedfoxus,项目名称:filezilla-client,代码行数:19,代码来源:statuslinectrl.cpp


示例8: wxCHECK_MSG

bool
wxNativeWindow::Create(wxWindow* parent,
                       wxWindowID winid,
                       wxNativeWindowHandle hwnd)
{
    wxCHECK_MSG( hwnd, false, wxS("Invalid null HWND") );
    wxCHECK_MSG( parent, false, wxS("Must have a valid parent") );
    wxASSERT_MSG( ::GetParent(hwnd) == GetHwndOf(parent),
                  wxS("The native window has incorrect parent") );

    const wxRect r = wxRectFromRECT(wxGetWindowRect(hwnd));

    // Skip wxWindow::Create() which would try to create a new HWND, we don't
    // want this as we already have one.
    if ( !CreateBase(parent, winid,
                     r.GetPosition(), r.GetSize(),
                     0, wxDefaultValidator, wxS("nativewindow")) )
        return false;

    parent->AddChild(this);

    SubclassWin(hwnd);

    if ( winid == wxID_ANY )
    {
        // We allocated a new ID to the control, use it at Windows level as
        // well because we assume that our and MSW IDs are the same in many
        // places and it seems prudent to avoid breaking this assumption.
        SetId(GetId());
    }
    else // We used a fixed ID.
    {
        // For the same reason as above, check that it's the same as the one
        // used by the native HWND.
        wxASSERT_MSG( ::GetWindowLong(hwnd, GWL_ID) == winid,
                      wxS("Mismatch between wx and native IDs") );
    }

    InheritAttributes();

    return true;
}
开发者ID:vdm113,项目名称:wxWidgets-ICC-patch,代码行数:42,代码来源:nativewin.cpp


示例9: wxToolInfo

    wxToolInfo(HWND hwndOwner, unsigned int id, const wxRect& rc)
    {
        // initialize all members
        ::ZeroMemory(this, sizeof(TOOLINFO));

        // the structure TOOLINFO has been extended with a 4 byte field in
        // version 4.70 of comctl32.dll and another one in 5.01 but we don't
        // use these extended fields so use the old struct size to ensure that
        // the tooltips work on old (Windows 95) systems too
        cbSize = TTTOOLINFO_V1_SIZE;

        hwnd = hwndOwner;

        if (rc.IsEmpty())
        {
            uFlags = TTF_IDISHWND;
            uId = (UINT_PTR)hwndOwner;
        }
        else
        {
            // this tooltip must be shown only if the mouse hovers a specific rect
            // of the hwnd parameter!
            rect.left = rc.GetLeft();
            rect.right = rc.GetRight();
            rect.top = rc.GetTop();
            rect.bottom = rc.GetBottom();

            // note that not setting TTF_IDISHWND from the uFlags member means that the
            // ti.uId field should not contain the HWND but rather as MSDN says an
            // "Application-defined identifier of the tool"; this is used internally by
            // Windows to distinguish the different tooltips attached to the same window
            uId = id;
        }

        // we use TTF_TRANSPARENT to fix a problem which arises at least with
        // the text controls but may presumably happen with other controls
        // which display the tooltip at mouse position: it can start flashing
        // then as the control gets "focus lost" events and dismisses the
        // tooltip which then reappears because mouse remains hovering over the
        // control, see SF patch 1821229
        uFlags |= TTF_TRANSPARENT;
    }
开发者ID:Asmodean-,项目名称:Ishiiruka,代码行数:42,代码来源:tooltip.cpp


示例10: 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


示例11: DrawItem

void wxTreeCompanionWindow::DrawItem(wxDC& dc, wxTreeItemId id, const wxRect& rect)
{
	// TEST CODE
#if 1
	if (m_treeCtrl)
	{
		wxString text = m_treeCtrl->GetItemText(id);
		dc.SetTextForeground(* wxBLACK);
		dc.SetBackgroundMode(wxTRANSPARENT);

		int textW, textH;
		dc.GetTextExtent(text, & textW, & textH);

		int x = 5;
		int y = rect.GetY() + wxMax(0, (rect.GetHeight() - textH) / 2);

		dc.DrawText(text, x, y);
	}
#endif
}
开发者ID:mentat,项目名称:YardSale,代码行数:20,代码来源:splittree.cpp


示例12: 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


示例13: PaintStraightGradientBox

void DrawingUtils::PaintStraightGradientBox(wxDC& dc,
        const wxRect& rect,
        const wxColour& startColor,
        const wxColour& endColor,
        bool  vertical)
{
    int rd, gd, bd, high = 0;
    rd = endColor.Red() - startColor.Red();
    gd = endColor.Green() - startColor.Green();
    bd = endColor.Blue() - startColor.Blue();

    /// Save the current pen and brush
    wxPen savedPen = dc.GetPen();
    wxBrush savedBrush = dc.GetBrush();

    if ( vertical )
        high = rect.GetHeight()-1;
    else
        high = rect.GetWidth()-1;

    if ( high < 1 )
        return;

    for (int i = 0; i <= high; ++i) {
        int r = startColor.Red() +  ((i*rd*100)/high)/100;
        int g = startColor.Green() + ((i*gd*100)/high)/100;
        int b = startColor.Blue() + ((i*bd*100)/high)/100;

        wxPen p(wxColor(r, g, b));
        dc.SetPen(p);

        if ( vertical )
            dc.DrawLine(rect.x, rect.y+i, rect.x+rect.width, rect.y+i);
        else
            dc.DrawLine(rect.x+i, rect.y, rect.x+i, rect.y+rect.height);
    }

    /// Restore the pen and brush
    dc.SetPen( savedPen );
    dc.SetBrush( savedBrush );
}
开发者ID:Hmaal,项目名称:codelite,代码行数:41,代码来源:drawingutils.cpp


示例14: GetSize

bool wxSpinCtrl::Reparent(wxWindowBase *newParent)
{
    // Reparenting both the updown control and its buddy does not seem to work:
    // they continue to be connected somehow, but visually there is no feedback
    // on the buddy edit control. To avoid this problem, we reparent the buddy
    // window normally, but we recreate the updown control and reassign its
    // buddy.

    if ( !wxWindowBase::Reparent(newParent) )
        return false;

    newParent->GetChildren().DeleteObject(this);

    // preserve the old values
    const wxSize size = GetSize();
    int value = GetValue();
    const wxRect btnRect = wxRectFromRECT(wxGetWindowRect(GetHwnd()));

    // destroy the old spin button
    UnsubclassWin();
    if ( !::DestroyWindow(GetHwnd()) )
    {
        wxLogLastError(wxT("DestroyWindow"));
    }

    // create and initialize the new one
    if ( !wxSpinButton::Create(GetParent(), GetId(),
                               btnRect.GetPosition(), btnRect.GetSize(),
                               GetWindowStyle(), GetName()) )
        return false;

    SetValue(value);
    SetRange(m_min, m_max);
    SetInitialSize(size);

    // associate it with the buddy control again
    ::SetParent(GetBuddyHwnd(), GetHwndOf(GetParent()));
    (void)::SendMessage(GetHwnd(), UDM_SETBUDDY, (WPARAM)GetBuddyHwnd(), 0);

    return true;
}
开发者ID:erwincoumans,项目名称:wxWidgets,代码行数:41,代码来源:spinctrl.cpp


示例15: WXUNUSED

void DefaultTabArt::DrawBackground(wxDC& dc,
                                        wxWindow* WXUNUSED(wnd),
                                        const wxRect& rect)
{
    // draw background
m_baseColour = wxColour(75,75,75);
    wxColor top_color       = m_baseColour.ChangeLightness(90);
    wxColor bottom_color   = m_baseColour.ChangeLightness(110);
    wxRect r;

   if (m_flags &wxAUI_NB_BOTTOM)
       r = wxRect(rect.x, rect.y, rect.width+2, rect.height);
   // TODO: else if (m_flags &wxAUI_NB_LEFT) {}
   // TODO: else if (m_flags &wxAUI_NB_RIGHT) {}
   else //for wxAUI_NB_TOP
       r = wxRect(rect.x, rect.y, rect.width+2, rect.height-3);

    dc.GradientFillLinear(r, top_color, bottom_color, wxSOUTH);


   // draw base lines
m_borderPen = top_color;
   dc.SetPen(m_borderPen);
   int y = rect.GetHeight();
   int w = rect.GetWidth();

   if (m_flags &wxAUI_NB_BOTTOM)
   {
       dc.SetBrush(wxBrush(bottom_color));
       dc.DrawRectangle(-1, 0, w+2, 4);
   }
   // TODO: else if (m_flags &wxAUI_NB_LEFT) {}
   // TODO: else if (m_flags &wxAUI_NB_RIGHT) {}
   else //for wxAUI_NB_TOP
   {
       dc.SetBrush(m_baseColourBrush);
       dc.SetBrush(m_baseColour);
       
       dc.DrawRectangle(-1, y-4, w+2, 4);
   }
}
开发者ID:r4tch31,项目名称:wxOCC,代码行数:41,代码来源:vxCstmArtPrvdr_NtbkTab.cpp


示例16: DrawPlainBackground

void CLMainAuiTBArt::DrawPlainBackground(wxDC& dc, wxWindow* wnd, const wxRect& rect)
{
    wxUnusedVar(wnd);
    wxBitmap bmp(rect.GetSize());
    wxMemoryDC dcMem;
    dcMem.SelectObject(bmp);
    dcMem.SetPen(DrawingUtils::GetPanelBgColour());
    dcMem.SetBrush(DrawingUtils::GetPanelBgColour());
    dcMem.DrawRectangle(rect);
    dcMem.SelectObject(wxNullBitmap);
    dc.DrawBitmap(bmp, wxPoint(0, 0));
}
开发者ID:eranif,项目名称:codelite,代码行数:12,代码来源:cl_aui_tb_are.cpp


示例17: Render

void wxCustomStatusBarFieldText::Render(wxDC& dc, const wxRect& rect, wxCustomStatusBarArt::Ptr_t art)
{
    m_rect = rect;
    wxSize textSize = dc.GetTextExtent(m_text);

    // Center text
    wxCoord textY = (rect.GetHeight() - textSize.GetHeight()) / 2 + rect.y;
    wxCoord textX;
    if(m_textAlign == wxALIGN_CENTER) {
        textX = (rect.GetWidth() - textSize.GetWidth()) / 2 + rect.x;
    } else {
        // left
        textX = rect.x + 5;
    }

    // draw border line
    art->DrawFieldSeparator(dc, rect);

    // Draw the text
    art->DrawText(dc, textX, textY + 1, m_text);
}
开发者ID:05storm26,项目名称:codelite,代码行数:21,代码来源:wxCustomStatusBar.cpp


示例18: DrawToDCClipped

// ----------------------------------------------------------------------------
// DrawToDCClipped - play back the op list to the DC but clip any objects
//                   known to be not in rect.  This is a coarse level of 
//                   clipping to speed things up when lots of objects are off 
//                   screen and doesn't affect the dc level clipping
// ----------------------------------------------------------------------------
void wxPseudoDC::DrawToDCClipped(wxDC *dc, const wxRect& rect)
{
    pdcObjectList::Node *pt = m_objectlist.GetFirst();
    pdcObject *obj;
    while (pt) 
    {
        obj = pt->GetData();
        if (!obj->IsBounded() || rect.Intersects(obj->GetBounds()))
            obj->DrawToDC(dc);
        pt = pt->GetNext();
    }
}
开发者ID:goretkin,项目名称:kwc-ros-pkg,代码行数:18,代码来源:pseudodc.cpp


示例19: DrawBackground

void clAuiMainNotebookTabArt::DrawBackground(wxDC& dc, wxWindow* wnd, const wxRect& rect)
{
    wxUnusedVar(wnd);
#ifdef __WXGTK__
    wxDC& gdc = dc;
#else
    wxGCDC gdc;
    if(!DrawingUtils::GetGCDC(dc, gdc)) return;
#endif

    DoSetColours();
    gdc.SetPen(m_activeTabPenColour);
    wxBrush brush = DrawingUtils::GetStippleBrush();
    brush.SetColour(m_bgColour);
    gdc.SetBrush(brush);
    gdc.GradientFillLinear(rect, m_bgColour, m_bgColour, wxSOUTH);

    wxPoint ptBottomLeft = rect.GetBottomLeft();
    wxPoint ptBottomRight = rect.GetBottomRight();
    gdc.DrawLine(ptBottomLeft, ptBottomRight);
}
开发者ID:gongfuPanada,项目名称:codelite,代码行数:21,代码来源:clAuiMainNotebookTabArt.cpp


示例20: 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 );
}
开发者ID:stevewolter,项目名称:rapidSTORM,代码行数:21,代码来源:Canvas.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ wxRegEx类代码示例发布时间:2022-05-31
下一篇:
C++ wxPropertyGridEvent类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap