Ejemplo n.º 1
0
void FrameManager::OnClose(wxCloseEvent &event) {
	DrawFrame *frame = wxDynamicCast(event.GetEventObject(), DrawFrame);
	assert(frame != NULL);

	if (event.CanVeto()) {
		wxString msg;

		if (frames.Count() == 1) {
			msg = _("Do you want to close the application?");

		} else
			msg = _("Do you want to close this window?");

		int ret = wxMessageBox(msg, _("Question"), wxYES_NO, frame);
		if (ret != wxYES) {
			event.Veto();
			return;
		}
	}

	size_t i;
	for (i = 0; i < frames.Count(); ++i)
		if (frames[i] == frame)
			break;

	assert(i < frames.Count());

	int dn = frame->wxWindowBase::GetId();

	int width, height;
	frame->GetSize(&width, &height);
	wxConfig::Get()->Write(wxString::Format(_T("DrawFrameWidth_%d"), dn), width);
	wxConfig::Get()->Write(wxString::Format(_T("DrawFrameHeight_%d"), dn), height);

	int x, y;
	frame->GetPosition(&x, &y);
	wxConfig::Get()->Write(wxString::Format(_T("DrawFrameX_%d"), dn), x);
	wxConfig::Get()->Write(wxString::Format(_T("DrawFrameY_%d"), dn), y);

	frame->SaveLayout();

	frame->Destroy();
	frames.RemoveAt(i);

	if (frames.Count() == 0) {
		wxConfig::Get()->Flush();
		wxExit();
	}

}
Ejemplo n.º 2
0
/**
 @brief PropertyMiniFrame Close Event Handler
 */
void CFrame::OnPropertyFrameClose(wxCloseEvent& event)
{
	event.Skip();

	// remove close miniframe object
	BOOST_FOREACH(auto &propFrame, m_PropFrames)
	{
		if (propFrame == event.GetEventObject())
		{
			const wxString title = propFrame->GetTitle();  // debug
			m_PropFrames.remove(propFrame);
			break;
		}
	}
}
Ejemplo n.º 3
0
void ManNotification::onCloseFrameNotification(wxCloseEvent& event)
{
	//Obtenir la (frame) notification qui a provoquer l'événement.
	FrameNotification* frameNotify = static_cast<FrameNotification*>(event.GetEventObject());
	
	//Unbind l'évènement de la notification.
	frameNotify->Unbind(wxEVT_CLOSE_WINDOW, &ManNotification::onCloseFrameNotification, this);
	
	//Supprime la notification.
	if(_frameNotify == frameNotify)
	{
		delete _frameNotify;
		_frameNotify = nullptr;
	}
	else if(_frameNotifyNearCursor == frameNotify)
	{
		delete _frameNotifyNearCursor;
		_frameNotifyNearCursor = nullptr;
	}
	else
		deleteFrameMultipleNotification(frameNotify);
}