示例#1
0
void DatDebugViewListBox::OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const
{
    SpriteMap::const_iterator spr_iter = sprites.find(int(n));
    if(spr_iter != sprites.end())
        spr_iter->second->DrawTo(&dc, SPRITE_SIZE_32x32, rect.GetX(), rect.GetY(), rect.GetWidth(), rect.GetHeight());

    if(int(n) == GetSelection()) {
        dc.SetTextForeground(wxColor(0xFF, 0xFF, 0xFF));
    } else {
        dc.SetTextForeground(wxColor(0x00, 0x00, 0x00));
    }

    dc.DrawText(wxString() << n, rect.GetX() + 40, rect.GetY() + 6);
}
示例#2
0
void BrushListBox::OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const
{
	ASSERT(n < tileset->size());
	Sprite* spr = gui.gfx.getSprite(tileset->brushlist[n]->getLookID());
	if(spr) {
		spr->DrawTo(&dc, SPRITE_SIZE_32x32, rect.GetX(), rect.GetY(), rect.GetWidth(), rect.GetHeight());
	}
	if(int(n) == GetSelection()) {
		dc.SetTextForeground(wxColor(0xFF, 0xFF, 0xFF));
	} else {
		dc.SetTextForeground(wxColor(0x00, 0x00, 0x00));
	}
	dc.DrawText(wxstr(tileset->brushlist[n]->getName()), rect.GetX() + 40, rect.GetY() + 6);
}
示例#3
0
	wxRect DimRect::GetValue(const wxRect& referenceRect) const {
		return wxRect(
			m_x.GetValue(referenceRect.GetX()),
			m_y.GetValue(referenceRect.GetY()),
			m_w.GetValue(referenceRect.GetWidth()),
			m_h.GetValue(referenceRect.GetHeight()));
	}
示例#4
0
文件: main.cpp 项目: Nadot/Wherbarium
bool MyApp::OnInit() {
    Aux::logsStr("", wxT("Wherbarium [" + wxDateTime::Now().Format(wxT("%Y-%m-%d %H:%M:%S")) + "] - IN"), logPut);
    try {
        // setting divers
        wxInitAllImageHandlers(); // évite les problèmes de handlers d'images
        SetExitOnFrameDelete(false); // évite la fermeture de l'application sur un close quelconque !!!
        
        // variables de dimensionnement
        ecranRectGbl.SetPosition(wxPoint(0, 0));
        ecranRectGbl.SetSize(wxSize(wxSystemSettings::GetMetric(wxSYS_SCREEN_X), wxSystemSettings::GetMetric(wxSYS_SCREEN_Y)));
        
        wxDisplay *display = new wxDisplay();
        clientRectGbl = display->GetClientArea();

        gapGbl = 16;
        winRectGbl.SetPosition(wxPoint(clientRectGbl.GetX()+gapGbl, clientRectGbl.GetY()+gapGbl));
        winRectGbl.SetSize(wxSize(clientRectGbl.width-2*gapGbl, clientRectGbl.height-2*gapGbl));
        win3RectGbl = winRectGbl;
        win3RectGbl.SetWidth(winRectGbl.GetWidth()/3);
        
        wxSystemSettings sysSet;
        dimScrollXGbl = sysSet.GetMetric(wxSYS_VSCROLL_X, NULL);
        dimScrollYGbl = sysSet.GetMetric(wxSYS_HSCROLL_Y, NULL);
        
        Aux::logsPoint("MyApp::OnInit::ecranRectGbl", ecranRectGbl.GetPosition(), logNop);
        Aux::logsSize("MyApp::OnInit::ecranRectGbl", ecranRectGbl.GetSize(), logNop);
        Aux::logsPoint("MyApp::OnInit::clientRectGbl", clientRectGbl.GetPosition(), logNop);
        Aux::logsSize("MyApp::OnInit::clientRectGbl", clientRectGbl.GetSize(), logNop);
        Aux::logsPoint("MyApp::OnInit::winRectGbl", winRectGbl.GetPosition(), logNop);
        Aux::logsSize("MyApp::OnInit::winRectGbl", winRectGbl.GetSize(), logNop);
        Aux::logsPoint("MyApp::OnInit::win3RectGbl", win3RectGbl.GetPosition(), logNop);
        Aux::logsSize("MyApp::OnInit::win3RectGbl", win3RectGbl.GetSize(), logNop);
        
        wxString dbDir = "/Users/" + wxGetUserId() + "/Pictures/Wherbarium/Connect/";
        if (! wxDir::Exists(dbDir)) {
            wxDir::Make(dbDir);
        }
        wxArrayString *files = new wxArrayString();
        wxDir::GetAllFiles(dbDir, files);
        wxString dbFile = dbDir + "Wherbarium.db";
        wxFile *fileConnect;
        if (files->size() == 0) {
            fileConnect = new wxFile();
            fileConnect->Create(dbFile, false, wxS_DEFAULT);
        } else if (files->size() != 1) {
            Exit();
        }
        
        string tableName = "tblConnParams";
        sqlite = new SQLite(string(dbFile), tableName);
        sqliteStatement = sqlite->ptrTableConnParams();
        
        // début des opérations de l'application
        InitApp *initApp = new InitApp();
        initApp->nop();
        
    } catch (const exception &e) { Aux::logsStr("", e.what(), logPut); }
    return true;
}
示例#5
0
void WindowPosition::fitToScreen(const wxRect& screen, float xfraction, float yfraction)
{
	_size[0] = static_cast<int>(screen.GetWidth() * xfraction) - 12;
	_size[1] = static_cast<int>(screen.GetHeight() * yfraction) - 48;

	_position[0] = screen.GetX() + static_cast<int>((screen.GetWidth() - _size[0] - 12)/2);
	_position[1] = screen.GetY() + static_cast<int>((screen.GetHeight() - _size[1] - 48)/2);
}
示例#6
0
void CentreOnArea(wxScrollHelperBase &Scrolled,
                  wxSize const &TargetSize,
                  wxRect const &Area)
{
  CentreOnPoint(Scrolled,
                TargetSize,
                wxPoint(Area.GetX() + (Area.GetWidth()  / 2),
                        Area.GetY() + (Area.GetHeight() / 2)));
}
示例#7
0
/** Draw
  *
  * Overriden from wxGridCellStringRenderer
  */
void GridCellInfoRenderer::Draw(wxGrid &grid, wxGridCellAttr &attr, wxDC &dc, const wxRect &rect, int item, int column, bool isSelected)
{
    if (column != 0) return;

    bool pc = state.pc == item ? IMAGE_PC : 0;
    int bp = state.breakpoints.find(item) != state.breakpoints.end() ? IMAGE_BREAKPOINT : 0;
    bp = (bp == IMAGE_BREAKPOINT && !state.breakpoints[item].enabled) ? IMAGE_DISABLEDBP : bp;
    int bb = state.blackboxes.find(item) != state.blackboxes.end() ? IMAGE_BLACKBOX : 0;
    bb = (bb == IMAGE_BLACKBOX && !state.blackboxes[item].enabled) ? IMAGE_DISABLEDBB : bb;

    wxGridCellStringRenderer::Draw(grid, attr, dc, rect, item, column, isSelected);

    if (pc)
        infoImages->Draw(pc, dc, rect.GetX(), rect.GetY(), wxIMAGELIST_DRAW_TRANSPARENT | (isSelected ? wxIMAGELIST_DRAW_SELECTED : 0));
    if (bp)
        infoImages->Draw(bp, dc, rect.GetX(), rect.GetY(), wxIMAGELIST_DRAW_TRANSPARENT | (isSelected ? wxIMAGELIST_DRAW_SELECTED : 0));
    if (bb)
        infoImages->Draw(bb, dc, rect.GetX(), rect.GetY(), wxIMAGELIST_DRAW_TRANSPARENT | (isSelected ? wxIMAGELIST_DRAW_SELECTED : 0));
}
示例#8
0
文件: aqua.cpp 项目: sqba/floopy
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 );
}
示例#9
0
文件: pathctrl.cpp 项目: sqba/floopy
void CPathItem::DrawBG(wxDC &dc, wxRect &rc)
{
	wxPen oldpen = dc.GetPen();
	wxPen pen( IsSelected() ? *wxBLACK_PEN : *wxMEDIUM_GREY_PEN );
	pen.SetWidth(IsSelected() ? 2 : 1);
	dc.SetPen( pen );

	wxBrush oldBrush = dc.GetBrush();
	wxBrush brush(m_color, NULL!=m_pInput ? wxSOLID : wxTRANSPARENT);
	dc.SetBrush(brush);

	int x = rc.GetX();
	int y = rc.GetY();
	int w = rc.GetWidth();
	int h = rc.GetHeight();
	int n = 0;

	wxPoint points[6];

	if(NULL != m_pInput)
	{
		points[0] = wxPoint(x,								y);
		points[1] = wxPoint(x+w-GAP_LENGTH,					y);
		points[2] = wxPoint(x+w+CORNER_LENGTH-GAP_LENGTH,	y+h/2);
		points[3] = wxPoint(x+w-GAP_LENGTH,					y+h);
		points[4] = wxPoint(x,								y+h);
		points[5] = wxPoint(x+CORNER_LENGTH,				y+h/2);

		n = m_bFirst ? 5 : 6;
	}
	else
	{
		// Last component: mixer
		points[0] = wxPoint(x,					y);
		points[1] = wxPoint(x+w,				y);
		points[2] = wxPoint(x+w,				y+h);
		points[3] = wxPoint(x,					y+h);
		points[4] = wxPoint(x+CORNER_LENGTH,	y+h/2);

		n = 5;
	}

	if(m_pRegion)
		delete m_pRegion;
	m_pRegion = new wxRegion(n, points);

	dc.DrawPolygon(n, points);

	dc.SetBrush( oldBrush );
	dc.SetPen(oldpen);
}
示例#10
0
void BrowseTileListBox::OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const
{
    ItemsMap::const_iterator item_iterator = items.find(int(n));
    Item* item = item_iterator->second;

    Sprite* sprite = gui.gfx.getSprite(item->getClientID());
    if (sprite)
        sprite->DrawTo(&dc, SPRITE_SIZE_32x32, rect.GetX(), rect.GetY(), rect.GetWidth(), rect.GetHeight());

    if (IsSelected(n))
    {
        item->select();
        dc.SetTextForeground(wxColor(0xFF, 0xFF, 0xFF));
    }
    else {
        item->deselect();
        dc.SetTextForeground(wxColor(0x00, 0x00, 0x00));
    }

    wxString label;
    label << item->getID() << wxT(" - ") << item->getName();
    dc.DrawText(label, rect.GetX() + 40, rect.GetY() + 6);
}
void wxGD::Draw::Bitmap( wxDC &dc, const wxBitmap &bitmap,
                         const wxRect &rect, const wxString &text )
{
    if( bitmap.IsOk() )
    {
        wxCoord x = rect.GetX() + 3;
        wxCoord y = (rect.GetHeight() - bitmap.GetHeight()) / 2;

        if( text.empty() )
            x = (rect.GetWidth() - bitmap.GetWidth()) / 2;

        dc.DrawBitmap( bitmap, x, y, true );
    }
}
示例#12
0
bool wxCheckListBoxItem::OnDrawItem(wxDC& dc, const wxRect& rc,
                                    wxODAction act, wxODStatus stat)
{
    // first draw the label
    if ( !wxOwnerDrawn::OnDrawItem(dc, rc, act, stat) )
        return false;

    // now draw the check mark part
    wxMSWDCImpl *impl = (wxMSWDCImpl*) dc.GetImpl();
    HDC hdc = GetHdcOf(*impl);

    wxSize size = wxRendererNative::Get().GetCheckBoxSize(GetParent());

    // first create bitmap in a memory DC
    MemoryHDC hdcMem(hdc);
    CompatibleBitmap hBmpCheck(hdc, size.GetWidth(), size.GetHeight());

    // then draw a check mark into it
    {
        SelectInHDC selBmp(hdcMem, hBmpCheck);

        int flags = wxCONTROL_FLAT;
        if ( IsChecked() )
            flags |= wxCONTROL_CHECKED;

        wxDCTemp dcMem(hdcMem);
        wxRendererNative::Get().DrawCheckBox(GetParent(), dcMem, wxRect(size), flags);
    } // select hBmpCheck out of hdcMem

    // finally draw bitmap to screen

    // position of check mark bitmap
    int x = rc.GetX() + CHECKMARK_EXTRA_SPACE;
    int y = rc.GetY() + (rc.GetHeight() - size.GetHeight()) / 2;

    UINT uState = stat & wxOwnerDrawn::wxODSelected ? wxDSB_SELECTED : wxDSB_NORMAL;

    // checkmarks should not be mirrored in RTL layout
    DWORD oldLayout = impl->GetLayoutDirection() == wxLayout_RightToLeft ? LAYOUT_RTL : 0;
    if ( oldLayout & LAYOUT_RTL )
        ::SetLayout(hdc, oldLayout | LAYOUT_BITMAPORIENTATIONPRESERVED);
    wxDrawStateBitmap(hdc, hBmpCheck, x, y, uState);
    if ( oldLayout & LAYOUT_RTL )
        ::SetLayout(hdc, oldLayout);

    return true;
}
示例#13
0
void CFloopyControl::DrawBG(wxDC& dc, wxRect& rc)
{
	wxBrush oldBrush = dc.GetBrush();
	wxPen oldpen = dc.GetPen();

	wxPen pen( *wxLIGHT_GREY );
	pen.SetWidth(1);
	dc.SetPen( pen );

	wxBrush brush(GetParent()->GetColor(), wxSOLID);
	dc.SetBrush(brush);

	dc.DrawRoundedRectangle(rc.GetX(), rc.GetTop(),
		rc.GetWidth(), rc.GetHeight(), 2);

	dc.SetPen(oldpen);
	dc.SetBrush( oldBrush );
}
示例#14
0
文件: pathctrl.cpp 项目: sqba/floopy
void CPathItem::DrawFore(wxDC &dc, wxRect &rc)
{
	dc.SetTextForeground(*wxBLACK);

	wxString csName(_T("mixer"));
	if(NULL != m_pInput)
	{
		const char *nname = m_pInput->GetName();
		const char *dname = m_pInput->GetDisplayName();
		csName = (wxChar*)(strlen(nname) > strlen(dname) ? dname : nname);
	}

	int width = rc.GetWidth();
	if(!m_bFirst)
		width -= CORNER_LENGTH;

	wxFont oldFont = dc.GetFont();
	wxFont font(7, wxSWISS, wxNORMAL, wxNORMAL);
	font.SetWeight(IsSelected() ? wxBOLD : wxNORMAL);
	font.SetStyle(IsSelected() ? wxITALIC : wxNORMAL );
	font.SetPointSize( 7 );
	dc.SetFont( font );

	int w=0, h=0;
	dc.GetTextExtent(csName, &w, &h);
	if(h<rc.GetHeight())
	{
		if(w>width)
		{
			csName.Printf(_T("%c"),csName[0]);
			dc.GetTextExtent(csName, &w, &h);
		}
		int x = rc.GetX() + width/2 - w/2 + (m_bFirst ? 0 : CORNER_LENGTH);
		int y = rc.GetY() + rc.GetHeight()/2 - h/2;
		dc.DrawText( csName, x, y );
	}

	dc.SetFont( oldFont );
}
示例#15
0
void GOrgueBitmap::ScaleBMP(wxImage& img, double scale, const wxRect& rect, GOrgueBitmap* background)
{
	if (background && img.HasAlpha())
	{
		wxBitmap bmp(img.GetWidth(), img.GetHeight());
		wxBitmap orig(img);
		wxMemoryDC dc;

		dc.SelectObject(bmp);
		dc.DrawBitmap(background->GetBitmap(), -rect.GetX(), -rect.GetY(), false);
		dc.DrawBitmap(orig, 0, 0, true);
		bmp.SetMask(orig.GetMask());
		wxImage img_result = bmp.ConvertToImage();
		img_result.InitAlpha();
		memcpy(img_result.GetAlpha(), img.GetAlpha(), img.GetWidth() * img.GetHeight());

		m_bmp = (wxBitmap)img_result.Scale(img.GetWidth() * scale, img.GetHeight() * scale, wxIMAGE_QUALITY_BICUBIC);
	}
	else
		m_bmp = (wxBitmap)img.Scale(img.GetWidth() * scale, img.GetHeight() * scale, wxIMAGE_QUALITY_BICUBIC);
	m_Scale = scale;
}
示例#16
0
文件: parameter.cpp 项目: sqba/floopy
void CParameter::DrawFore(wxDC& dc, wxRect& rc)
{
	m_iSamplesPerPixel = m_pTracks->GetSamplesPerPixel();

	if(m_fMax == 0.f)
		return;

	m_fScale	= (float)rc.GetHeight() / (float)(m_fMax - m_fMin);
	int start	= m_pRegion->GetStartPos();
	int end		= m_pRegion->GetEndPos();
	int offset	= m_pRegion->GetStartOffset();
	int top		= rc.GetTop();
	int bottom	= rc.GetTop() + rc.GetHeight();
	int left	= rc.GetX() + 1;
	int right	= left + rc.GetWidth() - 1;
	float value = 0.f;
	int prevX	= left;
	int prevY	= bottom;
	int pos	= m_bAfterTrack ? 0 : start;
	bool bLoaded = false;

	bool bDrawCircle = true;

	if(!m_pInput->GetParamAt(pos, m_index, &value))
	{
		pos = m_pInput->GetPrevOffset(pos);
		bDrawCircle = false;
	}
	else
		bLoaded = true;

	wxPen oldpen = dc.GetPen();
	wxColor color = m_color;
	if( IsSelected() )
		color.Set(255-color.Red(), 255-color.Green(), 255-color.Blue());
	dc.SetPen( wxPen(color) );

	do {
		if(m_pInput->GetParamAt(pos, m_index, &value))
		{
			bLoaded = true;

			int x = pos;
			int y = (int)((float)bottom - (value * m_fScale));

			if(y>top && y<bottom)
			{
				if(m_bAfterTrack && offset>=0)
					x += start - offset;

				x /= m_iSamplesPerPixel;

				if(x <= left)
					prevX = left;
				else if(x >= right)
					y = prevY;
				else
				{
					dc.DrawLine(prevX, prevY, x, prevY);	// Horizontal line
					dc.DrawLine(x, prevY, x, y);			// Vertical line

					if( bDrawCircle )
					{
						if(m_pSelectedPoint &&
							m_pSelectedPoint->m_offset==pos &&
							m_pSelectedPoint->m_value==value)
						{
							dc.DrawRectangle(x-3, y-3, 6, 6);	// Selected parameter
						}
						else
							dc.DrawCircle(x, y, 3);				// Parameter
					}

					prevX = x;
				}

				bDrawCircle = true;

				prevY = y;
			}
		}
		pos = m_pInput->GetNextOffset(pos);
	} while ( pos>0 && pos<end && prevX<right );

	if(bLoaded && prevX<right) // there have been parameters!
		dc.DrawLine(prevX, prevY, right, prevY);

	dc.SetPen(oldpen);
}
示例#17
0
wxRect wxRibbonPanel::GetExpandedPosition(wxRect panel,
                                          wxSize expanded_size,
                                          wxDirection direction)
{
    // Strategy:
    // 1) Determine primary position based on requested direction
    // 2) Move the position so that it sits entirely within a display
    //    (for single monitor systems, this moves it into the display region,
    //     but for multiple monitors, it does so without splitting it over
    //     more than one display)
    // 2.1) Move in the primary axis
    // 2.2) Move in the secondary axis

    wxPoint pos;
    bool primary_x = false;
    int secondary_x = 0;
    int secondary_y = 0;
    switch(direction)
    {
    case wxNORTH:
        pos.x = panel.GetX() + (panel.GetWidth() - expanded_size.GetWidth()) / 2;
        pos.y = panel.GetY() - expanded_size.GetHeight();
        primary_x = true;
        secondary_y = 1;
        break;
    case wxEAST:
        pos.x = panel.GetRight();
        pos.y = panel.GetY() + (panel.GetHeight() - expanded_size.GetHeight()) / 2;
        secondary_x = -1;
        break;
    case wxSOUTH:
        pos.x = panel.GetX() + (panel.GetWidth() - expanded_size.GetWidth()) / 2;
        pos.y = panel.GetBottom();
        primary_x = true;
        secondary_y = -1;
        break;
    case wxWEST:
    default:
        pos.x = panel.GetX() - expanded_size.GetWidth();
        pos.y = panel.GetY() + (panel.GetHeight() - expanded_size.GetHeight()) / 2;
        secondary_x = 1;
        break;
    }
    wxRect expanded(pos, expanded_size);

    wxRect best(expanded);
    int best_distance = INT_MAX;

    const unsigned display_n = wxDisplay::GetCount();
    unsigned display_i;
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
#   pragma ivdep
#   pragma swp
#   pragma unroll
#   pragma prefetch
#   if 0
#       pragma simd noassert
#   endif
#endif /* VDM auto patch */
    for(display_i = 0; display_i < display_n; ++display_i)
    {
        wxRect display = wxDisplay(display_i).GetGeometry();

        if(display.Contains(expanded))
        {
            return expanded;
        }
        else if(display.Intersects(expanded))
        {
            wxRect new_rect(expanded);
            int distance = 0;

            if(primary_x)
            {
                if(expanded.GetRight() > display.GetRight())
                {
                    distance = expanded.GetRight() - display.GetRight();
                    new_rect.x -= distance;
                }
                else if(expanded.GetLeft() < display.GetLeft())
                {
                    distance = display.GetLeft() - expanded.GetLeft();
                    new_rect.x += distance;
                }
            }
            else
            {
                if(expanded.GetBottom() > display.GetBottom())
                {
                    distance = expanded.GetBottom() - display.GetBottom();
                    new_rect.y -= distance;
                }
                else if(expanded.GetTop() < display.GetTop())
                {
                    distance = display.GetTop() - expanded.GetTop();
                    new_rect.y += distance;
                }
            }
            if(!display.Contains(new_rect))
            {
                // Tried moving in primary axis, but failed.
                // Hence try moving in the secondary axis.
                int dx = secondary_x * (panel.GetWidth() + expanded_size.GetWidth());
                int dy = secondary_y * (panel.GetHeight() + expanded_size.GetHeight());
                new_rect.x += dx;
                new_rect.y += dy;

                // Squaring makes secondary moves more expensive (and also
                // prevents a negative cost)
                distance += dx * dx + dy * dy;
            }
            if(display.Contains(new_rect) && distance < best_distance)
            {
                best = new_rect;
                best_distance = distance;
            }
        }
    }

    return best;
}
示例#18
0
bool wxCheckListBoxItem::OnDrawItem (
  wxDC&                             rDc
, const wxRect&                     rRect
, wxODAction                        eAct
, wxODStatus                        eStat
)
{
    wxRect                          vRect = rRect;

    ::WinQueryWindowRect( m_pParent->GetHWND()
                         ,&rDc.m_vRclPaint
                        );
    if (IsChecked())
        eStat = (wxOwnerDrawn::wxODStatus)(eStat | wxOwnerDrawn::wxODChecked);

    //
    // Unfortunately PM doesn't quite get the text position exact.  We need to alter
    // it down and to the right, just a little bit.  The coords in rRect are OS/2
    // coords not wxWidgets coords.
    //
    vRect.x += 5;
    vRect.y -= 3;
    if (wxOwnerDrawn::OnDrawItem( rDc
                                 ,vRect
                                 ,eAct
                                 ,eStat))
    {
        size_t                      nCheckWidth  = GetDefaultMarginWidth();
        size_t                      nCheckHeight = m_pParent->GetItemHeight();
        int                         nParentHeight;
        int                         nX = rRect.GetX();
        int                         nY = rRect.GetY();
        int                         nOldY = nY;
        wxColour                    vColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
        wxPen                       vPenBack;
        wxPen                       vPenGray;
        wxPen                       vPenPrev;

        m_pParent->GetSize( NULL
                           ,&nParentHeight
                          );

        nY = nParentHeight - nY - nCheckHeight;
        vPenBack = wxPen(vColour, 1, wxSOLID);
        vPenGray = wxPen(wxColour(127, 127, 127), 1, wxSOLID);

        //
        // Erase the 1-pixel border
        //
        rDc.SetPen(vPenBack);
        rDc.DrawRectangle( nX
                          ,nY
                          ,nCheckWidth
                          ,nCheckHeight
                         );

        //
        // Now we draw the smaller rectangle
        //
        nY++;
        nCheckWidth  -= 2;
        nCheckHeight -= 2;

        //
        // Draw hollow gray rectangle
        //
        rDc.SetPen(vPenGray);
        rDc.DrawRectangle( nX
                          ,nY
                          ,nCheckWidth
                          ,nCheckHeight
                         );

        nX++;
        if (IsChecked())
        {
            //
            // Draw the check by loading the sys standard bitmap and drawing it
            //
            HBITMAP                 hChkBmp = ::WinGetSysBitmap( HWND_DESKTOP
                                                                ,SBMP_MENUCHECK
                                                               );
            POINTL                  vPoint = {nX, nOldY + 3};

            ::WinDrawBitmap( rDc.GetHPS()
                            ,hChkBmp
                            ,NULL
                            ,&vPoint
                            ,NULL
                            ,NULL
                            ,DBM_NORMAL
                           );
        }
        return TRUE;
    }
    return FALSE;
} // end of wxCheckListBoxItem::OnDrawItem
示例#19
0
void SDC::DrawRectangle(const wxRect& rect) {
	DrawRectangle(rect.GetX(), rect.GetY(), rect.GetWidth(), rect.GetHeight());
}
示例#20
0
QRect wxQtConvertRect( const wxRect &rect )
{
    return QRect( rect.GetX(), rect.GetY(), rect.GetWidth(), rect.GetHeight() );
}
示例#21
0
void wxSFShapeBase::_GetCompleteBoundingBox(wxRect &rct, int mask)
{
    //wxASSERT(m_pParentManager);
    if(!m_pParentManager)return;

    if( m_lstProcessed.IndexOf(this) != wxNOT_FOUND )return;
    else
        m_lstProcessed.Append(this);

	ShapeList lstChildren;
	//SerializableList lstConnections;

	// firts, get bounding box of the current shape
	if(mask & bbSELF)
	{
		if(rct.IsEmpty())rct = this->GetBoundingBox().Inflate( abs(m_nHBorder), abs(m_nVBorder) );
		else
			rct.Union(this->GetBoundingBox().Inflate( abs(m_nHBorder), abs(m_nVBorder)) );

		// add also shadow offset if neccessary
        if( (mask & bbSHADOW) && (m_nStyle & sfsSHOW_SHADOW) && GetParentCanvas() )
        {
            wxRealPoint nOffset = GetParentCanvas()->GetShadowOffset();

            if( nOffset.x < 0 )
            {
                rct.SetX(rct.GetX() + (int)nOffset.x);
                rct.SetWidth(rct.GetWidth() - (int)nOffset.x);
            }
            else
                rct.SetWidth(rct.GetWidth() + (int)nOffset.x);

            if( nOffset.y < 0 )
            {
                rct.SetY(rct.GetY() + (int)nOffset.y);
                rct.SetHeight(rct.GetHeight() - (int)nOffset.y);
            }
            else
                rct.SetHeight(rct.GetHeight() + (int)nOffset.y);;
        }
	}
	else
		mask |= bbSELF;

	// get list of all connection lines assigned to the shape and find their child shapes
	if(mask & bbCONNECTIONS)
	{
		wxSFShapeBase *pLine;

        ShapeList lstLines;
        GetAssignedConnections( CLASSINFO(wxSFLineShape), lineBOTH, lstLines );

		ShapeList::compatibility_iterator node = lstLines.GetFirst();
		while(node)
		{
			pLine = node->GetData();

			//rct.Union(pLine->GetBoundingBox());
			lstChildren.Append(pLine);

			// get children of the connections
			pLine->GetChildShapes(sfANY, lstChildren);

			node = node->GetNext();
		}
	}

	// get children of this shape
	if(mask & bbCHILDREN)
	{
		this->GetChildShapes(sfANY, lstChildren, sfNORECURSIVE);

		// now, call this function for all children recursively...
		ShapeList::compatibility_iterator node = lstChildren.GetFirst();
		while(node)
		{
		    node->GetData()->_GetCompleteBoundingBox(rct, mask);
			node = node->GetNext();
		}
	}
}