Example #1
0
LRESULT CFoldView::DoneFolding(WPARAM wParam, LPARAM lParam) {
	CDialog* finished;
	//CMainFrame* frame = (CMainFrame*) Parent;

	if (m_save) delete foldobject.savefile;

	if (!subfold) {
		//offer to display the predicted structures if this is not subfolding
		finished = new CDialog(IDD_FINISHED,this);

		if(finished->DoModal()==IDOK) ((CRNAstructureApp*) GetFoldDocument()->pMainFrame)->Draw(m_ctname.GetBuffer(10));
	

		delete finished;
	}

	

	progress->SendMessage (WM_CLOSE);
	
	GetFoldDocument()->Frame->SendMessage(WM_CLOSE);
	
	return 0;


}
Example #2
0
bool CSubFormCollection::ShowSubForm(int ix)
{
    ASSERT(ix <= m_Forms.GetUpperBound());
    if (ix > m_Forms.GetUpperBound()) return(false); // does not exist

    CDialog* pDlg;
    if (ix != -1) {
        if (m_nActiveForm != -1) {
            pDlg = m_Forms.GetAt(m_nActiveForm);
            ASSERT(pDlg != NULL);
            ASSERT(pDlg->m_hWnd != NULL);
            if ((pDlg == NULL) 
            ||  (pDlg->m_hWnd == NULL)) return(false);
            pDlg->ShowWindow(SW_HIDE);
        }
        m_nActiveForm = ix; // this is the active one now;
    }
    else {
        if (m_nActiveForm == -1) {
            m_nActiveForm = 0;
        }
    }
    pDlg = m_Forms.GetAt(m_nActiveForm);
    ASSERT(pDlg != NULL);
    ASSERT(pDlg->m_hWnd != NULL);
    if ((pDlg == NULL) 
    ||  (pDlg->m_hWnd == NULL)) return(false);
    pDlg->ShowWindow(SW_SHOW);
    pDlg->Invalidate();
    pDlg->RedrawWindow();
    return(true);
}
Example #3
0
void CUITestDialog::OnBnClickedButtonHtmlDialogTest()
{
	// TODO: 在此添加控件通知处理程序代码
 //   CWindowFactory::Instance()->ShowWindow( WndWebpage, this->GetWindowId() );
	CDialog *pDlg = CWindowFactory::Instance()->NewDlg( WndWebpage );
	pDlg->DoModal();
}
Example #4
0
/*創建分頁-頁面增加*/
void CHM_MachineView::CreatePages()
{
    CDialog* dlg;
    dlg = new CMain;
    m_DlgArray.Add(dlg);
    dlg->Create(IDD_MAIN, m_TabCtrl);
    m_TabCtrl->InsertItem(0, _T("主頁面"));
    if (((CHM_MachineApp*)AfxGetApp())->Post == _T("工程師"))
    {
        dlg = new CCompiler;
        m_DlgArray.Add(dlg);
        dlg->Create(IDD_COMPILER, m_TabCtrl);
        m_TabCtrl->InsertItem(1, _T("編輯頁面"));
        dlg = new CParameter;
        m_DlgArray.Add(dlg);
        dlg->Create(IDD_PARAMETER, m_TabCtrl);
        m_TabCtrl->InsertItem(2, _T("參數設定"));
        dlg = new CIOState;
        m_DlgArray.Add(dlg);
        dlg->Create(IDD_IOSTATE, m_TabCtrl);
        m_TabCtrl->InsertItem(3, _T("I/O狀態"));
    } 
    OnTabSelChange(NULL, NULL);
    Invalidate();      
}
Example #5
0
BOOL CALLBACK DialogProc(HWND hwnd,
						 UINT message,
						 WPARAM wParam,
						 LPARAM lParam)
{
	CDialog *pDlg = NULL;

	switch (message)
	{
	case WM_INITDIALOG:
		pDlg = (CDialog*)lParam;
		return pDlg->OnInit(hwnd);

	case WM_COMMAND:
		pDlg = (CDialog*)::GetWindowLong(hwnd, DWL_USER);
		return pDlg->OnCommand(LOWORD (wParam), HIWORD (wParam));

	case WM_DESTROY:
		::PostQuitMessage(0);
		return TRUE;

	case WM_CLOSE:
		pDlg = (CDialog*)::GetWindowLong(hwnd, DWL_USER);
		return pDlg->OnClose();
	}
	return FALSE;
}
Example #6
0
INT_PTR CALLBACK DefDialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	CDialog* pThis = NULL;
	CDialog* pThat = NULL;
	switch(uMsg)
	{
	case WM_INITDIALOG:
		pThis=(CDialog*)lParam;		//获取对象指针
		if( NULL != pThis)
		{
			pThis->Attach(hWnd);	//设置HWND和对象之间的关系
			SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)pThis);	//将对象指针保存到窗口hWnd用户数据空间
		}
		break;
	default:
		break;
	}
	pThat = (CDialog*)GetWindowLongPtr(hWnd, GWLP_USERDATA);	//从窗口句柄hWnd得到对象指针,因为之前有SetWindowLongPtr()
	if(NULL != pThat)
	{
		return ( pThat->HandleMessage(uMsg,wParam, lParam) );
	}

	return (INT_PTR)FALSE;
}
BOOL DlgAnimationExporterMain::OnInitDialog()
{
	CDialog::OnInitDialog();
	UpdateData(FALSE);//
	// TODO:  在此添加额外的初始化

	char* szItemName[] = {" 骨骼框架", "动画序列", "纹理", "模型信息", "5"};
	
	for (int i = 0; i < MAX_PAGE; i++)
	{
		m_tabExporter.InsertItem(i, szItemName[i]);
	}

	RECT rc;
	m_tabExporter.GetClientRect(&rc);
	ClientToScreen(&rc);
	RECT rcDlg = {0,0,0,0};
	//GetClientRect(&rcDlg);
	//GetWindowRect(&rcDlg);
	//ClientToScreen(&rcDlg);
	RECT rcw = {rcDlg.left + rc.left, rcDlg.top + rc.top + 21, rcDlg.left + rc.right, rcDlg.top + rc.bottom};
	CDialog* pDlg = NULL;
	int iDlgNum = 0;
	CREATE_PAGE(IDD_DIALOG1, CDlgExporterPage1);
	pDlg->ShowWindow(SW_SHOW);
	CREATE_PAGE(IDD_DIALOG2, CDlgExporterPage2);
	CREATE_PAGE(IDD_DIALOG3, CDlgExportPage3);
	CREATE_PAGE(IDD_DIALOG4, CDlgExportPage4);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	// 异常: OCX 属性页应返回 FALSE
}
BOOL C3DGORangeWire::OnApply() 
{
	UpdateData();
	CDialog* pDlg = STATIC_DOWNCAST(CDialog, AfxGetMainWnd());
	pDlg->SendMessage(WM_3DOPTIONS_CHANGE, 0, 0);
	
	return CPropertyPage::OnApply();
}
Example #9
0
void CUITestDialog::OnBnClickedButtonControlTest()
{
	// TODO: 在此添加控件通知处理程序代码
// 	CControlTestDialog dlg;
// 	dlg.DoModal();
	CDialog *pDlg = CWindowFactory::Instance()->NewDlg( WndUnittestCtrl );
	pDlg->DoModal();
}
Example #10
0
// static
INT_PTR CALLBACK CDialog::DlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	CDialog *dlg = (CDialog*)FromHandle(hWnd);
	if( dlg )
		return dlg->MsgProc(msg, wParam, lParam);

	return FALSE;
}
Example #11
0
CSubFormCollection::~CSubFormCollection()
{
    // Free all sub forms on destruction
    for (int i = 0; i <=  m_Forms.GetUpperBound(); i++) {
        CDialog* pDlg = m_Forms.GetAt(i);
        pDlg->DestroyWindow();
        delete pDlg;
    }
}
Example #12
0
//*****************************************************************************
//
// Function Name:  RColorDialog::ShowPage
//
// Description:    Helper function for creating/displaying the correct
//						 property sheet in the tab control.
//
// Returns:        VOID
//
// Exceptions:	    None
//
//*****************************************************************************
void RColorDialog::ShowPage( int nPage )
{
	CDialog* pPrevPage  = m_pCurrentPage;
	CDialog* pPages[]   = { &m_dlgColorPalette, &m_dlgColorTexture, &m_dlgColorPhoto };
	int		pPageIDs[] = { DIALOG_COLOR_DIALOG_GRADIENTS, m_dlgColorTexture.IDD, m_dlgColorPhoto.IDD };

	TpsAssert( nPage < NumElements( pPages ), "Invalid page number!" );

	if (m_pCurrentPage != pPages[nPage])
	{
		m_pCurrentPage = pPages[nPage] ;

		if (!IsWindow( m_pCurrentPage->m_hWnd ))
		{
			CRect   rectAdjust(0,0,0,0);
			CRect   rectWindow(0,0,0,0);

			m_ctlTabCtrl.AdjustRect( TRUE, &rectAdjust );
			m_ctlTabCtrl.GetWindowRect( &rectWindow );

			rectWindow.left -= rectAdjust.left;
			rectWindow.top  -= rectAdjust.top;
			ScreenToClient( &rectWindow );

			if (!m_pCurrentPage->Create( pPageIDs[nPage], this ))
			{
				if (!pPrevPage) return ;

				// Restore the current page pointer to the previous one.
				m_pCurrentPage = pPrevPage ;
				pPrevPage = NULL;

				// Find the index of the previous page. (For setting the tab)
				for (int i = 0; i < NumElements( pPages ); i++)
				{
					if (m_pCurrentPage == pPages[i])
					{
						m_ctlTabCtrl.SetCurSel( i ) ;
						break ;
					}
				}
			}

			m_pCurrentPage->SetWindowPos( &wndTop, rectWindow.left,
				rectWindow.top, 0, 0, SWP_NOSIZE ) ;

		} // if (IsWindow())
			
	} // if (new page)

	if (pPrevPage && IsWindow( pPrevPage->m_hWnd ))
		pPrevPage->ShowWindow( SW_HIDE ) ;

	m_pCurrentPage->ShowWindow( SW_SHOW ) ;

	GetDlgItem( IDC_COLOR_MORE )->EnableWindow( m_pCurrentPage == &m_dlgColorPalette );
}
void CConfigWizard::AddBoard(LPRECT lpRect, LPCTSTR desc)
{
	CDialog *pDlg = new T;
	pDlg->Create(T::IDD, &m_bnBoardPlace);
	pDlg->MoveWindow(lpRect);
	pDlg->SetWindowText(desc);
	m_wizards.push_back(pDlg);
	m_lbStep.AddItem(0, desc);
}
Example #14
0
int APIENTRY WinMain( HINSTANCE hInstance, 
					 HINSTANCE hPrevInstance, 
					 LPSTR lpCmdLine, 
					 int nCmdShow)
{
	CDialog dlg;
	dlg.DoDialogBox(hInstance, CDialog::IDD, GetDesktopWindow());
	return 0;
}
Example #15
0
int test_4_Button() {
  bool done = false;
  int key = 0;
  int i = 0;
  int fn = C_FULL_FRAME;
  CDialog Screen;
  for(int k=2;k<console.getRows();k+=2){
    for(int m=0;m<console.getCols()-10;m+=10){
      Screen<<new CLabel((i=!i)?"Hello": "Hi",k, m, 9);
    }
  }
  Screen<<new CLabel(">>>>>> Dialog and Button Tester <<<<<<<<", 0, (console.getCols()-40)/2);
  Screen.draw();
  CDialog D(&Screen, 5, 10, 50, 15, true, "+-+|+-+|");
  CButton Inc("Increase",9,10);
  CButton Dec("Decrease",9,30);
  D.add(new CLabel("Testing Buttons (bordered)",1, 12,30));
  D.add(new CLabel("Press F10 to toggle button borders visiblity",3,3));
  D.add(new CLabel("Press F6 to move ",4,15));
  int mesIndx = D.add(new CLabel(7, 24, 10));
  int incNum = D.add(Inc) + 1;
  int decNum = D.add(Dec) + 1;
  D << new CLabel("Press Escape to exit", 12, 15);
  D[mesIndx].set("100");
  while(!done){
    key = D.edit(fn);
    switch(key){
    case ESCAPE:
      done = true;
      break;
    case F(10):
      Inc.visible(!Inc.visible());
      Dec.visible(!Dec.visible());
      D[0].set(Inc.visible() ? "Testing Buttons (bordered)" : "Testing Buttons (no border)");
      D.refresh();
      break;
    case F(6):
      D.move();
      break;
    case C_BUTTON_HIT:
      if(&D.curField() == &Inc){
        i++;
        fn = incNum;
      }
      else{
        i--;
        fn = decNum;
      }
      sprintf((char*)D[mesIndx].data(),"%d",i);
      D[mesIndx].draw();
      break;
    }
  }
  D.hide();
  console.pause();
  return 0;
}
Example #16
0
void CUITestDialog::OnBnClickedButtonLoginDialogTest()
{
	// TODO: 在此添加控件通知处理程序代码
//     CWindowFactory::Instance()->ShowWindow( WndLogin, this->GetWindowId() );
//     return ;

	CDialog *pDlg = CWindowFactory::Instance()->NewDlg( WndLogin );
	pDlg->DoModal();

}
BOOL C2DOptionsMode::OnApply() 
{
	if(m_fDirty)
	{
		CDialog* pDlg = STATIC_DOWNCAST(CDialog, AfxGetMainWnd());
		pDlg->SendMessage(WM_USER_CHANGE_OBJECT_PROPERTIES, 0, 0);
		m_fDirty = false;
	}
	
	return CPropertyPage::OnApply();
}
Example #18
0
void CUITestDialog::OnBnClickedButtonPlayerDlgNoPtz()
{
	// TODO: 在此添加控件通知处理程序代码
//	CPlayerDialog dlg;
	CMCUSession::Instance()->CurVideoSession()->PtzControl( FALSE );
//	dlg.DoModal();

//    CWindowFactory::Instance()->ShowWindow( WndPlayer, this->GetWindowId() );
	CDialog *pDlg = CWindowFactory::Instance()->NewDlg( WndPlayer );
	pDlg->DoModal();
}
int main(){
  bool done = false;
  int key = 0;
  int i = 0;
  bool insert = true;
  char str[81] = "I want to edit this thing!";
  CDialog Screen;
  for(int k=1;k<console.getRows();k+=2){
    for(int m=0;m<console.getCols()-10;m+=10){
      Screen<<new CLabel((i=!i)?"Hello": "Hi",k, m, 9);
    }
  }
  Screen<<new CLabel("Dialog and Line Editor Tester      ", 0, 0);

  CDialog D(&Screen, 5, 10, 50, 15, true, "+-+|+-+|");
  CLabel L("Enter some text down here:",6, 4);
  Screen.draw();
  D.add(new CLabel("Testing Label and Line edit",1, 12));
  D << new CLabel("Name: ", 4, 3)
    << new CLineEdit(4,9,20,40,&insert)
    << new CLabel("Surname: ", 5, 3)
    << new CLineEdit(5,12,20,50,&insert)<< L
    << new CLineEdit(str,7,4,40,80, &insert, true);
  int mesIndx = D.add(new CLabel(10, 5, 40));
  D << new CLabel("Press ESC or F2 to exit, press F6 to Move", 2, 3);
  D[mesIndx].set("Setting the message to see what happens");
  D.draw();
  while(!done){
    key = D.edit(mesIndx+ 1);
    i++;
    sprintf((char*)D[mesIndx].data(), "LOOP No: %d", i);    
    switch(key){
    case ESCAPE:
    case F(2):
      done = true;
      break;
    case F(3):
      D[mesIndx].set("Setting the message to something more than 40 characters to see what happens");
      break;
    case F(6):
      D.move();
      break;
    }
  }
  console.clear();
  console.display("First Lineedit data:", 8, 1);
  console.display((char*)D[2].data(), 9, 0);
  console.display("Second Lineedit data:", 10, 1);
  console.display((char*)D[4].data(), 11, 0);
  console.display("Third Linedit data:", 14, 1);
  console.display((char*)D[6].data(), 15, 0);
  console.pause();
  return 0;
}
Example #20
0
BOOL CALLBACK CDialog::class_initial_DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	if (uMsg == WM_INITDIALOG)
		SetWindowLong(hwndDlg, GWL_USERDATA, lParam);

	CDialog *pDlg = (CDialog*)GetWindowLong(hwndDlg, GWL_USERDATA);

	if (pDlg)
		return pDlg->class_DialogProc(hwndDlg, uMsg, wParam, lParam);
	else
		return FALSE;
}
BOOL CMarkersPropertyPage::OnInitDialog() 
{
	CDialog     *pConfigDlg;
	CFileMarker *pMarker;
 int          Index;

	CResizablePage::OnInitDialog();
	
	// preset resize layout
	AddAnchor(IDC_SELECTION_CHECKLIST, TOP_LEFT,BOTTOM_LEFT);
	AddAnchor(IDC_SELECTION_FRAME,  TOP_LEFT,BOTTOM_LEFT);
	AddAnchor(IDC_SELECTION_INFO_FRAME,  TOP_LEFT,TOP_RIGHT);
	AddAnchor(IDC_SELECTION_DESCRIPTION,  TOP_LEFT,TOP_RIGHT);
	AddAnchor(IDC_SELECTION_CONFIG_FRAME, TOP_LEFT, BOTTOM_RIGHT);
	AddAnchor(IDC_PROPERTYSHEET,  TOP_LEFT, BOTTOM_RIGHT);
	AddAnchor(IDC_SELECTIONS_MAKE,  BOTTOM_LEFT);
 //

 // subclass checklistbox
 m_SelectionCheckList.SubclassDlgItem(IDC_SELECTION_CHECKLIST,this);
 //


	for (Index = 0; Index < g_DupeFileFind.GetFileSelectionArray()->GetSize(); Index++)
	{
		pMarker = g_DupeFileFind.GetFileSelectionArray()->GetAt(Index);
		pConfigDlg = pMarker->GetForm();
				
	 if (pConfigDlg)
		{
 		CRect rcSheet;
			pConfigDlg->Create(pMarker->GetFormID(), this);
			GetDlgItem( IDC_PROPERTYSHEET )->GetWindowRect( &rcSheet );
			ScreenToClient( &rcSheet );
			pConfigDlg->SetWindowPos( NULL, rcSheet.left-7, rcSheet.top-7, 0, 0, 	SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE );
			pConfigDlg->UpdateData();
 	}
	 m_SelectionCheckList.AddString ( pMarker->GetName() );
  m_SelectionCheckList.SetItemData ( Index, (DWORD)pMarker );
	}

	if ( m_SelectionCheckList.GetCount() != 0 )
	{
		m_SelectionCheckList.SetCurSel(0);
  UpdateForm();	
	}


// CANNOT LOG HERE

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Example #22
0
void CUITestDialog::OnBnClickedButtonPlayerDlgTest()
{
	// TODO: 在此添加控件通知处理程序代码
//	CPlayerDialog dlg;
	CMCUSession::Instance()->CurVideoSession()->PtzControl( TRUE );
//	dlg.DoModal();

//    CWindowFactory::Instance()->ShowWindow( WndPlayer, WndUnittestUI );
	CDialog *pDlg = CWindowFactory::Instance()->NewDlg( WndPlayer );
	pDlg->DoModal();

}
Example #23
0
//---------------------------------------------------------------------------
// Function name	: InsertPage
// Description	  : return -1 if an error occurs
//---------------------------------------------------------------------------
int	CRollupCtrl::InsertPage(const TCHAR* caption, UINT nIDTemplate, int idx)
{
	if (idx>0 && idx>=m_PageList.GetSize())		idx=-1;

	//Create Template
	CDialog* wndtemplate = new CDialog(nIDTemplate, this);
	BOOL b = wndtemplate->Create(nIDTemplate, this);
	if (!b)	{ delete wndtemplate; return -1; }

	//Insert Page
	return _InsertPage(caption, wndtemplate, idx, TRUE);
}
Example #24
0
int CRollupCtrl::InsertPage(LPCTSTR caption, UINT nIDTemplate, CRuntimeClass* rtc, int idx)
{
	if (idx>0 && idx>=(int)m_PageList.size())		idx=-1;

	//Create Template
	ASSERT(rtc!=NULL);
	CDialog* pwndTemplate = (CDialog*)rtc->CreateObject();
	BOOL b = pwndTemplate->Create(nIDTemplate, this);
	if (!b)	{ delete pwndTemplate; return -1; }

	//Insert Page
	return _InsertPage(caption, pwndTemplate, idx, TRUE);
}
Example #25
0
static INT_PTR APIENTRY DialogProcedure(HWND dialogHWND, UINT message, WPARAM wParam, LPARAM lParam)
{
  CWindow tempDialog(dialogHWND);
  if (message == WM_INITDIALOG)
    tempDialog.SetUserDataLongPtr(lParam);
  CDialog *dialog = (CDialog *)(tempDialog.GetUserDataLongPtr());
  if (dialog == NULL)
    return FALSE;
  if (message == WM_INITDIALOG)
    dialog->Attach(dialogHWND);
  try { return BoolToBOOL(dialog->OnMessage(message, wParam, lParam)); }
  catch(...) { return TRUE; }
}
Example #26
0
//---------------------------------------------------------------------------
// Function name	: InsertPage
// Description	  : return -1 if an error occurs
//---------------------------------------------------------------------------
int CRollupCtrl::InsertPage(const TCHAR* caption, UINT nIDTemplate, CRuntimeClass* rtc, int idx)
{
	if (idx>0 && idx>=m_PageList.GetSize())		idx=-1;

	//Create Template
	ASSERT(rtc!=NULL);
	CDialog* wndtemplate = (CDialog*)rtc->CreateObject();
	BOOL b = wndtemplate->Create(nIDTemplate, this);
	if (!b)	{ delete wndtemplate; return -1; }

	//Insert Page
	return _InsertPage(caption, wndtemplate, idx, TRUE);
}
Example #27
0
BOOL CALLBACK AfxDlgProc(HWND hWnd, UINT message, WPARAM, LPARAM)
{
	if (message == WM_INITDIALOG)
	{
		// special case for WM_INITDIALOG
		CDialog* pDlg = DYNAMIC_DOWNCAST(CDialog, CWnd::FromHandlePermanent(hWnd));
		if (pDlg != NULL)
			return pDlg->OnInitDialog();
		else
			return 1;
	}
	return 0;
}
static INT_PTR APIENTRY DialogProcedure(HWND dialogHWND, UINT message, 
    WPARAM wParam, LPARAM lParam)
{
  CWindow dialogTmp(dialogHWND);
  if (message == WM_INITDIALOG)
    dialogTmp.SetUserDataLongPtr(lParam);
  CDialog *dialog = (CDialog *)(dialogTmp.GetUserDataLongPtr());
  if (dialog == NULL)
    return FALSE;
  if (message == WM_INITDIALOG)
    dialog->Attach(dialogHWND);

  return BoolToBOOL(dialog->OnMessage(message, wParam, lParam));
}
void WarningBox(const std::string &msg)
{
    CDialog *dialog = CreateBaseDialog(TColorPair(COLOR_YELLOW, COLOR_RED),
                                       TColorPair(COLOR_WHITE, COLOR_RED), 30, 0, msg);
    
    dialog->AddButton(new CButton(GetTranslation("OK")));
    
    TUI.AddGroup(dialog, true);
    
    while (dialog->Run())
        ;
    
    delete dialog;
}
void MessageBox(const std::string &msg)
{
    CDialog *dialog = CreateBaseDialog(TColorPair(COLOR_GREEN, COLOR_BLUE),
                                       TColorPair(COLOR_WHITE, COLOR_BLUE), 25, 0, msg);
    
    dialog->AddButton(new CButton(GetTranslation("OK")));
    
    TUI.AddGroup(dialog, true);
    
    while (dialog->Run())
        ;
    
    delete dialog;
}