예제 #1
0
// 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;
}
예제 #2
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;
}
//---------------------------------------------------------
void CDLG_Parameters::Set_Position(wxRect r)
{
	if( m_pInfo && m_pInfo->IsShown() )
	{
		r.SetWidth(r.GetWidth() / 2 - 4);
		m_pInfo->SetSize(r);

		r.SetLeft(r.GetRight() + 9);
		m_pControl->SetSize(r);
	}
	else
	{
		m_pControl->SetSize(r);
	}
}
예제 #4
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();
		}
	}
}