Exemple #1
0
void wxMDIClientWindow::OnPageChanged(wxNotebookEvent& event)
{
    // Notify child that it has been activated
    if (event.GetOldSelection() != -1)
    {
        wxMDIChildFrame* oldChild = (wxMDIChildFrame*) GetPage(event.GetOldSelection());
        if (oldChild)
        {
            wxActivateEvent event(wxEVT_ACTIVATE, false, oldChild->GetId());
            event.SetEventObject( oldChild );
            oldChild->GetEventHandler()->ProcessEvent(event);
        }
    }
    if (event.GetSelection() != -1)
    {
        wxMDIChildFrame* activeChild = (wxMDIChildFrame*) GetPage(event.GetSelection());
        if (activeChild)
        {
            wxActivateEvent event(wxEVT_ACTIVATE, true, activeChild->GetId());
            event.SetEventObject( activeChild );
            activeChild->GetEventHandler()->ProcessEvent(event);

            if (activeChild->GetMDIParentFrame())
            {
                activeChild->GetMDIParentFrame()->SetActiveChild(activeChild);
                activeChild->GetMDIParentFrame()->SetChildMenuBar(activeChild);
            }
        }
    }
    event.Skip();
}
// Loads the html source of edit textctrl into preview htmlwindow, so can render a preview.
void editor_dialog::on_notebook_changing( wxNotebookEvent &event )
{ 
    // There is a on_notebook_changing event sent when loading dialog, and this causes a 
    // crash. Therefore we prevent it executing until our notebook is displayed.
    if ( this->wxWindow::IsShown() ) 
    {
        wxLogDebug( wxT( "Entering on_notebook_changing_function") );
        wxLogDebug( wxT( "Notebook event.GetOldSelection=%d"), event.GetOldSelection() ); 
        if ( event.GetOldSelection() == EDITOR_NOTEBOOK_PAGE_INDEX_EDIT ) {   
            wxLogDebug( wxT( "Switching from edit tab, so sending text to preview tab") );
            stc_or_textctrl_send_text_to_preview();
        }        
    }   
}
Exemple #3
0
void wxNotebook::OnSelChange(wxNotebookEvent& event)
{
    // is it our tab control?
    if ( event.GetEventObject() == this )
        ChangePage(event.GetOldSelection(), event.GetSelection());

    // we want to give others a chance to process this message as well
    event.Skip();
}
Exemple #4
0
void wxNotebook::OnSelChange (
  wxNotebookEvent&                  rEvent
)
{
    //
    // Is it our tab control?
    //
    if (rEvent.GetEventObject() == this)
    {
        int   nPageCount = GetPageCount();
        int   nSel;
        ULONG ulOS2Sel = (ULONG)rEvent.GetOldSelection();
        bool  bFound = false;

        for (nSel = 0; nSel < nPageCount; nSel++)
        {
            if (ulOS2Sel == (ULONG)m_alPageId[nSel])
            {
                bFound = true;
                break;
            }
        }

        if (!bFound)
            return;

        m_pages[nSel]->Show(false);

        ulOS2Sel = (ULONG)rEvent.GetSelection();

        bFound = false;

        for (nSel = 0; nSel < nPageCount; nSel++)
        {
            if (ulOS2Sel == (ULONG)m_alPageId[nSel])
            {
                bFound = true;
                break;
            }
        }

        if (!bFound)
            return;

        wxNotebookPage*         pPage = m_pages[nSel];

        pPage->Show(true);
        m_nSelection = nSel;
    }

    //
    // We want to give others a chance to process this message as well
    //
    rEvent.Skip();
} // end of wxNotebook::OnSelChange
/*---------------------------------------------------------------------------*/
void wxCreateTableDialog::OnBookPageChanging(wxNotebookEvent& event)
{
   if (event.GetOldSelection() == 0)
   {
      wxString ddl = GetCreateTableDDL();

      if (ddl.IsEmpty())
         event.Veto();
      else
         m_TextDdl->SetValue(ddl);
   }
}
void GLIBitmapNotebook::OnPageChange(wxNotebookEvent &event)
{
  // Ensure our window ID and a valid page was selected previously
  if(event.GetId() == GetId())
  {
    int newPage = event.GetSelection();
    int oldPage = event.GetOldSelection();

    // Get if the selected pages are valid
    if(newPage >= 0 && newPage < bitmapViews.size() &&
       oldPage >= 0 && oldPage < bitmapViews.size())
    {
      int scrollStartX = 0;
      int scrollStartY = 0;
      int oldScrollPPUX = 1;
      int oldScrollPPUY = 1;
      int newScrollPPUX = 1;
      int newScrollPPUY = 1;

      // Get the old scroll position
      bitmapViews[oldPage]->GetViewStart(&scrollStartX, &scrollStartY);
      bitmapViews[oldPage]->GetScrollPixelsPerUnit(&oldScrollPPUX, &oldScrollPPUY);

      // Get the new scroll pixels per unit (probably the same as the old one)
      bitmapViews[newPage]->GetScrollPixelsPerUnit(&newScrollPPUX, &newScrollPPUY);

      // Ensure a valid setting of the scroll area
      if(newScrollPPUX != 0 && newScrollPPUY != 0)
      {
        // Set the new scroll position
        bitmapViews[newPage]->Scroll(scrollStartX*oldScrollPPUX/newScrollPPUX,
                                     scrollStartY*oldScrollPPUY/newScrollPPUY);
      }
      else
      {
        bitmapViews[newPage]->Scroll(0, 0);
      }

      // Get the current GL buffer type displayed
      bitmapViews[newPage]->GetGLBufferType(preferedBufferTypeID, preferedDrawBufferID);

      // Update the window title the new image
      parentControl->UpdateWindowTitle();
    }
  }

  // Allow others to process
  event.Skip();
}
Exemple #7
0
void
Project::OnPageChanged(wxNotebookEvent& evt)
{
	if (evt.GetEventObject() == this)
	{
		int old = evt.GetOldSelection();
		int current = evt.GetSelection();
		if (old != -1 && current != -1)
		{
			Panel *panel = (Panel *)GetPage(old);
			panel->GetMenu();
			panel = (Panel *)GetPage(current);
			panel->SetMenu();
		}
	}
	evt.Skip();
}
Exemple #8
0
void
Project::OnPageChanging(wxNotebookEvent& evt)
{
	size_t old = evt.GetOldSelection();
	size_t pages = GetPageCount();
	if (old >= 0 && old < pages)
	{
		Panel *panel = (Panel *)GetPage(old);
		Panel::Layout layout = panel->GetLayout();
		for (size_t page = 0; page < pages; page++)
		{
			if (page != old)
			{
				panel = (Panel *)GetPage(page);
				panel->SetLayout(layout);
			}
		}
	}
}
	void
	MainFrameLogic::on_notebook_page_changed(wxNotebookEvent& event)
	{
		/* Find module for old page and remove tools from toolbar... */
		std::vector<Module*>::iterator find_old_iter = _registered_modules.begin();
		std::vector<Module*>::iterator find_old_iter_end = _registered_modules.end();
		for (; find_old_iter != find_old_iter_end; ++find_old_iter)
		{
			if ((*find_old_iter)->get_notebook_id() == event.GetOldSelection())
				break;
		}
		
		if (find_old_iter != find_old_iter_end)
		{
			if ((*find_old_iter)->icons().size() > 0)
			{
				if ((*find_old_iter)->icons().size() != (*find_old_iter)->icons_event_handlers().size())
				{
					mlog(MLog::warning, "MainFrameLogic")
						<< "Module has different numbers of icons and corresponding event "
						<< "handlers. You really must not change these attributes after "
						<< "registering a module!\n";
				}
				
				if ((*find_old_iter)->toolbar_ids().size() != (*find_old_iter)->icons_event_handlers().size())
				{
					mlog(MLog::error, "MainFrameLogic")
						<< "Module has different numbers of icons event handlers and "
						<< "saved toolbar ids. You really must not change these attributes "
						<< "after registering a module! Consequence: I cannot unregister "
						<< "the event handler. This may cause a fatal error in wx!\n";
				}

				std::vector<int>::iterator ids_iter = (*find_old_iter)->toolbar_ids().begin();
				std::vector<int>::iterator ids_iter_end = (*find_old_iter)->toolbar_ids().end();
				
				Module::D_IconsEventHandlersVector::iterator
					icons_event_handlers_iter = (*find_old_iter)->icons_event_handlers().begin();
				Module::D_IconsEventHandlersVector::iterator
					icons_event_handlers_iter_end = (*find_old_iter)->icons_event_handlers().end();
					
				for (; ids_iter != ids_iter_end; ++ids_iter)
				{
					GetToolBar()->RemoveTool(*ids_iter);
					
					if (icons_event_handlers_iter != icons_event_handlers_iter_end)
					{
						Disconnect(*ids_iter, wxEVT_COMMAND_TOOL_CLICKED,
							(wxObjectEventFunction)(wxEventFunction)(wxCommandEventFunction) // only casts!
							(icons_event_handlers_iter->first));
						
						++icons_event_handlers_iter;
					}
				}
				
				(*find_old_iter)->toolbar_ids().clear();
			}
		}
		
		/* Find module for new page and add tools... */
		std::vector<Module*>::iterator find_new_iter = _registered_modules.begin();
		std::vector<Module*>::iterator find_new_iter_end = _registered_modules.end();
		for (; find_new_iter != find_new_iter_end; ++find_new_iter)
		{
			if ((*find_new_iter)->get_notebook_id() == event.GetSelection())
				break;
		}
		
		if (find_new_iter != find_new_iter_end)
		{
			if ((*find_new_iter)->icons().size() > 0)
			{
				if ((*find_new_iter)->icons().size() != (*find_new_iter)->icons_event_handlers().size())
				{
					mlog(MLog::warning, "MainFrameLogic")
						<< "Module has different numbers of icons and corresponding event "
						<< "handlers. Module's icons will not be added to toolbar!\n";
				} else
				{
					std::vector<wxIcon*>::iterator icons_iter = (*find_new_iter)->icons().begin();
					std::vector<wxIcon*>::iterator icons_iter_end = (*find_new_iter)->icons().end();
					
					Module::D_IconsEventHandlersVector::iterator
						icons_event_handlers_iter = (*find_new_iter)->icons_event_handlers().begin();
					
					for (; icons_iter != icons_iter_end; ++icons_iter, ++icons_event_handlers_iter)
					{
						(*find_new_iter)->toolbar_ids().push_back(_next_id);
						increment_next_id();
						
						GetToolBar()->AddTool((*find_new_iter)->toolbar_ids().back(), **icons_iter);
						GetToolBar()->Connect(
							(*find_new_iter)->toolbar_ids().back(),
							wxEVT_COMMAND_TOOL_CLICKED,
							(wxObjectEventFunction)(wxEventFunction)(wxCommandEventFunction) // only casts!
							(icons_event_handlers_iter->first),
							NULL,
							icons_event_handlers_iter->second
						);
					}
				}
			}
		}
	}