PdfPage* PdfPagesTree::CreatePage( const PdfRect & rSize ) { PdfPage* pPage = new PdfPage( rSize, GetRoot()->GetOwner() ); InsertPage( this->GetTotalNumberOfPages() - 1, pPage ); m_cache.AddPageObject( this->GetTotalNumberOfPages(), pPage ); return pPage; }
void Notebook::InsertPage(size_t index, wxWindow* win, const wxString& text, const wxString& tooltip, const wxBitmap& bmp, bool selected) { Freeze(); CustomTab *tab = new CustomTab(m_tabs, wxID_ANY, text, tooltip, bmp, selected, m_tabs->GetOrientation(), m_style); win->Reparent(this); tab->SetWindow(win); InsertPage(tab, index); GetSizer()->Layout(); Thaw(); }
PdfPage* PdfPagesTree::InsertPage( const PdfRect & rSize, int atIndex) { PdfPage* pPage = new PdfPage( rSize, GetRoot()->GetOwner() ); if (atIndex < 0 || atIndex >= this->GetTotalNumberOfPages()) { atIndex = this->GetTotalNumberOfPages() - 1; } InsertPage( atIndex - 1, pPage ); m_cache.AddPageObject( atIndex, pPage ); return pPage; }
bool wxSTEditorNotebook::InsertEditorSplitter(int nPage, wxSTEditorSplitter* splitter, bool bSelect) { wxCHECK_MSG(splitter && (splitter->GetParent() == this), false, wxT("Invalid wxSTEditorSplitter or parent")); if (GetPageCount() >= GetMaxPageCount()) { wxMessageBox(_("Maximum number of notebook pages exceeded,\nplease close one first."), _("Too many pages opened"), wxOK|wxICON_ERROR, this); delete splitter; return false; } wxString title(FileNameToTabName(splitter->GetEditor())); size_t n_pages = GetPageCount(); if (nPage < 0) // they want to insert it anywhere { // presort the insert page to reduce flicker if ((n_pages > 0) && GetOptions().HasNotebookOption(STN_ALPHABETICAL_TABS)) { wxArrayString names; names.Add(title+wxT("=999999")); // insert after any other pages with same name for (size_t n = 0; n < n_pages; n++) { wxString name(GetPageText(n)); if ((name.Length() > 0) && (name[0u] == wxT('*'))) name = name.Mid(1); names.Add(name + wxString::Format(wxT("=%d"), (int)n)); } names.Sort(STN_SortNameCompareFunction); nPage = names.Index(title+wxT("=999999")); } else nPage = (int)n_pages; } if (n_pages < 1) bSelect = true; if (nPage < int(n_pages)) return InsertPage(nPage, splitter, title, bSelect); bool ret = AddPage(splitter, title, bSelect); UpdateAllItems(); return ret; }
// // Add a page to the notebook // bool wxNotebook::AddPage ( wxNotebookPage* pPage , const wxString& rStrText , bool bSelect , int nImageId ) { return InsertPage( GetPageCount() ,pPage ,rStrText ,bSelect ,nImageId ); } // end of wxNotebook::AddPage
//------------------------------------------------------------- // VtxCloudsTabs::updateControls() update UI //------------------------------------------------------------- void VtxCloudsTabs::updateControls(){ CloudLayer *obj=object(); int pages=GetPageCount(); if(obj->threeD()){ if(pages==2) InsertPage(2,geometry_page,"Volume",false,-1); } else if(pages==3){ RemovePage(2); } if(update_needed){ getObjAttributes(); } }
uint64 CSmallSpace::Allocate(uint32 nSize) { register uint32 nBlockSize = MakeAlign(nSize, 8); register uint32 nTotalBlock = CVirtualPage::GetTotalBlock(nBlockSize); if(!nTotalBlock) return 0; register uint64 nAddr = TryAllocate(nBlockSize); if(nAddr) return nAddr; register uint64 nPageAddr = AllocateNewPage(nTotalBlock, nBlockSize); if(nPageAddr == VMM_INVALID_ADDR64) return 0; m_oMutex.Enter(); if(!InsertPage(nPageAddr, nBlockSize)) nAddr = g_oStorage.AllocateBlock(nPageAddr); else g_oStorage.DeAllocatePage(nPageAddr); m_oMutex.Leave(); return nAddr; }
BOOL COXTabViewContainer::InsertPage(int nIndex, CRuntimeClass* pClass, CCreateContext* pContext, LPCTSTR lpszTitle/*=NULL*/) { ASSERT_VALID(this); ASSERT(nIndex>=0 && nIndex<=GetPageCount()); ASSERT(pClass!=NULL); ASSERT(pClass->IsDerivedFrom(RUNTIME_CLASS(CWnd))); ASSERT(AfxIsValidAddress(pClass,sizeof(CRuntimeClass),FALSE)); if(!(nIndex>=0 && nIndex<=GetPageCount()) || pClass==NULL) return FALSE; CCreateContext context; if(pContext==NULL) { // if no context specified, generate one from the currently active // view if possible CView* pOldView=(CView*)GetActivePage(); if(pOldView!=NULL && pOldView->IsKindOf(RUNTIME_CLASS(CView))) { // set info about last pane ASSERT(context.m_pCurrentFrame==NULL); context.m_pLastView=pOldView; context.m_pCurrentDoc=pOldView->GetDocument(); if(context.m_pCurrentDoc!=NULL) { context.m_pNewDocTemplate=context.m_pCurrentDoc-> GetDocTemplate(); } } pContext=&context; } CWnd* pWnd; TRY { pWnd=(CWnd*)pClass->CreateObject(); if(pWnd==NULL) AfxThrowMemoryException(); } CATCH_ALL(e) { TRACE(_T("COXTabViewContainer::InsertPage: Out of memory inserting new page\n")); // Note: DELETE_EXCEPTION(e) not required return FALSE; } END_CATCH_ALL ASSERT_KINDOF(CWnd,pWnd); ASSERT(pWnd->m_hWnd==NULL); // not yet created DWORD dwStyle=AFX_WS_DEFAULT_VIEW; #if _MFC_VER < 0x0700 if(afxData.bWin4) #endif dwStyle&=~WS_BORDER; DWORD dwID=GetUniqueId(); // Create with the right size if(!pWnd->Create(NULL,NULL,dwStyle,m_rectPage,this,dwID,pContext)) { TRACE(_T("COXTabViewContainer::InsertPage: couldn't create new page\n")); // pWnd will be cleaned up by PostNcDestroy return FALSE; } if(InsertPage(nIndex,pWnd,lpszTitle)) { CWnd* pWnd=GetPage(nIndex); ASSERT(pWnd!=NULL); ASSERT(::IsWindow(pWnd->m_hWnd)); if(pWnd->IsKindOf(RUNTIME_CLASS(CView))) { // send initial notification message pWnd->SendMessage(WM_INITIALUPDATE); } return TRUE; } return FALSE; }
void Notebook::AddPage(CustomTab *tab) { InsertPage(tab, GetPageCount()); }
bool wxFlatNotebook::AddPage(wxWindow* window, const wxString& caption, const bool selected, const int imgindex) { return InsertPage(m_windows.GetCount(), window, caption, selected, imgindex); }
void wxSTEditorNotebook::SortTabs(int style) { if ((int)GetPageCount() < 2) return; if (STE_HASBIT(style, STN_ALPHABETICAL_TABS)) { int sel = GetSelection(); int new_sel = sel; size_t page_count = GetPageCount(); size_t n; if (page_count < 2) return; wxString curPageName; wxArrayString names; for (n = 0; n < page_count; n++) { wxString name(GetPageText(n)); if ((name.Length() > 0) && (name[0u] == wxT('*'))) name = name.Mid(1); names.Add(name + wxString::Format(wxT("=%d"), (int)n)); } names.Sort(STN_SortNameCompareFunction); bool sel_changed = false; for (n = 0; n < page_count; n++) { long old_page = 0; names[n].AfterLast(wxT('=')).ToLong(&old_page); if (old_page != long(n)) { wxWindow *oldWin = GetPage(old_page); wxString oldName(GetPageText(old_page)); if (oldWin && RemovePage(old_page)) { sel_changed = true; if (old_page == sel) new_sel = (int)n; if (n < page_count - 1) InsertPage((int)(n+1), oldWin, oldName, old_page == sel); else AddPage(oldWin, oldName, old_page == sel); } } } if (sel_changed) { wxNotebookEvent noteEvent(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, GetId(), new_sel, new_sel); noteEvent.SetString(wxT("wxSTEditorNotebook Page Change")); noteEvent.SetExtraLong(new_sel); // FIXME no Clone in wxNotebookEvent // NOTE: this may have to be AddPendingEvent for wx < 2.7 since gtk // can become reentrant GetEventHandler()->AddPendingEvent(noteEvent); } // causes reentrant assert in gtk, even though it's necessary sometimes //SetSelection(new_sel); // force selection for GTK } }