当前位置: 首页>>代码示例>>C++>>正文


C++ GetPageCount函数代码示例

本文整理汇总了C++中GetPageCount函数的典型用法代码示例。如果您正苦于以下问题:C++ GetPageCount函数的具体用法?C++ GetPageCount怎么用?C++ GetPageCount使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetPageCount函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的GetPageCount函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。