示例#1
0
LRESULT CPageNavigator::OnLButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	if (!m_bCapture)
		return S_OK;
		
	ReleaseCapture();
	m_bCapture = false;

	if (!m_bDown)
		return S_OK;
		
	m_bDown = false;

	int nPage = -1;
	POINT ptCursor = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
	for (int i = 0; i < GetItemCount(); i++)
	{
		RECT ItemRect = {0,0,0,0};
		GetIconRect(i, &ItemRect);
		if (::PtInRect(&ItemRect, ptCursor))
		{
			nPage = i;
			break;
		}
	}

	if (::GetFocus() != m_hWnd)
		::SetFocus(m_hWnd);

	if (nPage < m_pAGDoc->GetNumPages())
	{
		int nLastPage = GetPage();
		if (SelectPage(nPage, true/*bSetState*/))
			SendMessage(GetParent(), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), BN_CLICKED/*wNotifyCode*/), MAKELPARAM(nLastPage,nPage));
	}
	else
	{ // It must be the add button
		SendMessage(GetParent(), WM_COMMAND, MAKEWPARAM(IDC_DOC_PAGEADD, BN_CLICKED/*wNotifyCode*/), 0L);
	}

	return S_OK;
}
示例#2
0
void SeView::keyPressEvent(QKeyEvent * e)
{
	bool accepted = false;
	int k = e->key();
	if (k == Qt::Key_Delete)
	{
		e->accept();
		if (ScMessageBox::question(this, tr("Delete Page?"),
			 "<qt>" + tr("Are you sure you want to delete this page?") + "</qt>",
			QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes)
		{
			bool dummy;
			int pageToDelete=GetPage(currentRow(), currentColumn(), &dummy);
			emit DelPage(pageToDelete);
		}
		accepted = true;
	}
	if (!accepted)
		QTableWidget::keyPressEvent(e);
}
示例#3
0
文件: NGWizard.cpp 项目: jhbsz/cpe-1
// Mark all pages as initialised. This allows them
// to determine that any OnSetActive() calls they
// get are the genuine article, and not a consequence
// of the resizer being initialised
BOOL CNGWizard::SetInitialisingFlag(BOOL bInitialising)
{
	BOOL bResult = FALSE;

	// Mark all pages as initialised
	// This is so they know the next OnSetActive() they
	// get will be a REAL one...
	for (int nPage = 0; nPage < GetPageCount(); nPage++ )
	{
		CNGWizardPage* pPage = DYNAMIC_DOWNCAST(	CNGWizardPage,
												GetPage(nPage) );
		if (pPage != NULL)
		{
			pPage->SetInitialisingFlag(bInitialising);

			bResult = TRUE;
		}
	}
	return bResult;
}
示例#4
0
void CSettingsSheet::BuildTree()
{
	HTREEITEM hGroup = NULL;

	for ( int nPage = 0 ; nPage < GetPageCount() ; nPage++ )
	{
		CSettingsPage* pPage = GetPage( nPage );

		if ( pPage->m_bGroup ) hGroup = NULL;

		HTREEITEM hItem = m_wndTree.InsertItem(
			TVIF_PARAM|TVIF_TEXT|TVIF_STATE,
			pPage->m_sCaption, 0, 0, TVIS_EXPANDED|(TVIS_BOLD*pPage->m_bGroup),
			TVIS_EXPANDED|TVIS_BOLD, (LPARAM)pPage, hGroup, TVI_LAST );

		if ( pPage->m_bGroup ) hGroup = hItem;

		if ( pPage == m_pPage ) m_wndTree.SelectItem( hItem );
	}
}
示例#5
0
void SeView::keyPressEvent(QKeyEvent * e)
{
    bool accepted = false;
    int k = e->key();
    if (k == Qt::Key_Delete)
    {
        e->accept();
        if (!QMessageBox::question(this, tr("Delete Page?"),
                                   "<qt>" + tr("Are you sure you want to delete this page?") + "</qt>",
                                   CommonStrings::trYesKey, CommonStrings::trNoKey, QString::null, 0, 1 ))
        {
            bool dummy;
            int pageToDelete=GetPage(currentRow(), currentColumn(), &dummy);
            emit DelPage(pageToDelete);
        }
        accepted = true;
    }
    if (!accepted)
        QTableWidget::keyPressEvent(e);
}
示例#6
0
void cbAuiNotebook::RestoreFocus()
{
    // if selected tab has changed, we set the focus on the window it belongs too
    if ((m_LastSelected != wxNOT_FOUND) && (GetSelection() != m_LastSelected))
    {
        wxWindow* win = GetPage(GetSelection());
        if (win)
            win->SetFocus();
    }
    // otherwise, we restore the former focus, if the window
    // with the saved Id still exists
    else if (m_LastId != 0)
    {
        wxWindow* win = FindWindowById(m_LastId);
        if (win)
            win->SetFocus();
    }
    m_LastSelected = wxNOT_FOUND;
    m_LastId = 0;
}
示例#7
0
void ReportView::Paint(Draw& w) {
	Size sz = GetSize();
	if(sz.cx <= 0 || sz.cy <= 0) return;
	if(!vsize || !report) {
		w.DrawRect(0, 0, sz.cx, sz.cy, SGray);
		return;
	}
	int i = sb / pagesize.cy;
	int y = i * pagesize.cy - sb;
	i *= pvn;
	while(y < sz.cy) {
		int x = 0;
		for(int j = pvn; j--;) {
			if(i < report->GetCount()) {
				w.DrawImage(x + 1, y + 1, GetPage(i));
				if(j == 0) {
					w.DrawRect(x + pagesize.cx - 1, y, sz.cx - x - pagesize.cx, pagesize.cy, White);
					DrawFrame(w, x, y, sz.cx - x, pagesize.cy, White, LtGray);
				}
				else
					DrawFrame(w, x, y, pagesize.cx, pagesize.cy, White, LtGray);
				if(numbers) {
					String n = Format("%d", i + 1);
					Size tsz = GetTextSize(n, StdFont());
					tsz += Size(8, 4);
					int tx = x + pagesize.cx - tsz.cx;
					DrawFrame(w, tx, y, tsz.cx, tsz.cy, Black, Black);
					w.DrawRect(tx + 1, y + 1, tsz.cx - 2, tsz.cy - 2, Yellow);
					w.DrawText(tx + 4, y + 2, n);
				}
			}
			else {
				w.DrawRect(x, y, sz.cx - x, pagesize.cy, Gray);
				break;
			}
			x += pagesize.cx;
			i++;
		}
		y += pagesize.cy;
	}
}
//-----------------------------------------------------------------------------------------------
// GetLastPage
//
// Updates the page handle with the last reserved page of the file.
//-----------------------------------------------------------------------------------------------
t_rc STORM_FileHandle::GetLastPage(STORM_PageHandle &pageHandle)
{
	if (!m_isOpened)
		return (STORM_FILENOTOPENED);

	int lastPageID = INVALID_PAGEID;

	for (int pageCounter = 1; pageCounter <= m_fileSubHeader.numAllocatedPages; pageCounter++) 
	{
		if (IsPageReserved(pageCounter)) 
		{
			lastPageID = pageCounter;
			m_filePos = lastPageID;
		}
	}

	if (lastPageID == INVALID_PAGEID)
		return (STORM_EOF);

	return (GetPage(lastPageID, pageHandle));
}
示例#9
0
void cbAuiNotebook::FocusActiveTabCtrl()
{
    UpdateTabControlsArray();
    int sel = GetSelection();
    if (sel < 0)
        return;

    wxWindow* wnd = GetPage(static_cast<size_t>(sel));
    if (!wnd)
        return;

    for (size_t i = 0; i < m_TabCtrls.GetCount(); ++i)
    {
        wxWindow* win = m_TabCtrls[i]->GetWindowFromIdx(m_TabCtrls[i]->GetActivePage());
        if (win && (win == wnd))
        {
            m_TabCtrls[i]->SetFocus();
            break;
        }
    }
}
示例#10
0
/* #FN#
   Checks if reboot of an emulated Atari is necessary */
BOOL
/* #AS#
   TRUE if reboot is necessary, otherwise FALSE */
CWizardDlg::
Reboot()
{
	BOOL bResult = FALSE;

	CWizardPage *pPage = NULL;
	for( int i = 0; i < m_arrPages.GetUpperBound() + 1; i++ )
	{
		pPage = GetPage( i );
		if( pPage && pPage->GetReboot() )
		{
			bResult = TRUE;
			break;
		}
	}
	return bResult;

} /* #OF# CWizardDlg::Reboot */
void CDonkeySettingsPage::OnEnable()
{
	UpdateData( TRUE );

	if ( m_bEnabled && ( Settings.GetOutgoingBandwidth() < 2 ) )
	{
		MsgBox( IDS_NETWORK_BANDWIDTH_LOW, MB_OK );
		m_bEnabled = FALSE;
		UpdateData( FALSE );
	}

	CNetworksSettingsPage* ppNetworks =
		(CNetworksSettingsPage*)GetPage( RUNTIME_CLASS(CNetworksSettingsPage) );

	if ( ppNetworks->GetSafeHwnd() != NULL )
	{
		ppNetworks->UpdateData( TRUE );
		ppNetworks->m_bEDEnable = m_bEnabled;
		ppNetworks->UpdateData( FALSE );
	}
}
示例#12
0
bool CChatSelector::SendMessage( const wxString& message, const wxString& client_name, uint64 to_id )
{
	// Dont let the user send empty messages
	// This is also a user-fix for people who mash the enter-key ...
	if ( message.IsEmpty() ) {
		return false;
	}

	if (to_id) {
		// Checks if there's a page with this client, and selects it or creates it
		StartSession(to_id, client_name, true);
	}

	int usedtab = GetSelection();
	// Workaround for a problem with wxNotebook, where an invalid selection is returned
	if (usedtab >= (int)GetPageCount()) {
		usedtab = GetPageCount() - 1;
	}
	if (usedtab == -1) {
		return false;
	}

	CChatSession* ci = (CChatSession*)GetPage( usedtab );

	ci->m_active = true;

	//#warning EC needed here.

	#ifndef CLIENT_GUI
	if (theApp->clientlist->SendChatMessage(ci->m_client_id, message)) {
		ci->AddText( thePrefs::GetUserNick(), COLOR_GREEN, false );
		ci->AddText( wxT(": ") + message, COLOR_BLACK );
	} else {
		ci->AddText( _("*** Connecting to Client ***"), COLOR_RED );
	}
	#endif

	return true;
}
示例#13
0
int cbAuiNotebook::GetTabPositionFromIndex(int index)
{
    if (GetPageCount() <= 0)
        return wxNOT_FOUND;

    UpdateTabControlsArray();

    wxAuiTabCtrl* tabCtrl = nullptr;
    int idx = -1;

    if (!FindTab(GetPage(index), &tabCtrl, &idx))
        return wxNOT_FOUND;

    if (!tabCtrl || idx < 0)
        return wxNOT_FOUND;

    int indexOffset = 0;
    wxAuiPaneInfoArray& all_panes = m_mgr.GetAllPanes();
    const size_t pane_count = all_panes.GetCount();
    for (size_t i = 0; i < pane_count; ++i)
    {
        wxAuiPaneInfo& pane = all_panes[i];
        if (pane.name == wxT("dummy"))
            continue;

        if (pane.window == GetTabFrameFromTabCtrl(tabCtrl))
            break;

        for (size_t j = 0; j < m_TabCtrls.GetCount(); ++j)
        {
            if (pane.window == GetTabFrameFromTabCtrl(m_TabCtrls[j]))
            {
                indexOffset += m_TabCtrls[j]->GetPageCount();
                break;
            }
        }
    }
    return idx + indexOffset;
}
示例#14
0
void CDataProcess::ThreadProc()
{
	long lLastQueryTime = 0;
	string strHeader = m_strHeader;
	int iRet = -1;
	CString strRet = "";
	CString strPath = CFunction::GetAppPath().c_str();
	strPath += "xmlLog";
	CString strFilePath = "";
	if (!CFileUtil::IsDirectoryExist(strPath))
	{
		CFileUtil::CreateDirectory(strPath);
	}
	while (IsRunning())
	{
		if (::GetTickCount() - lLastQueryTime < m_lQueryInterval)
		{
			Sleep(500);
			continue;
		}
		strHeader = m_strHeader;
		if (m_bUseZipCompress)
			strHeader.append("\r\nAccept-Encoding:gzip, deflate");
		strFilePath.Format("%s\\%s.xml", strPath, CTime::GetCurrentTime().Format("%Y%m%d%H%M%S"));

		int iRet = GetPage(m_strObject, strHeader.c_str(), NULL, 0, true, strFilePath);
		if(iRet < 0)
		{
			Sleep(500);
			continue;
		}
		lLastQueryTime = ::GetTickCount();
		ReadXmlInfo(strFilePath);
		if(m_hWndShow)	ShowInfo(m_hWndShow);
		CString strShow = "最后抓取时间: ";
		if(m_hWndNotice) ::SetWindowText(m_hWndNotice,strShow + CTime::GetCurrentTime().Format("%Y-%m-%d %H:%M:%S"));
	}
}
示例#15
0
文件: notebook.cpp 项目: EdgarTx/wx
int wxNotebook::DoSetSelection( size_t page, int flags )
{
    wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid notebook") );

    wxCHECK_MSG( page < m_pagesData.GetCount(), -1, wxT("invalid notebook index") );

    int selOld = GetSelection();

    if ( !(flags & SetSelection_SendEvent) )
    {
        g_signal_handlers_disconnect_by_func (m_widget,
                                             (gpointer) gtk_notebook_page_changing_callback,
                                             this);

        g_signal_handlers_disconnect_by_func (m_widget,
                                             (gpointer) gtk_notebook_page_changed_callback,
                                             this);
    }

    gtk_notebook_set_current_page( GTK_NOTEBOOK(m_widget), page );

    if ( !(flags & SetSelection_SendEvent) )
    {
        // reconnect to signals

        g_signal_connect (m_widget, "switch_page",
                          G_CALLBACK (gtk_notebook_page_changing_callback), this);

        g_signal_connect_after (m_widget, "switch_page",
                      G_CALLBACK (gtk_notebook_page_changed_callback), this);
    }

    wxNotebookPage *client = GetPage(page);
    if ( client )
        client->SetFocus();

    return selOld;
}
示例#16
0
BOOL COXTabViewContainer::DeletePage(int nIndex, 
									 BOOL bDestroy/*=TRUE*/)
{
	ASSERT_VALID(this);
	ASSERT(nIndex>=0 && nIndex<GetPageCount());

	if(nIndex>=0 && nIndex<GetPageCount())
	{
		// if active page is being deleted - activate next
		int nActivePage=GetActivePageIndex();
		if(nActivePage==nIndex)
		{
			if(nActivePage==GetPageCount()-1)
				SetActivePageIndex(0);
			else
				SetActivePageIndex(GetPageCount()>1 ? nActivePage+1 : 0);
		}
		CWnd* pWnd=GetPage(nIndex);
		ASSERT(pWnd!=NULL);
		m_arrUniqueIDs.Add(pWnd->GetDlgCtrlID());
		if(bDestroy && ::IsWindow(pWnd->m_hWnd))
			VERIFY(pWnd->DestroyWindow());

		m_arrPages.RemoveAt(nIndex);

		nActivePage=GetActivePageIndex();
		if(nActivePage>=nIndex)
			m_nActivePageIndex--;

		CalcTabBtnRects();

		RedrawContainer();
	
		return TRUE;
	}

	return FALSE;
}
示例#17
0
void CDCSettingsPage::OnEnable()
{
	UpdateData( TRUE );

	if ( m_bEnabled && ( Settings.GetOutgoingBandwidth() < 2 ) )
	{
		CString strMessage;
		LoadString( strMessage, IDS_NETWORK_BANDWIDTH_LOW );
		MsgBox( strMessage, MB_OK );
		m_bEnabled = FALSE;
		UpdateData( FALSE );
	}

	CNetworksSettingsPage* ppNetworks =
		(CNetworksSettingsPage*)GetPage( RUNTIME_CLASS(CNetworksSettingsPage) );

	if ( ppNetworks->GetSafeHwnd() != NULL )
	{
		ppNetworks->UpdateData( TRUE );
	//	ppNetworks->m_bDCEnable = m_bEnabled;
		ppNetworks->UpdateData( FALSE );
	}
}
示例#18
0
void cbAuiNotebook::OnIdle(cb_unused wxIdleEvent& event)
{
    if (m_SetZoomOnIdle)
    {
        m_SetZoomOnIdle = false;
        int zoom = Manager::Get()->GetEditorManager()->GetZoom();
        for (size_t i = 0; i < GetPageCount(); ++i)
        {
            wxWindow* win = GetPage(i);
            if (win && static_cast<EditorBase*>(win)->IsBuiltinEditor())
                static_cast<cbEditor*>(win)->SetZoom(zoom);
        }
    }

    if (m_MinimizeFreeSpaceOnIdle)
    {
        m_MinimizeFreeSpaceOnIdle = false;
        UpdateTabControlsArray();
        for (size_t i = 0; i < m_TabCtrls.GetCount(); ++i)
            MinimizeFreeSpace(m_TabCtrls[i]);
    }

}
示例#19
0
bool Notebook::DeletePage(size_t page, bool notify)
{
    if (page >= GetPageCount())
        return false;

    if (notify) {
        //send event to noitfy that the page has changed
        NotebookEvent event(wxEVT_COMMAND_BOOK_PAGE_CLOSING, GetId());
        event.SetSelection( page );
        event.SetEventObject( this );
        GetEventHandler()->ProcessEvent(event);

        if (!event.IsAllowed()) {
            return false;
        }
    }

    wxWindow* win = GetPage(page);
    win->Disconnect(wxEVT_KEY_DOWN, wxKeyEventHandler(Notebook::OnKeyDown),  NULL, this);
    GTKDeletePgInfo(win);

    bool rc = wxNotebook::DeletePage(page);
    if (rc) {
        PopPageHistory(win);
    }

    if (rc && notify) {
        //send event to noitfy that the page has been closed
        NotebookEvent event(wxEVT_COMMAND_BOOK_PAGE_CLOSED, GetId());
        event.SetSelection( page );
        event.SetEventObject( this );
        GetEventHandler()->ProcessEvent(event);
    }

    return rc;

}
示例#20
0
bool wxPropertyGridManager::ProcessEvent( wxEvent& event )
{
    int evtType = event.GetEventType();

#ifdef __WXPYTHON__
    // NB: For some reason, under wxPython, Connect in Init doesn't work properly,
    //     so we'll need to call OnPropertyGridSelect manually. Multiple call's
    //     don't really matter.
    if ( evtType == wxEVT_PG_SELECTED )
        OnPropertyGridSelect((wxPropertyGridEvent&)event);
#endif

    // Property grid events get special attention
    if ( evtType >= wxPG_BASE_EVT_TYPE &&
         evtType < (wxPG_MAX_EVT_TYPE) &&
         m_selPage >= 0 )
    {
        wxPropertyGridPage* page = GetPage(m_selPage);
        wxPropertyGridEvent* pgEvent = wxDynamicCast(&event, wxPropertyGridEvent);

        // Add property grid events to appropriate custom pages
        // but stop propagating to parent if page says it is
        // handling everything.
        if ( pgEvent && !page->m_isDefault )
        {
            /*if ( pgEvent->IsPending() )
                page->AddPendingEvent(event);
            else*/
                page->ProcessEvent(event);

            if ( page->IsHandlingAllEvents() )
                event.StopPropagation();
        }
    }

    return wxPanel::ProcessEvent(event);
}
示例#21
0
BOOL CSettingsSheet::OnInitDialog()
{
	CSkinDialog::OnInitDialog();

	SetWindowText( m_sCaption );

	CRect rect;
	m_wndTree.Create( WS_CHILD|WS_TABSTOP|WS_VISIBLE|/*TVS_PRIVATEIMAGELISTS|*/
		TVS_HASLINES|TVS_SHOWSELALWAYS|TVS_TRACKSELECT|TVS_NOHSCROLL, rect, this, IDC_SETTINGS_TREE );

	m_wndOK.Create( _T("OK"), WS_CHILD|WS_TABSTOP|WS_VISIBLE|BS_DEFPUSHBUTTON, rect, this, IDOK );
	m_wndOK.SetFont( &theApp.m_gdiFont );
	m_wndCancel.Create( _T("Cancel"), WS_CHILD|WS_TABSTOP|WS_VISIBLE, rect, this, IDCANCEL );
	m_wndCancel.SetFont( &theApp.m_gdiFont );
	m_wndApply.Create( _T("Apply"), WS_CHILD|WS_TABSTOP|WS_VISIBLE, rect, this, IDRETRY );
	m_wndApply.SetFont( &theApp.m_gdiFont );

	if ( m_pFirst == NULL ) m_pFirst = GetPage( INT_PTR(0) );
	SetActivePage( m_pFirst );

	BuildTree();

	return TRUE;
}
示例#22
0
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);
    }
}
//------------------------------------------------------------------------------
stPage * stPlainDiskPageManager::GetNewPage(){
   stPageID * next;
   stPage * page;
   
   if (header->Available == 0){
      // Get instance from cache
      page = pageInstanceCache->Get();
      
      // Creating the new page
      header->PageCount++;
      page->SetPageID(header->PageCount);
   }else{
      // Remove from free list
      page = GetPage(header->Available);
      next = (stPageID *)(page->GetData());
      header->Available = * next;
   }//end if
   
   // Update header
   header->UsedPages++;
   WriteHeaderPage(headerPage);
   
   return page;   
}//end stPlainDiskPageManager::GetNewPage
示例#24
0
CPPageSheet::CPPageSheet(LPCTSTR pszCaption, IFilterGraph* pFG, CWnd* pParentWnd, UINT idPage)
	: CTreePropSheet(pszCaption, pParentWnd, 0)
	, m_audioswitcher(pFG)
{
	AddPage(&m_player);
	AddPage(&m_formats);
	AddPage(&m_acceltbl);
	AddPage(&m_logo);
	AddPage(&m_playback);
	AddPage(&m_dvd);
	AddPage(&m_output);
	AddPage(&m_webserver);
	AddPage(&m_internalfilters);
	AddPage(&m_audioswitcher);
	AddPage(&m_externalfilters);
	AddPage(&m_subtitles);
	AddPage(&m_substyle);
	AddPage(&m_subdb);
	AddPage(&m_tweaks);

	EnableStackedTabs(FALSE);

	SetTreeViewMode(TRUE, TRUE, FALSE);

	if(idPage || (idPage = AfxGetApp()->GetProfileInt(ResStr(IDS_R_SETTINGS), _T("LastUsedPage"), 0)))
	{
		for(int i = 0; i < GetPageCount(); i++)
		{
			if(GetPage(i)->m_pPSP->pszTemplate == MAKEINTRESOURCE(idPage))
			{
				SetActivePage(i);
				break;
			}
		}
	}
}
void CGnutellaSettingsPage::OnG1Today() 
{
	UpdateData( TRUE );

	if ( m_bG1Today && ( Settings.GetOutgoingBandwidth() < 2 ) )
	{
		CString strMessage;
		LoadString( strMessage, IDS_NETWORK_BANDWIDTH_LOW );
		AfxMessageBox( strMessage, MB_OK );
		m_bG1Today = FALSE;
		UpdateData( FALSE );
	}

	CNetworksSettingsPage* ppNetworks =
		(CNetworksSettingsPage*)GetPage( RUNTIME_CLASS(CNetworksSettingsPage) );
	
	if ( ppNetworks->GetSafeHwnd() != NULL )
	{
		UpdateData( TRUE );
		ppNetworks->UpdateData( TRUE );
		ppNetworks->m_bG1Enable = m_bG1Today;
		ppNetworks->UpdateData( FALSE );
	}
}
示例#26
0
void SeView::mouseMoveEvent(QMouseEvent* e)
{
    if ((Mpressed) && ((Mpos - e->pos()).manhattanLength() > 4))
    {
        Mpressed = false;
        int a = rowAt(e->pos().y());
        int b = columnAt(e->pos().x());
        if ((a != -1) && (b != -1))
        {
            QTableWidgetItem* ite = item(a, b);
            if (ite != 0)
            {
                if (ite->type() == 1002)
                {
                    SeItem* it = (SeItem*)ite;
                    QString str(it->pageName);
                    bool dummy;
                    int p = GetPage(a, b, &dummy);
                    QString tmp;
                    QMimeData *mimeData = new QMimeData;
                    mimeData->setData("page/magic", "2 "+tmp.setNum(p).toLocal8Bit()+" "+str.toLocal8Bit());
                    mimeData->setText("2 "+tmp.setNum(p)+" "+str);
                    QDrag *dr = new QDrag(this);
                    dr->setMimeData(mimeData);
                    const QPixmap& pm = loadIcon("doc.png");
                    dr->setPixmap(pm);
                    //	dr->setDragCursor(pm, Qt::CopyAction);
                    //	dr->setDragCursor(pm, Qt::MoveAction);
                    dr->exec(Qt::CopyAction | Qt::MoveAction);
                    QApplication::setOverrideCursor(Qt::ArrowCursor);
                }
            }
        }
    }
    QTableWidget::mouseMoveEvent(e);
}
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);
	}


	return TRUE;
}
示例#28
0
BOOL COXTabViewContainer::SetActivePageIndex(int nIndex)
{
	if(nIndex==m_nActivePageIndex)
	{
		return TRUE;
	}

	CWnd* pWndOld=GetActivePage();
	if(pWndOld!=NULL)
	{
		ASSERT(::IsWindow(pWndOld->m_hWnd));
		if(::IsWindow(pWndOld->m_hWnd))
		{
			UpdateScrollInfo();

			pWndOld->ShowWindow(SW_HIDE);
			PAGEINFO pi=m_arrPages[GetActivePageIndex()];
			m_nActivePageIndex=-1;
			UINT nBar=(pi.bHasScrollHorz&pi.bHasScrollVert ? SB_BOTH : 
				(pi.bHasScrollHorz ? SB_HORZ : 
				(pi.bHasScrollVert ? SB_VERT : 0)));
			if(nBar!=0)
			{
				pWndOld->ShowScrollBar(nBar,TRUE);
			}
		}
	}

	m_nActivePageIndex=nIndex;
	if(m_nActivePageIndex>=0 && m_nActivePageIndex<GetPageCount())
	{
		EnsureTabBtnVisible(m_nActivePageIndex);

		CWnd* pWnd=GetPage(m_nActivePageIndex);
		if(pWnd!=NULL)
		{
			ASSERT(::IsWindow(pWnd->m_hWnd));
			if(::IsWindow(pWnd->m_hWnd))
			{
				IniScrollInfo();

				pWnd->ShowWindow(SW_SHOW);
				CRect rect;
				pWnd->GetWindowRect(rect);
				if(rect.Width()!=m_rectPage.Width() || 
					rect.Height()!=m_rectPage.Height())
				{
					pWnd->MoveWindow(m_rectPage);
				}
				else
				{
					pWnd->SendMessage(WM_SIZE,SIZE_RESTORED,
						MAKELPARAM(rect.Width(),rect.Height()));
				}

				// set the focus to the page
				CFrameWnd* pFrameWnd=(CFrameWnd*)GetParent();
				ASSERT(pFrameWnd!=NULL);
				if(pFrameWnd->IsKindOf(RUNTIME_CLASS(CFrameWnd)))
				{
					if(pWnd->IsKindOf(RUNTIME_CLASS(CView)))
					{
						pFrameWnd->SetActiveView((CView*)pWnd);
					}
					else
					{
						if(pWndOld!=NULL && 
							pWndOld->IsKindOf(RUNTIME_CLASS(CView)))
						{
							pFrameWnd->SetActiveView(NULL);
						}
						pWnd->SetFocus();
					}
				}
				else
				{
					pWnd->SetFocus();
				}

				RedrawTabBtnArea();
			}
		}
	}
	else
		return FALSE;

	return TRUE;
}
示例#29
0
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;
}
示例#30
0
BOOL CSettingsSheet::SetActivePage(int nPage)
{
	return SetActivePage( GetPage( nPage ) );
}