Ejemplo n.º 1
0
CStatusLineCtrl::CStatusLineCtrl(CQueueView* pParent, const t_EngineData* const pEngineData, const wxRect& initialPosition)
	: m_pEngineData(pEngineData)
{
	m_mdc = 0;
	m_pPreviousStatusText = 0;
	m_last_elapsed_seconds = 0;
	m_last_left = 0;
	m_last_bar_split = -1;
	m_last_permill = -1;

	wxASSERT(pEngineData);

#ifdef __WXMSW__
	Create(pParent, wxID_ANY, initialPosition.GetPosition(), initialPosition.GetSize());
#else
	Create(pParent->GetMainWindow(), wxID_ANY, initialPosition.GetPosition(), initialPosition.GetSize());
#endif

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

	m_transferStatusTimer.SetOwner(this);

	m_pParent = pParent;
	m_pStatus = 0;
	m_lastOffset = -1;
	
	m_gcLastTimeStamp = wxDateTime::Now();
	m_gcLastOffset = -1;
	m_gcLastSpeed = -1;

	SetTransferStatus(0);


	// Calculate field widths so that the contents fit under every language.
	if (!m_initialized)
	{
		m_initialized = true;
		wxClientDC dc(this);
		dc.SetFont(GetFont());

		wxCoord w, h;
		wxTimeSpan elapsed(100, 0, 0);
		dc.GetTextExtent(elapsed.Format(_("%H:%M:%S elapsed")), &w, &h);
		m_textHeight = h;
		m_fieldOffsets[0] = 50 + w;

		dc.GetTextExtent(elapsed.Format(_("%H:%M:%S left")), &w, &h);
		m_fieldOffsets[1] = m_fieldOffsets[0] + 20 + w;

		m_fieldOffsets[2] = m_fieldOffsets[1] + 20;
		m_fieldOffsets[3] = m_fieldOffsets[2] + PROGRESSBAR_WIDTH + 20;
	}

#ifdef __WXGTK__
	ResetCursor(this);
#endif
}
Ejemplo n.º 2
0
// Returns the rectangle for this object (id = 0) or a child element (id > 0).
wxAccStatus SplitterWindowAccessible::GetLocation(wxRect& rect, int elementId)
{
    wxSplitterWindow* splitter = wxDynamicCast(GetWindow(), wxSplitterWindow);
    if (splitter && elementId == 2 && splitter->IsSplit())
    {
        wxSize clientSize = splitter->GetClientSize();
        if (splitter->GetSplitMode() == wxSPLIT_VERTICAL)
        {
            rect.x = splitter->GetSashPosition();
            rect.y = 0;
            rect.SetPosition(splitter->ClientToScreen(rect.GetPosition()));
            rect.width = splitter->GetSashSize();
            rect.height = clientSize.y;
        }
        else
        {
            rect.x = 0;
            rect.y = splitter->GetSashPosition();
            rect.SetPosition(splitter->ClientToScreen(rect.GetPosition()));
            rect.width = clientSize.x;
            rect.height = splitter->GetSashSize();
        }
        return wxACC_OK;
    }
    // Let the framework handle the other cases.
    return wxACC_NOT_IMPLEMENTED;
}
Ejemplo n.º 3
0
// Returns the rectangle for this object (id = 0) or a child element (id > 0).
// rect is in screen coordinates.
wxAccStatus
KeyViewAx::GetLocation(wxRect & rect, int elementId)
{
   int line;

   if (IdToLine(elementId, line))
   {
      wxRect rectLine;

      rectLine.width = mView->GetClientSize().GetWidth();

      // iterate over all visible lines
      for (int i = 0; i < line; i++)
      {
         wxCoord hLine = mView->GetLineHeight(i);

         rectLine.height = hLine;

         rect = rectLine;
         wxPoint margins = mView->GetMargins();
         rect.Deflate(margins.x, margins.y);
         rectLine.y += hLine;
      }

      rect.SetPosition(mView->ClientToScreen(rect.GetPosition()));
   }
   else
   {
      rect = mView->GetRect();
      rect.SetPosition(mView->GetParent()->ClientToScreen(rect.GetPosition()));
   }

   return wxACC_OK;
}
Ejemplo n.º 4
0
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;
}
Ejemplo n.º 5
0
void wxFileDialog::MSWOnInitDone(WXHWND hDlg)
{
    // note the dialog is the parent window: hDlg is a child of it when
    // OFN_EXPLORER is used
    HWND hFileDlg = ::GetParent((HWND)hDlg);

    // set HWND so that our DoMoveWindow() works correctly
    SetHWND((WXHWND)hFileDlg);

    if ( m_centreDir )
    {
        // now we have the real dialog size, remember it
        RECT rect;
        GetWindowRect(hFileDlg, &rect);
        gs_rectDialog = wxRectFromRECT(rect);

        // and position the window correctly: notice that we must use the base
        // class version as our own doesn't do anything except setting flags
        wxFileDialogBase::DoCentre(m_centreDir);
    }
    else // need to just move it to the correct place
    {
        SetPosition(gs_rectDialog.GetPosition());
    }

    // we shouldn't destroy this HWND
    SetHWND(NULL);
}
bool LfnTech::Copy(
	void* destBase,
	const void* srcBase,
	const wxRect& destBounds,
	const wxRect& srcBounds,
	const wxPoint& destPoint,
	const wxRect& srcRect,
	int destStride,
	int srcStride,
	int bytesPerPixel)
{
	bool result = false;

	if (!destBounds.IsEmpty() && !srcBounds.IsEmpty())
	{
		wxPoint destPointClipped(destPoint);
		wxPoint srcPointClipped(srcRect.GetPosition());
		wxSize sizeClipped(srcRect.GetSize());

		// Clip against src bounds, then against dest bounds, then once again
		// against src bounds in case the dest clip translation moved it significantly.
		Clip(srcBounds, srcPointClipped, sizeClipped, destPointClipped);
		Clip(destBounds, destPointClipped, sizeClipped, srcPointClipped);
		Clip(srcBounds, srcPointClipped, sizeClipped, destPointClipped);

		result = Copy(destBase, srcBase, destPointClipped, wxRect(srcPointClipped, sizeClipped), destStride, srcStride, bytesPerPixel);
	}

	return result;
}
Ejemplo n.º 7
0
MovieElement::MovieElement(Stage *inStage, const wxString &inName,
                           Halyard::TCallbackPtr inDispatcher,
                           const wxRect &inBounds,
                           const wxString &inLocation,
                           long inWindowStyle,
                           MovieWindowStyle inMovieWindowStyle,
                           float inVolume)
    : Widget(inStage, inName, inDispatcher),
      mLocationInfo(inLocation), mMovieWindow(NULL),
      mHaveSentMediaErrorEvent(false),
      mHaveSentMediaTimeoutEvent(false)
{
    mMovieWindow = new MovieWindowNative(inStage, -1, inBounds.GetPosition(),
                                         inBounds.GetSize(), inWindowStyle,
                                         inMovieWindowStyle);
    mMovieWindow->SetVolume("all", inVolume);
    try {
        mMovieWindow->SetMovie(inLocation);
    } catch (std::exception &e) {
        // Log this exception.  We'll report it in our Idle() method,
        // because many movie errors occur after playback has started, so
        // it's more consistent to handle this one that way.
        std::string location(inLocation.mb_str());
        gLog.Info("halyard", "Movie error: %s for %s", e.what(),
                  location.c_str());
    }
    InitializeWidgetWindow(mMovieWindow);
}
Ejemplo n.º 8
0
// Returns the rectangle for this object (id = 0) or a child element (id > 0).
// rect is in screen coordinates.
wxAccStatus GridAx::GetLocation(wxRect & rect, int elementId)
{
    wxRect r;
    int row;
    int col;

    if (GetRowCol(elementId, row, col)) {
        rect = mGrid->CellToRect(row, col);
        rect.SetPosition(mGrid->GetGridWindow()->ClientToScreen(rect.GetPosition()));
    }
    else {
        rect = mGrid->GetRect();
        rect.SetPosition(mGrid->GetParent()->ClientToScreen(rect.GetPosition()));
    }

    return wxACC_OK;
}
Ejemplo n.º 9
0
wxPoint ClampPosition( const wxRect& viewport, const wxRect& extent )
{
    const wxSize delta( viewport.GetSize() - extent.GetSize() ); 

    wxPoint newTopLeft( viewport.GetPosition() );

    if( delta.x < 0 )
    {
        // viewport smaller than extent
        int minX = extent.GetPosition().x;
        int maxX = ( extent.GetPosition().x + extent.GetSize().x ) - viewport.GetSize().x;
        newTopLeft.x = clamp( newTopLeft.x, minX, maxX );
    }
    else
    {
        // viewport larger than extent
        newTopLeft.x = extent.GetPosition().x - ( delta.x / 2 );
    }

    if( delta.y < 0 )
    {
        // viewport smaller than extent
        int minY = extent.GetPosition().y;
        int maxY = ( extent.GetPosition().y + extent.GetSize().y ) - viewport.GetSize().y;
        newTopLeft.y = clamp( newTopLeft.y, minY, maxY );
    }
    else
    {
        // viewport larger than extent
        newTopLeft.y = extent.GetPosition().y - ( delta.y / 2 );
    }

    return newTopLeft;
}
Ejemplo n.º 10
0
// Returns the rectangle for this object (id = 0) or a child element (id > 0).
// rect is in screen coordinates.
wxAccStatus AButtonAx::GetLocation( wxRect& rect, int WXUNUSED(elementId) )
{
    AButton *ab = wxDynamicCast( GetWindow(), AButton );

    rect = ab->GetRect();
    rect.SetPosition( ab->GetParent()->ClientToScreen( rect.GetPosition() ) );

    return wxACC_OK;
}
Ejemplo n.º 11
0
// Returns the rectangle for this object (id = 0) or a child element (id > 0).
// rect is in screen coordinates.
wxAccStatus HtmlWindowAx::GetLocation( wxRect& rect, int WXUNUSED(elementId) )
{
   HtmlWindow *hw = wxDynamicCast( GetWindow(), HtmlWindow );

   rect = hw->GetRect();
   rect.SetPosition( hw->GetParent()->ClientToScreen( rect.GetPosition() ) );

   return wxACC_OK;
}
Ejemplo n.º 12
0
// Returns the rectangle for this object (id = 0) or a child element (id > 0).
// rect is in screen coordinates.
wxAccStatus ASliderAx::GetLocation( wxRect& rect, int WXUNUSED(elementId) )
{
   ASlider *as = wxDynamicCast( GetWindow(), ASlider );

   rect = as->GetRect();
   rect.SetPosition( as->GetParent()->ClientToScreen( rect.GetPosition() ) );

   return wxACC_OK;
}
Ejemplo n.º 13
0
CustomWxHtmlWindow::CustomWxHtmlWindow(wxWindow *inParent,
                                       const wxRect &inBounds,
                                       BrowserElementWx *inElement)
    : wxHtmlWindow(inParent, -1,
                   inBounds.GetPosition(),
                   inBounds.GetSize(),
                   wxHW_SCROLLBAR_AUTO | wxBORDER),
      mElement(inElement)
{
}
Ejemplo n.º 14
0
void wxPDFViewPage::DrawThumbnail(wxPDFViewPagesClient* client, wxDC& dc, const wxRect& rect)
{
	dc.SetBackground(*wxTRANSPARENT_BRUSH);
	dc.SetPen(*wxLIGHT_GREY_PEN);
	dc.DrawRectangle(rect.Inflate(1, 1));

	wxBitmap bmp = client->GetCachedBitmap(m_index, rect.GetSize());
	if (bmp.Ok())
	{
		dc.DrawBitmap(bmp, rect.GetPosition());
	}
}
Ejemplo n.º 15
0
FichiersToUpload::FichiersToUpload() {
    Model *model = new Model();

    if (model->isUserDemo()) {
        wxMessageBox(_("L'utilisateur \"demo\" ne peut pas ajouter de photos"));
        return;
    } else {
        AppMenuBar &appMenuBar = AppMenuBar::Instance();
        appMenuBar.disableAllMenus();

        wxString toUploadPath = model->getCurBaseDir() + wxT("PhotosToUpload/");
        wxDir dir(toUploadPath);
        if ( !dir.IsOpened() ) {
            wxMessageBox(_("Répertoire \"") + toUploadPath + _("\" ne peut être ouvert"), _("Erreur fatale"));
            return;
        }

        AfficheFileTransfer *afficheFileTransfer = new AfficheFileTransfer(this, win3RectGbl.GetPosition(), win3RectGbl.GetSize(), _T("Téléchargement d'une liste de fichiers photos"), className, true);

        wxArrayString fileNames;
        wxDir::GetAllFiles(toUploadPath, &fileNames, wxT("*.jpg"), wxDIR_DEFAULT);
        wxDir::GetAllFiles(toUploadPath, &fileNames, wxT("*.JPG"), wxDIR_DEFAULT);
        wxDir::GetAllFiles(toUploadPath, &fileNames, wxT("*.jpeg"), wxDIR_DEFAULT);
        wxDir::GetAllFiles(toUploadPath, &fileNames, wxT("*.JPEG"), wxDIR_DEFAULT);
        if (fileNames.size() == 0) {
            afficheFileTransfer->addItem(_("Aucun fichier au format JPEG dans le répertoire :"));
            afficheFileTransfer->addLine(wxT("\"") + model->getCurBaseDir());
            afficheFileTransfer->addLine(wxT("PhotosToUpload/\""));
            wxMessageBox(_("Seuls les fichiers au format JPEG (extensions .JPEG | .JPG | .jpeg | .jpg) sont acceptés"), _("Rappel"));
            return;
        } else {
            afficheFileTransfer->addItem(_("Nombre de fichiers à télecharger : ")+to_string(fileNames.size()));
            afficheFileTransfer->wait();
            afficheFileTransfer->temps(_("Début : "));
            for (int ijk=0; ijk<fileNames.size(); ijk++) {
                wxString flnIn = wxFileNameFromPath(fileNames[ijk]);
                afficheFileTransfer->addLine(_("Fichier[") + to_string(ijk) + wxT("] : \"") + flnIn + wxT("\""));
//                Aux::logsNumber("ijk", ijk, logPut);
                int sts = model->addFichierToTblFichiers(toUploadPath, flnIn);
                if (sts == 0) {
                    afficheFileTransfer->addLine(_("Le fichier existe déjà"));
                }
                model->moveFichierAfterLoaded(toUploadPath+flnIn, toUploadPath + "../PhotosUploaded/" + flnIn);

            }
            afficheFileTransfer->temps(_("Fin : "));
            afficheFileTransfer->addDummy();
            afficheFileTransfer->addLine(_("Les fichiers téléchargés sont maintenant dans le répertoire : "));
            afficheFileTransfer->addLine(wxT("\"") + model->getCurBaseDir());
            afficheFileTransfer->addLine(wxT("PhotosUploaded/\""));
        }
    }
}
Ejemplo n.º 16
0
GestionCarnet::GestionCarnet() {
    Aux::logsInOut("GestionCarnet::GestionCarnet", logIn, logNop);
    try {
        Create(NULL, wxID_ANY, _("Chargement des photos"), winRectGbl.GetPosition(), winRectGbl.GetSize(), wxDEFAULT_FRAME_STYLE, className);
        this->Show(false); // !!! hum ...
        AppMenuBar &appMenuBar = AppMenuBar::Instance();
        appMenuBar.disableAllMenus();
        
        ObjPlante *objPlante = new ObjPlante();
        tableOfPhotosOfCarnet = new TableOfPhotos(this, winRectGbl.GetSize(), objPlante, this->getClassName());
    } catch (const exception &e) { Aux::logsStr("", e.what(), logPut); }
    Aux::logsInOut("GestionCarnet::GestionCarnet", logOut, logNop);
}
Ejemplo n.º 17
0
void wxMarkupText::Render(wxDC& dc, const wxRect& rect, int flags)
{
    // We want to center the above-baseline parts of the letter vertically, so
    // we use the visible height and not the total height (which includes
    // descent and internal leading) here.
    int visibleHeight;
    wxRect rectText(rect.GetPosition(), Measure(dc, &visibleHeight));
    rectText.height = visibleHeight;

    wxMarkupParserRenderOutput out(dc, rectText.CentreIn(rect), flags);
    wxMarkupParser parser(out);
    parser.Parse(m_markup);
}
Ejemplo n.º 18
0
// Returns the rectangle for this object (id = 0) or a child element (id > 0).
// rect is in screen coordinates.
wxAccStatus TimeTextCtrlAx::GetLocation(wxRect & rect, int elementId)
{
   rect = mCtrl->GetRect();

   if (elementId != wxACC_SELF) {
//      rect.x += mCtrl->mFields[elementId - 1].fieldX;
//      rect.width =  mCtrl->mFields[elementId - 1].fieldW;
        rect = mCtrl->mDigits[elementId - 1].digitBox;
   }

   rect.SetPosition(mCtrl->GetParent()->ClientToScreen(rect.GetPosition()));

   return wxACC_OK;
}
Ejemplo n.º 19
0
void tcButtonConsole::AddButton(wxRect bounds, long command, std::string caption)
{
    wxSize buttonSize = bounds.GetSize();
    wxPoint buttonPosition = bounds.GetPosition();

#if 0
    tcButton *buttonToAdd = new tcButton(this, buttonPosition, buttonSize);
    buttonToAdd->SetCaption(caption);
    buttonToAdd->SetCommand(command);
    buttonToAdd->SetSendRedraw(true);

    buttons.push_back(buttonToAdd);
#endif
}
Ejemplo n.º 20
0
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.

    // Get the position before changing the parent as it would be offset after
    // changing it.
    const wxRect rect = GetRect();

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

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

    // destroy the old spin button after detaching it from this wxWindow object
    // (notice that m_hWnd will be reset by UnsubclassWin() so save it first)
    const HWND hwndOld = GetHwnd();
    UnsubclassWin();
    if ( !::DestroyWindow(hwndOld) )
    {
        wxLogLastError(wxT("DestroyWindow"));
    }

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

    // reapply our values to wxSpinButton
    wxSpinButton::SetValue(GetValue());
    SetRange(m_min, m_max);

    // also set the size again with wxSIZE_ALLOW_MINUS_ONE flag: this is
    // necessary if our original position used -1 for either x or y
    SetSize(rect, wxSIZE_ALLOW_MINUS_ONE);

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

    return true;
}
Ejemplo n.º 21
0
AnimatedOverlay::AnimatedOverlay(Stage *inStage, const wxString &inName,
                                 const wxRect &inBounds, 
                                 Halyard::TCallbackPtr inDispatch,
                                 const std::string &inCursorName,
                                 bool inHasAlpha,
                                 const std::string &inStatePath, 
                                 TValueList images)
     : Overlay(inStage, inName, inBounds, inDispatch, inCursorName,
               inHasAlpha),
       mBasePosition(inBounds.GetPosition()), mCurrentOffset(0, 0),
       mStatePath(inStatePath)
{
    // convert TValueList to ImageList
    TValueList::iterator iter = images.begin();
    for (; iter != images.end(); ++iter)
        mImages.push_back(tvalue_cast<std::string>(*iter));
    
    NotifyStateChanged();
}
AssocPhotosToPlante::AssocPhotosToPlante(wxWindow *parent, vector<ObjMicroPhoto *> &listeOfObjMicrosPhotos, wxString topClass) {
    Create(parent, wxID_ANY, winRectGbl.GetPosition(), winRectGbl.GetSize(), wxDEFAULT_FRAME_STYLE & ~(wxRESIZE_BORDER | wxMAXIMIZE_BOX));

//    Aux::logsThis(wxT("AssocPhotosToPlante::AssocPhotosToPlante"), this, logPut);
//    Aux::logsThis(wxT("AssocPhotosToPlante::AssocPhotosToPlante::parent"), parent, logPut);

    parent0 = parent;
    listeOfObjMicrosPhotos0 = &listeOfObjMicrosPhotos;

    this->Show(false);

    SelectPlanteNameFrame *selectPlanteNameFrame = new SelectPlanteNameFrame(this, classTitle, wxEmptyString, wxT("ModelTPL"), topClass);
    selectPlanteNameFrame->SetPosition(this->GetPosition());
    selectPlanteNameFrame->SetBackgroundColour(Couleurs::backgColor);
    selectPlanteNameFrame->Show(true);
    selectPlanteNameFrame->SetFocus();

    selectPlanteNameFrame->getObjPlante();
}
Ejemplo n.º 23
0
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();
}
Ejemplo n.º 24
0
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;
}
Ejemplo n.º 25
0
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;
}
Ejemplo n.º 26
0
GestionPhotosOfPlante::GestionPhotosOfPlante( ) {
    Aux::logsInOut("GestionPhotosOfPlante", 0, logNop);
    try {
    Create(NULL, wxID_ANY, classTitle, winRectGbl.GetPosition(), winRectGbl.GetSize(), wxDEFAULT_FRAME_STYLE & ~(wxRESIZE_BORDER | wxMAXIMIZE_BOX), className);
        
//        Model *model = new Model();
        
        if (model->existAnyPlanteAssociated()) {
            AppMenuBar &appMenuBar = AppMenuBar::Instance();
            appMenuBar.disableAllMenus();
            
            SelectPlanteNameFrame *selectPlanteNameFrame = new SelectPlanteNameFrame(this, classTitle, wxEmptyString, wxT("Model"), className);
            selectPlanteNameFrame->Show(true);
        } else {
            wxMessageBox(_("Voir le menu Gestion des photos orphelines"), _("Aucune photo n'est associée à une plante"), wxOK);
            return;
        }
        
    } catch (const exception &e) { Aux::logsStr("", e.what(), logPut); }
    Aux::logsInOut("GestionPhotosOfPlante", 1, logNop);
}
Ejemplo n.º 27
0
// Returns the rectangle for this object (id = 0) or a child element (id > 0).
// rect is in screen coordinates.
wxAccStatus TrackPanelAx::GetLocation( wxRect& rect, int elementId )
{
   wxRect client;

   if( elementId == wxACC_SELF )
   {
      rect = mTrackPanel->GetRect();
   }
   else
   {
      Track *t = FindTrack( elementId );

      if( t == NULL )
      {
         return wxACC_FAIL;
      }

      rect = mTrackPanel->FindTrackRect( t, true );
   }

   rect.SetPosition( mTrackPanel->GetParent()->ClientToScreen( rect.GetPosition() ) );

   return wxACC_OK;
}
Ejemplo n.º 28
0
NotePanel::NotePanel(wxWindow *parent, int numeroNote) {
    try {
        Create(parent, wxID_ANY, winRectGbl.GetPosition(), wxDefaultSize, wxBORDER_NONE);
        this->SetBackgroundColour(Couleurs::lightBackgColor);
//        Aux::logsThis("NotePanel::NotePanel", this, "put");
        notePanel = this;
        numeroNote0 = numeroNote;
        
        parent0 = (TableOfNotes *)parent->GetGrandParent();
//        Aux::logsThis("NotePanel::NotePanel::parent0", parent0, "put");
        
        int gap16 = 16;
        int marge4 = 4;
        int marge8 = 8;

        wxSize dimText(parent->GetSize().x - 2*scrollW - 32, heightTexte);

        wxBoxSizer *verticalSizers = new wxBoxSizer(wxVERTICAL);
        
        wxBoxSizer *horizontalSizers0 = new wxBoxSizer(wxHORIZONTAL);
        selButton = new wxButton(this, ID_PhAssAuxNotePanelSelButton, "Sélectionner cette note", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
        selButton->Enable(true);
        horizontalSizers0->Add(selButton, 0, wxALL, marge4);
        horizontalSizers0->AddSpacer(4*gap16);
        OKButton = new wxButton(this, ID_PhAssAuxNotePanelOKButton, "OK pour cette note", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
        OKButton->Enable(false);
        horizontalSizers0->Add(OKButton, 0, wxALL, marge4);
        verticalSizers->Add(horizontalSizers0, 0);
        
        wxBoxSizer *horizontalSizers1 = new wxBoxSizer(wxHORIZONTAL);
        horizontalSizers1->AddSpacer(gap16);
        delButton = new wxButton(this, ID_PhAssAuxNotePanelDelButton, "Supprimer", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
        delButton->Enable(false);
        horizontalSizers1->Add(delButton, 0, wxALL, marge4);
        horizontalSizers1->AddSpacer(gap16);
        editButton = new wxButton(this, ID_PhAssAuxNotePanelEditButton, "Editer", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
        editButton->Enable(false);
        horizontalSizers1->Add(editButton, 0, wxALL, marge4);
        horizontalSizers1->AddSpacer(gap16);
        editOKButton = new wxButton(this, ID_PhAssAuxNotePanelEditOKButton, "Edition OK", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
        editOKButton->Enable(false);
        horizontalSizers1->Add(editOKButton, 0, wxALL, marge4);
        horizontalSizers1->AddSpacer(gap16);
        zoneButton = new wxButton(this, ID_PhAssAuxNotePanelZoneButton, "Zone", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
        zoneButton->Enable(false);
        horizontalSizers1->Add(zoneButton, 0, wxALL, marge4);
        horizontalSizers1->AddSpacer(gap16);
        zoneOKButton = new wxButton(this, ID_PhAssAuxNotePanelZoneOKButton, "Zone OK", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
        zoneOKButton->Enable(false);
        horizontalSizers1->Add(zoneOKButton, 0, wxALL, marge4);
        verticalSizers->Add(horizontalSizers1, 0);
        
        wxBoxSizer *horizontalSizers2 = new wxBoxSizer(wxHORIZONTAL);
        horizontalSizers2->AddSpacer(marge8);
        noteText = new wxTextCtrl(this, ID_PhAssAuxNotePanelNoteText, wxEmptyString, wxDefaultPosition, dimText, wxTE_MULTILINE);
        noteText->Enable(false);
        horizontalSizers2->Add(noteText, 0, wxALL, marge8);
        horizontalSizers2->AddSpacer(marge8);
        verticalSizers->Add(horizontalSizers2, 0);
        
//        SetSizerAndFit(verticalSizers);
        SetSizer(verticalSizers);
        
        heightNotePanelZ = verticalSizers->GetSize().y;
//        this->SetSize(parent->GetSize().x-scrollW, heightNotePanelZ);
        this->SetSize(winRectGbl.GetSize());
        
        this->Show(true);
        objNote0 = new ObjNote();
        objNote0->setNumero(numeroNote);
    } catch (const exception &e) { Aux::logsStr("", e.what(), logPut); }
}
Ejemplo n.º 29
0
AddPageToCarnet::AddPageToCarnet(wxWindow *parent, TableOfImagesPanelDyn *tableOfImagePanelDyn,/*vector<ObjMicroPhoto *> listeOfObjMicrosPhotos,*/ wxString topClass) {
//    Aux::logsStr("AddPageToCarnet::topClass", topClass, logPut);
    Create(parent, wxID_ANY, _("Attributs de terrain d'un groupe de photos"), winRectGbl.GetPosition(), winRectGbl.GetSize(), wxDEFAULT_FRAME_STYLE & ~(wxRESIZE_BORDER | wxMAXIMIZE_BOX | wxMINIMIZE_BOX | wxCLOSE_BOX), wxEmptyString);

//    Aux::logsThis(wxT("AddPageToCarnet"), this, logPut);
//    Aux::logsThis(wxT("AddPageToCarnet::parent"), parent, logPut);

    parent0 = parent;
    topClass0 = topClass;
    tableOfImagePanelDyn0 = tableOfImagePanelDyn;
    
//    Aux::logsNumber("AddPageToCarnet::size", (int)listeOfObjMicrosPhotos0.size(), logPut);
//    for (int ijk; ijk<listeOfObjMicrosPhotos0.size(); ijk++) {
//        Aux::logsStr("AddPageToCarnet::[" + to_string(ijk) + "]", listeOfObjMicrosPhotos0.at(ijk)->getNomPhoto(), logPut);
//        model->assocPhotoToCarnetPages(listeOfObjMicrosPhotos0.at(ijk), objPageOfCarnet);
//        Aux::logsThis("AddPageToCarnet::", listeOfObjMicrosPhotos0.at(ijk), logPut);
//    }
    

 panel0 = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, wxEmptyString);
    panel0->SetBackgroundColour(Couleurs::backgColor);
    int curDelta = deltaGbl;
    
    EntetePanel *entetePanel = new EntetePanel(panel0, _("Entrer les attributs qui seront affectés à chacune des photos sélectionnées"), wxDefaultPosition, wxDefaultSize, Couleurs::planteColor);
    entetePanel->SetSize(winSizeX, entetePanel->GetSize().y);
    
    curDelta = entetePanel->GetSize().y;
    wxStaticText *paysLabel =  new wxStaticText(panel0, wxID_ANY, _("Pays : "), wxPoint(X0, curDelta), wxSize(size0, heightGbl),wxALIGN_RIGHT);
    paysLabel->Show(true);
    paysNom = new wxTextCtrl(panel0, wxID_ANY, wxEmptyString, wxPoint(X1, curDelta), wxSize(size1,heightGbl));
    paysNom->SetHint(_("Pays"));
    paysNom->SetValue(wxT("France"));
    paysNom->SetFocus();
    paysNom->Show(true);
    
    curDelta = curDelta + heightGbl + deltaGbl;
    int XX0 = deltaGbl, sizeX0 = 96;
    int XX1 = XX0 + sizeX0 + deltaGbl, sizeX1 = 48;
    wxStaticText *cpLabel =  new wxStaticText(panel0, wxID_ANY, _("Code postal : "), wxPoint(XX0, curDelta), wxSize(sizeX0, heightGbl),wxALIGN_RIGHT);
    cpLabel->Show(true);
    cpNom = new wxTextCtrl(panel0, wxID_ANY, wxEmptyString, wxPoint(XX1, curDelta), wxSize(sizeX1, heightGbl));
    cpNom->SetHint(wxT("CP"));
    cpNom->SetValue(wxT("00000"));
    cpNom->SetFocus();
    cpNom->Show(true);
    int XX2 = 172, sizeX2 = 96;
    int XX3 = XX2 + sizeX2 + deltaGbl, sizeX3 = 340;
    wxStaticText *communeLabel =  new wxStaticText(panel0,wxID_ANY, _("Commune : "), wxPoint(XX2, curDelta), wxSize(sizeX2 ,heightGbl),wxALIGN_RIGHT);
    communeLabel->Show(true);
    communeNom = new wxTextCtrl(panel0, wxID_ANY, wxEmptyString, wxPoint(XX3, curDelta), wxSize(sizeX3,heightGbl));
    communeNom->SetHint(_("Commune"));
    communeNom->SetValue(wxT("- nop -"));
    communeNom->SetFocus();
    communeNom->Show(true);
    
    curDelta = curDelta + heightGbl + deltaGbl;
    wxStaticText *lieuDitLabel =  new wxStaticText(panel0,wxID_ANY, _("Lieu-dit : "), wxPoint(X0, curDelta), wxSize(size0 ,heightGbl),wxALIGN_RIGHT);
    lieuDitLabel->Show(true);
    lieuDitNom = new wxTextCtrl(panel0, wxID_ANY, wxEmptyString, wxPoint(X1, curDelta), wxSize(size1,heightGbl));
    lieuDitNom->SetHint(_("Lieu-dit"));
    lieuDitNom->SetValue(wxT("- nop -"));
    lieuDitNom->SetFocus();
    lieuDitNom->Show(true);
    
    curDelta = curDelta + heightGbl + deltaGbl;
    wxStaticText *auteurNomLabel =  new wxStaticText(panel0,wxID_ANY, _("Nom de l'auteur : "), wxPoint(X0, curDelta), wxSize(size0 ,3*heightGbl),wxALIGN_RIGHT);
    auteurNomLabel->Show(true);
    auteurNom = new wxTextCtrl(panel0, wxID_ANY, wxEmptyString, wxPoint(X1, curDelta), wxSize(size1,heightGbl) );
    auteurNom->SetValue(wxT("Nadot"));
    auteurNom->Show(true);
    
    curDelta = curDelta + heightGbl + deltaGbl;
    wxStaticText *auteurPrenomLabel =  new wxStaticText(panel0,wxID_ANY, _("Prénom de l'auteur : "), wxPoint(X0, curDelta), wxSize(size0 ,3*heightGbl),wxALIGN_RIGHT);
    auteurPrenomLabel->Show(true);
    auteurPrenom = new wxTextCtrl(panel0, wxID_ANY, wxEmptyString, wxPoint(X1, curDelta), wxSize(size1,heightGbl) );
    auteurPrenom->SetValue(wxT("Sophie"));
    auteurPrenom->Show(true);
    
    curDelta = curDelta + heightGbl + deltaGbl;
    wxStaticText *commentLabel =  new wxStaticText(panel0,wxID_ANY, _("Commentaire : "), wxPoint(X0, curDelta), wxSize(size0 ,3*heightGbl),wxALIGN_RIGHT);
    commentLabel->Show(true);
    commentNom = new wxTextCtrl(panel0, wxID_ANY, wxEmptyString, wxPoint(X1, curDelta), wxSize(size1,3*heightGbl), wxTE_MULTILINE);
    commentNom->SetValue(wxT("- nop -"));
    commentNom->Show(true);
    
    curDelta = curDelta + (maxFields-4)*(heightGbl + deltaGbl);
    cancelButton =  new wxButton(panel0, ID_PhInitAuxCarnetPagesPhotosCancel, _("Annuler"), wxPoint(X2Button,curDelta), wxSize(sizeButton,heightGbl));
    cancelButton->Enable(true);
    cancelButton->Show();
    
    OKButton = new wxButton(panel0, ID_PhInitAuxCarnetPagesPhotosOK, _("Terminer"), wxPoint(X1Button,curDelta), wxSize(sizeButton,heightGbl));
    OKButton->Enable(true);
    
    this->SetSize(winRectGbl.GetSize());
//    panel0->Show();
    this->Show(true);
}
Ejemplo n.º 30
0
void BaseEditor::DrawRectangle(wxDC& dc, const wxRect& rect)
{
	DrawRectangle(dc, rect.GetPosition(), rect.GetSize());
}