本文整理汇总了C++中wxNotebookEvent::GetOldSelection方法的典型用法代码示例。如果您正苦于以下问题:C++ wxNotebookEvent::GetOldSelection方法的具体用法?C++ wxNotebookEvent::GetOldSelection怎么用?C++ wxNotebookEvent::GetOldSelection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxNotebookEvent
的用法示例。
在下文中一共展示了wxNotebookEvent::GetOldSelection方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnPageChanged
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();
}
示例2: on_notebook_changing
// 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();
}
}
}
示例3: OnSelChange
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();
}
示例4: OnSelChange
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
示例5: OnBookPageChanging
/*---------------------------------------------------------------------------*/
void wxCreateTableDialog::OnBookPageChanging(wxNotebookEvent& event)
{
if (event.GetOldSelection() == 0)
{
wxString ddl = GetCreateTableDDL();
if (ddl.IsEmpty())
event.Veto();
else
m_TextDdl->SetValue(ddl);
}
}
示例6: OnPageChange
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();
}
示例7:
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
);
}
//.........这里部分代码省略.........