本文整理汇总了C++中GetPageCount函数的典型用法代码示例。如果您正苦于以下问题:C++ GetPageCount函数的具体用法?C++ GetPageCount怎么用?C++ GetPageCount使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetPageCount函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GetSelection
void cbAuiNotebook::AdvanceSelection(bool forward)
{
if (GetPageCount() <= 1)
return;
int currentSelection = GetSelection();
wxAuiTabCtrl* tabCtrl = nullptr;
int idx = -1;
if (!FindTab(GetPage(currentSelection), &tabCtrl, &idx))
return;
if (!tabCtrl || idx < 0)
return;
wxWindow* page = nullptr;
size_t maxPages = tabCtrl->GetPageCount();
forward?idx++:idx--;
if (idx < 0)
idx = maxPages - 1;
if ((size_t)idx < maxPages)
page = tabCtrl->GetPage(idx).window;
if (!page && maxPages > 0)
page = tabCtrl->GetPage(0).window;
if (page)
{
currentSelection = GetPageIndex(page);
SetSelection(currentSelection);
}
}
开发者ID:WinterMute,项目名称:codeblocks_sf,代码行数:36,代码来源:cbauibook.cpp
示例2: GetImageList
bool wxNotebook::InsertPage(size_t n, wxWindow *page, const wxString& text,
bool bSelect, int imageId)
{
// disable firing qt signals until wx structures are filled
m_qtTabWidget->blockSignals(true);
if (imageId != -1)
{
if (HasImageList())
{
const wxBitmap* bitmap = GetImageList()->GetBitmapPtr(imageId);
m_qtTabWidget->insertTab( n, page->GetHandle(), QIcon( *bitmap->GetHandle() ), wxQtConvertString( text ));
}
else
{
wxFAIL_MSG("invalid notebook imagelist");
}
}
else
{
m_qtTabWidget->insertTab( n, page->GetHandle(), wxQtConvertString( text ));
}
m_pages.Insert(page, n);
m_images.insert(m_images.begin() + n, imageId);
// reenable firing qt signals as internal wx initialization was completed
m_qtTabWidget->blockSignals(false);
if (bSelect && GetPageCount() > 1)
{
SetSelection( n );
}
return true;
}
开发者ID:slunski,项目名称:wxWidgets,代码行数:36,代码来源:notebook.cpp
示例3: wxCHECK_MSG
bool CMuleNotebook::DeletePage(int nPage)
{
wxCHECK_MSG((nPage >= 0) && (nPage < (int)GetPageCount()), false,
wxT("Trying to delete invalid page-index in CMuleNotebook::DeletePage"));
// Send out close event
wxNotebookEvent evt( wxEVT_COMMAND_MULENOTEBOOK_PAGE_CLOSING, GetId(), nPage );
evt.SetEventObject(this);
ProcessEvent( evt );
// and finally remove the actual page
bool result = wxNotebook::DeletePage( nPage );
// Ensure a valid selection
if ( GetPageCount() && (int)GetSelection() >= (int)GetPageCount() ) {
SetSelection( GetPageCount() - 1 );
}
// Send a page change event to work around wx problem when newly selected page
// is identical with deleted page (wx sends a page change event during deletion,
// but the control is still the one to be deleted at that moment).
if (GetPageCount()) {
// Select the tab that took the place of the one we just deleted.
size_t page = nPage;
// Except if we deleted the last one - then select the one that is last now.
if (page == GetPageCount()) {
page--;
}
wxNotebookEvent event( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, GetId(), page );
event.SetEventObject(this);
ProcessEvent( event );
} else {
// Send an event when no pages are left open
wxNotebookEvent event( wxEVT_COMMAND_MULENOTEBOOK_ALL_PAGES_CLOSED, GetId() );
event.SetEventObject(this);
ProcessEvent( event );
}
return result;
}
开发者ID:amule-project,项目名称:amule,代码行数:40,代码来源:MuleNotebook.cpp
示例4: GetSelection
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
}
}
开发者ID:Abyss116,项目名称:luaplus51-all,代码行数:71,代码来源:stenoteb.cpp
示例5: SetTimer
BOOL CTPropertySheet::OnInitDialog()
{
// TRACE("CTPropertySheet::OnInitDialog()\n");
/*
// DR00169 2.001 removed hardcoding from 2.000
NOTE: For MICGM, m_bSameNextFinish is always true. MIC 1.9.0.7 set it false when
creating a WATCH window; MICGM uses a different mechanism for creating a WATCH window
that doesn't use the wizard functionality.
PJM May 18, 2005
*/
BOOL bResult = CPropertySheet::OnInitDialog();
SetTimer(1,1000,NULL);
char temp[32];
WINDOWPLACEMENT lpwndpl;
//grow the property sheet
GetWindowPlacement(&lpwndpl);
lpwndpl.rcNormalPosition.bottom += 27;
// DR00169 2.001 removed hardcoding from 2.000
SetWindowPlacement(&lpwndpl);
//we do want the cancel action
GetDlgItem(IDCANCEL)->GetWindowPlacement(&lpwndpl);
lpwndpl.rcNormalPosition.bottom += 28;
// DR00169 2.001 removed hardcoding from 2.000
GetDlgItem(IDCANCEL)->SetWindowPlacement(&lpwndpl);
int minutes = (m_dMyDlgClose/1000-m_dToClose)/60;
int seconds = (m_dMyDlgClose/1000-m_dToClose) % 60;
sprintf(temp,"Extend Auto\nClose: %d:%02d",minutes,seconds);
SetDlgItemText(IDHELP,temp);
GetDlgItem(IDHELP)->ModifyStyle(NULL,BS_MULTILINE);
GetDlgItem(IDHELP)->GetWindowPlacement(&lpwndpl);
lpwndpl.rcNormalPosition.bottom += 28;
// DR00169 2.001 removed hardcoding from 2.000
GetDlgItem(IDHELP)->SetWindowPlacement(&lpwndpl);
GetDlgItem(IDHELP)->SetDlgCtrlID(IDB_TOCLOSE);
if (m_bSameNextFinish)
{
GetDlgItem(ID_WIZNEXT)->GetWindowPlacement(&lpwndpl);
int offset = lpwndpl.rcNormalPosition.right-lpwndpl.rcNormalPosition.left;
lpwndpl.rcNormalPosition.bottom += 28;
lpwndpl.rcNormalPosition.left -= offset;
lpwndpl.rcNormalPosition.right -= offset;
// DR00169 2.001 removed hardcoding from 2.000
GetDlgItem(ID_WIZNEXT)->SetWindowPlacement(&lpwndpl);
GetDlgItem(ID_WIZBACK)->GetWindowPlacement(&lpwndpl);
lpwndpl.rcNormalPosition.bottom += 28;
lpwndpl.rcNormalPosition.left -= offset;
lpwndpl.rcNormalPosition.right -= offset;
// DR00169 2.001 removed hardcoding from 2.000
GetDlgItem(ID_WIZBACK)->SetWindowPlacement(&lpwndpl);
GetDlgItem(ID_WIZFINISH)->GetWindowPlacement(&lpwndpl);
lpwndpl.rcNormalPosition.bottom += 28;
// DR00169 2.001 removed hardcoding from 2.000
GetDlgItem(ID_WIZFINISH)->SetWindowPlacement(&lpwndpl);
// GetDlgItem(ID_WIZFINISH)->EnableWindow(false);
}
else
{
GetDlgItem(ID_WIZNEXT)->GetWindowPlacement(&lpwndpl);
lpwndpl.rcNormalPosition.bottom += 28;
GetDlgItem(ID_WIZNEXT)->SetWindowPlacement(&lpwndpl);
GetDlgItem(ID_WIZBACK)->GetWindowPlacement(&lpwndpl);
lpwndpl.rcNormalPosition.bottom += 28;
GetDlgItem(ID_WIZBACK)->SetWindowPlacement(&lpwndpl);
GetDlgItem(ID_WIZFINISH)->GetWindowPlacement(&lpwndpl);
lpwndpl.rcNormalPosition.bottom += 28;
GetDlgItem(ID_WIZFINISH)->SetWindowPlacement(&lpwndpl);
// GetDlgItem(ID_WIZFINISH)->EnableWindow(false);
}
for (int i = GetPageCount();i>=0;i--)
SetActivePage(i-1);
m_dToClose = 0;
return bResult;
}
开发者ID:hnordquist,项目名称:MIC,代码行数:83,代码来源:TPropertySheet.cpp
示例6: wxCHECK_MSG
bool wxNotebook::InsertPage( size_t position,
wxNotebookPage* win,
const wxString& text,
bool select,
int imageId )
{
wxCHECK_MSG( m_widget != NULL, false, wxT("invalid notebook") );
wxCHECK_MSG( win->GetParent() == this, false,
wxT("Can't add a page whose parent is not the notebook!") );
wxCHECK_MSG( position <= GetPageCount(), false,
wxT("invalid page index in wxNotebookPage::InsertPage()") );
// Hack Alert! (Part II): See above in wxNotebook::AddChildGTK
// why this has to be done.
gtk_widget_unparent(win->m_widget);
if (m_themeEnabled)
win->SetThemeEnabled(true);
GtkNotebook *notebook = GTK_NOTEBOOK(m_widget);
wxGtkNotebookPage* pageData = new wxGtkNotebookPage;
m_pages.Insert(win, position);
m_pagesData.Insert(position, pageData);
// set the label image and text
// this must be done before adding the page, as GetPageText
// and GetPageImage will otherwise return wrong values in
// the page-changed event that results from inserting the
// first page.
pageData->m_imageIndex = imageId;
pageData->m_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 1);
gtk_container_set_border_width(GTK_CONTAINER(pageData->m_box), 2);
pageData->m_image = NULL;
if (imageId != -1)
{
if (HasImageList())
{
const wxBitmap* bitmap = GetImageList()->GetBitmapPtr(imageId);
pageData->m_image = gtk_image_new_from_pixbuf(bitmap->GetPixbuf());
gtk_box_pack_start(GTK_BOX(pageData->m_box),
pageData->m_image, false, false, m_padding);
}
else
{
wxFAIL_MSG("invalid notebook imagelist");
}
}
/* set the label text */
pageData->m_label = gtk_label_new(wxGTK_CONV(wxStripMenuCodes(text)));
gtk_box_pack_end(GTK_BOX(pageData->m_box),
pageData->m_label, false, false, m_padding);
gtk_widget_show_all(pageData->m_box);
gtk_notebook_insert_page(notebook, win->m_widget, pageData->m_box, position);
/* apply current style */
#ifdef __WXGTK3__
GTKApplyStyle(pageData->m_label, NULL);
#else
GtkRcStyle *style = GTKCreateWidgetStyle();
if ( style )
{
gtk_widget_modify_style(pageData->m_label, style);
g_object_unref(style);
}
#endif
if (select && GetPageCount() > 1)
{
SetSelection( position );
}
InvalidateBestSize();
return true;
}
开发者ID:CobaltBlues,项目名称:wxWidgets,代码行数:82,代码来源:notebook.cpp
示例7: GTKApplyStyle
void wxNotebook::DoApplyWidgetStyle(GtkRcStyle *style)
{
GTKApplyStyle(m_widget, style);
for (size_t i = GetPageCount(); i--;)
GTKApplyStyle(GetNotebookPage(i)->m_label, style);
}
开发者ID:CobaltBlues,项目名称:wxWidgets,代码行数:6,代码来源:notebook.cpp
示例8: ASSERT_VALID
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;
}
开发者ID:leonwang9999,项目名称:testcode,代码行数:84,代码来源:OXTabView.cpp
示例9: GetWindowRect
BOOL CXTPResizePropertySheet::OnInitDialog()
{
CRect rcClientBegin, rcClientEnd;
GetWindowRect(rcClientBegin);
SendMessage(WM_NCCALCSIZE, FALSE, (LPARAM)(LPRECT)rcClientBegin);
// Modify the window style to include WS_THICKFRAME for resizing.
::SetWindowLong(m_hWnd,
GWL_STYLE, GetStyle() | WS_THICKFRAME);
GetWindowRect(rcClientEnd);
SendMessage(WM_NCCALCSIZE, FALSE, (LPARAM)(LPRECT)rcClientEnd);
CPropertySheet::OnInitDialog();
// subclass our "flicker-free" tab control.
m_tabCtrl.SubclassWindow(GetTabControl()->m_hWnd);
// the size icon is too close to the buttons, so inflate the sheet
CRect rc;
GetWindowRect(rc);
if (rcClientBegin.Width() - rcClientEnd.Width() > 3)
{
rc.InflateRect((rcClientBegin.Width() - rcClientEnd.Width()) / 2,
(rcClientBegin.Height() - rcClientEnd.Height()) / 2);
MoveWindow(rc);
}
// Do this last so that any prop pages are moved accordingly
else if (!HasFlag(xtpResizeNoSizeIcon) && !IsWizard())
{
rc.InflateRect(1, 1, 2, 2);
MoveWindow(rc);
}
// add sizing entries to the system menu
CMenu* pSysMenu = (CMenu*)GetSystemMenu(FALSE);
if (pSysMenu)
{
CString szMaximize, szMinimize, szSize, szRestore;
// try to get the strings from the topmost window
CWnd* pwndTop;
for (pwndTop = this; pwndTop->GetParent(); pwndTop = pwndTop->GetParent());
CMenu* pTopSysMenu = (CMenu*)pwndTop->GetSystemMenu(FALSE);
if (pTopSysMenu)
{
pTopSysMenu->GetMenuString(SC_MAXIMIZE, szMaximize, MF_BYCOMMAND);
pTopSysMenu->GetMenuString(SC_MINIMIZE, szMinimize, MF_BYCOMMAND);
pTopSysMenu->GetMenuString(SC_SIZE, szSize, MF_BYCOMMAND);
pTopSysMenu->GetMenuString(SC_RESTORE, szRestore, MF_BYCOMMAND);
}
// if we din't get the strings then set them to the English defaults
if (szMaximize.IsEmpty()) szMaximize = _T("Ma&ximize");
if (szMinimize.IsEmpty()) szMinimize = _T("Mi&nimize");
if (szSize.IsEmpty()) szSize = _T("&Size");
if (szRestore.IsEmpty()) szRestore = _T("&Restore");
pSysMenu->InsertMenu(1, MF_BYPOSITION | MF_SEPARATOR, 0, (LPCTSTR) 0);
pSysMenu->InsertMenu(1, MF_BYPOSITION | MF_STRING, SC_MAXIMIZE, szMaximize);
pSysMenu->InsertMenu(1, MF_BYPOSITION | MF_STRING, SC_MINIMIZE, szMinimize);
pSysMenu->InsertMenu(1, MF_BYPOSITION | MF_STRING, SC_SIZE, szSize);
pSysMenu->InsertMenu(0, MF_BYPOSITION | MF_STRING, SC_RESTORE, szRestore);
}
DWORD dwStyle = ::GetWindowLong(m_hWnd, GWL_STYLE);
if ((dwStyle & WS_THICKFRAME) == 0)
{
SetFlag(xtpResizeNoSizeIcon);
}
CXTPResize::Init();
// Check which buttons are available in sheet or wizard
if (IsWizard())
{
SetResize(ID_WIZBACK, XTP_ATTR_REPOS(1));
SetResize(ID_WIZNEXT, XTP_ATTR_REPOS(1));
SetResize(ID_WIZFINISH, XTP_ATTR_REPOS(1));
SetResize(ID_WIZLINE, XTP_ANCHOR_BOTTOMLEFT, XTP_ANCHOR_BOTTOMRIGHT);
}
else
{
SetResize(IDOK, XTP_ATTR_REPOS(1));
SetResize(ID_APPLY_NOW, XTP_ATTR_REPOS(1));
SetResize(AFX_IDC_TAB_CONTROL, XTP_ATTR_RESIZE(1));
}
SetResize(IDCANCEL, XTP_ATTR_REPOS(1));
SetResize(IDHELP, XTP_ATTR_REPOS(1));
// set page sizings
CRect rcPage;
GetActivePage()->GetWindowRect(rcPage);
ScreenToClient(rcPage);
int i;
for (i = 0; i <GetPageCount(); i++)
{
SetResize(GetPage(i), XTP_ATTR_RESIZE(1), rcPage);
}
//.........这里部分代码省略.........
开发者ID:lai3d,项目名称:ThisIsASoftRenderer,代码行数:101,代码来源:XTPResizePropertySheet.cpp
示例10: ASSERT
BOOL COXCustomizeManager::InsertPage(COXCustomizePage* pCustomizePage,
int nPageIndex)
{
ASSERT(pCustomizePage!=NULL);
CString sTitle=pCustomizePage->GetTitle();
LPCTSTR lpszImageResource=pCustomizePage->GetImageResource();
COLORREF clrMask=pCustomizePage->GetImageMask();
CString sTooltip=pCustomizePage->GetTooltip();
CString sGroup=pCustomizePage->GetGroup();
#ifdef _DEBUG
ASSERT(nPageIndex>=0 && nPageIndex<=GetPageCount(sGroup));
HSHBGROUP hGroupTest=NULL;
int nIndexTest=-1;
ASSERT(!FindPage(pCustomizePage,hGroupTest,nIndexTest));
ASSERT(!FindPage(sTitle,sGroup,hGroupTest,nIndexTest));
#endif
// find/create the corresponding shortcut bar group
HSHBGROUP hGroup=m_shb.FindGroupByTitle(sGroup);
BOOL bNewGroup=FALSE;
if(hGroup==NULL)
{
hGroup=m_shb.InsertGroup(sGroup);
bNewGroup=TRUE;
}
if(hGroup==NULL)
{
TRACE(_T("COXCustomizeManager::InsertPage: failed to create group for the specified page\n"));
if(bNewGroup)
m_shb.DeleteGroup(hGroup);
return FALSE;
}
// associate image list with the created group
m_shb.SetLCImageList(hGroup,&m_ilShortcutBar,LVSIL_NORMAL);
// get image index for new page
int nImageIndex=-1;
if(lpszImageResource!=NULL)
{
CImageList imageList;
if(!imageList.Create(lpszImageResource,32,0,clrMask))
{
TRACE(_T("COXCustomizeManager::InsertPage: failed to extract image for new page\n"));
if(bNewGroup)
{
m_shb.DeleteGroup(hGroup);
}
return FALSE;
}
HICON hIcon=imageList.ExtractIcon(0);
ASSERT(hIcon!=NULL);
nImageIndex=m_ilShortcutBar.Add(hIcon);
ASSERT(nImageIndex!=-1);
VERIFY(::DestroyIcon(hIcon));
}
int nItem=m_shb.InsertLCItem(hGroup,nPageIndex,sTitle,nImageIndex,
(LPARAM)pCustomizePage);
if(nItem==-1)
{
TRACE(_T("COXCustomizeManager::InsertPage: failed to insert new item into the shortcut bar\n"));
if(bNewGroup)
{
m_shb.DeleteGroup(hGroup);
}
return FALSE;
}
m_mapPages.SetAt(pCustomizePage,((PtrToLong(hGroup))<<16)+nItem);
m_mapTooltips.SetAt(pCustomizePage,sTooltip);
return TRUE;
}
开发者ID:drupalhunter-team,项目名称:TrackMonitor,代码行数:77,代码来源:OXCustomizeManager.cpp
示例11: ASSERT
void COXTabViewContainer::DrawTabButton(CDC* pDC, int nIndex) const
{
ASSERT(nIndex>=0 && nIndex<GetPageCount());
CRect rect=m_arrTabBtnRects[nIndex];
rect+=m_rectTabBtnArea.TopLeft();
rect.OffsetRect(m_nTabBtnAreaOrigin,0);
if(rect.right>m_rectTabBtnArea.left && rect.left<m_rectTabBtnArea.right)
{
rect.bottom=m_rectTabBtnArea.bottom;
POINT arrPoints[4];
arrPoints[0].x=rect.left;
arrPoints[0].y=rect.top;
arrPoints[1].x=rect.left+ID_TABBTNOVERLAPSIZE;
arrPoints[1].y=rect.bottom;
arrPoints[2].x=rect.right-ID_TABBTNOVERLAPSIZE;
arrPoints[2].y=rect.bottom;
arrPoints[3].x=rect.right;
arrPoints[3].y=rect.top;
CPen penTop(PS_SOLID,1,::GetSysColor(COLOR_BTNHILIGHT));
CPen penBottom(PS_SOLID,1,::GetSysColor(COLOR_BTNSHADOW));
CPen* pOldPen=NULL;
if(nIndex==GetActivePageIndex())
{
pDC->Polygon(arrPoints,4);
pOldPen=pDC->SelectObject(&penTop);
arrPoints[0].x++;
pDC->MoveTo(arrPoints[0]);
pDC->LineTo(arrPoints[3]);
pDC->SelectObject(&penBottom);
arrPoints[1].y--;
arrPoints[2].y--;
pDC->MoveTo(arrPoints[1]);
pDC->LineTo(arrPoints[2]);
}
else
{
pDC->Polygon(arrPoints,4);
pOldPen=pDC->SelectObject(&penBottom);
arrPoints[1].y--;
arrPoints[2].y--;
pDC->MoveTo(arrPoints[1]);
pDC->LineTo(arrPoints[2]);
arrPoints[2].x--;
arrPoints[3].x--;
pDC->MoveTo(arrPoints[2]);
pDC->LineTo(arrPoints[3]);
pDC->SelectObject(&penTop);
arrPoints[0].x+=2;
arrPoints[0].y++;
arrPoints[1].x++;
pDC->MoveTo(arrPoints[0]);
pDC->LineTo(arrPoints[1]);
}
if(pOldPen!=NULL)
pDC->SelectObject(pOldPen);
CString sTitle=GetPageTitle(nIndex);
if(!sTitle.IsEmpty())
{
COLORREF oldColor=pDC->SetTextColor(::GetSysColor(COLOR_WINDOWTEXT));
int nOldBkMode=pDC->SetBkMode(TRANSPARENT);
pDC->DrawText(sTitle,rect,DT_CENTER|DT_SINGLELINE|DT_VCENTER);
pDC->SetBkMode(nOldBkMode);
pDC->SetTextColor(oldColor);
}
}
}
开发者ID:leonwang9999,项目名称:testcode,代码行数:74,代码来源:OXTabView.cpp
示例12: GetPageCount
uint32 CGsCachedArea::GetSize() const
{
return GetPageCount() * CGsPixelFormats::PAGESIZE;
}
开发者ID:250394,项目名称:Play-,代码行数:4,代码来源:GsCachedArea.cpp
示例13: wxCHECK_MSG
int wxTreebook::DoSetSelection(size_t pagePos, int flags)
{
wxCHECK_MSG( IS_VALID_PAGE(pagePos), wxNOT_FOUND,
wxT("invalid page index in wxListbook::DoSetSelection()") );
wxASSERT_MSG( GetPageCount() == DoInternalGetPageCount(),
wxT("wxTreebook logic error: m_treeIds and m_pages not in sync!"));
wxBookCtrlEvent event(wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING, m_windowId);
const int oldSel = m_selection;
wxTreeCtrl *tree = GetTreeCtrl();
bool allowed = false;
if (flags & SetSelection_SendEvent)
{
event.SetEventObject(this);
event.SetSelection(pagePos);
event.SetOldSelection(m_selection);
// don't send the event if the old and new pages are the same; do send it
// otherwise and be prepared for it to be vetoed
allowed = (int)pagePos == m_selection ||
!GetEventHandler()->ProcessEvent(event) ||
event.IsAllowed();
}
if ( !(flags & SetSelection_SendEvent) || allowed )
{
// hide the previously shown page
wxTreebookPage * const oldPage = DoGetCurrentPage();
if ( oldPage )
oldPage->Hide();
// then show the new one
m_selection = pagePos;
wxTreebookPage *page = wxBookCtrlBase::GetPage(m_selection);
if ( !page )
{
// find the next page suitable to be shown: the first (grand)child
// of this one with a non-NULL associated page
wxTreeItemId childId = m_treeIds[pagePos];
int actualPagePos = pagePos;
while ( !page && childId.IsOk() )
{
wxTreeItemIdValue cookie;
childId = tree->GetFirstChild( childId, cookie );
if ( childId.IsOk() )
{
page = wxBookCtrlBase::GetPage(++actualPagePos);
}
}
m_actualSelection = page ? actualPagePos : m_selection;
}
if ( page )
page->Show();
tree->SelectItem(DoInternalGetPage(pagePos));
if (flags & SetSelection_SendEvent)
{
// notify about the (now completed) page change
event.SetEventType(wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED);
(void)GetEventHandler()->ProcessEvent(event);
}
}
else if ( (flags & SetSelection_SendEvent) && !allowed) // page change vetoed
{
// tree selection might have already had changed
if ( oldSel != wxNOT_FOUND )
tree->SelectItem(DoInternalGetPage(oldSel));
}
return oldSel;
}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:75,代码来源:treebkg.cpp
示例14: if
HRESULT STDMETHODCALLTYPE SumatraUIAutomationTextRange::MoveEndpointByUnit(TextPatternRangeEndpoint endpoint, TextUnit unit, int count, int *moved)
{
if (moved == NULL)
return E_POINTER;
// if document is closed, don't do anything
if (!document->IsDocumentLoaded())
return E_FAIL;
// if not set, don't do anything
if (IsNullRange())
return S_OK;
// what to move
int *target_page, *target_glyph;
if (endpoint == TextPatternRangeEndpoint_Start) {
target_page = &startPage;
target_glyph = &startGlyph;
} else if (endpoint == TextPatternRangeEndpoint_End) {
target_page = &endPage;
target_glyph = &endGlyph;
} else {
return E_INVALIDARG;
}
class EndPointMover {
protected:
SumatraUIAutomationTextRange* target;
int* target_page;
int* target_glyph;
public:
// return false when cannot be moved
virtual bool NextEndpoint() const {
// HACK: Declaring these as pure virtual causes "unreferenced local variable" warnings ==> define a dummy body to get rid of warnings
CrashIf(true);
return false;
}
virtual bool PrevEndpoint() const {
CrashIf(true);
return false;
}
// return false when not appliable
bool NextPage() const {
int max_glyph = target->GetPageGlyphCount(*target_page);
if (*target_glyph == max_glyph) {
if (*target_page == target->GetPageCount()) {
// last page
return false;
}
// go to next page
(*target_page)++;
(*target_glyph) = 0;
}
return true;
}
bool PreviousPage() const {
if (*target_glyph == 0) {
if (*target_page == 1) {
// first page
return false;
}
// go to next page
(*target_page)--;
(*target_glyph) = target->GetPageGlyphCount(*target_page);
}
return true;
}
// do the moving
int Move(int count, SumatraUIAutomationTextRange* target, int* target_page, int* target_glyph) {
this->target = target;
this->target_page = target_page;
this->target_glyph = target_glyph;
int retVal = 0;
if (count > 0) {
for (int i=0;i<count && (NextPage() || NextEndpoint());++i)
++retVal;
} else {
for (int i=0;i<-count && (PreviousPage() || PrevEndpoint());++i)
++retVal;
}
return retVal;
}
};
class CharEndPointMover : public EndPointMover {
bool NextEndpoint() const {
(*target_glyph)++;
return true;
}
bool PrevEndpoint() const {
(*target_glyph)--;
return true;
}
//.........这里部分代码省略.........
开发者ID:RazvanB,项目名称:sumatrapdf,代码行数:101,代码来源:TextRange.cpp
示例15: GetPageCount
void wxSTEditorNotebook::UpdateGotoCloseMenu(wxMenu *menu, int startID)
{
if (!menu) return;
size_t n, page_count = GetPageCount();
size_t item_count = menu->GetMenuItemCount();
// ======== Radio items have problems in gtk
/*
// delete extra menu items (if any)
if (page_count < item_count)
{
for (n=page_count; n < item_count; n++)
menu->Delete(startID+n);
item_count = page_count;
}
wxString label;
// change labels of existing items
for (n=0; n<item_count; n++)
{
label = wxString::Format(wxT("%2d : %s"), n+1, GetPageText(n).wx_str());
if (menu->GetLabel(startID+n) != label)
menu->SetLabel(startID+n, label);
}
// append new pages
for (n=item_count; n<page_count; n++)
menu->AppendRadioItem(startID+n, wxString::Format(wxT("%2d : %s"), n+1, GetPageText(n).wx_str()));
*/
/*
// This just clears it and adds the items fresh
for (n=0; n<item_count; n++)
menu->Delete(startID+n);
for (n=0; n<page_count; n++)
menu->AppendRadioItem(startID+n, wxString::Format(wxT("%2d : %s"), n+1, GetPageText(n).wx_str()));
*/
// ==== check items do not
// delete extra menu items (if any)
if (page_count < item_count)
{
for (n = page_count; n < item_count; n++)
menu->Delete(int(startID+n));
item_count = page_count;
}
wxString label;
// change labels of existing items
for (n = 0; n < item_count; n++)
{
label = wxString::Format(wxT("%2d : %s"), (int)n+1, GetPageText(n).wx_str());
if (menu->GetLabel(int(startID+n)) != label)
menu->SetLabel(int(startID+n), label);
menu->Check(int(startID+n), false);
}
// append new pages
for (n = item_count; n < page_count; n++)
menu->AppendCheckItem(int(startID+n), wxString::Format(wxT("%2d : %s"), (int)n+1, GetPageText(n).wx_str()));
/*
// use check items
for (n = 0; n < item_count; n++)
menu->Delete(startID+n);
for (n = 0; n < page_count; n++)
menu->AppendCheckItem(startID+n, wxString::Format(wxT("%2d : %s"), n+1, GetPageText(n).wx_str()));
*/
// show what page we're on
int sel = GetSelection();
if ((sel >= 0) && (page_count >= 0))
menu->Check(startID+sel, true);
}
开发者ID:Abyss116,项目名称:luaplus51-all,代码行数:78,代码来源:stenoteb.cpp
示例16: guard
bool wxSTEditorNotebook::HandleMenuEvent(wxCommandEvent &event)
{
wxSTERecursionGuard guard(m_rGuard_HandleMenuEvent);
if (guard.IsInside()) return false;
int n_page = (int)GetPageCount();
int win_id = event.GetId();
switch (win_id)
{
case wxID_NEW:
{
NewPage();
return true;
}
case wxID_OPEN:
{
LoadFiles();
return true;
}
case wxID_SAVEAS:
{
wxSTEditor *editor = GetEditor();
if (!editor) return true; // event handled, but we couldn't do anything with it.
if (!editor->IsFileFromDisk())
{
editor->SaveFile(true);
}
else
{
wxFileName selectedFileName;
wxString selectedFileEncoding;
bool selected_file_bom = false;
bool ok = editor->SaveFileDialog(true, wxEmptyString, &selectedFileName, &selectedFileEncoding, &selected_file_bom);
if (!ok) return true; // they probably canceled the dialog
if (selectedFileName == editor->GetFileName())
{
// They want to save to the same filename, update current editor.
editor->SaveFile(selectedFileName, selectedFileEncoding, selected_file_bom);
return true;
}
else
{
// Make a new editor for the new filename, leave the original editor as is.
wxSTEditorSplitter *splitter = CreateSplitter(wxID_ANY);
wxCHECK_MSG(splitter, true, wxT("Invalid splitter"));
wxSTEditor *newEditor = splitter->GetEditor();
wxCHECK_MSG(newEditor, true, wxT("Invalid splitter editor"));
// Make this new editor identical to the original one
// these are probably not necessary
//splitter->GetEditor()->SetOptions(editor->GetOptions());
//splitter->GetEditor()->RegisterPrefs(editor->GetEditorPrefs());
//splitter->GetEditor()->RegisterStyles(editor->GetEditorStyles());
//splitter->GetEditor()->RegisterLangs(editor->GetEditorLangs());
newEditor->SetLanguage(editor->GetLanguageId());
newEditor->SetFileName(editor->GetFileName());
newEditor->SetFileEncoding(editor->GetFileEncoding());
newEditor->SetFileBOM(editor->GetFileBOM());
newEditor->SetText(editor->GetText());
newEditor->ColouriseDocument();
newEditor->GotoPos(editor->PositionFromLine(editor->LineFromPosition(editor->GetCurrentPos())));
newEditor->GotoPos(editor->GetCurrentPos());
newEditor->ScrollToLine(editor->GetFirstVisibleLine());
// if we can save it, then add it to the notebook
if (newEditor->SaveFile(selectedFileName, selectedFileEncoding, selected_file_bom))
{
if (!InsertEditorSplitter(-1, splitter, true))
splitter->Destroy();
}
else
splitter->Destroy(); // problem saving, delete new editor
}
}
return true;
}
case ID_STN_SAVE_ALL:
{
SaveAllFiles();
return true;
}
case ID_STN_CLOSE_PAGE:
{
if ((GetSelection() != -1) && GetEditor(GetSelection()))
{
ClosePage(GetSelection(), true);
}
return true;
}
case ID_STN_CLOSE_ALL:
{
if (wxYES == wxMessageBox(_("Close all pages?"), _("Confim closing all pages"),
wxICON_QUESTION|wxYES_NO, this))
{
//.........这里部分代码省略.........
开发者ID:Abyss116,项目名称:luaplus51-all,代码行数:101,代码来源:stenoteb.cpp
示例17: GetPageCount
int Menu::PagekeyToItem(page_t page, item_t key)
{
size_t start = page * items_per_page;
size_t num_pages = GetPageCount();
if (num_pages == 1 || !items_per_page)
{
if (key > m_Items.length())
{
return MENU_EXIT;
} else {
return key-1;
}
} else {
//first page
if (page == 0)
{
/* The algorithm for spaces here is same as a middle page. */
item_t new_key = key;
for (size_t i=start; i<(start+key-1) && i<m_Items.length(); i++)
{
for (size_t j=0; j<m_Items[i]->blanks.length(); j++)
{
if (m_Items[i]->blanks[j].EatNumber())
{
if (!new_key)
{
break;
}
new_key--;
}
if (!new_key)
{
break;
}
}
}
key = new_key;
if (key == items_per_page + 2)
{
return MENU_MORE;
} else if (key == items_per_page + 3) {
return MENU_EXIT;
} else {
return (start + key - 1);
}
} else if (page == num_pages - 1) {
//last page
item_t item_tracker = 0; // tracks how many valid items we have passed so far.
size_t remaining = m_Items.length() - start;
item_t new_key = key;
// For every item that takes up a slot (item or padded blank)
// we subtract one from new key.
// For every item (not blanks), we increase item_tracker.
// When new_key equals 0, item_tracker will then be set to
// whatever valid item was selected.
for (size_t i=m_Items.length() - remaining; i<m_Items.length(); i++)
{
item_tracker++;
if (new_key<=1) // If new_key is 0, or will be 0 after the next decrease
{
new_key=0;
break;
}
new_key--;
for (size_t j=0; j<m_Items[i]->blanks.length(); j++)
{
if (m_Items[i]->blanks[j].EatNumber())
{
new_key--;
}
if (!new_key)
{
break;
}
}
}
// If new_key doesn't equal zero, then a back/exit button was pressed.
if (new_key!=0)
{
if (key == items_per_page + 1)
{
return MENU_BACK;
}
else if (key == items_per_page + 3)
{
return MENU_EXIT;
}
// MENU_MORE should never happen here.
}
// otherwise our item is now start + item_tracker - 1
return (start + item_tracker - 1);
} else {
/* The algorithm for spaces here is a bit harder. We have to subtract
* one from the key for each space we find along the way.
*/
//.........这里部分代码省略.........
开发者ID:WPMGPRoSToTeMa,项目名称:amxmodx,代码行数:101,代码来源:newmenus.cpp
示例18: SetPageText
bool Notebook::SetPageText(size_t index, const wxString &text)
{
if (index >= GetPageCount())
return false;
return wxNotebook::SetPageText(index, text);
}
开发者ID:AndrianDTR,项目名称:codelite,代码行数:6,代码来源:gtk_notebook_ex.cpp
示例19: wxCHECK_MSG
// same as AddPage() but does it at given position
bool wxNotebook::InsertPage(size_t nPage,
wxNotebookPage *pPage,
const wxString& strText,
bool bSelect,
int imageId)
{
wxCHECK_MSG( pPage != NULL, false, wxT("NULL page in wxNotebook::InsertPage") );
wxCHECK_MSG( IS_VALID_PAGE(nPage) || nPage == GetPageCount(), false,
wxT("invalid index in wxNotebook::InsertPage") );
wxASSERT_MSG( pPage->GetParent() == this,
wxT("notebook pages must have notebook as parent") );
// add a new tab to the control
// ----------------------------
// init all fields to 0
TC_ITEM tcItem;
wxZeroMemory(tcItem);
// set the image, if any
if ( imageId != -1 )
{
tcItem.mask |= TCIF_IMAGE;
tcItem.iImage = imageId;
}
// and the text
if ( !strText.empty() )
{
tcItem.mask |= TCIF_TEXT;
tcItem.pszText = wxMSW_CONV_LPTSTR(strText);
}
// hide the page: unless it is selected, it shouldn't be shown (and if it
// is selected it will be shown later)
HWND hwnd = GetWinHwnd(pPage);
SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_VISIBLE);
// this updates internal flag too -- otherwise it would get out of sync
// with the real state
pPage->Show(false);
// fit the notebook page to the tab control's display area: this should be
// done before adding it to the notebook or TabCtrl_InsertItem() will
//
|
请发表评论